From e4bedf96b144ee45b0271a212fb4eaeff229cc43 Mon Sep 17 00:00:00 2001 From: methylDragon Date: Wed, 20 Apr 2022 15:06:34 -0700 Subject: [PATCH 1/8] Add ignition- deprecations and aliases, and gz- redirect Signed-off-by: methylDragon --- cmake/IgnConfigureProject.cmake | 12 ++- cmake/IgnUtils.cmake | 152 +++++++++++++++++++++++++++++--- cmake/ignition-config.cmake.in | 56 ++++++++++++ 3 files changed, 209 insertions(+), 11 deletions(-) diff --git a/cmake/IgnConfigureProject.cmake b/cmake/IgnConfigureProject.cmake index f979bae1..caf7b433 100644 --- a/cmake/IgnConfigureProject.cmake +++ b/cmake/IgnConfigureProject.cmake @@ -58,6 +58,15 @@ macro(ign_configure_project) set(IGN_DESIGNATION ${PROJECT_NAME}) # Remove the leading "ignition-" string(REGEX REPLACE "ignition-" "" IGN_DESIGNATION ${IGN_DESIGNATION}) + + # Also support "gz-" + if(${IGN_DESIGNATION} MATCHES "^gz-") + set(PROJECT_PREFIX "gz") + else() + set(PROJECT_PREFIX "ignition") + endif() + string(REGEX REPLACE "gz-" "" IGN_DESIGNATION ${IGN_DESIGNATION}) + # Remove the trailing version number string(REGEX REPLACE "[0-9]+" "" IGN_DESIGNATION ${IGN_DESIGNATION}) @@ -68,7 +77,7 @@ macro(ign_configure_project) if(ign_configure_project_NO_IGNITION_PREFIX) set(PROJECT_NAME_NO_VERSION ${IGN_DESIGNATION}) else() - set(PROJECT_NAME_NO_VERSION "ignition-${IGN_DESIGNATION}") + set(PROJECT_NAME_NO_VERSION "${PROJECT_PREFIX}-${IGN_DESIGNATION}") endif() string(TOLOWER ${PROJECT_NAME_NO_VERSION} PROJECT_NAME_NO_VERSION_LOWER) string(TOUPPER ${PROJECT_NAME_NO_VERSION} PROJECT_NAME_NO_VERSION_UPPER) @@ -98,6 +107,7 @@ macro(ign_configure_project) set(PROJECT_VERSION_FULL ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH}) + # The full version of the project, but without any prerelease suffix set(PROJECT_VERSION_FULL_NO_SUFFIX ${PROJECT_VERSION_FULL}) diff --git a/cmake/IgnUtils.cmake b/cmake/IgnUtils.cmake index 564c4f03..1237813d 100644 --- a/cmake/IgnUtils.cmake +++ b/cmake/IgnUtils.cmake @@ -138,7 +138,12 @@ # is provided using VERSION, then this will be left # out, whether or not it is provided. # -macro(ign_find_package PACKAGE_NAME) +macro(ign_find_package MACRO_PACKAGE_NAME) + # This is to allow "remapping" of the macro arg for function-like capability, but also access to + # the parent scope + # TODO(CH3): Remove this on tock, along the later sections, + # and change MACRO_PACKAGE_NAME back to PACKAGE_NAME + set(PACKAGE_NAME ${MACRO_PACKAGE_NAME}) #------------------------------------ # Define the expected arguments @@ -150,6 +155,79 @@ macro(ign_find_package PACKAGE_NAME) # Parse the arguments _ign_cmake_parse_arguments(ign_find_package "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) + #------------------------------------ + # Handle ticktock + # TODO(CH3): Remove on tock + if(${PACKAGE_NAME} MATCHES "^ign(ition)?-") + message(DEPRECATION + "\nThe use of 'ign-' and 'ignition-' prefixed libraries has been " + "deprecated in favor of 'gz-' and will be removed in the next version!\n" + ) + set(PACKAGE_NAME_BAK ${PACKAGE_NAME}) + + string(REGEX REPLACE "^ign(ition)?-" "gz-" PACKAGE_NAME ${PACKAGE_NAME_BAK}) + message(NOTICE "...Trying to use the gz- version of the library you specified: '${PACKAGE_NAME}'\n") + + #------------------------------------ + # Construct the arguments to pass to find_package + # The duplication is necessary for the ticktock... + # TODO(CH3): Remove on tock + set(gz_find_package_args ${PACKAGE_NAME}) + + if(ign_find_package_VERSION) + list(APPEND gz_find_package_args ${ign_find_package_VERSION}) + endif() + + if(ign_find_package_QUIET) + list(APPEND gz_find_package_args QUIET) + endif() + + if(ign_find_package_EXACT) + list(APPEND gz_find_package_args EXACT) + endif() + + if(ign_find_package_CONFIG) + list(APPEND gz_find_package_args CONFIG) + endif() + + if(ign_find_package_COMPONENTS) + list(APPEND gz_find_package_args COMPONENTS ${ign_find_package_COMPONENTS}) + endif() + + if(ign_find_package_OPTIONAL_COMPONENTS) + list(APPEND gz_find_package_args OPTIONAL_COMPONENTS ${ign_find_package_OPTIONAL_COMPONENTS}) + endif() + + if(ign_find_package_EXTRA_ARGS) + list(APPEND gz_find_package_args ${ign_find_package_EXTRA_ARGS}) + endif() + + find_package(${gz_find_package_args} QUIET) + + if(${PACKAGE_NAME}_FOUND) + message(NOTICE "Found! Using it instead of '${PACKAGE_NAME_BAK}'") + + # Manually set ignition- prefix version numbers for ticktock + # TODO(CH3): Remove on tock + set(${PACKAGE_NAME_BAK}_VERSION ${${PACKAGE_NAME}_VERSION}) + set(${PACKAGE_NAME_BAK}_VERSION_MAJOR ${${PACKAGE_NAME}_VERSION_MAJOR}) + set(${PACKAGE_NAME_BAK}_VERSION_MINOR ${${PACKAGE_NAME}_VERSION_MINOR}) + set(${PACKAGE_NAME_BAK}_VERSION_PATCH ${${PACKAGE_NAME}_VERSION_PATCH}) + set(${PACKAGE_NAME_BAK}_VERSION_TWEAK ${${PACKAGE_NAME}_VERSION_TWEAK}) + + else() + message(WARNING + "\n'${PACKAGE_NAME}' not found! Falling back to '${PACKAGE_NAME_BAK}'...\n" + "== NOTE ==\n" + "gz- library finding will sometimes deterministically fail because the dynamic substitution " + "doesn't get picked up by colcon-cmake.\n" + "To avoid these failures, substitute your 'ign(ition)-' prefixes with 'gz-' in your CMake " + "files, or call `colcon build --executor sequential` instead!\n") + + set(PACKAGE_NAME ${PACKAGE_NAME_BAK}) + endif() + endif() + #------------------------------------ # Construct the arguments to pass to find_package set(${PACKAGE_NAME}_find_package_args ${PACKAGE_NAME}) @@ -309,7 +387,7 @@ macro(ign_find_package PACKAGE_NAME) # TODO: When we migrate to cmake-3.9+ bring back find_dependency(~) because # at that point it will be able to support COMPONENTS and EXTRA_ARGS -# set(${PACKAGE_NAME}_find_dependency "find_dependency(${${PACKAGE_NAME}_dependency_args})") + # set(${PACKAGE_NAME}_find_dependency "find_dependency(${${PACKAGE_NAME}_dependency_args})") set(${PACKAGE_NAME}_find_dependency "find_package(${${PACKAGE_NAME}_dependency_args})") @@ -952,12 +1030,56 @@ function(ign_create_core_library) #------------------------------------ # Create the target for the core library, and configure it to be installed - _ign_add_library_or_component( - LIB_NAME ${PROJECT_LIBRARY_TARGET_NAME} - INCLUDE_DIR "${PROJECT_INCLUDE_DIR}" - EXPORT_BASE IGNITION_${IGN_DESIGNATION_UPPER} - SOURCES ${sources} - ${interface_option}) + + # Support "gz-" + if(${PROJECT_LIBRARY_TARGET_NAME} MATCHES "^gz-") + _ign_add_library_or_component( + LIB_NAME ${PROJECT_LIBRARY_TARGET_NAME} + INCLUDE_DIR "${PROJECT_INCLUDE_DIR}" + EXPORT_BASE GZ_${IGN_DESIGNATION_UPPER} + SOURCES ${sources} + ${interface_option}) + + # For ticktocking: Export an "ignition-" target as well, allowing linking against + # the ignition- prefixed name + # TODO(CH3): To remove on tock + string(REGEX REPLACE "^gz-" "ignition-" IGN_LIBRARY_TARGET_NAME ${PROJECT_LIBRARY_TARGET_NAME}) + _ign_add_library_or_component( + LIB_NAME ${IGN_LIBRARY_TARGET_NAME} + INCLUDE_DIR "${PROJECT_INCLUDE_DIR}" + EXPORT_BASE IGNITION_${IGN_DESIGNATION_UPPER} + SOURCES ${sources} + ${interface_option}) + + target_include_directories(${IGN_LIBRARY_TARGET_NAME} + ${property_type} + # This is the publicly installed headers directory. + "$" + # This is the in-build version of the core library headers directory. + # Generated headers for the core library get placed here. + "$" + # Generated headers for the core library might also get placed here. + "$") + + #------------------------------------ + # Handle cmake and pkgconfig packaging + # TODO(CH3): Remove on tock + string(REGEX REPLACE "^gz-" "ignition-" IGN_PROJECT_NAME_LOWER ${PROJECT_NAME_LOWER}) + + if(ign_create_core_library_INTERFACE) + set(project_pkgconfig_core_lib) # Intentionally blank + else() + set(project_pkgconfig_core_lib "-l${IGN_PROJECT_NAME_LOWER}") + endif() + + else() + _ign_add_library_or_component( + LIB_NAME ${PROJECT_LIBRARY_TARGET_NAME} + INCLUDE_DIR "${PROJECT_INCLUDE_DIR}" + EXPORT_BASE IGNITION_${IGN_DESIGNATION_UPPER} + SOURCES ${sources} + ${interface_option}) + endif() # These generator expressions are necessary for multi-configuration generators # such as MSVC on Windows. They also ensure that our target exports its @@ -1006,7 +1128,9 @@ function(ign_create_core_library) if(ign_create_core_library_INTERFACE) set(project_pkgconfig_core_lib) # Intentionally blank else() - set(project_pkgconfig_core_lib "-l${PROJECT_NAME_LOWER}") + # We append here so the project target can live alongside the ignition- alias + # TODO(CH3): Change back to set() on tock and remove the set() in the other TODO above + ign_string_append(project_pkgconfig_core_lib "-l${PROJECT_NAME_LOWER}") endif() # Export and install the core library's cmake target and package information @@ -1136,10 +1260,18 @@ function(ign_add_component component_name) #------------------------------------ # Create the target for this component, and configure it to be installed + + # Support "gz-" + if(${PROJECT_LIBRARY_TARGET_NAME} MATCHES "^gz-") + set(EXPORT_PREFIX "GZ") + else() + set(EXPORT_PREFIX "IGNITION") + endif() + _ign_add_library_or_component( LIB_NAME ${component_target_name} INCLUDE_DIR "${PROJECT_INCLUDE_DIR}/${include_subdir}" - EXPORT_BASE IGNITION_${IGN_DESIGNATION_UPPER}_${component_name_upper} + EXPORT_BASE ${EXPORT_PREFIX}_${IGN_DESIGNATION_UPPER}_${component_name_upper} SOURCES ${sources} ${interface_option}) diff --git a/cmake/ignition-config.cmake.in b/cmake/ignition-config.cmake.in index 19145484..67c6acff 100644 --- a/cmake/ignition-config.cmake.in +++ b/cmake/ignition-config.cmake.in @@ -94,6 +94,12 @@ endif() @PACKAGE_INIT@ +# Add 'ignition-' prefixed package name if package is 'gz-' prefixed +# TODO(CH3): Remove on tock +if(@PKG_NAME@ MATCHES "^gz-") + string(REGEX REPLACE "^gz-" "ignition-" IGN_PKG_NAME @PKG_NAME@) +endif() + if(NOT TARGET @import_target_name@) include("${CMAKE_CURRENT_LIST_DIR}/@target_output_filename@") @@ -102,6 +108,16 @@ if(NOT TARGET @import_target_name@) add_library(@simple_import_name@ INTERFACE IMPORTED) set_target_properties(@simple_import_name@ PROPERTIES INTERFACE_LINK_LIBRARIES @import_target_name@) + + # Add 'ignition-' prefixed "alias" for the core library + # TODO(CH3): Remove on tock + if(IGN_PKG_NAME) + string(REGEX REPLACE "^gz-" "ignition-" ign_simple_import_name @simple_import_name@) + add_library(${ign_simple_import_name} INTERFACE IMPORTED) + set_target_properties(${ign_simple_import_name} PROPERTIES + INTERFACE_LINK_LIBRARIES @import_target_name@) + endif() + # Note: In a future version of cmake, we can replace this with an ALIAS target # In case someone tries to link against the plain library name, we want to @@ -112,11 +128,26 @@ if(NOT TARGET @import_target_name@) set_target_properties(@PKG_NAME@ PROPERTIES INTERFACE_LINK_LIBRARIES @import_target_name@) + # Add 'ignition-' prefixed "alias" + # TODO(CH3): Remove on tock + if(IGN_PKG_NAME) + add_library(${IGN_PKG_NAME} INTERFACE IMPORTED) + set_target_properties(${IGN_PKG_NAME} PROPERTIES + INTERFACE_LINK_LIBRARIES @import_target_name@) + endif() + endif() # Create the "all" target if it does not already exist if(NOT TARGET @ign_namespace@requested) add_library(@ign_namespace@requested INTERFACE IMPORTED) + + # TODO(CH3): Remove on tock + if(IGN_PKG_NAME) + # This is a really bad name... + string(REGEX REPLACE "^gz-" "ignition-" ign_ign_namespace @ign_namespace@) + add_library(${ign_ign_namespace}requested INTERFACE IMPORTED) + endif() endif() # Link the core library to the "all" target. We set the property explicitly @@ -128,17 +159,42 @@ if(NOT ign_all_components) # should NOT pass into the INTERFACE_LINK_LIBRARIES property. set_target_properties(@ign_namespace@requested PROPERTIES INTERFACE_LINK_LIBRARIES "@import_target_name@") + + # TODO(CH3): Remove on tock + if(IGN_PKG_NAME) + # This is a really bad name... + set_target_properties(${ign_ign_namespace}requested PROPERTIES + INTERFACE_LINK_LIBRARIES "@import_target_name@") + endif() else() set_target_properties(@ign_namespace@requested PROPERTIES INTERFACE_LINK_LIBRARIES "${ign_all_components};@import_target_name@") + + # TODO(CH3): Remove on tock + if(IGN_PKG_NAME) + # This is a really bad name... + set_target_properties(${ign_ign_namespace}requested PROPERTIES + INTERFACE_LINK_LIBRARIES "${ign_all_components};@import_target_name@") + endif() endif() # Package variables. Note that @PKG_NAME@_LIBRARIES and @PKG_NAME@_CORE_LIBRARY # contain imported targets, so @PKG_NAME@_INCLUDE_DIRS is never needed. set(@PKG_NAME@_CORE_LIBRARY @simple_import_name@) set(@PKG_NAME@_LIBRARIES @ign_namespace@requested) + set_and_check(@PKG_NAME@_INCLUDE_DIRS "@PACKAGE_IGN_INCLUDE_INSTALL_DIR_FULL@") +# Add ignition- prefixed package variables and include directories pointing to the gz- headers +# TODO(CH3): Remove on tock +if(IGN_PKG_NAME) + set(${IGN_PKG_NAME}_CORE_LIBRARY @simple_import_name@) + set(${IGN_PKG_NAME}_LIBRARIES @ign_namespace@requested) + + set_and_check(@PKG_NAME@_INCLUDE_DIRS "@PACKAGE_IGN_INCLUDE_INSTALL_DIR_FULL@") + set_and_check(${IGN_PKG_NAME}_INCLUDE_DIRS "@PACKAGE_IGN_INCLUDE_INSTALL_DIR_FULL@") +endif() + # Backwards compatibility variables set(@LEGACY_PROJECT_PREFIX@_LIBRARIES ${@PKG_NAME@_LIBRARIES}) set(@LEGACY_PROJECT_PREFIX@_INCLUDE_DIRS ${@PKG_NAME@_INCLUDE_DIRS}) From 8b3b49573652305027e7bf37aa7635588fd29a1e Mon Sep 17 00:00:00 2001 From: methylDragon Date: Thu, 21 Apr 2022 12:03:57 -0700 Subject: [PATCH 2/8] Bring ign_ign_namespace assignment to parent scope Signed-off-by: methylDragon --- cmake/ignition-config.cmake.in | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/cmake/ignition-config.cmake.in b/cmake/ignition-config.cmake.in index 67c6acff..4113cf02 100644 --- a/cmake/ignition-config.cmake.in +++ b/cmake/ignition-config.cmake.in @@ -138,14 +138,18 @@ if(NOT TARGET @import_target_name@) endif() +# TODO(CH3): Remove on tock +if(IGN_PKG_NAME) + # This is a really bad name... + string(REGEX REPLACE "^gz-" "ignition-" ign_ign_namespace @ign_namespace@) +endif() + # Create the "all" target if it does not already exist if(NOT TARGET @ign_namespace@requested) add_library(@ign_namespace@requested INTERFACE IMPORTED) # TODO(CH3): Remove on tock if(IGN_PKG_NAME) - # This is a really bad name... - string(REGEX REPLACE "^gz-" "ignition-" ign_ign_namespace @ign_namespace@) add_library(${ign_ign_namespace}requested INTERFACE IMPORTED) endif() endif() From ceb3510dd038fe1cabda0fcb50c7489838f32910 Mon Sep 17 00:00:00 2001 From: methylDragon Date: Thu, 21 Apr 2022 12:05:38 -0700 Subject: [PATCH 3/8] Remove duplicated set_and_check call Signed-off-by: methylDragon --- cmake/ignition-config.cmake.in | 1 - 1 file changed, 1 deletion(-) diff --git a/cmake/ignition-config.cmake.in b/cmake/ignition-config.cmake.in index 4113cf02..a15d41fe 100644 --- a/cmake/ignition-config.cmake.in +++ b/cmake/ignition-config.cmake.in @@ -195,7 +195,6 @@ if(IGN_PKG_NAME) set(${IGN_PKG_NAME}_CORE_LIBRARY @simple_import_name@) set(${IGN_PKG_NAME}_LIBRARIES @ign_namespace@requested) - set_and_check(@PKG_NAME@_INCLUDE_DIRS "@PACKAGE_IGN_INCLUDE_INSTALL_DIR_FULL@") set_and_check(${IGN_PKG_NAME}_INCLUDE_DIRS "@PACKAGE_IGN_INCLUDE_INSTALL_DIR_FULL@") endif() From 19245942952f8a6129faa6dc29c554278bed2946 Mon Sep 17 00:00:00 2001 From: methylDragon Date: Thu, 21 Apr 2022 15:19:08 -0700 Subject: [PATCH 4/8] Migrate examples to gz Signed-off-by: methylDragon --- examples/CMakeLists.txt | 26 +++++++------- examples/comp_deps/CMakeLists.txt | 2 +- examples/core_child/CMakeLists.txt | 6 ++-- examples/core_child/src/CMakeLists.txt | 2 +- examples/core_child_private/CMakeLists.txt | 6 ++-- .../core_child_private/src/CMakeLists.txt | 2 +- examples/core_nodep/CMakeLists.txt | 2 +- examples/core_nodep_static/CMakeLists.txt | 2 +- examples/core_static_child/CMakeLists.txt | 6 ++-- examples/core_static_child/src/CMakeLists.txt | 2 +- examples/find_ogre2/ogre-2.1/CMakeLists.txt | 2 +- examples/find_ogre2/ogre-2.2/CMakeLists.txt | 2 +- examples/ign_conf/CMakeLists.txt | 2 +- examples/prerelease/CMakeLists.txt | 2 +- examples/sanitizers/CMakeLists.txt | 2 +- ...test_core_child_requires_core_no_deps.bash | 36 +++++++++---------- examples/use_component_depsA/CMakeLists.txt | 4 +-- .../use_component_depsA/src/CMakeLists.txt | 2 +- examples/use_component_depsB/CMakeLists.txt | 4 +-- .../use_component_depsB/src/CMakeLists.txt | 2 +- examples/use_component_depsC/CMakeLists.txt | 4 +-- .../use_component_depsC/src/CMakeLists.txt | 2 +- examples/use_config_ifp/CMakeLists.txt | 10 +++--- ..._config.cmake => Findgz-find_config.cmake} | 0 ...onfig.cmake => gz-find_configConfig.cmake} | 0 25 files changed, 65 insertions(+), 65 deletions(-) rename examples/use_config_ifp/{Findignition-find_config.cmake => Findgz-find_config.cmake} (100%) rename examples/use_config_ifp/{ignition-find_configConfig.cmake => gz-find_configConfig.cmake} (100%) diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt index 90abd1ac..33117584 100644 --- a/examples/CMakeLists.txt +++ b/examples/CMakeLists.txt @@ -31,36 +31,36 @@ endif() foreach(example ${example_directories}) set(run_codecheck false) if (${example} STREQUAL "ign_conf") - set(example_tarball_name ignition-minimal-0.1.0.tar.bz2) + set(example_tarball_name gz-minimal-0.1.0.tar.bz2) elseif (${example} STREQUAL "no_ignition_prefix") set(example_tarball_name no_ignition_prefix-0.1.0.tar.bz2) elseif (${example} STREQUAL "prerelease") - set(example_tarball_name ignition-minimal-1.0.0~pre1.tar.bz2) + set(example_tarball_name gz-minimal-1.0.0~pre1.tar.bz2) elseif (${example} STREQUAL "core_nodep") - set(example_tarball_name ignition-core_no_deps-0.1.0.tar.bz2) + set(example_tarball_name gz-core_no_deps-0.1.0.tar.bz2) set(run_codecheck true) elseif (${example} STREQUAL "core_nodep_static") - set(example_tarball_name ignition-core_no_deps_static-0.1.0.tar.bz2) + set(example_tarball_name gz-core_no_deps_static-0.1.0.tar.bz2) set(run_codecheck true) elseif (${example} STREQUAL "core_child") - set(example_tarball_name ignition-core_child-0.1.0.tar.bz2) + set(example_tarball_name gz-core_child-0.1.0.tar.bz2) set(run_codecheck true) elseif (${example} STREQUAL "core_child_private") - set(example_tarball_name ignition-core_child_private-0.1.0.tar.bz2) + set(example_tarball_name gz-core_child_private-0.1.0.tar.bz2) set(run_codecheck true) elseif (${example} STREQUAL "core_static_child") - set(example_tarball_name ignition-core_static_child-0.1.0.tar.bz2) + set(example_tarball_name gz-core_static_child-0.1.0.tar.bz2) set(run_codecheck true) elseif (${example} STREQUAL "comp_deps") - set(example_tarball_name ignition-component_deps-0.1.0.tar.bz2) + set(example_tarball_name gz-component_deps-0.1.0.tar.bz2) elseif (${example} STREQUAL "use_component_depsA") - set(example_tarball_name ignition-use_component_depsa-0.1.0.tar.bz2) + set(example_tarball_name gz-use_component_depsa-0.1.0.tar.bz2) elseif (${example} STREQUAL "use_component_depsB") - set(example_tarball_name ignition-use_component_depsb-0.1.0.tar.bz2) + set(example_tarball_name gz-use_component_depsb-0.1.0.tar.bz2) elseif (${example} STREQUAL "use_component_depsC") - set(example_tarball_name ignition-use_component_depsc-0.1.0.tar.bz2) + set(example_tarball_name gz-use_component_depsc-0.1.0.tar.bz2) elseif (${example} STREQUAL "use_config_ifp") - set(example_tarball_name ignition-find_config-0.1.0.tar.bz2) + set(example_tarball_name gz-find_config-0.1.0.tar.bz2) else() set(example_tarball_name) @@ -192,7 +192,7 @@ if (UNIX) @ONLY) set(_env_vars) # On Debian and if the install prefix is /usr, the default CMAKE_INSTALL_LIBDIR of this project - # as set by GNUInstallDirs will be different from the one of the example project, + # as set by GNUInstallDirs will be different from the one of the example project, # so let's hardcode it in that case if(EXISTS "/etc/debian_version" AND "${CMAKE_INSTALL_PREFIX}" MATCHES "^/usr/?$") set(example_PKGCONFIG_INSTALL_LIBDIR "lib/pkgconfig") diff --git a/examples/comp_deps/CMakeLists.txt b/examples/comp_deps/CMakeLists.txt index 5ae53288..3cb9c4fe 100644 --- a/examples/comp_deps/CMakeLists.txt +++ b/examples/comp_deps/CMakeLists.txt @@ -1,5 +1,5 @@ cmake_minimum_required(VERSION 3.10.2 FATAL_ERROR) -project(ignition-component_deps VERSION 0.1.0) +project(gz-component_deps VERSION 0.1.0) find_package(ignition-cmake3 REQUIRED) ign_configure_project() ign_configure_build(QUIT_IF_BUILD_ERRORS diff --git a/examples/core_child/CMakeLists.txt b/examples/core_child/CMakeLists.txt index a348d179..341b1df4 100644 --- a/examples/core_child/CMakeLists.txt +++ b/examples/core_child/CMakeLists.txt @@ -1,8 +1,8 @@ cmake_minimum_required(VERSION 3.10.2 FATAL_ERROR) -project(ignition-core_child VERSION 0.1.0) +project(gz-core_child VERSION 0.1.0) find_package(ignition-cmake3 REQUIRED) ign_configure_project() -ign_find_package(ignition-core_no_deps REQUIRED) +ign_find_package(gz-core_no_deps REQUIRED) ign_configure_build(QUIT_IF_BUILD_ERRORS) ign_create_packages() -ign_create_docs(TAGFILES "${IGNITION-CORE_NO_DEPS_DOXYGEN_TAGFILE} = ${IGNITION-CORE_NO_DEPS_API_URL}") +ign_create_docs(TAGFILES "${GZ-CORE_NO_DEPS_DOXYGEN_TAGFILE} = ${GZ-CORE_NO_DEPS_API_URL}") diff --git a/examples/core_child/src/CMakeLists.txt b/examples/core_child/src/CMakeLists.txt index 82c11722..7a02bba2 100644 --- a/examples/core_child/src/CMakeLists.txt +++ b/examples/core_child/src/CMakeLists.txt @@ -2,5 +2,5 @@ ign_get_libsources_and_unittests(sources gtest_sources) ign_create_core_library(SOURCES ${sources} CXX_STANDARD 11) target_link_libraries(${PROJECT_LIBRARY_TARGET_NAME} PUBLIC - ignition-core_no_deps::ignition-core_no_deps) + gz-core_no_deps::gz-core_no_deps) ign_build_tests(TYPE UNIT SOURCES ${gtest_sources}) diff --git a/examples/core_child_private/CMakeLists.txt b/examples/core_child_private/CMakeLists.txt index 0036a2b4..62d576f4 100644 --- a/examples/core_child_private/CMakeLists.txt +++ b/examples/core_child_private/CMakeLists.txt @@ -1,8 +1,8 @@ cmake_minimum_required(VERSION 3.10.2 FATAL_ERROR) -project(ignition-core_child_private VERSION 0.1.0) +project(gz-core_child_private VERSION 0.1.0) find_package(ignition-cmake3 REQUIRED) ign_configure_project() -ign_find_package(ignition-core_no_deps PRIVATE REQUIRED) +ign_find_package(gz-core_no_deps PRIVATE REQUIRED) ign_configure_build(QUIT_IF_BUILD_ERRORS) ign_create_packages() -ign_create_docs(TAGFILES "${IGNITION-CORE_NO_DEPS_DOXYGEN_TAGFILE} = ${IGNITION-CORE_NO_DEPS_API_URL}") +ign_create_docs(TAGFILES "${GZ-CORE_NO_DEPS_DOXYGEN_TAGFILE} = ${GZ-CORE_NO_DEPS_API_URL}") diff --git a/examples/core_child_private/src/CMakeLists.txt b/examples/core_child_private/src/CMakeLists.txt index 29014808..d5845a1b 100644 --- a/examples/core_child_private/src/CMakeLists.txt +++ b/examples/core_child_private/src/CMakeLists.txt @@ -2,5 +2,5 @@ ign_get_libsources_and_unittests(sources gtest_sources) ign_create_core_library(SOURCES ${sources} CXX_STANDARD 11) target_link_libraries(${PROJECT_LIBRARY_TARGET_NAME} PRIVATE - ignition-core_no_deps::ignition-core_no_deps) + gz-core_no_deps::gz-core_no_deps) ign_build_tests(TYPE UNIT SOURCES ${gtest_sources}) diff --git a/examples/core_nodep/CMakeLists.txt b/examples/core_nodep/CMakeLists.txt index 5759bd2e..580074cd 100644 --- a/examples/core_nodep/CMakeLists.txt +++ b/examples/core_nodep/CMakeLists.txt @@ -1,5 +1,5 @@ cmake_minimum_required(VERSION 3.10.2 FATAL_ERROR) -project(ignition-core_no_deps VERSION 0.1.0) +project(gz-core_no_deps VERSION 0.1.0) find_package(ignition-cmake3 REQUIRED) ign_configure_project() ign_configure_build(QUIT_IF_BUILD_ERRORS) diff --git a/examples/core_nodep_static/CMakeLists.txt b/examples/core_nodep_static/CMakeLists.txt index 5726db10..e03ffbc8 100644 --- a/examples/core_nodep_static/CMakeLists.txt +++ b/examples/core_nodep_static/CMakeLists.txt @@ -1,5 +1,5 @@ cmake_minimum_required(VERSION 3.10.2 FATAL_ERROR) -project(ignition-core_no_deps_static VERSION 0.1.0) +project(gz-core_no_deps_static VERSION 0.1.0) find_package(ignition-cmake3 REQUIRED) ign_configure_project() OPTION(BUILD_SHARED_LIBS OFF) diff --git a/examples/core_static_child/CMakeLists.txt b/examples/core_static_child/CMakeLists.txt index 92758ed4..7fa33335 100644 --- a/examples/core_static_child/CMakeLists.txt +++ b/examples/core_static_child/CMakeLists.txt @@ -1,8 +1,8 @@ cmake_minimum_required(VERSION 3.10.2 FATAL_ERROR) -project(ignition-core_static_child VERSION 0.1.0) +project(gz-core_static_child VERSION 0.1.0) find_package(ignition-cmake3 REQUIRED) ign_configure_project() -ign_find_package(ignition-core_no_deps_static REQUIRED) +ign_find_package(gz-core_no_deps_static REQUIRED) ign_configure_build(QUIT_IF_BUILD_ERRORS) ign_create_packages() -ign_create_docs(TAGFILES "${IGNITION-CORE_NO_DEPS_STATIC_DOXYGEN_TAGFILE} = ${IGNITION-CORE_NO_DEPS_STATIC_API_URL}") +ign_create_docs(TAGFILES "${GZ-CORE_NO_DEPS_STATIC_DOXYGEN_TAGFILE} = ${GZ-CORE_NO_DEPS_STATIC_API_URL}") diff --git a/examples/core_static_child/src/CMakeLists.txt b/examples/core_static_child/src/CMakeLists.txt index 400f4ecd..10104e34 100644 --- a/examples/core_static_child/src/CMakeLists.txt +++ b/examples/core_static_child/src/CMakeLists.txt @@ -2,5 +2,5 @@ ign_get_libsources_and_unittests(sources gtest_sources) ign_create_core_library(SOURCES ${sources} CXX_STANDARD 11) target_link_libraries(${PROJECT_LIBRARY_TARGET_NAME} PUBLIC - ignition-core_no_deps_static::ignition-core_no_deps_static) + gz-core_no_deps_static::gz-core_no_deps_static) ign_build_tests(TYPE UNIT SOURCES ${gtest_sources}) diff --git a/examples/find_ogre2/ogre-2.1/CMakeLists.txt b/examples/find_ogre2/ogre-2.1/CMakeLists.txt index a465a5cf..0ba25292 100644 --- a/examples/find_ogre2/ogre-2.1/CMakeLists.txt +++ b/examples/find_ogre2/ogre-2.1/CMakeLists.txt @@ -1,5 +1,5 @@ cmake_minimum_required(VERSION 3.10.2 FATAL_ERROR) -project(ignition-ogre-2.1 VERSION 0.1.0) +project(gz-ogre-2.1 VERSION 0.1.0) find_package(ignition-cmake3 REQUIRED) diff --git a/examples/find_ogre2/ogre-2.2/CMakeLists.txt b/examples/find_ogre2/ogre-2.2/CMakeLists.txt index 7e1044eb..57da6219 100644 --- a/examples/find_ogre2/ogre-2.2/CMakeLists.txt +++ b/examples/find_ogre2/ogre-2.2/CMakeLists.txt @@ -1,5 +1,5 @@ cmake_minimum_required(VERSION 3.10.2 FATAL_ERROR) -project(ignition-ogre-2.2 VERSION 0.1.0) +project(gz-ogre-2.2 VERSION 0.1.0) find_package(ignition-cmake3 REQUIRED) diff --git a/examples/ign_conf/CMakeLists.txt b/examples/ign_conf/CMakeLists.txt index b39e8d44..02722de2 100644 --- a/examples/ign_conf/CMakeLists.txt +++ b/examples/ign_conf/CMakeLists.txt @@ -1,5 +1,5 @@ cmake_minimum_required(VERSION 3.10.2 FATAL_ERROR) -project(ignition-minimal0 VERSION 0.1.0) +project(gz-minimal0 VERSION 0.1.0) find_package(ignition-cmake3 REQUIRED) ign_configure_project() ign_configure_build(QUIT_IF_BUILD_ERRORS) diff --git a/examples/prerelease/CMakeLists.txt b/examples/prerelease/CMakeLists.txt index a4649eea..d376f980 100644 --- a/examples/prerelease/CMakeLists.txt +++ b/examples/prerelease/CMakeLists.txt @@ -1,5 +1,5 @@ cmake_minimum_required(VERSION 3.10.2 FATAL_ERROR) -project(ignition-minimal1 VERSION 1.0.0) +project(gz-minimal1 VERSION 1.0.0) find_package(ignition-cmake3 REQUIRED) ign_configure_project(VERSION_SUFFIX pre1) ign_configure_build(QUIT_IF_BUILD_ERRORS) diff --git a/examples/sanitizers/CMakeLists.txt b/examples/sanitizers/CMakeLists.txt index 22e9cab4..0ade8e8c 100644 --- a/examples/sanitizers/CMakeLists.txt +++ b/examples/sanitizers/CMakeLists.txt @@ -1,5 +1,5 @@ cmake_minimum_required(VERSION 3.10.2 FATAL_ERROR) -project(ignition-sanitizers VERSION 0.1.0) +project(gz-sanitizers VERSION 0.1.0) find_package(ignition-cmake3 REQUIRED) ign_configure_project() ign_configure_build(QUIT_IF_BUILD_ERRORS) diff --git a/examples/test_core_child_requires_core_no_deps.bash b/examples/test_core_child_requires_core_no_deps.bash index 9febf845..810dfcb1 100755 --- a/examples/test_core_child_requires_core_no_deps.bash +++ b/examples/test_core_child_requires_core_no_deps.bash @@ -2,40 +2,40 @@ TEST_STATUS=0 echo -echo Expect ignition-core_child to require ignition-core_no_deps -pkg-config ignition-core_child --print-requires -if ! pkg-config ignition-core_child --print-requires \ - | grep ignition-core_no_deps +echo Expect gz-core_child to require gz-core_no_deps +pkg-config gz-core_child --print-requires +if ! pkg-config gz-core_child --print-requires \ + | grep gz-core_no_deps then echo oops TEST_STATUS=1 fi echo -echo Expect ignition-core_child to not privately require ignition-core_no_deps -pkg-config ignition-core_child --print-requires-private -if pkg-config ignition-core_child --print-requires-private \ - | grep ignition-core_no_deps +echo Expect gz-core_child to not privately require gz-core_no_deps +pkg-config gz-core_child --print-requires-private +if pkg-config gz-core_child --print-requires-private \ + | grep gz-core_no_deps then echo oops TEST_STATUS=1 fi echo -echo Expect ignition-core_child_private to privately require ignition-core_no_deps -pkg-config ignition-core_child_private --print-requires-private -if ! pkg-config ignition-core_child_private --print-requires-private \ - | grep ignition-core_no_deps +echo Expect gz-core_child_private to privately require gz-core_no_deps +pkg-config gz-core_child_private --print-requires-private +if ! pkg-config gz-core_child_private --print-requires-private \ + | grep gz-core_no_deps then echo oops TEST_STATUS=1 fi echo -echo Expect ignition-core_child_private to not require ignition-core_no_deps -pkg-config ignition-core_child_private --print-requires -if pkg-config ignition-core_child_private --print-requires \ - | grep ignition-core_no_deps +echo Expect gz-core_child_private to not require gz-core_no_deps +pkg-config gz-core_child_private --print-requires +if pkg-config gz-core_child_private --print-requires \ + | grep gz-core_no_deps then echo oops TEST_STATUS=1 @@ -44,11 +44,11 @@ fi echo if [[ $TEST_STATUS -eq 0 ]] then - echo Successfully detected ignition-core_nodep requirements + echo Successfully detected gz-core_nodep requirements cp core_child_requires_core_nodep_pass.xml ../test_results/core_child_requires_core_nodep.xml exit 0 else - echo Could not detect all ignition-core_nodep requirements correctly + echo Could not detect all gz-core_nodep requirements correctly cp core_child_requires_core_nodep_fail.xml ../test_results/core_child_requires_core_nodep.xml exit 1 fi diff --git a/examples/use_component_depsA/CMakeLists.txt b/examples/use_component_depsA/CMakeLists.txt index fa2e397a..5f7d1f98 100644 --- a/examples/use_component_depsA/CMakeLists.txt +++ b/examples/use_component_depsA/CMakeLists.txt @@ -1,8 +1,8 @@ cmake_minimum_required(VERSION 3.10.2 FATAL_ERROR) -project(ignition-use_component_depsA VERSION 0.1.0) +project(gz-use_component_depsA VERSION 0.1.0) find_package(ignition-cmake3 REQUIRED) ign_configure_project() -ign_find_package(ignition-component_deps REQUIRED COMPONENTS parent child) +ign_find_package(gz-component_deps REQUIRED COMPONENTS parent child) ign_configure_build(QUIT_IF_BUILD_ERRORS) ign_create_packages() ign_create_docs() diff --git a/examples/use_component_depsA/src/CMakeLists.txt b/examples/use_component_depsA/src/CMakeLists.txt index 1344fa3f..7e9873f1 100644 --- a/examples/use_component_depsA/src/CMakeLists.txt +++ b/examples/use_component_depsA/src/CMakeLists.txt @@ -2,5 +2,5 @@ ign_get_libsources_and_unittests(sources gtest_sources) ign_create_core_library(SOURCES ${sources} CXX_STANDARD 11) target_link_libraries(${PROJECT_LIBRARY_TARGET_NAME} PUBLIC - ignition-component_deps::ignition-component_deps-child) + gz-component_deps::gz-component_deps-child) ign_build_tests(TYPE UNIT SOURCES ${gtest_sources}) diff --git a/examples/use_component_depsB/CMakeLists.txt b/examples/use_component_depsB/CMakeLists.txt index 09ffa782..312927e2 100644 --- a/examples/use_component_depsB/CMakeLists.txt +++ b/examples/use_component_depsB/CMakeLists.txt @@ -1,8 +1,8 @@ cmake_minimum_required(VERSION 3.10.2 FATAL_ERROR) -project(ignition-use_component_depsB VERSION 0.1.0) +project(gz-use_component_depsB VERSION 0.1.0) find_package(ignition-cmake3 REQUIRED) ign_configure_project() -ign_find_package(ignition-component_deps REQUIRED COMPONENTS child parent) +ign_find_package(gz-component_deps REQUIRED COMPONENTS child parent) ign_configure_build(QUIT_IF_BUILD_ERRORS) ign_create_packages() ign_create_docs() diff --git a/examples/use_component_depsB/src/CMakeLists.txt b/examples/use_component_depsB/src/CMakeLists.txt index 1344fa3f..7e9873f1 100644 --- a/examples/use_component_depsB/src/CMakeLists.txt +++ b/examples/use_component_depsB/src/CMakeLists.txt @@ -2,5 +2,5 @@ ign_get_libsources_and_unittests(sources gtest_sources) ign_create_core_library(SOURCES ${sources} CXX_STANDARD 11) target_link_libraries(${PROJECT_LIBRARY_TARGET_NAME} PUBLIC - ignition-component_deps::ignition-component_deps-child) + gz-component_deps::gz-component_deps-child) ign_build_tests(TYPE UNIT SOURCES ${gtest_sources}) diff --git a/examples/use_component_depsC/CMakeLists.txt b/examples/use_component_depsC/CMakeLists.txt index cbf897be..61962770 100644 --- a/examples/use_component_depsC/CMakeLists.txt +++ b/examples/use_component_depsC/CMakeLists.txt @@ -1,8 +1,8 @@ cmake_minimum_required(VERSION 3.10.2 FATAL_ERROR) -project(ignition-use_component_depsC VERSION 0.1.0) +project(gz-use_component_depsC VERSION 0.1.0) find_package(ignition-cmake3 REQUIRED) ign_configure_project() -ign_find_package(ignition-component_deps REQUIRED COMPONENTS child) +ign_find_package(gz-component_deps REQUIRED COMPONENTS child) ign_configure_build(QUIT_IF_BUILD_ERRORS) ign_create_packages() ign_create_docs() diff --git a/examples/use_component_depsC/src/CMakeLists.txt b/examples/use_component_depsC/src/CMakeLists.txt index 1344fa3f..7e9873f1 100644 --- a/examples/use_component_depsC/src/CMakeLists.txt +++ b/examples/use_component_depsC/src/CMakeLists.txt @@ -2,5 +2,5 @@ ign_get_libsources_and_unittests(sources gtest_sources) ign_create_core_library(SOURCES ${sources} CXX_STANDARD 11) target_link_libraries(${PROJECT_LIBRARY_TARGET_NAME} PUBLIC - ignition-component_deps::ignition-component_deps-child) + gz-component_deps::gz-component_deps-child) ign_build_tests(TYPE UNIT SOURCES ${gtest_sources}) diff --git a/examples/use_config_ifp/CMakeLists.txt b/examples/use_config_ifp/CMakeLists.txt index 29cfee2f..5cb0afcf 100644 --- a/examples/use_config_ifp/CMakeLists.txt +++ b/examples/use_config_ifp/CMakeLists.txt @@ -1,17 +1,17 @@ cmake_minimum_required(VERSION 3.10.2 FATAL_ERROR) -project(ignition-find_config VERSION 0.1.0) +project(gz-find_config VERSION 0.1.0) find_package(ignition-cmake3 REQUIRED) set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/") -set(ignition-find_config_DIR "${CMAKE_SOURCE_DIR}/") -#ign_find_package(ignition-find_config) will search for Findignition-find_config.cmake before ignition-find_configConfig.cmake -ign_find_package(ignition-find_config) +set(gz-find_config_DIR "${CMAKE_SOURCE_DIR}/") +#ign_find_package(gz-find_config) will search for Findgz-find_config.cmake before gz-find_configConfig.cmake +ign_find_package(gz-find_config) if(CONFIG_TEST MATCHES "The package was found using MODULE mode") message(STATUS "The package was found using MODULE mode") else() message(SEND_ERROR "Couldn't find correct package in MODULE mode.\nign_find_package CONFIG test failed") endif() #After CONFIG arguemnt ign_find_package will skip MODULE mode and search for ignition-find_configConfig.cmake directly -ign_find_package(ignition-find_config CONFIG) +ign_find_package(gz-find_config CONFIG) if(CONFIG_TEST MATCHES "The package was found using CONFIG mode") message(STATUS "The package was found using CONFIG mode") else() diff --git a/examples/use_config_ifp/Findignition-find_config.cmake b/examples/use_config_ifp/Findgz-find_config.cmake similarity index 100% rename from examples/use_config_ifp/Findignition-find_config.cmake rename to examples/use_config_ifp/Findgz-find_config.cmake diff --git a/examples/use_config_ifp/ignition-find_configConfig.cmake b/examples/use_config_ifp/gz-find_configConfig.cmake similarity index 100% rename from examples/use_config_ifp/ignition-find_configConfig.cmake rename to examples/use_config_ifp/gz-find_configConfig.cmake From 841fc7cd5c4150a8dd661d15e092c441e0efc2f7 Mon Sep 17 00:00:00 2001 From: methylDragon Date: Tue, 3 May 2022 18:21:11 -0700 Subject: [PATCH 5/8] Use GZ_PACKAGE_NAME instead Signed-off-by: methylDragon --- cmake/IgnUtils.cmake | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/cmake/IgnUtils.cmake b/cmake/IgnUtils.cmake index 1237813d..afc8a76d 100644 --- a/cmake/IgnUtils.cmake +++ b/cmake/IgnUtils.cmake @@ -158,21 +158,21 @@ macro(ign_find_package MACRO_PACKAGE_NAME) #------------------------------------ # Handle ticktock # TODO(CH3): Remove on tock - if(${PACKAGE_NAME} MATCHES "^ign(ition)?-") + if(${PACKAGE_NAME} MATCHES "^ignition-") message(DEPRECATION "\nThe use of 'ign-' and 'ignition-' prefixed libraries has been " "deprecated in favor of 'gz-' and will be removed in the next version!\n" ) - set(PACKAGE_NAME_BAK ${PACKAGE_NAME}) + set(GZ_PACKAGE_NAME ${PACKAGE_NAME}) - string(REGEX REPLACE "^ign(ition)?-" "gz-" PACKAGE_NAME ${PACKAGE_NAME_BAK}) - message(NOTICE "...Trying to use the gz- version of the library you specified: '${PACKAGE_NAME}'\n") + string(REGEX REPLACE "^ign(ition)?-" "gz-" GZ_PACKAGE_NAME ${PACKAGE_NAME}) + message(NOTICE "...Trying to use the gz- version of the library you specified: '${GZ_PACKAGE_NAME}'\n") #------------------------------------ # Construct the arguments to pass to find_package # The duplication is necessary for the ticktock... # TODO(CH3): Remove on tock - set(gz_find_package_args ${PACKAGE_NAME}) + set(gz_find_package_args ${GZ_PACKAGE_NAME}) if(ign_find_package_VERSION) list(APPEND gz_find_package_args ${ign_find_package_VERSION}) @@ -204,27 +204,25 @@ macro(ign_find_package MACRO_PACKAGE_NAME) find_package(${gz_find_package_args} QUIET) - if(${PACKAGE_NAME}_FOUND) + if(${GZ_PACKAGE_NAME}_FOUND) message(NOTICE "Found! Using it instead of '${PACKAGE_NAME_BAK}'") # Manually set ignition- prefix version numbers for ticktock # TODO(CH3): Remove on tock - set(${PACKAGE_NAME_BAK}_VERSION ${${PACKAGE_NAME}_VERSION}) - set(${PACKAGE_NAME_BAK}_VERSION_MAJOR ${${PACKAGE_NAME}_VERSION_MAJOR}) - set(${PACKAGE_NAME_BAK}_VERSION_MINOR ${${PACKAGE_NAME}_VERSION_MINOR}) - set(${PACKAGE_NAME_BAK}_VERSION_PATCH ${${PACKAGE_NAME}_VERSION_PATCH}) - set(${PACKAGE_NAME_BAK}_VERSION_TWEAK ${${PACKAGE_NAME}_VERSION_TWEAK}) + set(${PACKAGE_NAME}_VERSION ${${GZ_PACKAGE_NAME}_VERSION}) + set(${PACKAGE_NAME}_VERSION_MAJOR ${${GZ_PACKAGE_NAME}_VERSION_MAJOR}) + set(${PACKAGE_NAME}_VERSION_MINOR ${${GZ_PACKAGE_NAME}_VERSION_MINOR}) + set(${PACKAGE_NAME}_VERSION_PATCH ${${GZ_PACKAGE_NAME}_VERSION_PATCH}) + set(${PACKAGE_NAME}_VERSION_TWEAK ${${GZ_PACKAGE_NAME}_VERSION_TWEAK}) else() message(WARNING - "\n'${PACKAGE_NAME}' not found! Falling back to '${PACKAGE_NAME_BAK}'...\n" + "\n'${GZ_PACKAGE_NAME}' not found! Falling back to '${PACKAGE_NAME}'...\n" "== NOTE ==\n" "gz- library finding will sometimes deterministically fail because the dynamic substitution " "doesn't get picked up by colcon-cmake.\n" "To avoid these failures, substitute your 'ign(ition)-' prefixes with 'gz-' in your CMake " "files, or call `colcon build --executor sequential` instead!\n") - - set(PACKAGE_NAME ${PACKAGE_NAME_BAK}) endif() endif() From 8690f689abda5edd4c76c46784121876d897e53d Mon Sep 17 00:00:00 2001 From: methylDragon Date: Wed, 4 May 2022 12:53:42 -0700 Subject: [PATCH 6/8] Ticktock export headers Signed-off-by: methylDragon --- cmake/Export.hh.in | 42 ++++++++++++++++++++++++++++++++++++++++-- cmake/IgnUtils.cmake | 16 ++++++++++++++-- 2 files changed, 54 insertions(+), 4 deletions(-) diff --git a/cmake/Export.hh.in b/cmake/Export.hh.in index c20b4836..2cdbb9b1 100644 --- a/cmake/Export.hh.in +++ b/cmake/Export.hh.in @@ -52,12 +52,50 @@ #endif -#ifndef IGN_DEPRECATED +#ifndef GZ_DEPRECATED /// For @lib_name@ developers: Use this macro to indicate that a /// function or class has been deprecated and should no longer be used. A /// version should be specified to provide context to the user about when the /// function became deprecated. -#define IGN_DEPRECATED(version) IGN_DEPRECATED_ALL_VERSIONS + +// NOTE(CH3): GZ_DEPRECATED_ALL_VERSIONS can't be ticktocked, it's generated +// On the bright side, it seems to be private +#define GZ_DEPRECATED(version) GZ_DEPRECATED_ALL_VERSIONS +#endif + + +#ifndef IGN_DEPRECATED +// TODO(CH3): Remove on ticktock +// NOTE(CH3): This has no docstring since we'll make GZ_DEPRECATED the default +#define IGN_DEPRECATED(version) GZ_DEPRECATED_ALL_VERSIONS +#endif + + +// TICKTOCK IGNITION ======================================================== +// TODO(CH3): Remove on ticktock, supports defining IGNITION macros if we're +// a lib is using GZ_ prefixed export macros +#define _GZ_EXPORT_BASE @_gz_export_base@ + +#if _GZ_EXPORT_BASE +#ifndef IGNITION_VISIBLE +/// For @lib_name@ developers: Apply this macro to @lib_name@ +/// functions and classes which consumers of this library will need to be able +/// to call from their own programs or libraries. +#define IGNITION_VISIBLE \ + DETAIL_@export_base@_VISIBLE #endif + +#ifndef IGNITION_HIDDEN +/// For @lib_name@ developers: Apply this macro to @lib_name@ +/// functions and classes which must not be used by consumers of this library. +/// By default, this property is applied to all classes and functions which are +/// not tagged with IGNITION_VISIBLE, so this does not +/// generally need to be used. +#define IGNITION_HIDDEN \ + DETAIL_@export_base@_HIDDEN #endif +#endif // _GZ_EXPORT_BASE + + +#endif // @export_base@_EXPORT_HH_ diff --git a/cmake/IgnUtils.cmake b/cmake/IgnUtils.cmake index afc8a76d..4a162346 100644 --- a/cmake/IgnUtils.cmake +++ b/cmake/IgnUtils.cmake @@ -1045,7 +1045,9 @@ function(ign_create_core_library) _ign_add_library_or_component( LIB_NAME ${IGN_LIBRARY_TARGET_NAME} INCLUDE_DIR "${PROJECT_INCLUDE_DIR}" - EXPORT_BASE IGNITION_${IGN_DESIGNATION_UPPER} + + # Using GZ_ is deliberate, Export.hh.in has logic to deal with this + EXPORT_BASE GZ_${IGN_DESIGNATION_UPPER} SOURCES ${sources} ${interface_option}) @@ -1554,7 +1556,7 @@ macro(_ign_add_library_or_component) EXPORT_FILE_NAME ${implementation_file_name} EXPORT_MACRO_NAME DETAIL_${export_base}_VISIBLE NO_EXPORT_MACRO_NAME DETAIL_${export_base}_HIDDEN - DEPRECATED_MACRO_NAME IGN_DEPRECATED_ALL_VERSIONS) + DEPRECATED_MACRO_NAME GZ_DEPRECATED_ALL_VERSIONS) set(install_include_dir "${IGN_INCLUDE_INSTALL_DIR_FULL}/${include_dir}") @@ -1568,6 +1570,16 @@ macro(_ign_add_library_or_component) # Configure the public-facing header for exporting and deprecating. This # header provides commentary for the macros so that developers can know their # purpose. + + # TODO(CH3): Remove this on ticktock + # This is to allow IGNITION_ prefixed export macros to generate in Export.hh + # _gz_export_base is used in Export.hh.in's configuration! + if(${export_base} MATCHES "^GZ_") + set(_gz_export_base 1) + else() + set(_gz_export_base 0) + endif() + configure_file( "${IGNITION_CMAKE_DIR}/Export.hh.in" "${binary_include_dir}/Export.hh") From d0c212a68ee3b5ecb9f63fdf4ed2cc8a1d8b80d3 Mon Sep 17 00:00:00 2001 From: methylDragon Date: Wed, 4 May 2022 13:02:04 -0700 Subject: [PATCH 7/8] Ticktock export headers Signed-off-by: methylDragon --- cmake/Export.hh.in | 40 ++++++++++++++++++++- cmake/IgnUtils.cmake | 85 +++++++++++++++++++++++++++++++++++++++----- 2 files changed, 116 insertions(+), 9 deletions(-) diff --git a/cmake/Export.hh.in b/cmake/Export.hh.in index c20b4836..f07c0f26 100644 --- a/cmake/Export.hh.in +++ b/cmake/Export.hh.in @@ -53,11 +53,49 @@ #ifndef IGN_DEPRECATED +// TODO(CH3): Remove on ticktock +// NOTE(CH3): This has no docstring since we'll make GZ_DEPRECATED the default +#define IGN_DEPRECATED(version) GZ_DEPRECATED_ALL_VERSIONS +#endif + +#ifndef GZ_DEPRECATED /// For @lib_name@ developers: Use this macro to indicate that a /// function or class has been deprecated and should no longer be used. A /// version should be specified to provide context to the user about when the /// function became deprecated. -#define IGN_DEPRECATED(version) IGN_DEPRECATED_ALL_VERSIONS + +// NOTE(CH3): GZ_DEPRECATED_ALL_VERSIONS can't be ticktocked, it's generated +// On the bright side, it seems to be private +#define GZ_DEPRECATED(version) GZ_DEPRECATED_ALL_VERSIONS +#endif + + +// TICKTOCK IGNITION ======================================================== +// TODO(CH3): Remove on ticktock, supports defining IGNITION macros if we're +// a lib is using GZ_ prefixed export macros +#define _@export_base@_USING_GZ_EXPORT_BASE @_using_gz_export_base@ +#if _USING_GZ_EXPORT_BASE + + +#ifndef @_ign_export_base@_VISIBLE +/// For @lib_name@ developers: Apply this macro to @lib_name@ +/// functions and classes which consumers of this library will need to be able +/// to call from their own programs or libraries. +#define @_ign_export_base@_VISIBLE \ + DETAIL_@export_base@_VISIBLE #endif + +#ifndef @_ign_export_base@_HIDDEN +/// For @lib_name@ developers: Apply this macro to @lib_name@ +/// functions and classes which must not be used by consumers of this library. +/// By default, this property is applied to all classes and functions which are +/// not tagged with @_ign_export_base@_VISIBLE, so this does not +/// generally need to be used. +#define @_ign_export_base@_HIDDEN \ + DETAIL_@export_base@_HIDDEN #endif + + +#endif // _@export_base@_USING_GZ_EXPORT_BASE +#endif // @export_base@_EXPORT_HH_ diff --git a/cmake/IgnUtils.cmake b/cmake/IgnUtils.cmake index 4f185061..11b723e5 100644 --- a/cmake/IgnUtils.cmake +++ b/cmake/IgnUtils.cmake @@ -952,12 +952,58 @@ function(ign_create_core_library) #------------------------------------ # Create the target for the core library, and configure it to be installed - _ign_add_library_or_component( - LIB_NAME ${PROJECT_LIBRARY_TARGET_NAME} - INCLUDE_DIR "${PROJECT_INCLUDE_DIR}" - EXPORT_BASE IGNITION_${IGN_DESIGNATION_UPPER} - SOURCES ${sources} - ${interface_option}) + + # Support "gz-" + if(${PROJECT_LIBRARY_TARGET_NAME} MATCHES "^gz-") + _ign_add_library_or_component( + LIB_NAME ${PROJECT_LIBRARY_TARGET_NAME} + INCLUDE_DIR "${PROJECT_INCLUDE_DIR}" + EXPORT_BASE GZ_${IGN_DESIGNATION_UPPER} + SOURCES ${sources} + ${interface_option}) + + # For ticktocking: Export an "ignition-" target as well, allowing linking against + # the ignition- prefixed name + # TODO(CH3): To remove on tock + string(REGEX REPLACE "^gz-" "ignition-" IGN_LIBRARY_TARGET_NAME ${PROJECT_LIBRARY_TARGET_NAME}) + _ign_add_library_or_component( + LIB_NAME ${IGN_LIBRARY_TARGET_NAME} + INCLUDE_DIR "${PROJECT_INCLUDE_DIR}" + + # Using GZ_ is deliberate, Export.hh.in has logic to deal with this + EXPORT_BASE GZ_${IGN_DESIGNATION_UPPER} + SOURCES ${sources} + ${interface_option}) + + target_include_directories(${IGN_LIBRARY_TARGET_NAME} + ${property_type} + # This is the publicly installed headers directory. + "$" + # This is the in-build version of the core library headers directory. + # Generated headers for the core library get placed here. + "$" + # Generated headers for the core library might also get placed here. + "$") + + #------------------------------------ + # Handle cmake and pkgconfig packaging + # TODO(CH3): Remove on tock + string(REGEX REPLACE "^gz-" "ignition-" IGN_PROJECT_NAME_LOWER ${PROJECT_NAME_LOWER}) + + if(ign_create_core_library_INTERFACE) + set(project_pkgconfig_core_lib) # Intentionally blank + else() + set(project_pkgconfig_core_lib "-l${IGN_PROJECT_NAME_LOWER}") + endif() + + else() + _ign_add_library_or_component( + LIB_NAME ${PROJECT_LIBRARY_TARGET_NAME} + INCLUDE_DIR "${PROJECT_INCLUDE_DIR}" + EXPORT_BASE GZ_${IGN_DESIGNATION_UPPER} + SOURCES ${sources} + ${interface_option}) + endif() # These generator expressions are necessary for multi-configuration generators # such as MSVC on Windows. They also ensure that our target exports its @@ -1136,10 +1182,18 @@ function(ign_add_component component_name) #------------------------------------ # Create the target for this component, and configure it to be installed + + # Support "gz-" + if(${PROJECT_LIBRARY_TARGET_NAME} MATCHES "^gz-") + set(EXPORT_PREFIX "GZ") + else() + set(EXPORT_PREFIX "IGNITION") + endif() + _ign_add_library_or_component( LIB_NAME ${component_target_name} INCLUDE_DIR "${PROJECT_INCLUDE_DIR}/${include_subdir}" - EXPORT_BASE IGNITION_${IGN_DESIGNATION_UPPER}_${component_name_upper} + EXPORT_BASE ${EXPORT_PREFIX}_${IGN_DESIGNATION_UPPER}_${component_name_upper} SOURCES ${sources} ${interface_option}) @@ -1339,6 +1393,9 @@ macro(_ign_add_library_or_component) # - include_dir # - export_base # - lib_name + # + # - _using_gz_export_base + # - _ign_export_base #------------------------------------ # Define the expected arguments @@ -1424,7 +1481,7 @@ macro(_ign_add_library_or_component) EXPORT_FILE_NAME ${implementation_file_name} EXPORT_MACRO_NAME DETAIL_${export_base}_VISIBLE NO_EXPORT_MACRO_NAME DETAIL_${export_base}_HIDDEN - DEPRECATED_MACRO_NAME IGN_DEPRECATED_ALL_VERSIONS) + DEPRECATED_MACRO_NAME GZ_DEPRECATED_ALL_VERSIONS) set(install_include_dir "${IGN_INCLUDE_INSTALL_DIR_FULL}/${include_dir}") @@ -1438,6 +1495,18 @@ macro(_ign_add_library_or_component) # Configure the public-facing header for exporting and deprecating. This # header provides commentary for the macros so that developers can know their # purpose. + + # TODO(CH3): Remove this on ticktock + # This is to allow IGNITION_ prefixed export macros to generate in Export.hh + # _using_gz_export_base is used in Export.hh.in's configuration! + if(${export_base} MATCHES "^GZ_") + set(_using_gz_export_base 1) + else() + set(_using_gz_export_base 0) + endif() + + string(REGEX REPLACE "^GZ_" "IGNITION_" _ign_export_base ${export_base}) + configure_file( "${IGNITION_CMAKE_DIR}/Export.hh.in" "${binary_include_dir}/Export.hh") From 20748d42a2f1241ee0be5807bfb70721c0bf5be0 Mon Sep 17 00:00:00 2001 From: methylDragon Date: Wed, 4 May 2022 14:30:44 -0700 Subject: [PATCH 8/8] Always use GZ_ prefixed export base Signed-off-by: methylDragon --- cmake/Export.hh.in | 18 +++++++----------- cmake/IgnUtils.cmake | 17 +---------------- 2 files changed, 8 insertions(+), 27 deletions(-) diff --git a/cmake/Export.hh.in b/cmake/Export.hh.in index f07c0f26..003f6193 100644 --- a/cmake/Export.hh.in +++ b/cmake/Export.hh.in @@ -52,12 +52,6 @@ #endif -#ifndef IGN_DEPRECATED -// TODO(CH3): Remove on ticktock -// NOTE(CH3): This has no docstring since we'll make GZ_DEPRECATED the default -#define IGN_DEPRECATED(version) GZ_DEPRECATED_ALL_VERSIONS -#endif - #ifndef GZ_DEPRECATED /// For @lib_name@ developers: Use this macro to indicate that a /// function or class has been deprecated and should no longer be used. A @@ -73,10 +67,6 @@ // TICKTOCK IGNITION ======================================================== // TODO(CH3): Remove on ticktock, supports defining IGNITION macros if we're // a lib is using GZ_ prefixed export macros -#define _@export_base@_USING_GZ_EXPORT_BASE @_using_gz_export_base@ -#if _USING_GZ_EXPORT_BASE - - #ifndef @_ign_export_base@_VISIBLE /// For @lib_name@ developers: Apply this macro to @lib_name@ /// functions and classes which consumers of this library will need to be able @@ -97,5 +87,11 @@ #endif -#endif // _@export_base@_USING_GZ_EXPORT_BASE +#ifndef IGN_DEPRECATED +// TODO(CH3): Remove on ticktock +// NOTE(CH3): This has no docstring since we'll make GZ_DEPRECATED the default +#define IGN_DEPRECATED(version) GZ_DEPRECATED_ALL_VERSIONS +#endif + + #endif // @export_base@_EXPORT_HH_ diff --git a/cmake/IgnUtils.cmake b/cmake/IgnUtils.cmake index 11b723e5..5a18c166 100644 --- a/cmake/IgnUtils.cmake +++ b/cmake/IgnUtils.cmake @@ -1182,18 +1182,10 @@ function(ign_add_component component_name) #------------------------------------ # Create the target for this component, and configure it to be installed - - # Support "gz-" - if(${PROJECT_LIBRARY_TARGET_NAME} MATCHES "^gz-") - set(EXPORT_PREFIX "GZ") - else() - set(EXPORT_PREFIX "IGNITION") - endif() - _ign_add_library_or_component( LIB_NAME ${component_target_name} INCLUDE_DIR "${PROJECT_INCLUDE_DIR}/${include_subdir}" - EXPORT_BASE ${EXPORT_PREFIX}_${IGN_DESIGNATION_UPPER}_${component_name_upper} + EXPORT_BASE GZ_${IGN_DESIGNATION_UPPER}_${component_name_upper} SOURCES ${sources} ${interface_option}) @@ -1394,7 +1386,6 @@ macro(_ign_add_library_or_component) # - export_base # - lib_name # - # - _using_gz_export_base # - _ign_export_base #------------------------------------ @@ -1499,12 +1490,6 @@ macro(_ign_add_library_or_component) # TODO(CH3): Remove this on ticktock # This is to allow IGNITION_ prefixed export macros to generate in Export.hh # _using_gz_export_base is used in Export.hh.in's configuration! - if(${export_base} MATCHES "^GZ_") - set(_using_gz_export_base 1) - else() - set(_using_gz_export_base 0) - endif() - string(REGEX REPLACE "^GZ_" "IGNITION_" _ign_export_base ${export_base}) configure_file(