From 39bc3f6dbdeade5ccdf538494528775d7446c214 Mon Sep 17 00:00:00 2001 From: methylDragon Date: Fri, 8 Jul 2022 18:24:55 -0700 Subject: [PATCH 1/2] Migrate FindIgn files (#273) Signed-off-by: methylDragon --- cmake/{FindIgnBullet.cmake => FindGzBullet.cmake} | 0 cmake/{FindIgnCURL.cmake => FindGzCURL.cmake} | 0 cmake/{FindIgnOGRE.cmake => FindGzOGRE.cmake} | 0 cmake/{FindIgnOGRE2.cmake => FindGzOGRE2.cmake} | 0 cmake/{FindIgnProtobuf.cmake => FindGzProtobuf.cmake} | 0 cmake/{FindIgnURDFDOM.cmake => FindGzURDFDOM.cmake} | 0 6 files changed, 0 insertions(+), 0 deletions(-) rename cmake/{FindIgnBullet.cmake => FindGzBullet.cmake} (100%) rename cmake/{FindIgnCURL.cmake => FindGzCURL.cmake} (100%) rename cmake/{FindIgnOGRE.cmake => FindGzOGRE.cmake} (100%) rename cmake/{FindIgnOGRE2.cmake => FindGzOGRE2.cmake} (100%) rename cmake/{FindIgnProtobuf.cmake => FindGzProtobuf.cmake} (100%) rename cmake/{FindIgnURDFDOM.cmake => FindGzURDFDOM.cmake} (100%) diff --git a/cmake/FindIgnBullet.cmake b/cmake/FindGzBullet.cmake similarity index 100% rename from cmake/FindIgnBullet.cmake rename to cmake/FindGzBullet.cmake diff --git a/cmake/FindIgnCURL.cmake b/cmake/FindGzCURL.cmake similarity index 100% rename from cmake/FindIgnCURL.cmake rename to cmake/FindGzCURL.cmake diff --git a/cmake/FindIgnOGRE.cmake b/cmake/FindGzOGRE.cmake similarity index 100% rename from cmake/FindIgnOGRE.cmake rename to cmake/FindGzOGRE.cmake diff --git a/cmake/FindIgnOGRE2.cmake b/cmake/FindGzOGRE2.cmake similarity index 100% rename from cmake/FindIgnOGRE2.cmake rename to cmake/FindGzOGRE2.cmake diff --git a/cmake/FindIgnProtobuf.cmake b/cmake/FindGzProtobuf.cmake similarity index 100% rename from cmake/FindIgnProtobuf.cmake rename to cmake/FindGzProtobuf.cmake diff --git a/cmake/FindIgnURDFDOM.cmake b/cmake/FindGzURDFDOM.cmake similarity index 100% rename from cmake/FindIgnURDFDOM.cmake rename to cmake/FindGzURDFDOM.cmake From 6e6b2f81361b1e4037368d18c8ebd4c7dcdf0ffb Mon Sep 17 00:00:00 2001 From: methylDragon Date: Fri, 8 Jul 2022 19:09:28 -0700 Subject: [PATCH 2/2] Support FindIgn migration with ticktocks and hardtocks (#273) Signed-off-by: methylDragon --- Changelog.md | 22 +++++----- cmake/FindGzBullet.cmake | 12 +++--- cmake/FindGzCURL.cmake | 32 ++++++++------ cmake/FindGzOGRE.cmake | 42 +++++++++--------- cmake/FindGzOGRE2.cmake | 81 ++++++++++++++++++----------------- cmake/FindGzProtobuf.cmake | 27 ++++++------ cmake/FindGzURDFDOM.cmake | 20 +++++---- cmake/IgnImportTarget.cmake | 26 ++++++++++- cmake/IgnRonn2Man.cmake | 4 +- cmake/IgnUtils.cmake | 41 +++++++++++++++--- examples/find_ogre2/README.md | 9 ++-- 11 files changed, 192 insertions(+), 124 deletions(-) diff --git a/Changelog.md b/Changelog.md index c7b83dfa..f16cdefe 100644 --- a/Changelog.md +++ b/Changelog.md @@ -19,7 +19,7 @@ 1. Fix check for missing components in OGRE2. Be more verbose with components * [Pull request #220](https://github.com/gazebosim/gz-cmake/pull/220) -1. FindIgnOGRE2: exclude ogre versions different than 2.x +1. FindGzOGRE2: exclude ogre versions different than 2.x * [Pull request #219](https://github.com/gazebosim/gz-cmake/pull/219) * [Pull request #221](https://github.com/gazebosim/gz-cmake/pull/221) @@ -52,7 +52,7 @@ 1. Add Ubuntu Jammy CI * [Pull request #194](https://github.com/gazebosim/gz-cmake/pull/194) -1. FindIgnURDFDOM cmake module +1. FindGzURDFDOM cmake module * [Pull request #193](https://github.com/gazebosim/gz-cmake/pull/193) 1. Do not modify `CMAKE_FIND_LIBRARY_PREFIXES` and `CMAKE_FIND_LIBRARY_SUFFIXES` on Windows @@ -115,7 +115,7 @@ 1. Fix cmake message types * [Pull request #159](https://github.com/gazebosim/gz-cmake/pull/159) -1. Support imported targets in FindIgnOGRE.cmake +1. Support imported targets in FindGzOGRE.cmake * [Pull request #150](https://github.com/gazebosim/gz-cmake/pull/150) 1. Infrastructure @@ -176,10 +176,10 @@ 1. Added build-essential and cmake to packages.apt * [Pull request 130](https://github.com/gazebosim/gz-cmake/pull/130) -1. Fix FindIgnOgre on Windows when not using vcpkg +1. Fix FindGzOgre on Windows when not using vcpkg * [Pull request 124](https://github.com/gazebosim/gz-cmake/pull/124) -1. FindIgnOGRE2: prefer versioned component libraries +1. FindGzOGRE2: prefer versioned component libraries * [Pull request 125](https://github.com/gazebosim/gz-cmake/pull/125) 1. Correct CMake logic and update cpplint to Python3 @@ -209,7 +209,7 @@ 1. Fix use of FindYAML.cmake and FindJSONCPP without pkg-config * [Pull request 79](https://github.com/gazebosim/gz-cmake/pull/79) -1. Fix use of FindIgnOGRE2 on Windows if OGRE2 is not found +1. Fix use of FindGzOGRE2 on Windows if OGRE2 is not found * [Pull request 94](https://github.com/gazebosim/gz-cmake/pull/94) * Thanks to Silvio Traversaro @@ -243,14 +243,14 @@ 1. Set viewport for doxygen pages. * [BitBucket pull request 167](https://osrf-migration.github.io/ignition-gh-pages/#!/ignitionrobotics/ign-cmake/pull-requests/167) -1. Use upstream `CURL::libcurl` imported target in FindIgnCURL.cmake if available. +1. Use upstream `CURL::libcurl` imported target in FindGzCURL.cmake if available. * [BitBucket pull request 175](https://osrf-migration.github.io/ignition-gh-pages/#!/ignitionrobotics/ign-cmake/pull-requests/175) 1. Avoid hardcoding /machine:x64 flag on 64-bit on MSVC. * [BitBucket pull request 171](https://osrf-migration.github.io/ignition-gh-pages/#!/ignitionrobotics/ign-cmake/pull-requests/171) * [BitBucket pull request 168](https://osrf-migration.github.io/ignition-gh-pages/#!/ignitionrobotics/ign-cmake/pull-requests/168) -1. FindIgnOGRE2: fix include paths for new directory structure. +1. FindGzOGRE2: fix include paths for new directory structure. * [BitBucket pull request 170](https://osrf-migration.github.io/ignition-gh-pages/#!/ignitionrobotics/ign-cmake/pull-requests/170) * [BitBucket pull request 157](https://osrf-migration.github.io/ignition-gh-pages/#!/ignitionrobotics/ign-cmake/pull-requests/157) @@ -261,7 +261,7 @@ 1. IgnConfigureBuild: only `add_subdirectory(test)` if `BUILD_TESTING` is ON * [BitBucket pull request 169](https://osrf-migration.github.io/ignition-gh-pages/#!/ignitionrobotics/ign-cmake/pull-requests/169) -1. Add FindIgnBullet cmake module. +1. Add FindGzBullet cmake module. * [BitBucket pull request 162](https://osrf-migration.github.io/ignition-gh-pages/#!/ignitionrobotics/ign-cmake/pull-requests/162) ### Gazebo CMake 2.1.1 (2019-08-07) @@ -308,7 +308,7 @@ 1. Set viewport for doxygen pages. * [BitBucket pull request 167](https://osrf-migration.github.io/ignition-gh-pages/#!/ignitionrobotics/ign-cmake/pull-requests/167) -1. Use upstream `CURL::libcurl` imported target in FindIgnCURL.cmake if available. +1. Use upstream `CURL::libcurl` imported target in FindGzCURL.cmake if available. * [BitBucket pull request 175](https://osrf-migration.github.io/ignition-gh-pages/#!/ignitionrobotics/ign-cmake/pull-requests/175) 1. Avoid hardcoding /machine:x64 flag on 64-bit on MSVC. @@ -339,7 +339,7 @@ 1. Set viewport for doxygen pages. * [BitBucket pull request 167](https://osrf-migration.github.io/ignition-gh-pages/#!/ignitionrobotics/ign-cmake/pull-requests/167) -1. Use upstream `CURL::libcurl` imported target in FindIgnCURL.cmake if available. +1. Use upstream `CURL::libcurl` imported target in FindGzCURL.cmake if available. * [BitBucket pull request 175](https://osrf-migration.github.io/ignition-gh-pages/#!/ignitionrobotics/ign-cmake/pull-requests/175) 1. Avoid hardcoding /machine:x64 flag on 64-bit on MSVC. diff --git a/cmake/FindGzBullet.cmake b/cmake/FindGzBullet.cmake index 87d86859..798d2395 100644 --- a/cmake/FindGzBullet.cmake +++ b/cmake/FindGzBullet.cmake @@ -24,7 +24,7 @@ ######################################## set(gz_quiet_arg) -if(IgnBullet_FIND_QUIETLY) +if(GzBullet_FIND_QUIETLY) set(gz_quiet_arg QUIET) endif() @@ -33,14 +33,16 @@ endif() # with Bullet, which uses relative paths and may break transitive dependencies. find_package(Bullet MODULE ${gz_quiet_arg}) -set(IgnBullet_FOUND false) +set(GzBullet_FOUND false) # create Bullet target if(BULLET_FOUND) - set(IgnBullet_FOUND true) + set(GzBullet_FOUND true) - gz_import_target(IgnBullet - TARGET_NAME IgnBullet::IgnBullet + gz_import_target(GzBullet + TARGET_NAME GzBullet::GzBullet LIB_VAR BULLET_LIBRARIES INCLUDE_VAR BULLET_INCLUDE_DIRS ) endif() + +set(IgnBullet_FOUND ${GzBullet_FOUND}) # TODO(CH3): Deprecated. Remove on tock. diff --git a/cmake/FindGzCURL.cmake b/cmake/FindGzCURL.cmake index aeb78972..37249741 100644 --- a/cmake/FindGzCURL.cmake +++ b/cmake/FindGzCURL.cmake @@ -18,31 +18,37 @@ # # Usage of this module as follows: # -# find_package(IgnCURL) +# find_package(GzCURL) # # Variables defined by this module: # # curl::curl Imported target for libcurl # -# IgnCURL_FOUND System has CURL libs/headers -# IgnCURL_INCLUDE_DIRS The location of CURL headers -# IgnCURL_LIBRARIES The CURL libraries -# IgnCURL_VERSION The version of CURL found +# GzCURL_FOUND System has CURL libs/headers +# GzCURL_INCLUDE_DIRS The location of CURL headers +# GzCURL_LIBRARIES The CURL libraries +# GzCURL_VERSION The version of CURL found set(gz_quiet_arg) -if(IgnCURL_FIND_QUIETLY) +if(GzCURL_FIND_QUIETLY) set(gz_quiet_arg QUIET) endif() -find_package(CURL ${IgnCURL_FIND_VERSION} ${gz_quiet_arg}) +find_package(CURL ${GzCURL_FIND_VERSION} ${gz_quiet_arg}) -set(IgnCURL_FOUND ${CURL_FOUND}) +set(GzCURL_FOUND ${CURL_FOUND}) +set(IgnCURL_FOUND ${GzCURL_FOUND}) # TODO(CH3): Deprecated. Remove on tock. -if(${IgnCURL_FOUND}) +if(${GzCURL_FOUND}) - set(IgnCURL_INCLUDE_DIRS ${CURL_INCLUDE_DIRS}) - set(IgnCURL_LIBRARIES ${CURL_LIBRARIES}) - set(IgnCURL_VERSION ${CURL_VERSION_STRING}) + set(GzCURL_INCLUDE_DIRS ${CURL_INCLUDE_DIRS}) + set(GzCURL_LIBRARIES ${CURL_LIBRARIES}) + set(GzCURL_VERSION ${CURL_VERSION_STRING}) + + # TODO(CH3): Deprecated. Remove on tock. + set(IgnCURL_INCLUDE_DIRS ${GzCURL_INCLUDE_DIRS}) + set(IgnCURL_LIBRARIES ${GzCURL_LIBRARIES}) + set(IgnCURL_VERSION ${GzCURL_VERSION}) # Older versions of curl don't create imported targets, so we will create # them here if they have not been provided. @@ -61,6 +67,6 @@ if(${IgnCURL_FOUND}) endif() include(IgnPkgConfig) - gz_pkg_config_entry(IgnCURL "libcurl >= ${IgnCURL_FIND_VERSION}") + gz_pkg_config_entry(GzCURL "libcurl >= ${GzCURL_FIND_VERSION}") endif() diff --git a/cmake/FindGzOGRE.cmake b/cmake/FindGzOGRE.cmake index 572ad38f..8c01a682 100644 --- a/cmake/FindGzOGRE.cmake +++ b/cmake/FindGzOGRE.cmake @@ -20,7 +20,7 @@ # # Usage of this module as follows: # -# gz_find_package(IgnOGRE) +# gz_find_package(GzOGRE) # # Variables defined by this module: # @@ -32,7 +32,7 @@ # OGRE_VERSION_MINOR OGRE minor version # OGRE_VERSION_PATCH OGRE patch version # OGRE_RESOURCE_PATH Path to ogre plugins directory -# IgnOGRE::IgnOGRE Imported target for OGRE +# GzOGRE::GzOGRE Imported target for OGRE # # On Windows, we assume that all the OGRE* defines are passed in manually # to CMake. @@ -41,13 +41,13 @@ # # Example usage: # -# gz_find_package(IgnOGRE +# gz_find_package(GzOGRE # VERSION 1.8.0 # COMPONENTS RTShaderSystem Terrain Overlay) # Grab the version numbers requested by the call to find_package(~) -set(major_version ${IgnOGRE_FIND_VERSION_MAJOR}) -set(minor_version ${IgnOGRE_FIND_VERSION_MINOR}) +set(major_version ${GzOGRE_FIND_VERSION_MAJOR}) +set(minor_version ${GzOGRE_FIND_VERSION_MINOR}) # Set the full version number set(full_version ${major_version}.${minor_version}) @@ -69,7 +69,7 @@ if (NOT WIN32) OUTPUT_VARIABLE _pkgconfig_invoke_result RESULT_VARIABLE _pkgconfig_failed) if(_pkgconfig_failed) - IGN_BUILD_WARNING ("Failed to get pkg-config search paths") + GZ_BUILD_WARNING ("Failed to get pkg-config search paths") elseif (NOT _pkgconfig_invoke_result STREQUAL "") set (PKG_CONFIG_PATH_TMP "${PKG_CONFIG_PATH_TMP}:${_pkgconfig_invoke_result}") endif() @@ -105,7 +105,7 @@ if (NOT WIN32) OUTPUT_VARIABLE _pkgconfig_invoke_result RESULT_VARIABLE _pkgconfig_failed) if(_pkgconfig_failed) - IGN_BUILD_WARNING ("Failed to find OGRE's library directory. The build will succeed, but there will likely be run-time errors.") + GZ_BUILD_WARNING ("Failed to find OGRE's library directory. The build will succeed, but there will likely be run-time errors.") else() # set ogre library dir and strip line break set(OGRE_LIBRARY_DIRS ${_pkgconfig_invoke_result}) @@ -139,11 +139,11 @@ if (NOT WIN32) OGRE_VERSION_PATCH ${OGRE_VERSION}) # find ogre components - foreach(component ${IgnOGRE_FIND_COMPONENTS}) - gz_pkg_check_modules_quiet(IgnOGRE-${component} "OGRE-${component} >= ${full_version}" NO_CMAKE_ENVIRONMENT_PATH) - if(IgnOGRE-${component}_FOUND) - list(APPEND OGRE_LIBRARIES IgnOGRE-${component}::IgnOGRE-${component}) - elseif(IgnOGRE_FIND_REQUIRED_${component}) + foreach(component ${GzOGRE_FIND_COMPONENTS}) + gz_pkg_check_modules_quiet(GzOGRE-${component} "OGRE-${component} >= ${full_version}" NO_CMAKE_ENVIRONMENT_PATH) + if(GzOGRE-${component}_FOUND) + list(APPEND OGRE_LIBRARIES GzOGRE-${component}::GzOGRE-${component}) + elseif(GzOGRE_FIND_REQUIRED_${component}) set(OGRE_FOUND false) endif() endforeach() @@ -152,13 +152,13 @@ if (NOT WIN32) OUTPUT_VARIABLE _pkgconfig_invoke_result RESULT_VARIABLE _pkgconfig_failed) if(_pkgconfig_failed) - IGN_BUILD_WARNING ("Failed to find OGRE's plugin directory. The build will succeed, but there will likely be run-time errors.") + GZ_BUILD_WARNING ("Failed to find OGRE's plugin directory. The build will succeed, but there will likely be run-time errors.") else() # This variable will be substituted into cmake/setup.sh.in set(OGRE_PLUGINDIR ${_pkgconfig_invoke_result}) endif() - gz_pkg_config_library_entry(IgnOGRE OgreMain) + gz_pkg_config_library_entry(GzOGRE OgreMain) set(OGRE_RESOURCE_PATH ${OGRE_PLUGINDIR}) # Seems that OGRE_PLUGINDIR can end in a newline, which will cause problems @@ -171,12 +171,12 @@ if (NOT WIN32) else() find_package(OGRE ${full_version} - COMPONENTS ${IgnOGRE_FIND_COMPONENTS}) + COMPONENTS ${GzOGRE_FIND_COMPONENTS}) if(OGRE_FOUND) # OGREConfig.cmake from vcpkg disable the link against plugin libs # when compiling the shared version of it. Here we copied the code # to use it. - foreach(ogre_component ${IgnOGRE_FIND_COMPONENTS}) + foreach(ogre_component ${GzOGRE_FIND_COMPONENTS}) if(ogre_component MATCHES "Plugin_" OR ogre_component MATCHES "RenderSystem_") string(LENGTH "${ogre_component}" len) string(FIND "${ogre_component}" "_" split_pos) @@ -239,9 +239,9 @@ else() endif() endif() -set(IgnOGRE_FOUND false) +set(GzOGRE_FOUND false) if(OGRE_FOUND) - set(IgnOGRE_FOUND true) + set(GzOGRE_FOUND true) # manually search and append the the RenderSystem/GL path to # OGRE_INCLUDE_DIRS so OGRE GL headers can be found @@ -260,8 +260,10 @@ if(OGRE_FOUND) endforeach() include(IgnImportTarget) - gz_import_target(IgnOGRE - TARGET_NAME IgnOGRE::IgnOGRE + gz_import_target(GzOGRE + TARGET_NAME GzOGRE::GzOGRE LIB_VAR OGRE_LIBRARIES INCLUDE_VAR OGRE_INCLUDE_DIRS) endif() + +set(IgnOGRE_FOUND ${GzOGRE_FOUND}) # TODO(CH3): Deprecated. Remove on tock. diff --git a/cmake/FindGzOGRE2.cmake b/cmake/FindGzOGRE2.cmake index 5804b014..6272664a 100644 --- a/cmake/FindGzOGRE2.cmake +++ b/cmake/FindGzOGRE2.cmake @@ -20,12 +20,12 @@ # # Usage of this module as follows: # -# gz_find_package(IgnOGRE2) +# gz_find_package(GzOGRE2) # # Variables used by this module, they can change the default behaviour and need # to be set before calling find_package: # -# IGN_OGRE2_PROJECT_NAME Possible values: OGRE2 (default) or OGRE-Next +# GZ_OGRE2_PROJECT_NAME Possible values: OGRE2 (default) or OGRE-Next # (Only on UNIX, not in use for Windows) # Specify the project name used in the packaging. # It will impact directly in the name of the @@ -41,7 +41,7 @@ # OGRE2_VERSION_MINOR OGRE minor version # OGRE2_VERSION_PATCH OGRE patch version # OGRE2_RESOURCE_PATH Path to ogre plugins directory -# IgnOGRE2::IgnOGRE2 Imported target for OGRE2 +# GzOGRE2::GzOGRE2 Imported target for OGRE2 # # On Windows, we assume that all the OGRE* defines are passed in manually # to CMake. @@ -51,18 +51,18 @@ # # Example usage: # -# gz_find_package(IgnOGRE2 -# VERSION 2.2.0 -# COMPONENTS HlmsPbs HlmsUnlit Overlay) +# gz_find_package(GzOGRE2 +# VERSION 2.2.0 +# COMPONENTS HlmsPbs HlmsUnlit Overlay) # Sanity check: exclude OGRE1 project releasing versions in two ways: # - Legacy in from using 1.x.y until 1.12.y series # - Modern versions using X.Y.Z starting with 13.y.z # Reduce valid versions to 2.x series -if (${IgnOGRE2_FIND_VERSION_MAJOR}) - if (${IgnOGRE2_FIND_VERSION_MAJOR} VERSION_LESS "2" OR - ${IgnOGRE2_FIND_VERSION_MAJOR} VERSION_GREATER_EQUAL "3") +if (${GzOGRE2_FIND_VERSION_MAJOR}) + if (${GzOGRE2_FIND_VERSION_MAJOR} VERSION_LESS "2" OR + ${GzOGRE2_FIND_VERSION_MAJOR} VERSION_GREATER_EQUAL "3") set (OGRE2_FOUND false) return() endif() @@ -141,10 +141,10 @@ macro(get_preprocessor_entry CONTENTS KEYWORD VARIABLE) endmacro() if (NOT WIN32) - foreach (IGN_OGRE2_PROJECT_NAME "OGRE2" "OGRE-Next") - message(STATUS "Looking for OGRE using the name: ${IGN_OGRE2_PROJECT_NAME}") - if (IGN_OGRE2_PROJECT_NAME STREQUAL "OGRE2") - set(OGRE2_INSTALL_PATH "OGRE-2.${IgnOGRE2_FIND_VERSION_MINOR}") + foreach (GZ_OGRE2_PROJECT_NAME "OGRE2" "OGRE-Next") + message(STATUS "Looking for OGRE using the name: ${GZ_OGRE2_PROJECT_NAME}") + if (GZ_OGRE2_PROJECT_NAME STREQUAL "OGRE2") + set(OGRE2_INSTALL_PATH "OGRE-2.${GzOGRE2_FIND_VERSION_MINOR}") set(OGRE2LIBNAME "Ogre") else() set(OGRE2_INSTALL_PATH "OGRE-Next") @@ -155,13 +155,13 @@ if (NOT WIN32) # Note: OGRE2 installed from debs is named OGRE-2.2 while the version # installed from source does not have the 2.2 suffix # look for OGRE2 installed from debs - gz_pkg_check_modules_quiet(${IGN_OGRE2_PROJECT_NAME} ${OGRE2_INSTALL_PATH} NO_CMAKE_ENVIRONMENT_PATH QUIET) + gz_pkg_check_modules_quiet(${GZ_OGRE2_PROJECT_NAME} ${OGRE2_INSTALL_PATH} NO_CMAKE_ENVIRONMENT_PATH QUIET) - if (${IGN_OGRE2_PROJECT_NAME}_FOUND) - set(IGN_PKG_NAME ${OGRE2_INSTALL_PATH}) - set(OGRE2_FOUND ${${IGN_OGRE2_PROJECT_NAME}_FOUND}) # sync possible OGRE-Next to OGRE2 - fix_pkgconfig_prefix_jammy_bug("${${IGN_OGRE2_PROJECT_NAME}_LIBRARY_DIRS}" OGRE2_LIBRARY_DIRS) - set(OGRE2_LIBRARIES ${${IGN_OGRE2_PROJECT_NAME}_LIBRARIES}) # sync possible Ogre-Next ot OGRE2 + if (${GZ_OGRE2_PROJECT_NAME}_FOUND) + set(GZ_PKG_NAME ${OGRE2_INSTALL_PATH}) + set(OGRE2_FOUND ${${GZ_OGRE2_PROJECT_NAME}_FOUND}) # sync possible OGRE-Next to OGRE2 + fix_pkgconfig_prefix_jammy_bug("${${GZ_OGRE2_PROJECT_NAME}_LIBRARY_DIRS}" OGRE2_LIBRARY_DIRS) + set(OGRE2_LIBRARIES ${${GZ_OGRE2_PROJECT_NAME}_LIBRARIES}) # sync possible Ogre-Next ot OGRE2 else() # look for OGRE2 installed from source set(PKG_CONFIG_PATH_TMP ${PKG_CONFIG_PATH_ORIGINAL}) @@ -169,7 +169,7 @@ if (NOT WIN32) OUTPUT_VARIABLE _pkgconfig_invoke_result RESULT_VARIABLE _pkgconfig_failed) if(_pkgconfig_failed) - IGN_BUILD_WARNING ("Failed to get pkg-config search paths") + GZ_BUILD_WARNING ("Failed to get pkg-config search paths") elseif (NOT _pkgconfig_invoke_result STREQUAL "") set (PKG_CONFIG_PATH_TMP "${PKG_CONFIG_PATH_TMP}:${_pkgconfig_invoke_result}") endif() @@ -201,7 +201,7 @@ if (NOT WIN32) else() set(OGRE2_LIBRARIES ${OGRE2_LIBRARY}) endif() - set(IGN_PKG_NAME "OGRE") + set(GZ_PKG_NAME "OGRE") break() endif() endif() @@ -209,17 +209,17 @@ if (NOT WIN32) endif() if (NOT OGRE2_FOUND) - message(STATUS " ! ${IGN_OGRE2_PROJECT_NAME} not found") + message(STATUS " ! ${GZ_OGRE2_PROJECT_NAME} not found") continue() endif() # use pkg-config to find ogre plugin path # do it here before resetting the pkg-config paths - execute_process(COMMAND pkg-config --variable=plugindir ${IGN_PKG_NAME} + execute_process(COMMAND pkg-config --variable=plugindir ${GZ_PKG_NAME} OUTPUT_VARIABLE _pkgconfig_invoke_result RESULT_VARIABLE _pkgconfig_failed) if(_pkgconfig_failed) - IGN_BUILD_WARNING ("Failed to find OGRE's plugin directory. The build will succeed, but there will likely be run-time errors.") + GZ_BUILD_WARNING ("Failed to find OGRE's plugin directory. The build will succeed, but there will likely be run-time errors.") else() fix_pkgconfig_prefix_jammy_bug("${_pkgconfig_invoke_result}" OGRE2_PLUGINDIR) endif() @@ -227,7 +227,7 @@ if (NOT WIN32) # reset pkg config path set(ENV{PKG_CONFIG_PATH} ${PKG_CONFIG_PATH_ORIGINAL}) - set(OGRE2_INCLUDE_DIRS ${${IGN_OGRE2_PROJECT_NAME}_INCLUDE_DIRS}) # sync possible OGRE-Next to OGRE2 + set(OGRE2_INCLUDE_DIRS ${${GZ_OGRE2_PROJECT_NAME}_INCLUDE_DIRS}) # sync possible OGRE-Next to OGRE2 # verify ogre header can be found in the include path find_path(OGRE2_INCLUDE @@ -245,7 +245,7 @@ if (NOT WIN32) # OGRE2_INCLUDE_DIRS so OGRE GL headers can be found foreach (dir ${OGRE2_INCLUDE_DIRS}) get_filename_component(dir_name "${dir}" NAME) - if ("${dir_name}" STREQUAL ${IGN_PKG_NAME}) + if ("${dir_name}" STREQUAL ${GZ_PKG_NAME}) set(dir_include "${dir}/RenderSystems/GL3Plus") else() set(dir_include "${dir}") @@ -262,7 +262,7 @@ if (NOT WIN32) # find ogre components include(IgnImportTarget) - foreach(component ${IgnOGRE2_FIND_COMPONENTS}) + foreach(component ${GzOGRE2_FIND_COMPONENTS}) find_library(OGRE2-${component} NAMES "${OGRE2LIBNAME}${component}_d.${OGRE2_VERSION}" @@ -273,12 +273,12 @@ if (NOT WIN32) if (NOT "${OGRE2-${component}}" STREQUAL "OGRE2-${component}-NOTFOUND") message(STATUS " + component ${component}: found") # create a new target for each component - set(component_TARGET_NAME "IgnOGRE2-${component}::IgnOGRE2-${component}") + set(component_TARGET_NAME "GzOGRE2-${component}::GzOGRE2-${component}") set(component_INCLUDE_DIRS ${OGRE2_INCLUDE_DIRS}) foreach (dir ${OGRE2_INCLUDE_DIRS}) get_filename_component(dir_name "${dir}" NAME) - if ("${dir_name}" STREQUAL ${IGN_PKG_NAME}) + if ("${dir_name}" STREQUAL ${GZ_PKG_NAME}) # 1. append the Hlms/Common include dir if it exists. string(FIND ${component} "Hlms" HLMS_POS) if(${HLMS_POS} GREATER -1) @@ -303,7 +303,7 @@ if (NOT WIN32) # add it to the list of ogre libraries list(APPEND OGRE2_LIBRARIES ${component_TARGET_NAME}) - elseif(IgnOGRE2_FIND_REQUIRED_${component}) + elseif(GzOGRE2_FIND_REQUIRED_${component}) message(STATUS " ! component ${component}: not found!") set(OGRE2_FOUND false) endif() @@ -314,7 +314,7 @@ if (NOT WIN32) if (OGRE2_FOUND) break() else() - message(STATUS " ! ${IGN_OGRE2_PROJECT_NAME} not found") + message(STATUS " ! ${GZ_OGRE2_PROJECT_NAME} not found") endif() endforeach() @@ -340,7 +340,7 @@ if (NOT WIN32) # We need to manually specify the pkgconfig entry (and type of entry), # because gz_pkg_check_modules does not work for it. include(IgnPkgConfig) - gz_pkg_config_library_entry(IgnOGRE2 OgreMain) + gz_pkg_config_library_entry(GzOGRE2 OgreMain) else() #WIN32 set(OGRE2_FOUND TRUE) @@ -350,7 +350,7 @@ else() #WIN32 set(OGRE2_VERSION_MINOR "") set(OGRE2_RESOURCE_PATH "") - set(OGRE2_SEARCH_VER "OGRE-${IgnOGRE2_FIND_VERSION_MAJOR}.${IgnOGRE2_FIND_VERSION_MINOR}") + set(OGRE2_SEARCH_VER "OGRE-${GzOGRE2_FIND_VERSION_MAJOR}.${GzOGRE2_FIND_VERSION_MINOR}") set(OGRE2_PATHS "") set(OGRE2_INC_PATHS "") foreach(_rootPath ${VCPKG_CMAKE_FIND_ROOT_PATH}) @@ -461,10 +461,10 @@ else() #WIN32 ogre_find_plugin(RenderSystem_GL3Plus OgreGL3PlusRenderSystem.h RenderSystems/GL3Plus/include) ogre_find_plugin(RenderSystem_Direct3D11 OgreD3D11RenderSystem.h RenderSystems/Direct3D11/include) - foreach(component ${IgnOGRE2_FIND_COMPONENTS}) + foreach(component ${GzOGRE2_FIND_COMPONENTS}) set(PREFIX OGRE2_${component}) if(${PREFIX}_FOUND) - set(component_TARGET_NAME "IgnOGRE2-${component}::IgnOGRE2-${component}") + set(component_TARGET_NAME "GzOGRE2-${component}::GzOGRE2-${component}") set(component_INCLUDE_DIRS ${${PREFIX}_INCLUDE_DIRS}) # append the Hlms/Common include dir if it exists. string(FIND ${component} "Hlms" HLMS_POS) @@ -500,13 +500,16 @@ else() #WIN32 endif() endif() -set(IgnOGRE2_FOUND false) +set(GzOGRE2_FOUND false) # create OGRE2 target if (OGRE2_FOUND) - set(IgnOGRE2_FOUND true) + set(GzOGRE2_FOUND true) - gz_import_target(IgnOGRE2 - TARGET_NAME IgnOGRE2::IgnOGRE2 + gz_import_target(GzOGRE2 + TARGET_NAME GzOGRE2::GzOGRE2 LIB_VAR OGRE2_LIBRARIES INCLUDE_VAR OGRE2_INCLUDE_DIRS) endif() + +set(IgnOGRE2_FOUND ${GzOGRE2_FOUND}) # TODO(CH3): Deprecated. Remove on tock. +set(IGN_PKG_NAME ${GZ_PKG_NAME}) # TODO(CH3): Deprecated. Remove on tock. diff --git a/cmake/FindGzProtobuf.cmake b/cmake/FindGzProtobuf.cmake index f367c8bb..ff89a873 100644 --- a/cmake/FindGzProtobuf.cmake +++ b/cmake/FindGzProtobuf.cmake @@ -24,18 +24,18 @@ # support shared library versions of Protobuf. include(IgnPkgConfig) -gz_pkg_config_entry(IgnProtobuf "protobuf >= ${IgnProtobuf_FIND_VERSION}") +gz_pkg_config_entry(GzProtobuf "protobuf >= ${GzProtobuf_FIND_VERSION}") -find_package(Protobuf ${IgnProtobuf_FIND_VERSION} QUIET CONFIG) +find_package(Protobuf ${GzProtobuf_FIND_VERSION} QUIET CONFIG) if(NOT ${Protobuf_FOUND}) # If a config-file was not found, then fall back on the system-installed # find-module that comes with CMake. - find_package(Protobuf ${IgnProtobuf_FIND_VERSION}) + find_package(Protobuf ${GzProtobuf_FIND_VERSION}) endif() -set(IgnProtobuf_missing_components "") -foreach(component ${IgnProtobuf_FIND_COMPONENTS}) +set(GzProtobuf_missing_components "") +foreach(component ${GzProtobuf_FIND_COMPONENTS}) # If specific components are requested, check that each one is accounted for. # If any component is missing, then we should not consider this package to be @@ -43,41 +43,42 @@ foreach(component ${IgnProtobuf_FIND_COMPONENTS}) # If a requested component is not required, then we can just skip this # iteration. We don't do anything special for optional components. - if(NOT IgnProtobuf_FIND_REQUIRED_${component}) + if(NOT GzProtobuf_FIND_REQUIRED_${component}) continue() endif() if((${component} STREQUAL "libprotobuf") OR (${component} STREQUAL "all")) if((NOT PROTOBUF_LIBRARY) AND (NOT TARGET protobuf::libprotobuf)) set(Protobuf_FOUND false) - gz_string_append(IgnProtobuf_missing_components "libprotobuf" DELIM " ") + gz_string_append(GzProtobuf_missing_components "libprotobuf" DELIM " ") endif() endif() if((${component} STREQUAL "libprotoc") OR (${component} STREQUAL "all")) if((NOT PROTOBUF_PROTOC_LIBRARY) AND (NOT TARGET protobuf::libprotoc)) set(Protobuf_FOUND false) - gz_string_append(IgnProtobuf_missing_components "libprotoc" DELIM " ") + gz_string_append(GzProtobuf_missing_components "libprotoc" DELIM " ") endif() endif() if((${component} STREQUAL "protoc") OR (${component} STREQUAL "all")) if((NOT PROTOBUF_PROTOC_EXECUTABLE) AND (NOT TARGET protobuf::protoc)) set(Protobuf_FOUND false) - gz_string_append(IgnProtobuf_missing_components "protoc" DELIM " ") + gz_string_append(GzProtobuf_missing_components "protoc" DELIM " ") endif() endif() endforeach() -if(IgnProtobuf_missing_components AND NOT IgnProtobuf_FIND_QUIETLY) - message(STATUS "Missing required protobuf components: ${IgnProtobuf_missing_components}") +if(GzProtobuf_missing_components AND NOT GzProtobuf_FIND_QUIETLY) + message(STATUS "Missing required protobuf components: ${GzProtobuf_missing_components}") endif() if(${Protobuf_FOUND}) - # If we have found Protobuf, then set the IgnProtobuf_FOUND flag to true so + # If we have found Protobuf, then set the GzProtobuf_FOUND flag to true so # that gz_find_package(~) knows that we were successful. - set(IgnProtobuf_FOUND true) + set(GzProtobuf_FOUND true) + set(IgnProtobuf_FOUND true) # TODO(CH3): Deprecated. Remove on tock. # Older versions of protobuf don't create imported targets, so we will create # them here if they have not been provided. diff --git a/cmake/FindGzURDFDOM.cmake b/cmake/FindGzURDFDOM.cmake index ac34008b..357b7bc5 100644 --- a/cmake/FindGzURDFDOM.cmake +++ b/cmake/FindGzURDFDOM.cmake @@ -18,19 +18,19 @@ # on urdfdom series from 1.x to 3.0.0 (at least) include(IgnPkgConfig) if(PKG_CONFIG_FOUND) - if (IgnURDFDOM_FIND_VERSION) - set(signature "urdfdom >= ${IgnURDFDOM_FIND_VERSION}") + if (GzURDFDOM_FIND_VERSION) + set(signature "urdfdom >= ${GzURDFDOM_FIND_VERSION}") else() set(signature "urdfdom") endif() - gz_pkg_check_modules(IgnURDFDOM "${signature}") + gz_pkg_check_modules(GzURDFDOM "${signature}") else() message(VERBOSE "Unable to find pkg-config in the system, fallback to use CMake") endif() -if(NOT IgnURDFDOM_FOUND) - if(IgnURDFDOM_FIND_VERSION) - set(find_version VERSION ${IgnURDFDOM_FIND_VERSION}) +if(NOT GzURDFDOM_FOUND) + if(GzURDFDOM_FIND_VERSION) + set(find_version VERSION ${GzURDFDOM_FIND_VERSION}) else() set(find_version "") endif() @@ -38,8 +38,8 @@ if(NOT IgnURDFDOM_FOUND) # NOTE: urdfdom cmake does not support version checking gz_find_package(urdfdom ${find_version} QUIET) if (urdfdom_FOUND) - add_library(IgnURDFDOM::IgnURDFDOM INTERFACE IMPORTED) - target_link_libraries(IgnURDFDOM::IgnURDFDOM + add_library(GzURDFDOM::GzURDFDOM INTERFACE IMPORTED) + target_link_libraries(GzURDFDOM::GzURDFDOM INTERFACE urdfdom::urdfdom_model urdfdom::urdfdom_world @@ -47,6 +47,8 @@ if(NOT IgnURDFDOM_FOUND) urdfdom::urdfdom_model_state ) include(FindPackageHandleStandardArgs) - find_package_handle_standard_args(IgnURDFDOM DEFAULT_MSG) + find_package_handle_standard_args(GzURDFDOM DEFAULT_MSG) endif() endif() + +set(IgnURDFDOM_FOUND ${GzURDFDOM_FOUND}) # TODO(CH3): Deprecated. Remove on tock. diff --git a/cmake/IgnImportTarget.cmake b/cmake/IgnImportTarget.cmake index 3ebe2a0e..581669cd 100644 --- a/cmake/IgnImportTarget.cmake +++ b/cmake/IgnImportTarget.cmake @@ -78,6 +78,10 @@ macro(gz_import_target package) set(target_name ${package}::${package}) endif() + if(${target_name} MATCHES "^Ign[^:]*::Ign") + message(DEPRECATION "Ign prefixed ${target_name} is deprecated (e.g. IgnOGRE::IgnOGRE)! Please use Gz prefix instead (e.g. GzOGRE::GzOGRE)") + endif() + if(NOT TARGET ${target_name}) #------------------------------------ @@ -101,9 +105,27 @@ macro(gz_import_target package) # against the variable package_LIBRARIES with the old-fashioned # target_link_libraries(mytarget ${package_LIBRARIES} if(NOT gz_import_target_INTERFACE) - add_library(${target_name} UNKNOWN IMPORTED) + # TODO(CH3): Remove Global upon deprecation. Remove it on hard-tock. + # It's needed to let the alias work! + add_library(${target_name} UNKNOWN IMPORTED GLOBAL) + + # TODO(CH3): Deprecated. Remove on tock. + if(${target_name} MATCHES "^Gz[^:]*::Gz") + string(REGEX REPLACE "^Gz" "Ign" alias_name ${target_name}) + string(REGEX REPLACE "::Gz" "::Ign" alias_name ${alias_name}) + add_library(${alias_name} ALIAS ${target_name}) + endif() else() - add_library(${target_name} INTERFACE IMPORTED) + # TODO(CH3): Remove Global upon deprecation. Remove it on hard-tock. + # It's needed to let the alias work! + add_library(${target_name} INTERFACE IMPORTED GLOBAL) + + # TODO(CH3): Deprecated. Remove on tock. + if(${target_name} MATCHES "^Gz[^:]*::Gz") + string(REGEX REPLACE "^Gz" "Ign" alias_name ${target_name}) + string(REGEX REPLACE "::Gz" "::Ign" alias_name ${alias_name}) + add_library(${alias_name} ALIAS ${target_name}) + endif() endif() # Do not bother with the IMPORTED_LOCATION or IMPORTED_IMPLIB variables if it diff --git a/cmake/IgnRonn2Man.cmake b/cmake/IgnRonn2Man.cmake index 358f28f9..29900aca 100644 --- a/cmake/IgnRonn2Man.cmake +++ b/cmake/IgnRonn2Man.cmake @@ -20,10 +20,10 @@ FIND_PROGRAM(GZIP gzip) IF (NOT RONN OR NOT GZIP) IF (NOT RONN) - IGN_BUILD_WARNING ("ronn not found, manpages won't be generated") + GZ_BUILD_WARNING ("ronn not found, manpages won't be generated") ENDIF(NOT RONN) IF (NOT GZIP) - IGN_BUILD_WARNING ("gzip not found, manpages won't be generated") + GZ_BUILD_WARNING ("gzip not found, manpages won't be generated") ENDIF(NOT GZIP) # empty macro MACRO(manpage MANFILE) diff --git a/cmake/IgnUtils.cmake b/cmake/IgnUtils.cmake index adf397f4..c0a02a9a 100644 --- a/cmake/IgnUtils.cmake +++ b/cmake/IgnUtils.cmake @@ -150,7 +150,8 @@ macro(ign_find_package PACKAGE_NAME) set(gz_find_package_skip_parsing true) gz_find_package(${PACKAGE_NAME}) endmacro() -macro(gz_find_package PACKAGE_NAME) +macro(gz_find_package PACKAGE_NAME_) + set(PACKAGE_NAME ${PACKAGE_NAME_}) # Allow for variable rebinds # Deprecated, remove skip parsing logic in version 4 if (NOT gz_find_package_skip_parsing) @@ -198,6 +199,40 @@ macro(gz_find_package PACKAGE_NAME) endif() + #------------------------------------ + # Call find_package with the provided arguments + + # TODO(CH3): Deprecated. Remove on tock. + if(${PACKAGE_NAME} MATCHES "^Ign") + + # Deliberately use QUIET since we expect Ign to fail + find_package(${${PACKAGE_NAME}_find_package_args} QUIET) + + if(NOT ${PACKAGE_NAME}_FOUND) + # Try Gz prepended version instead! + string(REGEX REPLACE "^Ign(ition)?" "Gz" PACKAGE_NAME_GZ ${PACKAGE_NAME}) + + set(${PACKAGE_NAME_GZ}_find_package_args ${${PACKAGE_NAME}_find_package_args}) + list(POP_FRONT ${PACKAGE_NAME_GZ}_find_package_args) + list(PREPEND ${PACKAGE_NAME_GZ}_find_package_args ${PACKAGE_NAME_GZ}) + + find_package(${${PACKAGE_NAME_GZ}_find_package_args}) + if(${PACKAGE_NAME_GZ}_FOUND) + + message(DEPRECATION "Ign prefixed package name [${PACKAGE_NAME}] is deprecated! Automatically using the Gz prefix instead: [${PACKAGE_NAME_GZ}]") + set(PACKAGE_NAME ${PACKAGE_NAME_GZ}) + + endif() + + endif() + else() + + # TODO(CH3): On removal of tock, unindent this and just have this line!! + find_package(${${PACKAGE_NAME}_find_package_args}) + + endif() + + #------------------------------------ # Figure out which name to print if(gz_find_package_PRETTY) @@ -207,10 +242,6 @@ macro(gz_find_package PACKAGE_NAME) endif() - #------------------------------------ - # Call find_package with the provided arguments - find_package(${${PACKAGE_NAME}_find_package_args}) - if(${PACKAGE_NAME}_FOUND) message(STATUS "Looking for ${${PACKAGE_NAME}_pretty} - found\n") diff --git a/examples/find_ogre2/README.md b/examples/find_ogre2/README.md index dbbc9090..183a9a02 100644 --- a/examples/find_ogre2/README.md +++ b/examples/find_ogre2/README.md @@ -14,10 +14,10 @@ cmake .. ### Expected output ``` --- Looking for IgnOGRE2 - found +-- Looking for GzOGRE2 - found -- OGRE2_FOUND: TRUE --- OGRE2_LIBRARIES: /usr/lib/x86_64-linux-gnu/OGRE-2.1/libOgreMain.soIgnOGRE2-HlmsPbs::IgnOGRE2-HlmsPbsIgnOGRE2-HlmsUnlit::IgnOGRE2-HlmsUnlitIgnOGRE2-Overlay::IgnOGRE2-Overlay +-- OGRE2_LIBRARIES: /usr/lib/x86_64-linux-gnu/OGRE-2.1/libOgreMain.s GzOGRE2-HlmsPbs: GzOGRE2-HlmsPb GzOGRE2-HlmsUnlit: GzOGRE2-HlmsUnli GzOGRE2-Overlay: GzOGRE2-Overlay -- OGRE2_INCLUDE_DIRS: /usr/include/OGRE-2.1/usr/include/OGRE-2.1/RenderSystems/GL3Plus -- OGRE2_VERSION: 2.1.0 -- OGRE2_VERSION_MAJOR: 2 @@ -39,10 +39,10 @@ cmake .. ``` --- Looking for IgnOGRE2 - found +-- Looking for GzOGRE2 - found -- OGRE2_FOUND: TRUE --- OGRE2_LIBRARIES: /usr/lib/x86_64-linux-gnu/OGRE-2.2/libOgreMain.soIgnOGRE2-HlmsPbs::IgnOGRE2-HlmsPbsIgnOGRE2-HlmsUnlit::IgnOGRE2-HlmsUnlitIgnOGRE2-Overlay::IgnOGRE2-Overlay +-- OGRE2_LIBRARIES: /usr/lib/x86_64-linux-gnu/OGRE-2.2/libOgreMain.s GzOGRE2-HlmsPbs: GzOGRE2-HlmsPb GzOGRE2-HlmsUnlit: GzOGRE2-HlmsUnli GzOGRE2-Overlay: GzOGRE2-Overlay -- OGRE2_INCLUDE_DIRS: /usr/include/OGRE-2.2/usr/include/OGRE-2.2/RenderSystems/GL3Plus -- OGRE2_VERSION: 2.2.6 -- OGRE2_VERSION_MAJOR: 2 @@ -50,4 +50,3 @@ cmake .. -- OGRE2_VERSION_PATCH: 6 -- OGRE2_RESOURCE_PATH: /usr/lib/x86_64-linux-gnu/OGRE-2.2/OGRE ``` -