Skip to content

Commit

Permalink
[Gazebo9] More enhancement for Windows build (#2789)
Browse files Browse the repository at this point in the history
  • Loading branch information
seanyen authored Aug 11, 2020
1 parent 21db7f2 commit af30f74
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 6 deletions.
6 changes: 5 additions & 1 deletion cmake/GazeboUtils.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,11 @@ endmacro()
#################################################
macro (gz_install_library _name)
set_target_properties(${_name} PROPERTIES SOVERSION ${GAZEBO_MAJOR_VERSION} VERSION ${GAZEBO_VERSION_FULL})
install (TARGETS ${_name} DESTINATION ${LIB_INSTALL_DIR} COMPONENT shlib)
install (TARGETS ${_name}
ARCHIVE DESTINATION ${LIB_INSTALL_DIR}
LIBRARY DESTINATION ${LIB_INSTALL_DIR}
RUNTIME DESTINATION ${BIN_INSTALL_DIR}
COMPONENT shlib)
endmacro ()

#################################################
Expand Down
4 changes: 4 additions & 0 deletions gazebo/common/Material.cc
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,10 @@ void Material::SetTextureImage(const std::string &_tex,
}
}
}

// normalize the path
this->texImage = boost::filesystem::path(this->texImage)
.make_preferred().string();
}

//////////////////////////////////////////////////
Expand Down
19 changes: 14 additions & 5 deletions gazebo/common/ModelDatabase.cc
Original file line number Diff line number Diff line change
Expand Up @@ -503,19 +503,28 @@ std::string ModelDatabase::GetModelPath(const std::string &_uri,
continue;
}

std::string outputPath = getenv("HOME");
outputPath += "/.gazebo/models";

#ifndef _WIN32
TAR *tar;
tar_open(&tar, const_cast<char*>(tarfilename.c_str()),
nullptr, O_RDONLY, 0644, TAR_GNU);

std::string outputPath = getenv("HOME");
outputPath += "/.gazebo/models";

tar_extract_all(tar, const_cast<char*>(outputPath.c_str()));
#else
// Tar now is a built-in tool since Windows 10 build 17063.
std::string cmdline = "tar xzf \"";
cmdline += tarfilename + "\" -C \"";
cmdline += outputPath + "\"";
auto ret = system(cmdline.c_str());
if (ret != 0)
{
gzerr << "tar extract ret = " << ret << ", cmdline = " << cmdline << std::endl;
}
#endif
path = outputPath + "/" + modelName;

ModelDatabase::DownloadDependencies(path);
#endif
}

curl_easy_cleanup(curl);
Expand Down

0 comments on commit af30f74

Please sign in to comment.