Skip to content

Commit

Permalink
[ign -> gz] CMake functions (#322)
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 1f207ca commit fbde7d7
Show file tree
Hide file tree
Showing 12 changed files with 35 additions and 37 deletions.
26 changes: 13 additions & 13 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand All @@ -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
Expand All @@ -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)

Expand All @@ -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 ()
Expand All @@ -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
Expand All @@ -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)

#============================================================================
Expand All @@ -122,14 +122,14 @@ add_subdirectory(conf)
#============================================================================
# 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")
4 changes: 2 additions & 2 deletions conf/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Used only for internal testing.
set(ign_library_path "${CMAKE_BINARY_DIR}/test/lib/$<CONFIG>/ruby/ignition/cmd${IGN_DESIGNATION}${PROJECT_VERSION_MAJOR}")
set(gz_library_path "${CMAKE_BINARY_DIR}/test/lib/$<CONFIG>/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.
Expand All @@ -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.
Expand Down
4 changes: 2 additions & 2 deletions conf/transport.yaml.in
Original file line number Diff line number Diff line change
Expand Up @@ -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.
---
---
2 changes: 1 addition & 1 deletion include/gz/transport/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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})
3 changes: 1 addition & 2 deletions log/include/gz/transport/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@

ign_install_all_headers(COMPONENT log)
gz_install_all_headers(COMPONENT log)
7 changes: 3 additions & 4 deletions log/src/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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)
Expand All @@ -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}
Expand Down
6 changes: 3 additions & 3 deletions log/test/integration/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Integration tests

ign_build_tests(
gz_build_tests(
TYPE "INTEGRATION"
TEST_LIST logging_tests
SOURCES
Expand Down Expand Up @@ -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.
Expand Down
6 changes: 3 additions & 3 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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}
Expand All @@ -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})

Expand Down
4 changes: 2 additions & 2 deletions src/cmd/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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})

Expand Down
4 changes: 2 additions & 2 deletions test/integration/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ 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}
TEST_LIST test_list
LIB_DEPS ${EXTRA_TEST_LIB_DEPS})

Expand Down Expand Up @@ -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}
Expand Down
2 changes: 1 addition & 1 deletion test/performance/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ set(TEST_TYPE "PERFORMANCE")
set(tests
)

ign_build_tests(TYPE PERFORMANCE SOURCES ${tests})
gz_build_tests(TYPE PERFORMANCE SOURCES ${tests})
4 changes: 2 additions & 2 deletions test/regression/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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})

0 comments on commit fbde7d7

Please sign in to comment.