Skip to content

Commit

Permalink
[urdfdom][sdformat9] Re-fix build (microsoft#22367)
Browse files Browse the repository at this point in the history
* [urdfdom][sdformat9] Re-fix build

* version

* Remove empty folder

* version

* [dartsim] Fix build issue

* version

* Update version name

* version

* Apply suggestions

* version

* Add PKG_EXPORTS

* version

* Update ports/sdformat9/fix-dependency-urdfdom.patch

Co-authored-by: nicole mazzuca <[email protected]>
  • Loading branch information
JackBoosY and strega-nil-ms authored Jan 7, 2022
1 parent 6d27dc9 commit d4acfe7
Show file tree
Hide file tree
Showing 13 changed files with 174 additions and 59 deletions.
3 changes: 3 additions & 0 deletions ports/dartsim/portfile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ vcpkg_cmake_configure(
-DDART_SKIP_NLOPT=ON
-DDART_SKIP_OPENGL=ON
-DDART_SKIP_pagmo=ON
-Durdfdom_headers_VERSION_MAJOR=1
-Durdfdom_headers_VERSION_MINOR=0
-Durdfdom_headers_VERSION_PATCH=4
)

vcpkg_cmake_install()
Expand Down
2 changes: 1 addition & 1 deletion ports/dartsim/vcpkg.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "dartsim",
"version": "6.11.0",
"port-version": 2,
"port-version": 3,
"description": "Dynamic Animation and Robotics Toolkit",
"homepage": "https://dartsim.github.io/",
"dependencies": [
Expand Down
26 changes: 22 additions & 4 deletions ports/sdformat9/fix-dependency-urdfdom.patch
Original file line number Diff line number Diff line change
@@ -1,7 +1,16 @@
diff --git a/cmake/SearchForStuff.cmake b/cmake/SearchForStuff.cmake
index 965f1ec..cf2acf4 100644
index 427e5e7..af31df4 100644
--- a/cmake/SearchForStuff.cmake
+++ b/cmake/SearchForStuff.cmake
@@ -43,7 +43,7 @@ endif()
# 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 PKG_CONFIG_FOUND)
+if (0)
if (NOT DEFINED USE_INTERNAL_URDF)
BUILD_WARNING("Couldn't find pkg-config for urdfdom, using internal copy")
set(USE_INTERNAL_URDF true)
@@ -53,10 +53,9 @@ if (NOT PKG_CONFIG_FOUND)
endif()

Expand All @@ -12,6 +21,15 @@ index 965f1ec..cf2acf4 100644

- if (NOT URDF_FOUND)
+ if (NOT urdfdom_FOUND)
find_package(urdfdom)
if (urdfdom_FOUND)
set(URDF_INCLUDE_DIRS ${urdfdom_INCLUDE_DIRS})
find_package(urdfdom)
if (urdfdom_FOUND)
set(URDF_INCLUDE_DIRS ${urdfdom_INCLUDE_DIRS})
@@ -73,6 +72,7 @@ if (NOT DEFINED USE_INTERNAL_URDF OR NOT USE_INTERNAL_URDF)
# what am I doing here? pkg-config and cmake
- set(URDF_INCLUDE_DIRS ${URDF_INCLUDEDIR})
set(URDF_LIBRARY_DIRS ${URDF_LIBDIR})
+ set(URDF_INCLUDE_DIRS ${urdfdom_INCLUDE_DIRS})
+ set(URDF_LIBRARIES ${urdfdom_LIBRARIES})
endif()
endif()

2 changes: 1 addition & 1 deletion ports/sdformat9/portfile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ vcpkg_cmake_configure(
SOURCE_PATH "${SOURCE_PATH}"
OPTIONS
-DBUILD_TESTING=OFF
-DUSE_EXTERNAL_URDF=ON
-DUSE_INTERNAL_URDF=OFF
-DUSE_EXTERNAL_TINYXML=ON
)

Expand Down
4 changes: 2 additions & 2 deletions ports/sdformat9/vcpkg.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "sdformat9",
"version-string": "9.4.0",
"port-version": 2,
"version": "9.4.0",
"port-version": 3,
"description": "Simulation Description Format (SDF) parser and description files.",
"homepage": "http://sdformat.org/",
"supports": "!(linux | uwp)",
Expand Down
15 changes: 0 additions & 15 deletions ports/urdfdom/0003_import_prefix.patch

This file was deleted.

101 changes: 101 additions & 0 deletions ports/urdfdom/0005-fix-config-and-install.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index f0d115d..9acbfbe 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -58,17 +58,18 @@ set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}"

enable_testing()

-add_subdirectory(urdf_parser)
-
if(WIN32 AND NOT CYGWIN)
set(CMAKE_CONFIG_INSTALL_DIR CMake)
else()
set(CMAKE_CONFIG_INSTALL_DIR ${CMAKE_INSTALL_FULL_LIBDIR}/${PROJECT_NAME}/cmake/)
endif()

+add_subdirectory(urdf_parser)
+
set(PKG_NAME ${PROJECT_NAME})
set(PKG_LIBRARIES urdfdom_sensor urdfdom_model_state urdfdom_model urdfdom_world)
set(PKG_DEPENDS urdfdom_headers console_bridge)
+set(PKG_EXPORTS urdfdom)
set(cmake_conf_file "cmake/urdfdom-config.cmake")
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/${cmake_conf_file}.in" "${CMAKE_BINARY_DIR}/${cmake_conf_file}" @ONLY)
install(FILES ${CMAKE_BINARY_DIR}/${cmake_conf_file}
diff --git a/cmake/urdfdom-config.cmake.in b/cmake/urdfdom-config.cmake.in
index fb81b47..8b4ef8f 100644
--- a/cmake/urdfdom-config.cmake.in
+++ b/cmake/urdfdom-config.cmake.in
@@ -3,8 +3,12 @@ if (@PKG_NAME@_CONFIG_INCLUDED)
endif()
set(@PKG_NAME@_CONFIG_INCLUDED TRUE)

-set(@PKG_NAME@_INCLUDE_DIRS "@CMAKE_INSTALL_PREFIX@/include" "@TinyXML_INCLUDE_DIRS@")
+get_filename_component(_IMPORT_PREFIX "${CMAKE_CURRENT_LIST_FILE}" PATH)
+get_filename_component(_IMPORT_PREFIX "${_IMPORT_PREFIX}" PATH)

+set(@PKG_NAME@_INCLUDE_DIRS "${_IMPORT_PREFIX}/include" "@TinyXML_INCLUDE_DIRS@")
+
+if (0)
foreach(lib @PKG_LIBRARIES@)
set(onelib "${lib}-NOTFOUND")
find_library(onelib ${lib}
@@ -25,3 +29,13 @@ foreach(dep @PKG_DEPENDS@)
list(APPEND @PKG_NAME@_INCLUDE_DIRS ${${dep}_INCLUDE_DIRS})
list(APPEND @PKG_NAME@_LIBRARIES ${${dep}_LIBRARIES})
endforeach()
+endif()
+
+include(CMakeFindDependencyMacro)
+find_dependency(console_bridge)
+
+foreach(exp @PKG_EXPORTS@)
+ include(${@PROJECT_NAME@_DIR}/${exp}Export.cmake)
+endforeach()
+
+set(@PKG_NAME@_LIBRARIES urdfdom::urdfdom_model urdfdom::urdfdom_world urdfdom::urdfdom_sensor urdfdom::urdfdom_model_state)
\ No newline at end of file
diff --git a/urdf_parser/CMakeLists.txt b/urdf_parser/CMakeLists.txt
index 731b57a..ebd0586 100644
--- a/urdf_parser/CMakeLists.txt
+++ b/urdf_parser/CMakeLists.txt
@@ -39,10 +39,32 @@ if(BUILD_TESTING)
add_subdirectory(test)
endif()

-INSTALL(TARGETS urdfdom_model DESTINATION ${CMAKE_INSTALL_LIBDIR})
-INSTALL(TARGETS urdfdom_world DESTINATION ${CMAKE_INSTALL_LIBDIR})
-INSTALL(TARGETS check_urdf urdf_to_graphiz urdf_mem_test
- DESTINATION ${CMAKE_INSTALL_BINDIR})
-INSTALL(TARGETS urdfdom_sensor DESTINATION ${CMAKE_INSTALL_LIBDIR})
-INSTALL(TARGETS urdfdom_model_state DESTINATION ${CMAKE_INSTALL_LIBDIR})
+INSTALL(
+ TARGETS
+ check_urdf
+ urdf_to_graphiz
+ urdf_mem_test
+ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
+ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
+ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
+)
+INSTALL(
+ TARGETS
+ urdfdom_model
+ urdfdom_world
+ urdfdom_sensor
+ urdfdom_model_state
+ EXPORT
+ urdfdom
+ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
+ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
+ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
+)
+install(
+ EXPORT urdfdom
+ DESTINATION ${CMAKE_CONFIG_INSTALL_DIR}
+ NAMESPACE "${PROJECT_NAME}::"
+ FILE "urdfdomExport.cmake"
+)
+
INSTALL(DIRECTORY include/urdf_parser DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
45 changes: 15 additions & 30 deletions ports/urdfdom/portfile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -9,47 +9,32 @@ vcpkg_from_github(
PATCHES
0001_use_math_defines.patch
0002_fix_exports.patch
0003_import_prefix.patch
0004_fix-dependency-console_bridge.patch
0005-fix-config-and-install.patch
)

vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH}
PREFER_NINJA
vcpkg_cmake_configure(
SOURCE_PATH "${SOURCE_PATH}"
)

vcpkg_install_cmake()
vcpkg_cmake_install()
vcpkg_copy_pdbs()

if(EXISTS ${CURRENT_PACKAGES_DIR}/CMake)
vcpkg_fixup_cmake_targets(CONFIG_PATH CMake)
vcpkg_copy_tools(TOOL_NAMES check_urdf urdf_mem_test urdf_to_graphiz AUTO_CLEAN)

if(VCPKG_TARGET_IS_WINDOWS)
vcpkg_cmake_config_fixup(CONFIG_PATH CMake)
else()
vcpkg_fixup_cmake_targets(CONFIG_PATH lib/urdfdom/cmake)
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/lib/urdfdom)
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/lib/urdfdom)
vcpkg_cmake_config_fixup(CONFIG_PATH lib/urdfdom/cmake)
# Empty folders
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/lib/urdfdom")
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/lib/urdfdom")
endif()

if(EXISTS ${CURRENT_PACKAGES_DIR}/lib/pkgconfig)
if(NOT VCPKG_TARGET_IS_WINDOWS OR VCPKG_TARGET_IS_MINGW)
vcpkg_fixup_pkgconfig()
endif()

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

file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/bin)

file(MAKE_DIRECTORY ${CURRENT_PACKAGES_DIR}/tools/)
file(RENAME ${CURRENT_PACKAGES_DIR}/bin/ ${CURRENT_PACKAGES_DIR}/tools/${PORT}/)

file(GLOB URDFDOM_DLLS_DEBUG ${CURRENT_PACKAGES_DIR}/debug/lib/*.dll)
foreach(URDFDOM_DLL_DEBUG ${URDFDOM_DLLS_DEBUG})
file(COPY ${URDFDOM_DLL_DEBUG} DESTINATION ${CURRENT_PACKAGES_DIR}/debug/bin)
file(REMOVE ${URDFDOM_DLL_DEBUG})
endforeach()

file(GLOB URDFDOM_DLLS_RELEASE ${CURRENT_PACKAGES_DIR}/lib/*.dll)
foreach(URDFDOM_DLL_RELEASE ${URDFDOM_DLLS_RELEASE})
file(COPY ${URDFDOM_DLL_RELEASE} DESTINATION ${CURRENT_PACKAGES_DIR}/bin)
file(REMOVE ${URDFDOM_DLL_RELEASE})
endforeach()

file(INSTALL ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright)
file(INSTALL "${SOURCE_PATH}/LICENSE" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright)
14 changes: 11 additions & 3 deletions ports/urdfdom/vcpkg.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,20 @@
{
"name": "urdfdom",
"version-string": "1.0.4",
"port-version": 4,
"version": "1.0.4",
"port-version": 5,
"description": "Provides core data structures and a simple XML parsers for populating the class data structures from an URDF file.",
"homepage": "https://github.com/ros/urdfdom",
"dependencies": [
"console-bridge",
"tinyxml",
"urdfdom-headers"
"urdfdom-headers",
{
"name": "vcpkg-cmake",
"host": true
},
{
"name": "vcpkg-cmake-config",
"host": true
}
]
}
6 changes: 3 additions & 3 deletions versions/baseline.json
Original file line number Diff line number Diff line change
Expand Up @@ -1746,7 +1746,7 @@
},
"dartsim": {
"baseline": "6.11.0",
"port-version": 2
"port-version": 3
},
"dataframe": {
"baseline": "1.19.0",
Expand Down Expand Up @@ -6226,7 +6226,7 @@
},
"sdformat9": {
"baseline": "9.4.0",
"port-version": 2
"port-version": 3
},
"sdl1": {
"baseline": "1.2.15",
Expand Down Expand Up @@ -7046,7 +7046,7 @@
},
"urdfdom": {
"baseline": "1.0.4",
"port-version": 4
"port-version": 5
},
"urdfdom-headers": {
"baseline": "1.0.5",
Expand Down
5 changes: 5 additions & 0 deletions versions/d-/dartsim.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "8b816d852610f6ef105eedc49bcbe6ae4881f759",
"version": "6.11.0",
"port-version": 3
},
{
"git-tree": "f7fc216f598684b22949d55f2d573137965a4d2d",
"version": "6.11.0",
Expand Down
5 changes: 5 additions & 0 deletions versions/s-/sdformat9.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "5f47672c7e4349da14189c38db3a15dcdad5a196",
"version": "9.4.0",
"port-version": 3
},
{
"git-tree": "0ae3b0b53c638614e4a03164b1a5d1b70796e55e",
"version-string": "9.4.0",
Expand Down
5 changes: 5 additions & 0 deletions versions/u-/urdfdom.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "a74450532028f2079b8ea0b20bb82ded93e951d6",
"version": "1.0.4",
"port-version": 5
},
{
"git-tree": "1022fc5895356fb9cd1c37767cf2397e4edfd415",
"version-string": "1.0.4",
Expand Down

0 comments on commit d4acfe7

Please sign in to comment.