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

Use the message generation framework #398

Closed
wants to merge 3 commits into from
Closed
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
10 changes: 10 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,16 @@ set(GZ_UTILS_VER ${gz-utils2_VERSION_MAJOR})
gz_find_package(gz-msgs10 REQUIRED)
set(GZ_MSGS_VER ${gz-msgs10_VERSION_MAJOR})

# Get the gz-msgs installed messages and generate a library from them
gz_msgs_get_installed_messages(
MESSAGES_PATH_VARIABLE MSGS_PATH
MESSAGES_PROTOS_VARIABLE MSGS_PROTOS)
gz_msgs_generate_messages(
TARGET gz_msgs_gen
PROTO_PACKAGE "gz.msgs"
MSGS_PATH ${MSGS_PATH}
MSGS_PROTOS ${MSGS_PROTOS})

#--------------------------------------
# Find ifaddrs
gz_find_package(IFADDRS QUIET)
Expand Down
3 changes: 2 additions & 1 deletion log/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ list(APPEND sources cmd/LogCommandAPI.cc)
gz_add_component(log SOURCES ${sources} GET_TARGET_NAME log_lib_target)

target_link_libraries(${log_lib_target}
PRIVATE SQLite3::SQLite3)
PRIVATE SQLite3::SQLite3
PRIVATE gz_msgs_gen)

if (MSVC)
# Warning #4251 is the "dll-interface" warning that tells you when types used
Expand Down
3 changes: 1 addition & 2 deletions log/test/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
configure_file (test_config.hh.in
configure_file (test_config.hh.in
${PROJECT_BINARY_DIR}/include/log/test_config.hh
)

add_subdirectory(integration)
2 changes: 2 additions & 0 deletions log/test/integration/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ gz_build_tests(
LIB_DEPS
${PROJECT_LIBRARY_TARGET_NAME}-log
${EXTRA_TEST_LIB_DEPS}
gz_msgs_gen
INCLUDE_DIRS
${CMAKE_BINARY_DIR}/test/
)
Expand Down Expand Up @@ -52,6 +53,7 @@ foreach(source_file ${aux})
${log_lib_target}
gtest
${EXTRA_TEST_LIB_DEPS}
gz_msgs_gen
)

if(UNIX)
Expand Down
6 changes: 4 additions & 2 deletions parameters/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,15 @@ gz_add_component(

target_link_libraries(${param_lib_target}
PUBLIC
gz-utils${GZ_UTILS_VER}::gz-utils${GZ_UTILS_VER})
gz-utils${GZ_UTILS_VER}::gz-utils${GZ_UTILS_VER}
PRIVATE
gz_msgs_gen)

# Unit tests
gz_build_tests(
TYPE "UNIT"
SOURCES ${gtest_sources}
LIB_DEPS ${param_lib_target} ${EXTRA_TEST_LIB_DEPS}
LIB_DEPS ${param_lib_target} ${EXTRA_TEST_LIB_DEPS} gz_msgs_gen
)

if(NOT WIN32)
Expand Down
7 changes: 3 additions & 4 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ gz_create_core_library(SOURCES ${sources} CXX_STANDARD 17)
target_link_libraries(${PROJECT_LIBRARY_TARGET_NAME}
PUBLIC
gz-utils${GZ_UTILS_VER}::gz-utils${GZ_UTILS_VER}
gz-msgs${GZ_MSGS_VER}::gz-msgs${GZ_MSGS_VER}
CPPZMQ::CPPZMQ
PRIVATE
gz_msgs_gen
${ZeroMQ_TARGET}
)

target_include_directories(${PROJECT_LIBRARY_TARGET_NAME}
SYSTEM PUBLIC
SYSTEM PUBLIC
$<TARGET_PROPERTY:protobuf::libprotobuf,INTERFACE_INCLUDE_DIRECTORIES>
$<TARGET_PROPERTY:CPPZMQ::CPPZMQ,INTERFACE_INCLUDE_DIRECTORIES>)

Expand All @@ -34,14 +34,13 @@ gz_build_tests(TYPE UNIT SOURCES ${gtest_sources}
LIB_DEPS ${EXTRA_TEST_LIB_DEPS})

foreach(test ${test_list})

# Inform each test of its output directory so it knows where to call the
# auxiliary files from. Using a generator expression here is useful for
# multi-configuration generators, like Visual Studio.
target_compile_definitions(${test} PRIVATE
"DETAIL_GZ_TRANSPORT_TEST_DIR=\"$<TARGET_FILE_DIR:${test}>\""
"GZ_TEST_LIBRARY_PATH=\"$<TARGET_FILE_DIR:${PROJECT_LIBRARY_TARGET_NAME}>\"")

target_link_libraries(${test} gz_msgs_gen)
endforeach()

if(MSVC)
Expand Down
7 changes: 3 additions & 4 deletions src/cmd/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,8 @@ endif()

# Make a small static lib of command line functions
add_library(gz STATIC gz.cc)
target_link_libraries(gz
${PROJECT_LIBRARY_TARGET_NAME}
)
target_link_messages(TARGET gz MSG_TARGETS gz_msgs_gen)
target_link_libraries(gz ${PROJECT_LIBRARY_TARGET_NAME})

# Build topic CLI executable
set(topic_executable gz-transport-topic)
Expand Down Expand Up @@ -40,7 +39,7 @@ gz_build_tests(TYPE UNIT SOURCES ${gtest_sources}
LIB_DEPS ${EXTRA_TEST_LIB_DEPS})

foreach(test ${test_list})
target_link_libraries(${test} gz)
target_link_libraries(${test} gz gz_msgs_gen)

# Inform each test of its output directory so it knows where to call the
# auxiliary files from. Using a generator expression here is useful for
Expand Down
5 changes: 2 additions & 3 deletions test/integration/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,14 @@ endif()

gz_build_tests(TYPE INTEGRATION SOURCES ${tests}
TEST_LIST test_list
LIB_DEPS ${EXTRA_TEST_LIB_DEPS})
LIB_DEPS ${EXTRA_TEST_LIB_DEPS} gz_msgs_gen)

foreach(test ${test_list})

# Inform each test of its output directory so it knows where to call the
# auxiliary files from. Using a generator expression here is useful for
# multi-configuration generators, like Visual Studio.
target_compile_definitions(${test} PRIVATE
"DETAIL_GZ_TRANSPORT_TEST_DIR=\"$<TARGET_FILE_DIR:${test}>\"")

endforeach()

set(auxiliary_files
Expand Down Expand Up @@ -64,6 +62,7 @@ foreach(AUX_EXECUTABLE ${auxiliary_files})
${PROJECT_LIBRARY_TARGET_NAME}
gtest
${EXTRA_TEST_LIB_DEPS}
gz_msgs_gen
)

if(UNIX)
Expand Down