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

[ign -> gz] CMake functions #263

Merged
merged 1 commit into from
Jun 17, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
16 changes: 8 additions & 8 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ find_package(ignition-cmake3 REQUIRED)
#============================================================================
# Configure the project
#============================================================================
ign_configure_project(
gz_configure_project(
REPLACE_IGNITION_INCLUDE_PATH gz/msgs
VERSION_SUFFIX pre1)

Expand Down Expand Up @@ -76,15 +76,15 @@ 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
COMPONENTS all
PRETTY Protobuf)

#--------------------------------------
# Find ignition-math
ign_find_package(ignition-math7 REQUIRED)
gz_find_package(ignition-math7 REQUIRED)
set(IGN_MATH_VER ${ignition-math7_VERSION_MAJOR})

#--------------------------------------
Expand All @@ -93,12 +93,12 @@ find_program(HAVE_IGN_TOOLS ign)

#--------------------------------------
# Find Tinyxml2
ign_find_package(TINYXML2 REQUIRED PRIVATE PRETTY tinyxml2)
gz_find_package(TINYXML2 REQUIRED PRIVATE PRETTY tinyxml2)

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

#============================================================================
# ign command line support
Expand All @@ -113,7 +113,7 @@ add_subdirectory(tools)
#============================================================================
# Install proto files
#============================================================================
# TODO: Consider tweaking ign_configure_build() to call add_subdirectory(proto)
# TODO: Consider tweaking gz_configure_build() to call add_subdirectory(proto)
# whenever a proto subdirectory exists. This could be used alongside
# gz_msgs_protoc to get uniform support for proto messages across all ignition
# projects.
Expand All @@ -122,7 +122,7 @@ add_subdirectory(proto)
#============================================================================
# Create package information
#============================================================================
ign_create_packages()
gz_create_packages()

#============================================================================
# Create documentation
Expand All @@ -131,7 +131,7 @@ 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"
AUTOGENERATED_DOC "${CMAKE_BINARY_DIR}/include/gz/msgs/"
Expand Down
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/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.
Expand All @@ -9,7 +9,7 @@ configure_file(
"${CMAKE_BINARY_DIR}/test/conf/${IGN_DESIGNATION}${PROJECT_VERSION_MAJOR}.yaml" @ONLY)

# 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
2 changes: 1 addition & 1 deletion conf/msgs.yaml.in
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
format: 1.0.0
library_name: @PROJECT_NAME_NO_VERSION_LOWER@
library_version: @PROJECT_VERSION_FULL@
library_path: @ign_library_path@
library_path: @gz_library_path@
commands:
- msg : Print information about messages.
---
2 changes: 1 addition & 1 deletion include/gz/msgs/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ign_install_all_headers(
gz_install_all_headers(
GENERATED_HEADERS
MessageTypes.hh
)
14 changes: 7 additions & 7 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
##################################################
# Build a custom protoc plugin
ign_add_executable(gz_msgs_gen Generator.cc generator_main.cc)
gz_add_executable(gz_msgs_gen Generator.cc generator_main.cc)
target_link_libraries(gz_msgs_gen
protobuf::libprotoc
protobuf::libprotobuf)
Expand All @@ -14,7 +14,7 @@ endif()
if(INSTALL_GZ_MSGS_GEN_EXECUTABLE)
set_target_properties(gz_msgs_gen PROPERTIES VERSION ${PROJECT_VERSION_FULL})
install(TARGETS gz_msgs_gen DESTINATION ${IGN_BIN_INSTALL_DIR})

# TODO(chapulina) Deprecated. Remove on v10.
install(FILES $<TARGET_FILE:gz_msgs_gen> DESTINATION ${IGN_BIN_INSTALL_DIR} RENAME ign_msgs_gen PERMISSIONS OWNER_EXECUTE)
endif()
Expand Down Expand Up @@ -154,7 +154,7 @@ install(FILES ${gen_ruby_scripts} DESTINATION ${CMAKE_INSTALL_PREFIX}/${IGN_LIB_
message(STATUS "Installing Ruby messages to ${CMAKE_INSTALL_PREFIX}/${IGN_LIB_INSTALL_DIR}/ruby/gz/${IGN_DESIGNATION}${PROJECT_VERSION_MAJOR}")
install(FILES ${gen_ruby_scripts} DESTINATION ${CMAKE_INSTALL_PREFIX}/${IGN_LIB_INSTALL_DIR}/ruby/gz/${IGN_DESIGNATION}${PROJECT_VERSION_MAJOR})

ign_install_includes(
gz_install_includes(
"${IGN_INCLUDE_INSTALL_DIR_POSTFIX}/gz/${IGN_DESIGNATION}"
${gen_headers})

Expand All @@ -168,13 +168,13 @@ endforeach()
configure_file (${CMAKE_CURRENT_SOURCE_DIR}/MessageTypes.hh.in
${PROJECT_BINARY_DIR}/include/gz/msgs/MessageTypes.hh)

ign_install_includes(
gz_install_includes(
"${IGN_INCLUDE_INSTALL_DIR_POSTFIX}/gz/${IGN_DESIGNATION}"
"${PROJECT_BINARY_DIR}/include/gz/${IGN_DESIGNATION}/MessageTypes.hh")

##################################################
# Build the main library
ign_create_core_library(SOURCES
gz_create_core_library(SOURCES
${gen_sources}
${PROJECT_SOURCE_DIR}/src/Factory.cc
${PROJECT_SOURCE_DIR}/src/Filesystem.cc
Expand Down Expand Up @@ -208,10 +208,10 @@ target_include_directories(${PROJECT_LIBRARY_TARGET_NAME}

##################################################
# Build unit tests
ign_get_libsources_and_unittests(sources gtest_sources)
gz_get_libsources_and_unittests(sources gtest_sources)

# Build the unit tests.
ign_build_tests(TYPE UNIT
gz_build_tests(TYPE UNIT
SOURCES
${gtest_sources}
LIB_DEPS
Expand Down
5 changes: 2 additions & 3 deletions test/integration/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@

ign_get_sources(tests)
gz_get_sources(tests)

if(MSVC)
# TODO: Check if/why this test doesn't work on Windows and find a fix.
list(REMOVE_ITEM tests headers.cc)
endif()

ign_build_tests(TYPE INTEGRATION SOURCES ${tests})
gz_build_tests(TYPE INTEGRATION SOURCES ${tests})
5 changes: 2 additions & 3 deletions test/performance/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
gz_get_sources(tests)

ign_get_sources(tests)

ign_build_tests(TYPE PERFORMANCE SOURCES ${tests})
gz_build_tests(TYPE PERFORMANCE SOURCES ${tests})
5 changes: 2 additions & 3 deletions test/regression/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
gz_get_sources(tests)

ign_get_sources(tests)

ign_build_tests(TYPE REGRESION SOURCES ${tests})
gz_build_tests(TYPE REGRESION SOURCES ${tests})
2 changes: 1 addition & 1 deletion tools/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@ endif()


if (HAVE_IGN_TOOLS)
ign_build_tests(TYPE UNIT SOURCES ${test_sources})
gz_build_tests(TYPE UNIT SOURCES ${test_sources})
endif ()