Skip to content

Commit

Permalink
[ign -> gz] CMake functions (#65)
Browse files Browse the repository at this point in the history
Signed-off-by: Louise Poubel <[email protected]>
  • Loading branch information
chapulina authored Jun 17, 2022
1 parent cdd48b3 commit f950fed
Show file tree
Hide file tree
Showing 14 changed files with 29 additions and 29 deletions.
8 changes: 4 additions & 4 deletions BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ load(
"IGNITION_FEATURES",
"IGNITION_VISIBILITY",
"generate_include_header",
"ign_config_header",
"ign_export_header",
"gz_config_header",
"gz_export_header",
)

package(
Expand All @@ -24,15 +24,15 @@ PROJECT_MINOR = 0

PROJECT_PATCH = 0

ign_config_header(
gz_config_header(
name = "config",
src = "include/ignition/utils/config.hh.in",
cmakelists = ["CMakeLists.txt"],
project_name = PROJECT_NAME,
project_version = (PROJECT_MAJOR, PROJECT_MINOR, PROJECT_PATCH),
)

ign_export_header(
gz_export_header(
name = "include/ignition/utils/Export.hh",
export_base = "IGNITION_UTILS",
lib_name = "ignition-utils",
Expand Down
10 changes: 5 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ find_package(ignition-cmake3 REQUIRED)
# Configure the project
#============================================================================
set(c++standard 17)
ign_configure_project(
gz_configure_project(
REPLACE_IGNITION_INCLUDE_PATH gz/utils
VERSION_SUFFIX pre1)

Expand All @@ -35,26 +35,26 @@ option(
if(NOT IGN_UTILS_VENDOR_CLI11)
# PKGCONFIG_IGNORE can be removed once pkg-config support in CLI11 (see
# https://github.com/CLIUtils/CLI11/pull/523) is released
ign_find_package(CLI11 REQUIRED_BY cli PKGCONFIG_IGNORE)
gz_find_package(CLI11 REQUIRED_BY cli PKGCONFIG_IGNORE)
endif()

#============================================================================
# Configure the build
#============================================================================
ign_configure_build(QUIT_IF_BUILD_ERRORS
gz_configure_build(QUIT_IF_BUILD_ERRORS
COMPONENTS cli)

#============================================================================
# Create package information
#============================================================================
ign_create_packages()
gz_create_packages()

#============================================================================
# Configure documentation
#============================================================================
configure_file(${CMAKE_SOURCE_DIR}/api.md.in ${CMAKE_BINARY_DIR}/api.md)
configure_file(${CMAKE_SOURCE_DIR}/tutorials.md.in ${CMAKE_BINARY_DIR}/tutorials.md)

ign_create_docs(
gz_create_docs(
API_MAINPAGE_MD "${CMAKE_BINARY_DIR}/api.md"
TUTORIALS_MAINPAGE_MD "${CMAKE_BINARY_DIR}/tutorials.md")
2 changes: 1 addition & 1 deletion cli/include/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# to support the vendored and not vendored case, we need to manually call
# add_subdirectory of the correct directory, and
# target_include_directories(@tgt@ INTERFACE "$<BUILD_INTERFACE:@incl_dirs>")
# that for the usual include directories are handled by ign_add_component
# that for the usual include directories are handled by gz_add_component
if(IGN_UTILS_VENDOR_CLI11)
add_subdirectory(vendored-cli)
target_include_directories(${gz_utils_cli_target_name}
Expand Down
2 changes: 1 addition & 1 deletion cli/include/external-cli/gz/utils/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
ign_install_all_headers(COMPONENT cli)
gz_install_all_headers(COMPONENT cli)
2 changes: 1 addition & 1 deletion cli/include/gz/utils/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
ign_install_all_headers(COMPONENT cli)
gz_install_all_headers(COMPONENT cli)
2 changes: 1 addition & 1 deletion cli/include/vendored-cli/gz/utils/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
ign_install_all_headers(COMPONENT cli)
gz_install_all_headers(COMPONENT cli)
12 changes: 6 additions & 6 deletions cli/src/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
ign_add_component(
cli
INTERFACE
gz_add_component(
cli
INTERFACE
INDEPENDENT_FROM_PROJECT_LIB
GET_TARGET_NAME gz_utils_cli_target_name)

# Make sure that the name is visible also in cli/include/CMakeLists.txt
set(gz_utils_cli_target_name ${gz_utils_cli_target_name} PARENT_SCOPE)
if(NOT IGN_UTILS_VENDOR_CLI11)
target_link_libraries(${gz_utils_cli_target_name} INTERFACE CLI11::CLI11)
endif()
endif()

ign_get_libsources_and_unittests(sources gtest_sources)
ign_build_tests(TYPE UNIT
gz_get_libsources_and_unittests(sources gtest_sources)
gz_build_tests(TYPE UNIT
SOURCES ${gtest_sources}
LIB_DEPS
${gz_utils_cli_target_name}
Expand Down
2 changes: 1 addition & 1 deletion include/gz/utils/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
ign_install_all_headers()
gz_install_all_headers()
2 changes: 1 addition & 1 deletion include/gz/utils/utils.hh.in
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
// Automatically generated
#include <gz/utils/config.hh>
${ign_headers}
${gz_headers}
6 changes: 3 additions & 3 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ign_get_libsources_and_unittests(sources gtest_sources)
gz_get_libsources_and_unittests(sources gtest_sources)

ign_create_core_library(SOURCES ${sources} CXX_STANDARD ${c++standard})
ign_build_tests(TYPE UNIT SOURCES ${gtest_sources})
gz_create_core_library(SOURCES ${sources} CXX_STANDARD ${c++standard})
gz_build_tests(TYPE UNIT SOURCES ${gtest_sources})
4 changes: 2 additions & 2 deletions test/integration/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
set(TEST_TYPE "INTEGRATION")

ign_get_sources(tests)
gz_get_sources(tests)

# Test symbols having the right name on linux only
if (UNIX AND NOT APPLE)
Expand All @@ -9,6 +9,6 @@ if (UNIX AND NOT APPLE)
COMMAND bash ${CMAKE_CURRENT_BINARY_DIR}/all_symbols_have_version.bash $<TARGET_FILE:${PROJECT_LIBRARY_TARGET_NAME}>)
endif()

ign_build_tests(TYPE INTEGRATION SOURCES ${tests})
gz_build_tests(TYPE INTEGRATION SOURCES ${tests})

add_subdirectory(implptr)
2 changes: 1 addition & 1 deletion test/integration/implptr/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ target_compile_definitions(
-Dignition_utils${PROJECT_VERSION_MAJOR}_EXPORTS
)

ign_build_tests(TYPE INTEGRATION SOURCES ImplPtr_TEST.cc)
gz_build_tests(TYPE INTEGRATION SOURCES ImplPtr_TEST.cc)

target_link_libraries(INTEGRATION_ImplPtr_TEST
implptr_test_classes
Expand Down
2 changes: 1 addition & 1 deletion test/performance/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ set(tests

link_directories(${PROJECT_BINARY_DIR}/test)

ign_build_tests(TYPE PERFORMANCE SOURCES ${tests})
gz_build_tests(TYPE PERFORMANCE SOURCES ${tests})
2 changes: 1 addition & 1 deletion test/regression/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ set(tests

link_directories(${PROJECT_BINARY_DIR}/test)

ign_build_tests(TYPE REGRESSION SOURCES ${tests})
gz_build_tests(TYPE REGRESSION SOURCES ${tests})

0 comments on commit f950fed

Please sign in to comment.