Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deprecate public ign functions in favor of gz #250

Merged
merged 23 commits into from
Jun 16, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 20 additions & 20 deletions MigrationFromClassic.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,14 +63,14 @@ Any operations that might need to be performed while searching for a package
should be done in a find-module. See the section on anti-patterns for more
information on writing find-modules.

### Then call `ign_configure_build(~)`
### Then call `gz_configure_build(~)`

This macro accepts the argument `QUIT_IF_BUILD_ERRORS` which you should pass to
it to get the standard behavior for the ignition projects. If for some reason
you want to handle build errors in your own way, you can leave that argument
out and then do as you please after the macro finishes.

### Finally, call `ign_create_packages()`
### Finally, call `gz_create_packages()`

After this, your top-level `CMakeLists.txt` is finished. The remaining changes
listed below must be applied throughout your directory tree.
Expand Down Expand Up @@ -108,10 +108,10 @@ should not be using the CMake cache except to allow human users to set build
options. For more explanation about why and how we should avoid using the cache,
see the below section on CMake anti-patterns.

### Replace `ign_add_library(${PROJECT_LIBRARY_TARGET_NAME} ${sources})` with `ign_create_core_library(SOURCES ${sources})`
### Replace `gz_add_library(${PROJECT_LIBRARY_TARGET_NAME} ${sources})` with `gz_create_core_library(SOURCES ${sources})`

The `ign_add_library(~)` macro has been removed and replaced with the macro
`ign_create_core_library(~)`. With this new macro, you no longer need to specify
The `gz_add_library(~)` macro has been removed and replaced with the macro
`gz_create_core_library(~)`. With this new macro, you no longer need to specify
the library name, because it will be inferred from your project information.
Instead, you should pass the `SOURCES` argument, followed by the source files
which will be used to generate your library.
Expand All @@ -121,17 +121,17 @@ library requires (current options are 11 or 14). Note that if your library
requires a certain standard, it MUST be specified directly to this function in
order to ensure that the requirement gets correctly propagated into the
project's package information so that dependent libraries will also be aware of
the requirement. See the documentation of `ign_create_core_library(~)` in
the requirement. See the documentation of `gz_create_core_library(~)` in
`ign-cmake/cmake/IgnUtils.cmake` for more details on how to specify your
library's C++ standard requirement.

### Specify `TYPE` and `SOURCES` arguments in `ign_build_tests(~)`
### Specify `TYPE` and `SOURCES` arguments in `gz_build_tests(~)`

Previously, ignition libraries would set a `TEST_TYPE` variable before calling
`ign_build_tests(~)`, and that variable would be used by the macro to determine
`gz_build_tests(~)`, and that variable would be used by the macro to determine
the type of tests it should create. This resulted in some anti-patterns where
the `TEST_TYPE` variable would be set somewhere far away from the call to
`ign_build_tests(~)`, making it unclear to a human reader what type of tests the
`gz_build_tests(~)`, making it unclear to a human reader what type of tests the
call would produce. Instead, we now explicitly specify the test type using the
`TYPE` tag when calling the macro, and to avoid confusion with backwards
compatibility, the `SOURCES` tag must be used before specifying sources. We are
Expand All @@ -148,7 +148,7 @@ will make `LIB_DEPS` unnecessary, but it is still provided for edge cases.
Note that when individual tests depend on additional libraries, those individual
tests should be linked to their dependencies using
`target_link_libraries(<test_name> <dependency>)` after the call to
`ign_build_tests(~)`. `LIB_DEPS` should only be used for dependencies that are
`gz_build_tests(~)`. `LIB_DEPS` should only be used for dependencies that are
needed by (nearly) all of the tests. For component libraries, you can use
`LIB_DEPS` to have the tests link to your component library.

Expand Down Expand Up @@ -192,7 +192,7 @@ to.

Note that you must also specify which targets' interface include directories
will be needed by libraries which depend on your project's library. This should
be done using `ign_target_interface_include_directories(<project_target> <dependency_targets>)`.
be done using `gz_target_interface_include_directories(<project_target> <dependency_targets>)`.
That function will add the interface include directories of the dependency
targets that you pass in to the interface include directory list of
`<project_target>` in a way which is relocatable by using generator expressions.
Expand All @@ -218,9 +218,9 @@ find-module, the macro `gz_import_target(~)` should be used generate an
imported target which follows this convention. More about creating find-modules
can be found in the section on anti-patterns.

### Remove ign_install_library()
### Remove gz_install_library()

Calling `ign_create_core_library()` will also take care of installing the
Calling `gz_create_core_library()` will also take care of installing the
library. Simply remove this function from your cmake script.

### Replace calls to `#include "ignition/<project>/System.hh"` with `#include "ignition/<project>/Export.hh"`, and delete the file `System.hh`.
Expand Down Expand Up @@ -261,7 +261,7 @@ that are not already present in `ign-cmake`, then you should add those
features to `ign-cmake` and submit a pull request. I will try to be very prompt
about reviewing and approving those PRs.

### To add a component library, use `ign_add_component(<component> SOURCES ${sources})`
### To add a component library, use `gz_add_component(<component> SOURCES ${sources})`

This new function allows you to create a "component" library which will be
compiled separately from your core library. It will be packaged as a cmake
Expand Down Expand Up @@ -290,7 +290,7 @@ auto-generated name of the target. You can then use the target with
The following changes are not necessary, but may improve the readability and
maintainability of your CMake code. Use of these utilities is optional.

### GLOB up library source files and unit test source files using `ign_get_libsources_and_unittests(sources tests)`
### GLOB up library source files and unit test source files using `gz_get_libsources_and_unittests(sources tests)`

Placing this in `src/CMakeLists.txt` will collect all the source files in the
directory and sort them into a `source` variable (containing the library sources)
Expand All @@ -303,7 +303,7 @@ approach can be used to conditionally remove files from a list (see
want a file to be excluded, you can change its extension (e.g. `*.cc.backup` or
`.cc.old`) until a later time when you want it to be used again.

### Use `ign_install_all_headers(~)` in `include/ignition/<project>/CMakeLists.txt`
### Use `gz_install_all_headers(~)` in `include/ignition/<project>/CMakeLists.txt`

Using this macro will install all files ending in `*.h` and `*.hh` in the
current source directory recursively (so all the files in all subdirectories as
Expand All @@ -315,10 +315,10 @@ installed. The argument `EXCLUDE_DIRS` lets you specify subdirectories to not
install. Note that the files or directories must be specified relative to the
current directory.

### Use `ign_get_sources(~)` in `test/<type>/CMakeLists.txt` to collect source files
### Use `gz_get_sources(~)` in `test/<type>/CMakeLists.txt` to collect source files

Similar to `ign_get_libsources_and_unittests(~)` except it only produces one
list of source files, which is sufficient to be passed to `ign_build_tests(~)`.
Similar to `gz_get_libsources_and_unittests(~)` except it only produces one
list of source files, which is sufficient to be passed to `gz_build_tests(~)`.



Expand Down Expand Up @@ -378,7 +378,7 @@ writing a good quality find-module.
In many cases, a package that we depend on will be distributed with a pkgconfig
(`*.pc`) file. In such a case, `ignition-cmake` provides a macro that can easily
find the package and create an imported target for it. Simply use `include(IgnPkgConfig)`
and then `ign_pkg_check_modules(~)` in your find-module, and you are done. An
and then `gz_pkg_check_modules(~)` in your find-module, and you are done. An
example of a simple case of this can be found in `ign-cmake/cmake/FindGTS.cmake`.

If certain version-based behavior is needed, that must be handled within the
Expand Down
2 changes: 1 addition & 1 deletion cmake/FindAVCODEC.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
########################################
# Find avcodec
include(IgnPkgConfig)
ign_pkg_check_modules_quiet(AVCODEC libavcodec)
gz_pkg_check_modules_quiet(AVCODEC libavcodec)

if(NOT AVCODEC_FOUND)
include(IgnManualSearch)
Expand Down
2 changes: 1 addition & 1 deletion cmake/FindAVDEVICE.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ set(av_minor ${AVDEVICE_FIND_VERSION_MINOR})
set(av_patch ${AVDEVICE_FIND_VERSION_PATCH})

include(IgnPkgConfig)
ign_pkg_check_modules_quiet(AVDEVICE "libavdevice >= ${av_major}.${av_minor}.${av_patch}")
gz_pkg_check_modules_quiet(AVDEVICE "libavdevice >= ${av_major}.${av_minor}.${av_patch}")

if(NOT AVDEVICE_FOUND)
include(IgnManualSearch)
Expand Down
2 changes: 1 addition & 1 deletion cmake/FindAVFORMAT.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
########################################
# Find AV format
include(IgnPkgConfig)
ign_pkg_check_modules_quiet(AVFORMAT libavformat)
gz_pkg_check_modules_quiet(AVFORMAT libavformat)

if(NOT AVFORMAT_FOUND)
include(IgnManualSearch)
Expand Down
2 changes: 1 addition & 1 deletion cmake/FindAVUTIL.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
########################################
# Find avutil
include(IgnPkgConfig)
ign_pkg_check_modules_quiet(AVUTIL libavutil)
gz_pkg_check_modules_quiet(AVUTIL libavutil)

if(NOT AVUTIL_FOUND)
include(IgnManualSearch)
Expand Down
4 changes: 2 additions & 2 deletions cmake/FindDL.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,9 @@ else()
endif()

# We need to manually specify the pkgconfig entry (and type of entry) for dl,
# because ign_pkg_check_modules does not work for it.
# because gz_pkg_check_modules does not work for it.
include(IgnPkgConfig)
ign_pkg_config_library_entry(DL dl)
gz_pkg_config_library_entry(DL dl)

include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(
Expand Down
8 changes: 4 additions & 4 deletions cmake/FindEIGEN3.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -36,21 +36,21 @@ if(EIGEN3_FOUND)
TARGET_NAME Eigen3::Eigen)

if(EIGEN3_FIND_VERSION)
ign_pkg_config_entry(EIGEN3 "eigen3 >= ${EIGEN3_FIND_VERSION}")
gz_pkg_config_entry(EIGEN3 "eigen3 >= ${EIGEN3_FIND_VERSION}")
else()
ign_pkg_config_entry(EIGEN3 "eigen3")
gz_pkg_config_entry(EIGEN3 "eigen3")
endif()

return()

endif()

if(EIGEN3_FIND_VERSION)
ign_pkg_check_modules_quiet(EIGEN3 "eigen3 >= ${EIGEN3_FIND_VERSION}"
gz_pkg_check_modules_quiet(EIGEN3 "eigen3 >= ${EIGEN3_FIND_VERSION}"
INTERFACE
TARGET_NAME Eigen3::Eigen)
else()
ign_pkg_check_modules_quiet(EIGEN3 "eigen3"
gz_pkg_check_modules_quiet(EIGEN3 "eigen3"
INTERFACE
TARGET_NAME Eigen3::Eigen)
endif()
Expand Down
4 changes: 2 additions & 2 deletions cmake/FindFreeImage.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ set(full_version ${major_version}.${minor_version})

if (NOT WIN32)
include(IgnPkgConfig)
ign_pkg_config_library_entry(FreeImage freeimage)
gz_pkg_config_library_entry(FreeImage freeimage)

# If we don't have PkgConfig, or if PkgConfig failed, then do a manual search
if(NOT FreeImage_FOUND)
Expand Down Expand Up @@ -141,7 +141,7 @@ else()

if (FreeImage_FOUND)
include(IgnPkgConfig)
ign_pkg_config_library_entry(FreeImage "FreeImage")
gz_pkg_config_library_entry(FreeImage "FreeImage")
include(IgnImportTarget)
gz_import_target(FreeImage)
endif()
Expand Down
6 changes: 3 additions & 3 deletions cmake/FindGTS.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
if (NOT WIN32)
# Configuration using pkg-config modules
include(IgnPkgConfig)
ign_pkg_check_modules(GTS gts)
gz_pkg_check_modules(GTS gts)
else()
# true by default, change to false when a failure appears
set(GTS_FOUND true)
Expand Down Expand Up @@ -91,9 +91,9 @@ else()

if (GTS_FOUND)
# We need to manually specify the pkgconfig entry (and type of entry),
# because ign_pkg_check_modules does not work for it.
# because gz_pkg_check_modules does not work for it.
include(IgnPkgConfig)
ign_pkg_config_library_entry(GTS gts)
gz_pkg_config_library_entry(GTS gts)
include(IgnImportTarget)
gz_import_target(GTS)
endif()
Expand Down
2 changes: 1 addition & 1 deletion cmake/FindIgnCURL.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,6 @@ if(${IgnCURL_FOUND})
endif()

include(IgnPkgConfig)
ign_pkg_config_entry(IgnCURL "libcurl >= ${IgnCURL_FIND_VERSION}")
gz_pkg_config_entry(IgnCURL "libcurl >= ${IgnCURL_FIND_VERSION}")

endif()
6 changes: 3 additions & 3 deletions cmake/FindIgnOGRE.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ if (NOT WIN32)
set(OGRE_LIBRARY_DIRS "")
set(OGRE_LIBRARIES "")
set(ENV{PKG_CONFIG_PATH} ${pkg_path})
ign_pkg_check_modules_quiet(OGRE "OGRE >= ${full_version}"
gz_pkg_check_modules_quiet(OGRE "OGRE >= ${full_version}"
NO_CMAKE_ENVIRONMENT_PATH
QUIET)
if (OGRE_FOUND)
Expand Down Expand Up @@ -140,7 +140,7 @@ if (NOT WIN32)

# find ogre components
foreach(component ${IgnOGRE_FIND_COMPONENTS})
ign_pkg_check_modules_quiet(IgnOGRE-${component} "OGRE-${component} >= ${full_version}" NO_CMAKE_ENVIRONMENT_PATH)
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})
Expand All @@ -158,7 +158,7 @@ if (NOT WIN32)
set(OGRE_PLUGINDIR ${_pkgconfig_invoke_result})
endif()

ign_pkg_config_library_entry(IgnOGRE OgreMain)
gz_pkg_config_library_entry(IgnOGRE OgreMain)

set(OGRE_RESOURCE_PATH ${OGRE_PLUGINDIR})
# Seems that OGRE_PLUGINDIR can end in a newline, which will cause problems
Expand Down
6 changes: 3 additions & 3 deletions cmake/FindIgnOGRE2.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ 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
ign_pkg_check_modules_quiet(${IGN_OGRE2_PROJECT_NAME} ${OGRE2_INSTALL_PATH} NO_CMAKE_ENVIRONMENT_PATH QUIET)
gz_pkg_check_modules_quiet(${IGN_OGRE2_PROJECT_NAME} ${OGRE2_INSTALL_PATH} NO_CMAKE_ENVIRONMENT_PATH QUIET)

if (${IGN_OGRE2_PROJECT_NAME}_FOUND)
set(IGN_PKG_NAME ${OGRE2_INSTALL_PATH})
Expand Down Expand Up @@ -338,9 +338,9 @@ if (NOT WIN32)
fix_pkgconfig_resource_path_jammy_bug("${OGRE2_RESOURCE_PATH}" OGRE2_RESOURCE_PATH)

# We need to manually specify the pkgconfig entry (and type of entry),
# because ign_pkg_check_modules does not work for it.
# because gz_pkg_check_modules does not work for it.
include(IgnPkgConfig)
ign_pkg_config_library_entry(IgnOGRE2 OgreMain)
gz_pkg_config_library_entry(IgnOGRE2 OgreMain)
else() #WIN32

set(OGRE2_FOUND TRUE)
Expand Down
2 changes: 1 addition & 1 deletion cmake/FindIgnProtobuf.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
# support shared library versions of Protobuf.

include(IgnPkgConfig)
ign_pkg_config_entry(IgnProtobuf "protobuf >= ${IgnProtobuf_FIND_VERSION}")
gz_pkg_config_entry(IgnProtobuf "protobuf >= ${IgnProtobuf_FIND_VERSION}")

find_package(Protobuf ${IgnProtobuf_FIND_VERSION} QUIET CONFIG)

Expand Down
2 changes: 1 addition & 1 deletion cmake/FindIgnURDFDOM.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ if(PKG_CONFIG_FOUND)
else()
set(signature "urdfdom")
endif()
ign_pkg_check_modules(IgnURDFDOM "${signature}")
gz_pkg_check_modules(IgnURDFDOM "${signature}")
else()
message(VERBOSE "Unable to find pkg-config in the system, fallback to use CMake")
endif()
Expand Down
4 changes: 2 additions & 2 deletions cmake/FindJSONCPP.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@ else()
include(IgnPkgConfig)

if(JSONCPP_FOUND)
ign_pkg_config_entry(JSONCPP jsoncpp)
gz_pkg_config_entry(JSONCPP jsoncpp)
else()
ign_pkg_check_modules_quiet(JSONCPP jsoncpp)
gz_pkg_check_modules_quiet(JSONCPP jsoncpp)
set(JSONCPP_TARGET JSONCPP::JSONCPP)

# If that failed, then fall back to manual detection.
Expand Down
2 changes: 1 addition & 1 deletion cmake/FindOptiX.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -234,5 +234,5 @@ find_package_handle_standard_args(
REQUIRED_VARS OptiX_FOUND)

include(IgnPkgConfig)
ign_pkg_config_library_entry(OptiX OptiX)
gz_pkg_config_library_entry(OptiX OptiX)

4 changes: 2 additions & 2 deletions cmake/FindSQLite3.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@
# SQLite3_FOUND System has sqlite3 library and headers

if(SQLite3_FIND_VERSION)
ign_pkg_check_modules_quiet(SQLite3 "sqlite3 >= ${SQLite3_FIND_VERSION}")
gz_pkg_check_modules_quiet(SQLite3 "sqlite3 >= ${SQLite3_FIND_VERSION}")
else()
ign_pkg_check_modules_quiet(SQLite3 "sqlite")
gz_pkg_check_modules_quiet(SQLite3 "sqlite")
endif()

if(MSVC)
Expand Down
2 changes: 1 addition & 1 deletion cmake/FindSWSCALE.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
########################################
# Find libswscale format
include(IgnPkgConfig)
ign_pkg_check_modules_quiet(SWSCALE libswscale)
gz_pkg_check_modules_quiet(SWSCALE libswscale)

if(NOT SWSCALE_FOUND)
include(IgnManualSearch)
Expand Down
2 changes: 1 addition & 1 deletion cmake/FindTINYXML2.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
include(IgnPkgConfig)

# Use pkg_check_modules to start
ign_pkg_check_modules_quiet(TINYXML2 tinyxml2)
gz_pkg_check_modules_quiet(TINYXML2 tinyxml2)

# If that failed, then fall back to manual detection (necessary for MacOS)
if(NOT TINYXML2_FOUND)
Expand Down
2 changes: 1 addition & 1 deletion cmake/FindUUID.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
if (UNIX)
if(NOT APPLE)
include(IgnPkgConfig)
ign_pkg_check_modules_quiet(UUID uuid)
gz_pkg_check_modules_quiet(UUID uuid)

if(NOT UUID_FOUND)
include(IgnManualSearch)
Expand Down
2 changes: 1 addition & 1 deletion cmake/FindYAML.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ if(YAML_FIND_VERSION AND NOT YAML_FIND_VERSION VERSION_EQUAL "0.1")
"but you requested version ${YAML_FIND_VERSION}.")
else()
include(IgnPkgConfig)
ign_pkg_check_modules_quiet(YAML yaml-0.1)
gz_pkg_check_modules_quiet(YAML yaml-0.1)

# If that failed, then fall back to manual detection.
if(NOT YAML_FOUND)
Expand Down
2 changes: 1 addition & 1 deletion cmake/FindZIP.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
# ZIP_LIBRARIES The ZIP libraries

include(IgnPkgConfig)
ign_pkg_check_modules_quiet(ZIP libzip)
gz_pkg_check_modules_quiet(ZIP libzip)

# If that failed, then fall back to manual detection.
if(NOT ZIP_FOUND)
Expand Down
Loading