From d4acfe76d1c1f5f6d52b2969b6b70ecad831b45d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jack=C2=B7Boos=C2=B7Yu?= <47264268+JackBoosY@users.noreply.github.com> Date: Sat, 8 Jan 2022 06:47:34 +0800 Subject: [PATCH] [urdfdom][sdformat9] Re-fix build (#22367) * [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 <83086508+strega-nil-ms@users.noreply.github.com> --- ports/dartsim/portfile.cmake | 3 + ports/dartsim/vcpkg.json | 2 +- ports/sdformat9/fix-dependency-urdfdom.patch | 26 ++++- ports/sdformat9/portfile.cmake | 2 +- ports/sdformat9/vcpkg.json | 4 +- ports/urdfdom/0003_import_prefix.patch | 15 --- .../urdfdom/0005-fix-config-and-install.patch | 101 ++++++++++++++++++ ports/urdfdom/portfile.cmake | 45 +++----- ports/urdfdom/vcpkg.json | 14 ++- versions/baseline.json | 6 +- versions/d-/dartsim.json | 5 + versions/s-/sdformat9.json | 5 + versions/u-/urdfdom.json | 5 + 13 files changed, 174 insertions(+), 59 deletions(-) delete mode 100644 ports/urdfdom/0003_import_prefix.patch create mode 100644 ports/urdfdom/0005-fix-config-and-install.patch diff --git a/ports/dartsim/portfile.cmake b/ports/dartsim/portfile.cmake index 707d9336eb6947..0a12d6a14f64e4 100644 --- a/ports/dartsim/portfile.cmake +++ b/ports/dartsim/portfile.cmake @@ -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() diff --git a/ports/dartsim/vcpkg.json b/ports/dartsim/vcpkg.json index 60c7660a6a7a35..6bc7403f1884e1 100644 --- a/ports/dartsim/vcpkg.json +++ b/ports/dartsim/vcpkg.json @@ -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": [ diff --git a/ports/sdformat9/fix-dependency-urdfdom.patch b/ports/sdformat9/fix-dependency-urdfdom.patch index d9016c6de39f30..d16cc831b2e7fd 100644 --- a/ports/sdformat9/fix-dependency-urdfdom.patch +++ b/ports/sdformat9/fix-dependency-urdfdom.patch @@ -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() @@ -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() + diff --git a/ports/sdformat9/portfile.cmake b/ports/sdformat9/portfile.cmake index 708c463349b6ff..c31b757da0ebec 100644 --- a/ports/sdformat9/portfile.cmake +++ b/ports/sdformat9/portfile.cmake @@ -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 ) diff --git a/ports/sdformat9/vcpkg.json b/ports/sdformat9/vcpkg.json index 122f379bf453d8..71a89b157db9f7 100644 --- a/ports/sdformat9/vcpkg.json +++ b/ports/sdformat9/vcpkg.json @@ -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)", diff --git a/ports/urdfdom/0003_import_prefix.patch b/ports/urdfdom/0003_import_prefix.patch deleted file mode 100644 index 3353774af69c10..00000000000000 --- a/ports/urdfdom/0003_import_prefix.patch +++ /dev/null @@ -1,15 +0,0 @@ -diff --git a/cmake/urdfdom-config.cmake.in b/cmake/urdfdom-config.cmake.in -index fb81b47..3ccad51 100644 ---- a/cmake/urdfdom-config.cmake.in -+++ b/cmake/urdfdom-config.cmake.in -@@ -3,6 +3,10 @@ if (@PKG_NAME@_CONFIG_INCLUDED) - endif() - set(@PKG_NAME@_CONFIG_INCLUDED TRUE) - -+# Vcpkg fix-ups -+get_filename_component(_IMPORT_PREFIX "${CMAKE_CURRENT_LIST_FILE}" PATH) -+get_filename_component(_IMPORT_PREFIX "${_IMPORT_PREFIX}" PATH) -+ - set(@PKG_NAME@_INCLUDE_DIRS "@CMAKE_INSTALL_PREFIX@/include" "@TinyXML_INCLUDE_DIRS@") - - foreach(lib @PKG_LIBRARIES@) diff --git a/ports/urdfdom/0005-fix-config-and-install.patch b/ports/urdfdom/0005-fix-config-and-install.patch new file mode 100644 index 00000000000000..a0b654fd0c699e --- /dev/null +++ b/ports/urdfdom/0005-fix-config-and-install.patch @@ -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}) diff --git a/ports/urdfdom/portfile.cmake b/ports/urdfdom/portfile.cmake index 46226bc0e59bf2..ef1dfa803618fa 100644 --- a/ports/urdfdom/portfile.cmake +++ b/ports/urdfdom/portfile.cmake @@ -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) diff --git a/ports/urdfdom/vcpkg.json b/ports/urdfdom/vcpkg.json index d235316bcb11e7..0b9ee602cb2187 100644 --- a/ports/urdfdom/vcpkg.json +++ b/ports/urdfdom/vcpkg.json @@ -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 + } ] } diff --git a/versions/baseline.json b/versions/baseline.json index 12bc54779488f6..d1c03ae39e3845 100644 --- a/versions/baseline.json +++ b/versions/baseline.json @@ -1746,7 +1746,7 @@ }, "dartsim": { "baseline": "6.11.0", - "port-version": 2 + "port-version": 3 }, "dataframe": { "baseline": "1.19.0", @@ -6226,7 +6226,7 @@ }, "sdformat9": { "baseline": "9.4.0", - "port-version": 2 + "port-version": 3 }, "sdl1": { "baseline": "1.2.15", @@ -7046,7 +7046,7 @@ }, "urdfdom": { "baseline": "1.0.4", - "port-version": 4 + "port-version": 5 }, "urdfdom-headers": { "baseline": "1.0.5", diff --git a/versions/d-/dartsim.json b/versions/d-/dartsim.json index 1989a58caf78d7..bea457455c3730 100644 --- a/versions/d-/dartsim.json +++ b/versions/d-/dartsim.json @@ -1,5 +1,10 @@ { "versions": [ + { + "git-tree": "8b816d852610f6ef105eedc49bcbe6ae4881f759", + "version": "6.11.0", + "port-version": 3 + }, { "git-tree": "f7fc216f598684b22949d55f2d573137965a4d2d", "version": "6.11.0", diff --git a/versions/s-/sdformat9.json b/versions/s-/sdformat9.json index 32233bca2db0f4..5ec5fee7911336 100644 --- a/versions/s-/sdformat9.json +++ b/versions/s-/sdformat9.json @@ -1,5 +1,10 @@ { "versions": [ + { + "git-tree": "5f47672c7e4349da14189c38db3a15dcdad5a196", + "version": "9.4.0", + "port-version": 3 + }, { "git-tree": "0ae3b0b53c638614e4a03164b1a5d1b70796e55e", "version-string": "9.4.0", diff --git a/versions/u-/urdfdom.json b/versions/u-/urdfdom.json index bcefd4e533ad4f..8c71cc56c88d86 100644 --- a/versions/u-/urdfdom.json +++ b/versions/u-/urdfdom.json @@ -1,5 +1,10 @@ { "versions": [ + { + "git-tree": "a74450532028f2079b8ea0b20bb82ded93e951d6", + "version": "1.0.4", + "port-version": 5 + }, { "git-tree": "1022fc5895356fb9cd1c37767cf2397e4edfd415", "version-string": "1.0.4",