diff options
Diffstat (limited to 'vcpkg/ports/sdformat')
| -rw-r--r-- | vcpkg/ports/sdformat/cmake-config.patch | 24 | ||||
| -rw-r--r-- | vcpkg/ports/sdformat/no-absolute.patch | 48 | ||||
| -rw-r--r-- | vcpkg/ports/sdformat/portfile.cmake | 54 | ||||
| -rw-r--r-- | vcpkg/ports/sdformat/vcpkg.json | 24 |
4 files changed, 150 insertions, 0 deletions
diff --git a/vcpkg/ports/sdformat/cmake-config.patch b/vcpkg/ports/sdformat/cmake-config.patch new file mode 100644 index 0000000..aa5923f --- /dev/null +++ b/vcpkg/ports/sdformat/cmake-config.patch @@ -0,0 +1,24 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 0fedcd42..8b28fdcc 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -63,7 +63,18 @@ if (BUILD_SDF) + # 2. if USE_INTERNAL_URDF is set to True, use the internal copy + # 3. if USE_INTERNAL_URDF is set to False, force to search system installation, fail on error + if (NOT DEFINED USE_INTERNAL_URDF OR NOT USE_INTERNAL_URDF) +- gz_find_package(GzURDFDOM VERSION 1.0 QUIET) ++ find_package(urdfdom CONFIG REQUIRED) ++ add_library(GzURDFDOM::GzURDFDOM INTERFACE IMPORTED) ++ target_link_libraries(GzURDFDOM::GzURDFDOM ++ INTERFACE ++ urdfdom::urdfdom_model ++ urdfdom::urdfdom_world ++ urdfdom::urdfdom_sensor ++ urdfdom::urdfdom_model_state ++ ) ++ include(FindPackageHandleStandardArgs) ++ find_package_handle_standard_args(GzURDFDOM DEFAULT_MSG) ++ + if (NOT GzURDFDOM_FOUND) + if (NOT DEFINED USE_INTERNAL_URDF) + # fallback to internal urdf diff --git a/vcpkg/ports/sdformat/no-absolute.patch b/vcpkg/ports/sdformat/no-absolute.patch new file mode 100644 index 0000000..0a86209 --- /dev/null +++ b/vcpkg/ports/sdformat/no-absolute.patch @@ -0,0 +1,48 @@ +diff --git a/include/sdf/config.hh.in b/include/sdf/config.hh.in +index 456eb12c..9a9ce91d 100644 +--- a/include/sdf/config.hh.in ++++ b/include/sdf/config.hh.in +@@ -47,12 +47,5 @@ + + #cmakedefine SDFORMAT_DISABLE_CONSOLE_LOGFILE 1 + +-#ifndef SDF_SHARE_PATH +-#define SDF_SHARE_PATH _Pragma ("GCC warning \"'SDF_SHARE_PATH' macro is deprecated, use sdf::getSharePath() function instead. \"") "${CMAKE_INSTALL_FULL_DATAROOTDIR}/" +-#endif +- +-#ifndef SDF_VERSION_PATH +-#define SDF_VERSION_PATH _Pragma ("GCC warning \"'SDF_VERSION_PATH' macro is deprecated and should not be used. \"") "${CMAKE_INSTALL_FULL_DATAROOTDIR}/sdformat${PROJECT_VERSION_MAJOR}/${PROJECT_VERSION}" +-#endif + + #endif // #ifndef SDF_CONFIG_HH_ +diff --git a/src/SDF.cc b/src/SDF.cc +index 04fc5374..9cb98399 100644 +--- a/src/SDF.cc ++++ b/src/SDF.cc +@@ -150,25 +150,8 @@ std::string findFile(sdf::Errors &_errors, const std::string &_filename, + } + } + +- // Next check the install path. +- std::string path = sdf::filesystem::append(sdfSharePath(), filename); +- if (sdf::filesystem::exists(path)) +- { +- return path; +- } +- +- // Next check the versioned install path. +- path = sdf::filesystem::append(sdfSharePath(), +- "sdformat" + std::string(SDF_MAJOR_VERSION_STR), +- sdf::SDF::Version(), filename); +- +- if (sdf::filesystem::exists(path)) +- { +- return path; +- } +- + // Finally check to see if the given file exists. +- path = filename; ++ std::string path = filename; + if (sdf::filesystem::exists(path)) + { + return path; diff --git a/vcpkg/ports/sdformat/portfile.cmake b/vcpkg/ports/sdformat/portfile.cmake new file mode 100644 index 0000000..5635b12 --- /dev/null +++ b/vcpkg/ports/sdformat/portfile.cmake @@ -0,0 +1,54 @@ +string(REGEX MATCH "^[1-9]+" VERSION_MAJOR ${VERSION}) + +vcpkg_from_github( + OUT_SOURCE_PATH SOURCE_PATH + REPO gazebosim/${PORT} + REF ${PORT}${VERSION_MAJOR}_${VERSION} + SHA512 8e3bd85b5e567286110ed53ef4b800922a2c4df21aa61d4591141f6fb02d9629d8be0fb3e8bb9fb1e02c95e8064b381f1349d086e1e991aa91b512cff94cdf06 + HEAD_REF sdf${VERSION_MAJOR} + PATCHES + no-absolute.patch + cmake-config.patch +) + +# Python is required to generate the EmbeddedSdf.cc file, which contains all the supported SDF +# descriptions in a map of strings. The parser.cc file uses EmbeddedSdf.hh. +vcpkg_find_acquire_program(PYTHON3) +get_filename_component(PYTHON3_DIR "${PYTHON3}" DIRECTORY) +vcpkg_add_to_path("${PYTHON3_DIR}") + +vcpkg_cmake_configure( + SOURCE_PATH "${SOURCE_PATH}" + OPTIONS + -DBUILD_TESTING=OFF + -DSKIP_PYBIND11=ON + -DUSE_INTERNAL_URDF=OFF + -DCMAKE_DISABLE_FIND_PACKAGE_Doxygen=ON +) + +vcpkg_cmake_install() +vcpkg_cmake_config_fixup(CONFIG_PATH "lib/cmake/${PORT}${VERSION_MAJOR}") +vcpkg_fixup_pkgconfig() + +# preserve the original port behavior +file(COPY "${CURRENT_PACKAGES_DIR}/share/${PORT}/" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}${VERSION_MAJOR}/") + +# fix dependency urdfdom +vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/share/${PORT}${VERSION_MAJOR}/${PORT}${VERSION_MAJOR}-config.cmake" "find_package(TINYXML2" [[ +if (NOT TARGET GzURDFDOM::GzURDFDOM) + find_package(urdfdom CONFIG ${gz_package_quiet} ${gz_package_required}) + add_library(GzURDFDOM::GzURDFDOM INTERFACE IMPORTED) + target_link_libraries(GzURDFDOM::GzURDFDOM + INTERFACE + urdfdom::urdfdom_model + urdfdom::urdfdom_world + urdfdom::urdfdom_sensor + urdfdom::urdfdom_model_state + ) +endif() +find_package(TINYXML2]]) + +file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include" + "${CURRENT_PACKAGES_DIR}/debug/share") + +vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE") diff --git a/vcpkg/ports/sdformat/vcpkg.json b/vcpkg/ports/sdformat/vcpkg.json new file mode 100644 index 0000000..9381904 --- /dev/null +++ b/vcpkg/ports/sdformat/vcpkg.json @@ -0,0 +1,24 @@ +{ + "name": "sdformat", + "version": "15.1.1", + "port-version": 1, + "description": "Simulation Description Format (SDF) parser and description files.", + "homepage": "http://sdformat.org/", + "license": "Apache-2.0", + "supports": "!uwp", + "dependencies": [ + "gz-math", + "gz-tools", + "gz-utils", + "tinyxml2", + "urdfdom", + { + "name": "vcpkg-cmake", + "host": true + }, + { + "name": "vcpkg-cmake-config", + "host": true + } + ] +} |