From fbde7d7303851b3038a4f19577eac201e2cbb55c Mon Sep 17 00:00:00 2001 From: Louise Poubel Date: Fri, 17 Jun 2022 08:49:10 -0700 Subject: [PATCH] [ign -> gz] CMake functions (#322) Signed-off-by: Louise Poubel --- CMakeLists.txt | 26 ++++++++++++------------- conf/CMakeLists.txt | 4 ++-- conf/transport.yaml.in | 4 ++-- include/gz/transport/CMakeLists.txt | 2 +- log/include/gz/transport/CMakeLists.txt | 3 +-- log/src/CMakeLists.txt | 7 +++---- log/test/integration/CMakeLists.txt | 6 +++--- src/CMakeLists.txt | 6 +++--- src/cmd/CMakeLists.txt | 4 ++-- test/integration/CMakeLists.txt | 4 ++-- test/performance/CMakeLists.txt | 2 +- test/regression/CMakeLists.txt | 4 ++-- 12 files changed, 35 insertions(+), 37 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index e9d2dbbbd..6a2b9f163 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -15,7 +15,7 @@ set(IGN_CMAKE_VER ${ignition-cmake3_VERSION_MAJOR}) #============================================================================ # Configure the project #============================================================================ -ign_configure_project( +gz_configure_project( REPLACE_IGNITION_INCLUDE_PATH gz/transport VERSION_SUFFIX pre1) @@ -39,14 +39,14 @@ message(STATUS "\n\n-- ====== Finding Dependencies ======") #-------------------------------------- # Find Protobuf set(REQ_PROTOBUF_VER 3) -ign_find_package(IgnProtobuf +gz_find_package(IgnProtobuf VERSION ${REQ_PROTOBUF_VER} REQUIRED PRETTY Protobuf) #-------------------------------------- # Find ZeroMQ -ign_find_package(ZeroMQ VERSION 4 REQUIRED PRIVATE) +gz_find_package(ZeroMQ VERSION 4 REQUIRED PRIVATE) if (UNIX AND NOT APPLE) execute_process(COMMAND lsb_release -cs @@ -64,7 +64,7 @@ endif() #-------------------------------------- # Find cppzmq -ign_find_package(CPPZMQ REQUIRED PRIVATE +gz_find_package(CPPZMQ REQUIRED PRIVATE PKGCONFIG_IGNORE # NOTE: cppzmq does not seem to offer a pkg-config file PRETTY CppZMQ) @@ -73,22 +73,22 @@ ign_find_package(CPPZMQ REQUIRED PRIVATE if (MSVC) message (STATUS "UUID: Using Windows RPC UuidCreate function\n") else() - ign_find_package(UUID REQUIRED) + gz_find_package(UUID REQUIRED) endif() #-------------------------------------- # Find ignition-utils -ign_find_package(ignition-utils2 REQUIRED COMPONENTS cli) +gz_find_package(ignition-utils2 REQUIRED COMPONENTS cli) set(IGN_UTILS_VER ${ignition-utils2_VERSION_MAJOR}) #-------------------------------------- # Find ignition-msgs -ign_find_package(ignition-msgs9 REQUIRED) +gz_find_package(ignition-msgs9 REQUIRED) set(IGN_MSGS_VER ${ignition-msgs9_VERSION_MAJOR}) #-------------------------------------- # Find ifaddrs -ign_find_package(IFADDRS QUIET) +gz_find_package(IFADDRS QUIET) if (IFADDRS_FOUND) set (HAVE_IFADDRS ON CACHE BOOL "HAVE IFADDRS" FORCE) else () @@ -97,11 +97,11 @@ endif() #-------------------------------------- # Find ignition-tools -ign_find_package(ignition-tools2 QUIET) +gz_find_package(ignition-tools2 QUIET) #-------------------------------------- # Find SQLite3 -ign_find_package(SQLite3 +gz_find_package(SQLite3 VERSION 3.7.13 REQUIRED_BY log PRIVATE_FOR log @@ -111,7 +111,7 @@ ign_find_package(SQLite3 #============================================================================ # Configure the build #============================================================================ -ign_configure_build(QUIT_IF_BUILD_ERRORS +gz_configure_build(QUIT_IF_BUILD_ERRORS COMPONENTS log) #============================================================================ @@ -122,7 +122,7 @@ add_subdirectory(conf) #============================================================================ # Create package information #============================================================================ -ign_create_packages() +gz_create_packages() #============================================================================ # Configure documentation @@ -130,6 +130,6 @@ ign_create_packages() 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") diff --git a/conf/CMakeLists.txt b/conf/CMakeLists.txt index 9403b6dcf..8ebc6220d 100644 --- a/conf/CMakeLists.txt +++ b/conf/CMakeLists.txt @@ -1,5 +1,5 @@ # Used only for internal testing. -set(ign_library_path "${CMAKE_BINARY_DIR}/test/lib/$/ruby/ignition/cmd${IGN_DESIGNATION}${PROJECT_VERSION_MAJOR}") +set(gz_library_path "${CMAKE_BINARY_DIR}/test/lib/$/ruby/ignition/cmd${IGN_DESIGNATION}${PROJECT_VERSION_MAJOR}") # Generate a configuration file for internal testing. # Note that the major version of the library is included in the name. @@ -13,7 +13,7 @@ file(GENERATE INPUT "${CMAKE_CURRENT_BINARY_DIR}/${IGN_DESIGNATION}${PROJECT_VERSION_MAJOR}.yaml.configured") # Used for the installed version. -set(ign_library_path "${CMAKE_INSTALL_PREFIX}/lib/ruby/ignition/cmd${IGN_DESIGNATION}${PROJECT_VERSION_MAJOR}") +set(gz_library_path "${CMAKE_INSTALL_PREFIX}/lib/ruby/ignition/cmd${IGN_DESIGNATION}${PROJECT_VERSION_MAJOR}") # Generate the configuration file that is installed. # Note that the major version of the library is included in the name. diff --git a/conf/transport.yaml.in b/conf/transport.yaml.in index 4772aedeb..173b5cb7c 100644 --- a/conf/transport.yaml.in +++ b/conf/transport.yaml.in @@ -2,8 +2,8 @@ format: 1.0.0 library_name: @PROJECT_NAME_NO_VERSION@ library_version: @PROJECT_VERSION_FULL@ -library_path: @ign_library_path@ +library_path: @gz_library_path@ commands: - topic : Print information about topics. - service : Print information about services. ---- \ No newline at end of file +--- diff --git a/include/gz/transport/CMakeLists.txt b/include/gz/transport/CMakeLists.txt index ce4971051..2a5d4fc9f 100644 --- a/include/gz/transport/CMakeLists.txt +++ b/include/gz/transport/CMakeLists.txt @@ -2,5 +2,5 @@ # detail/* header files from being included in transport.hh. A side effect is # that the detail headers are not installed. The next install line solves this # problem. -ign_install_all_headers(EXCLUDE_DIRS detail) +gz_install_all_headers(EXCLUDE_DIRS detail) install(DIRECTORY detail DESTINATION ${IGN_INCLUDE_INSTALL_DIR_FULL}/gz/${IGN_DESIGNATION}) diff --git a/log/include/gz/transport/CMakeLists.txt b/log/include/gz/transport/CMakeLists.txt index 81a5f79c2..8733f2d34 100644 --- a/log/include/gz/transport/CMakeLists.txt +++ b/log/include/gz/transport/CMakeLists.txt @@ -1,2 +1 @@ - -ign_install_all_headers(COMPONENT log) +gz_install_all_headers(COMPONENT log) diff --git a/log/src/CMakeLists.txt b/log/src/CMakeLists.txt index 14b2a1564..27d325e0d 100644 --- a/log/src/CMakeLists.txt +++ b/log/src/CMakeLists.txt @@ -1,8 +1,7 @@ - -ign_get_libsources_and_unittests(sources gtest_sources) +gz_get_libsources_and_unittests(sources gtest_sources) list(APPEND sources cmd/LogCommandAPI.cc) -ign_add_component(log SOURCES ${sources} GET_TARGET_NAME log_lib_target) +gz_add_component(log SOURCES ${sources} GET_TARGET_NAME log_lib_target) target_link_libraries(${log_lib_target} PRIVATE SQLite3::SQLite3) @@ -17,7 +16,7 @@ if (MSVC) endif() # Unit tests -ign_build_tests( +gz_build_tests( TYPE "UNIT" SOURCES ${gtest_sources} LIB_DEPS ${log_lib_target} ${EXTRA_TEST_LIB_DEPS} diff --git a/log/test/integration/CMakeLists.txt b/log/test/integration/CMakeLists.txt index 5b813844c..aff166310 100644 --- a/log/test/integration/CMakeLists.txt +++ b/log/test/integration/CMakeLists.txt @@ -1,6 +1,6 @@ # Integration tests -ign_build_tests( +gz_build_tests( TYPE "INTEGRATION" TEST_LIST logging_tests SOURCES @@ -39,10 +39,10 @@ foreach(source_file ${aux}) string(REGEX REPLACE ".cc" "" AUX_EXECUTABLE ${source_file}) set(BINARY_NAME ${TEST_TYPE}_${AUX_EXECUTABLE}) - ign_add_executable(${BINARY_NAME} ${AUX_EXECUTABLE}.cc) + gz_add_executable(${BINARY_NAME} ${AUX_EXECUTABLE}.cc) # Include the interface directories that we always need. - ign_target_interface_include_directories(${BINARY_NAME} + gz_target_interface_include_directories(${BINARY_NAME} ${PROJECT_LIBRARY_TARGET_NAME}) # Link the libraries that we always need. diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 5d40e570a..a46a1eb36 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,6 +1,6 @@ # Collect source files into the "sources" variable and unit test files into the # "gtest_sources" variable. -ign_get_libsources_and_unittests(sources gtest_sources) +gz_get_libsources_and_unittests(sources gtest_sources) if (MSVC) # Warning #4251 is the "dll-interface" warning that tells you when types used @@ -12,7 +12,7 @@ if (MSVC) endif() # Create the library target. -ign_create_core_library(SOURCES ${sources} CXX_STANDARD 17) +gz_create_core_library(SOURCES ${sources} CXX_STANDARD 17) # Link the libraries that we always need. target_link_libraries(${PROJECT_LIBRARY_TARGET_NAME} @@ -33,7 +33,7 @@ if (NOT MSVC) endif() # Build the unit tests. -ign_build_tests(TYPE UNIT SOURCES ${gtest_sources} +gz_build_tests(TYPE UNIT SOURCES ${gtest_sources} TEST_LIST test_list LIB_DEPS ${EXTRA_TEST_LIB_DEPS}) diff --git a/src/cmd/CMakeLists.txt b/src/cmd/CMakeLists.txt index d44370a1a..78dfea7e0 100644 --- a/src/cmd/CMakeLists.txt +++ b/src/cmd/CMakeLists.txt @@ -1,6 +1,6 @@ # Collect source files into the "sources" variable and unit test files into the # "gtest_sources" variable. -ign_get_libsources_and_unittests(sources gtest_sources) +gz_get_libsources_and_unittests(sources gtest_sources) # Skip command line tests for Windows, see # https://github.com/gazebosim/gz-transport/issues/104 @@ -35,7 +35,7 @@ target_link_libraries(${service_executable} install(TARGETS ${service_executable} DESTINATION ${IGN_LIB_INSTALL_DIR}/ignition/${IGN_DESIGNATION}${PROJECT_VERSION_MAJOR}/) # Build the unit tests. -ign_build_tests(TYPE UNIT SOURCES ${gtest_sources} +gz_build_tests(TYPE UNIT SOURCES ${gtest_sources} TEST_LIST test_list LIB_DEPS ${EXTRA_TEST_LIB_DEPS}) diff --git a/test/integration/CMakeLists.txt b/test/integration/CMakeLists.txt index 5ef46dbfa..f64facb80 100644 --- a/test/integration/CMakeLists.txt +++ b/test/integration/CMakeLists.txt @@ -23,7 +23,7 @@ if (UNIX AND NOT APPLE) COMMAND bash ${CMAKE_CURRENT_BINARY_DIR}/all_symbols_have_version.bash $) endif() -ign_build_tests(TYPE INTEGRATION SOURCES ${tests} +gz_build_tests(TYPE INTEGRATION SOURCES ${tests} TEST_LIST test_list LIB_DEPS ${EXTRA_TEST_LIB_DEPS}) @@ -55,7 +55,7 @@ set(auxiliary_files # Build the auxiliary files. foreach(AUX_EXECUTABLE ${auxiliary_files}) - ign_add_executable(INTEGRATION_${AUX_EXECUTABLE} ${AUX_EXECUTABLE}.cc) + gz_add_executable(INTEGRATION_${AUX_EXECUTABLE} ${AUX_EXECUTABLE}.cc) # Link the libraries that we always need. target_link_libraries(INTEGRATION_${AUX_EXECUTABLE} diff --git a/test/performance/CMakeLists.txt b/test/performance/CMakeLists.txt index 39898c35f..a516984ad 100644 --- a/test/performance/CMakeLists.txt +++ b/test/performance/CMakeLists.txt @@ -3,4 +3,4 @@ set(TEST_TYPE "PERFORMANCE") set(tests ) -ign_build_tests(TYPE PERFORMANCE SOURCES ${tests}) +gz_build_tests(TYPE PERFORMANCE SOURCES ${tests}) diff --git a/test/regression/CMakeLists.txt b/test/regression/CMakeLists.txt index d0b09da6b..4657b4ad6 100644 --- a/test/regression/CMakeLists.txt +++ b/test/regression/CMakeLists.txt @@ -1,6 +1,6 @@ set(TEST_TYPE "REGRESSION") -ign_get_sources(tests) +gz_get_sources(tests) -ign_build_tests(TYPE REGRESSION SOURCES ${tests} +gz_build_tests(TYPE REGRESSION SOURCES ${tests} LIB_DEPS ${EXTRA_TEST_LIB_DEPS})