[sdformat13] new port (#31280)

* Add sdformat13 port

* sdformat13 fixes (#1)

* Fix cmake config export

* Cleanup

* Add usage

* Update versions

* Fix according comments review

---------

Co-authored-by: Kai Pastor <dg0yt@darc.de>
This commit is contained in:
talregev 2023-08-25 22:04:34 +03:00 committed by GitHub
parent 4a8d11802f
commit d71315b15e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 131 additions and 0 deletions

View File

@ -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)

View File

@ -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))

View File

@ -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")

View File

@ -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
}
]
}

View File

@ -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

View File

@ -0,0 +1,9 @@
{
"versions": [
{
"git-tree": "b8f7d3bdbefa0795808f6c9a42764584d6e96f2c",
"version": "13.5.0",
"port-version": 0
}
]
}