Skip to content

Commit

Permalink
[sdformat13] new port (#31280)
Browse files Browse the repository at this point in the history
* Add sdformat13 port

* sdformat13 fixes (#1)

* Fix cmake config export

* Cleanup

* Add usage

* Update versions

* Fix according comments review

---------

Co-authored-by: Kai Pastor <[email protected]>
  • Loading branch information
talregev and dg0yt authored Aug 25, 2023
1 parent 4a8d118 commit d71315b
Show file tree
Hide file tree
Showing 6 changed files with 131 additions and 0 deletions.
23 changes: 23 additions & 0 deletions ports/sdformat13/cmake-config.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 3465a8f..2b57440 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -26,6 +26,7 @@ else()
target_link_libraries(using_parser_urdf INTERFACE
GzURDFDOM::GzURDFDOM)
endif()
+install(TARGETS using_parser_urdf EXPORT ${PROJECT_LIBRARY_TARGET_NAME} COMPONENT libraries)

if (BUILD_TESTING)
# Build this test file only if Gazebo Tools is installed.

--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -58,6 +58,6 @@
if (NOT DEFINED USE_INTERNAL_URDF OR NOT USE_INTERNAL_URDF)
- gz_find_package(GzURDFDOM VERSION 1.0 QUIET)
+ gz_find_package(GzURDFDOM)
if (NOT GzURDFDOM_FOUND)
if (NOT DEFINED USE_INTERNAL_URDF)
# fallback to internal urdf
set(USE_INTERNAL_URDF ON)
38 changes: 38 additions & 0 deletions ports/sdformat13/no-absolute.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
diff --git a/include/sdf/config.hh.in b/include/sdf/config.hh.in
index d1b3db53..9a9ce91d 100644
--- a/include/sdf/config.hh.in
+++ b/include/sdf/config.hh.in
@@ -48,5 +48,3 @@
#cmakedefine SDFORMAT_DISABLE_CONSOLE_LOGFILE 1

-#define SDF_SHARE_PATH "${CMAKE_INSTALL_FULL_DATAROOTDIR}/"
-#define SDF_VERSION_PATH "${CMAKE_INSTALL_FULL_DATAROOTDIR}/sdformat${SDF_MAJOR_VERSION}/${SDF_PKG_VERSION}"

diff --git a/src/SDF.cc b/src/SDF.cc
index 20dcd4c6..802cbde3 100644
--- a/src/SDF.cc
+++ b/src/SDF.cc
@@ -97,22 +97,6 @@ std::string findFile(const std::string &_filename, bool _searchLocalPath,
filename = filename.substr(idx + sep.length());
}

- // Next check the install path.
- std::string path = sdf::filesystem::append(SDF_SHARE_PATH, filename);
- if (sdf::filesystem::exists(path))
- {
- return path;
- }
-
- // Next check the versioned install path.
- path = sdf::filesystem::append(SDF_SHARE_PATH,
- "sdformat" SDF_MAJOR_VERSION_STR,
- sdf::SDF::Version(), filename);
- if (sdf::filesystem::exists(path))
- {
- return path;
- }
-
// Next check to see if the given file exists.
- path = filename;
+ std::string path = filename;
if (sdf::filesystem::exists(path))
34 changes: 34 additions & 0 deletions ports/sdformat13/portfile.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO gazebosim/sdformat
REF "sdformat13_${VERSION}"
SHA512 adc555527aadaede84d6fde11555bf4872028d9e895fc47c89f4077452fde9a52b233d60d0cbff5a098e261c7810aa2dc38a6275ec9f37ba4d0161af98e2aade
HEAD_REF sdf13
PATCHES
no-absolute.patch
cmake-config.patch
)

# Ruby is required by the sdformat build process
vcpkg_find_acquire_program(RUBY)

vcpkg_cmake_configure(
SOURCE_PATH "${SOURCE_PATH}"
OPTIONS
"-DRUBY=${RUBY}"
-DBUILD_TESTING=OFF
-DSKIP_PYBIND11=ON
-DUSE_INTERNAL_URDF=OFF
-DCMAKE_DISABLE_FIND_PACKAGE_Doxygen=ON
-DCMAKE_REQUIRE_FIND_PACKAGE_GzURDFDOM=ON
-DCMAKE_DISABLE_FIND_PACKAGE_Python3=ON
)

vcpkg_cmake_install()
vcpkg_cmake_config_fixup(CONFIG_PATH "lib/cmake/sdformat13")
vcpkg_fixup_pkgconfig()

file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include"
"${CURRENT_PACKAGES_DIR}/debug/share")

vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE")
23 changes: 23 additions & 0 deletions ports/sdformat13/vcpkg.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"name": "sdformat13",
"version": "13.5.0",
"description": "Simulation Description Format (SDF) parser and description files.",
"homepage": "http://sdformat.org/",
"license": "Apache-2.0",
"supports": "!uwp",
"dependencies": [
"gz-math7",
"gz-tools2",
"gz-utils2",
"tinyxml2",
"urdfdom",
{
"name": "vcpkg-cmake",
"host": true
},
{
"name": "vcpkg-cmake-config",
"host": true
}
]
}
4 changes: 4 additions & 0 deletions versions/baseline.json
Original file line number Diff line number Diff line change
Expand Up @@ -7444,6 +7444,10 @@
"baseline": "10.0.0",
"port-version": 3
},
"sdformat13": {
"baseline": "13.5.0",
"port-version": 0
},
"sdformat6": {
"baseline": "6.2.0",
"port-version": 6
Expand Down
9 changes: 9 additions & 0 deletions versions/s-/sdformat13.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"versions": [
{
"git-tree": "b8f7d3bdbefa0795808f6c9a42764584d6e96f2c",
"version": "13.5.0",
"port-version": 0
}
]
}

0 comments on commit d71315b

Please sign in to comment.