From 57cf76fc259d13e208c3ae91ed4641e6120aad52 Mon Sep 17 00:00:00 2001 From: Steve Peters Date: Thu, 31 Jul 2025 22:11:01 +0000 Subject: [PATCH 1/7] Jetty support: bump to 4.0.0, fix package names Major version numbers have been removed from package names in Gazebo Jetty, so extra cmake config files are no longer needed. Signed-off-by: Steve Peters --- CMakeLists.txt | 45 ++++----------------------------- gz-utils-config.cmake.in | 14 +++++----- gz_utils_vendor-extras.cmake.in | 1 - 3 files changed, 12 insertions(+), 48 deletions(-) delete mode 100644 gz_utils_vendor-extras.cmake.in diff --git a/CMakeLists.txt b/CMakeLists.txt index 280537c..57aec03 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3,9 +3,9 @@ cmake_minimum_required(VERSION 3.10) project(gz_utils_vendor) # Project-specific settings -set(LIB_VER_MAJOR 3) -set(LIB_VER_MINOR 1) -set(LIB_VER_PATCH 1) +set(LIB_VER_MAJOR 4) +set(LIB_VER_MINOR 0) +set(LIB_VER_PATCH 0) set(LIB_VER_SUFFIX "") # Derived variables @@ -13,7 +13,7 @@ set(LIB_NAME gz-utils) set(GITHUB_NAME gz-utils) string(REPLACE "-" "_" LIB_NAME_UNDERSCORE ${LIB_NAME}) set(LIB_NAME_COMP_PREFIX ${LIB_NAME}) -set(LIB_NAME_FULL ${LIB_NAME}${LIB_VER_MAJOR}) +set(LIB_NAME_FULL ${LIB_NAME}) set(LIB_VER ${LIB_VER_MAJOR}.${LIB_VER_MINOR}.${LIB_VER_PATCH}) find_package(ament_cmake_core REQUIRED) @@ -69,39 +69,4 @@ if(NOT ${${LIB_NAME_FULL}_FOUND}) ament_environment_hooks("${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.sh") endif() -# The goal is to support versionless package names once the user has found the -# vendor package. Example usage: -# -# find_package(gz_sim_vendor) -# find_package(gz-sim VERSION 8.2.0) # Note gz-sim not gz-sim8 -# -# To accomplish this, we create a `{LIB_NAME}-config.cmake` file that does -# find_package on the underlying package and sets up CMake targets with the -# same name as the original targets sans the version number in the target. -# -# However, since the vendor package is built with `GLOBAL_HOOK`, we can't -# install the `-config.cmake` file we're creating here to where the versioned -# `-config.cmake` from the underlying package is located. If we did, users can -# `find_package` the versionless package without first finding the vendor -# package. Thus, we install the `-config.cmake` file to a nonstandard -# location: `opt/${PROJECT_NAME}/extra_cmake/` and provide a -# `{vendor_name}-extras.cmake` file that adds that path to `CMAKE_PREFIX_PATH`. -ament_package( - CONFIG_EXTRAS_POST "gz_utils_vendor-extras.cmake.in" -) - -include(CMakePackageConfigHelpers) -include(GNUInstallDirs) - -configure_package_config_file(${LIB_NAME}-config.cmake.in - ${CMAKE_CURRENT_BINARY_DIR}/${LIB_NAME}-config.cmake - INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${LIB_NAME}) - -write_basic_package_version_file( - ${CMAKE_CURRENT_BINARY_DIR}/${LIB_NAME}-config-version.cmake - VERSION ${LIB_VER} - COMPATIBILITY SameMajorVersion) - -install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${LIB_NAME}-config.cmake - ${CMAKE_CURRENT_BINARY_DIR}/${LIB_NAME}-config-version.cmake - DESTINATION "opt/${PROJECT_NAME}/extra_cmake/lib/cmake/${LIB_NAME}") +ament_package() diff --git a/gz-utils-config.cmake.in b/gz-utils-config.cmake.in index 56d06dd..74dc46e 100644 --- a/gz-utils-config.cmake.in +++ b/gz-utils-config.cmake.in @@ -1,24 +1,24 @@ cmake_minimum_required(VERSION 3.10.2 FATAL_ERROR) -find_package(@LIB_NAME@@LIB_VER_MAJOR@ ${@LIB_NAME@_FIND_VERSION} REQUIRED COMPONENTS ${@LIB_NAME@_FIND_COMPONENTS}) +find_package(@LIB_NAME@ ${@LIB_NAME@_FIND_VERSION} REQUIRED COMPONENTS ${@LIB_NAME@_FIND_COMPONENTS}) # Set up the core library and add it to the list of all components -add_library(@LIB_NAME_COMP_PREFIX@::@LIB_NAME_COMP_PREFIX@ ALIAS @LIB_NAME@@LIB_VER_MAJOR@::@LIB_NAME@@LIB_VER_MAJOR@) -add_library(@LIB_NAME_COMP_PREFIX@::core ALIAS @LIB_NAME@@LIB_VER_MAJOR@::@LIB_NAME@@LIB_VER_MAJOR@) +add_library(@LIB_NAME_COMP_PREFIX@::@LIB_NAME_COMP_PREFIX@ ALIAS @LIB_NAME@::@LIB_NAME@) +add_library(@LIB_NAME_COMP_PREFIX@::core ALIAS @LIB_NAME@::@LIB_NAME@) # Retrieve the list of components -get_target_property(components @LIB_NAME@@LIB_VER_MAJOR@::requested INTERFACE_LINK_LIBRARIES) +get_target_property(components @LIB_NAME@::requested INTERFACE_LINK_LIBRARIES) foreach(component ${components}) # Skip the core library - if(${component} STREQUAL @LIB_NAME@@LIB_VER_MAJOR@::@LIB_NAME@@LIB_VER_MAJOR@) + if(${component} STREQUAL @LIB_NAME@::@LIB_NAME@) continue() endif() # Change "gz-libN::gz-libN-component" to "component" - string(REGEX REPLACE "@LIB_NAME@@LIB_VER_MAJOR@::@LIB_NAME@@LIB_VER_MAJOR@-" "" component_name ${component}) + string(REGEX REPLACE "@LIB_NAME@::@LIB_NAME@-" "" component_name ${component}) add_library(@LIB_NAME_COMP_PREFIX@::${component_name} ALIAS ${component}) endforeach() # Add a root gz-lib alias -add_library(@LIB_NAME_COMP_PREFIX@ ALIAS @LIB_NAME@@LIB_VER_MAJOR@::@LIB_NAME@@LIB_VER_MAJOR@) +add_library(@LIB_NAME_COMP_PREFIX@ ALIAS @LIB_NAME@::@LIB_NAME@) diff --git a/gz_utils_vendor-extras.cmake.in b/gz_utils_vendor-extras.cmake.in deleted file mode 100644 index d490202..0000000 --- a/gz_utils_vendor-extras.cmake.in +++ /dev/null @@ -1 +0,0 @@ -list(PREPEND CMAKE_PREFIX_PATH "@CMAKE_INSTALL_PREFIX@/opt/@PROJECT_NAME@/extra_cmake") From 9f1d8d8ae6aae0c713faae9394f0ad2ec2a753a5 Mon Sep 17 00:00:00 2001 From: Steve Peters Date: Thu, 31 Jul 2025 22:11:49 +0000 Subject: [PATCH 2/7] Add option VENDOR_FROM_LIB_VCS_REF This allows vendoring from a specified vcs ref instead of the hard-coded tag. When this option is set to true, a branch, tag, or commit can be specified in the LIB_VCS_REF variable. If LIB_VCS_REF is unspecified, vendoring will use main. Signed-off-by: Steve Peters --- CMakeLists.txt | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 57aec03..e0e0919 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -16,6 +16,17 @@ set(LIB_NAME_COMP_PREFIX ${LIB_NAME}) set(LIB_NAME_FULL ${LIB_NAME}) set(LIB_VER ${LIB_VER_MAJOR}.${LIB_VER_MINOR}.${LIB_VER_PATCH}) +OPTION(VENDOR_FROM_LIB_VCS_REF + "Vendor from a VCS ref instead of tag. Uses the value in LIB_VCS_REF if specified or main otherwise" + OFF) +if(NOT VENDOR_FROM_LIB_VCS_REF) + set(LIB_VCS_VER ${GITHUB_NAME}${LIB_VER_MAJOR}_${LIB_VER}${LIB_VER_SUFFIX}) +elseif(LIB_VCS_REF) + set(LIB_VCS_VER ${LIB_VCS_REF}) +else() + set(LIB_VCS_VER main) +endif() + find_package(ament_cmake_core REQUIRED) find_package(ament_cmake_vendor_package REQUIRED) find_package(ament_cmake_export_dependencies REQUIRED) @@ -41,7 +52,7 @@ find_package(${LIB_NAME_FULL} ${VERSION_MATCH} ${LIB_VER} COMPONENTS all QUIET) ament_vendor(${LIB_NAME_UNDERSCORE}_vendor SATISFIED ${${LIB_NAME_FULL}_FOUND} VCS_URL https://github.com/gazebosim/${GITHUB_NAME}.git - VCS_VERSION ${GITHUB_NAME}${LIB_VER_MAJOR}_${LIB_VER}${LIB_VER_SUFFIX} + VCS_VERSION ${LIB_VCS_VER} GLOBAL_HOOK ) From 5a85953483059cace12bb92476fac977bdcf800a Mon Sep 17 00:00:00 2001 From: Steve Peters Date: Fri, 1 Aug 2025 18:19:40 +0000 Subject: [PATCH 3/7] remove unused cmake config file Signed-off-by: Steve Peters --- gz-utils-config.cmake.in | 24 ------------------------ 1 file changed, 24 deletions(-) delete mode 100644 gz-utils-config.cmake.in diff --git a/gz-utils-config.cmake.in b/gz-utils-config.cmake.in deleted file mode 100644 index 74dc46e..0000000 --- a/gz-utils-config.cmake.in +++ /dev/null @@ -1,24 +0,0 @@ -cmake_minimum_required(VERSION 3.10.2 FATAL_ERROR) - -find_package(@LIB_NAME@ ${@LIB_NAME@_FIND_VERSION} REQUIRED COMPONENTS ${@LIB_NAME@_FIND_COMPONENTS}) - -# Set up the core library and add it to the list of all components -add_library(@LIB_NAME_COMP_PREFIX@::@LIB_NAME_COMP_PREFIX@ ALIAS @LIB_NAME@::@LIB_NAME@) -add_library(@LIB_NAME_COMP_PREFIX@::core ALIAS @LIB_NAME@::@LIB_NAME@) - -# Retrieve the list of components -get_target_property(components @LIB_NAME@::requested INTERFACE_LINK_LIBRARIES) - -foreach(component ${components}) - # Skip the core library - if(${component} STREQUAL @LIB_NAME@::@LIB_NAME@) - continue() - endif() - - # Change "gz-libN::gz-libN-component" to "component" - string(REGEX REPLACE "@LIB_NAME@::@LIB_NAME@-" "" component_name ${component}) - add_library(@LIB_NAME_COMP_PREFIX@::${component_name} ALIAS ${component}) -endforeach() - -# Add a root gz-lib alias -add_library(@LIB_NAME_COMP_PREFIX@ ALIAS @LIB_NAME@::@LIB_NAME@) From e96c32d062931f608a99616649007d5f91398b3b Mon Sep 17 00:00:00 2001 From: Steve Peters Date: Fri, 1 Aug 2025 18:19:50 +0000 Subject: [PATCH 4/7] use lowercase to fix linter complaint Signed-off-by: Steve Peters --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index e0e0919..754d756 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -16,7 +16,7 @@ set(LIB_NAME_COMP_PREFIX ${LIB_NAME}) set(LIB_NAME_FULL ${LIB_NAME}) set(LIB_VER ${LIB_VER_MAJOR}.${LIB_VER_MINOR}.${LIB_VER_PATCH}) -OPTION(VENDOR_FROM_LIB_VCS_REF +option(VENDOR_FROM_LIB_VCS_REF "Vendor from a VCS ref instead of tag. Uses the value in LIB_VCS_REF if specified or main otherwise" OFF) if(NOT VENDOR_FROM_LIB_VCS_REF) From c40fe26e9523e5df1db9af3de3f7cd9fdf6c00a0 Mon Sep 17 00:00:00 2001 From: Steve Peters Date: Mon, 11 Aug 2025 21:43:22 +0000 Subject: [PATCH 5/7] Add dependency on cli11 Signed-off-by: Steve Peters --- package.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/package.xml b/package.xml index 9fbbc1e..b8200c8 100644 --- a/package.xml +++ b/package.xml @@ -25,6 +25,7 @@ ament_cmake_vendor_package cmake + cli11 gz_cmake_vendor spdlog_vendor From 798269e5f5241849fe292ac071ae38ed1b184fea Mon Sep 17 00:00:00 2001 From: Steve Peters Date: Thu, 4 Sep 2025 22:46:42 +0000 Subject: [PATCH 6/7] 4.0.0~pre1 Signed-off-by: Steve Peters --- CMakeLists.txt | 4 ++-- package.xml | 7 ++++--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 754d756..a91ada7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -6,14 +6,14 @@ project(gz_utils_vendor) set(LIB_VER_MAJOR 4) set(LIB_VER_MINOR 0) set(LIB_VER_PATCH 0) -set(LIB_VER_SUFFIX "") +set(LIB_VER_SUFFIX "-pre1") # Derived variables set(LIB_NAME gz-utils) set(GITHUB_NAME gz-utils) string(REPLACE "-" "_" LIB_NAME_UNDERSCORE ${LIB_NAME}) set(LIB_NAME_COMP_PREFIX ${LIB_NAME}) -set(LIB_NAME_FULL ${LIB_NAME}) +set(LIB_NAME_FULL gz-utils) set(LIB_VER ${LIB_VER_MAJOR}.${LIB_VER_MINOR}.${LIB_VER_PATCH}) option(VENDOR_FROM_LIB_VCS_REF diff --git a/package.xml b/package.xml index b8200c8..f871298 100644 --- a/package.xml +++ b/package.xml @@ -12,7 +12,7 @@ --> 0.3.0 - Vendor package for: gz-utils3 3.1.1 + Vendor package for: gz-utils 4.0.0 Gazebo Utils : Classes and functions for robot applications @@ -25,12 +25,13 @@ ament_cmake_vendor_package cmake - cli11 + cli11 + cli11 gz_cmake_vendor spdlog_vendor - gz-utils3 + gz-utils ament_cmake_copyright ament_cmake_lint_cmake From 39b1d72ab5d977238cdc3a48cc6406af6e30a51f Mon Sep 17 00:00:00 2001 From: "Addisu Z. Taddese" Date: Thu, 4 Sep 2025 23:45:51 -0500 Subject: [PATCH 7/7] Use vendored version of CLI11 Signed-off-by: Addisu Z. Taddese --- CMakeLists.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index a91ada7..f288b73 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -53,6 +53,8 @@ ament_vendor(${LIB_NAME_UNDERSCORE}_vendor SATISFIED ${${LIB_NAME_FULL}_FOUND} VCS_URL https://github.com/gazebosim/${GITHUB_NAME}.git VCS_VERSION ${LIB_VCS_VER} + CMAKE_ARGS + -DGZ_UTILS_VENDOR_CLI11=ON GLOBAL_HOOK )