From d7f6621961a60270e335899690e1a98bdadf137b Mon Sep 17 00:00:00 2001 From: Dirk Thomas Date: Fri, 10 Apr 2020 13:44:28 -0700 Subject: [PATCH] make rmw_dds_common use rosidl_generator_interfaces normally (#12) * make rmw_dds_common use rosidl_generator_interfaces normally Signed-off-by: Dirk Thomas * switch from .idl to .msg Signed-off-by: Dirk Thomas * interface target must have the name of the package Signed-off-by: Dirk Thomas * fix rebase Signed-off-by: Dirk Thomas * fix rebase - take 2 Signed-off-by: Dirk Thomas --- rmw_dds_common/CMakeLists.txt | 33 ++++++++++--------- rmw_dds_common/msg/Gid.idl | 8 ----- rmw_dds_common/msg/Gid.msg | 1 + rmw_dds_common/msg/NodeEntitiesInfo.idl | 12 ------- rmw_dds_common/msg/NodeEntitiesInfo.msg | 4 +++ .../msg/ParticipantEntitiesInfo.idl | 14 -------- .../msg/ParticipantEntitiesInfo.msg | 2 ++ rmw_dds_common/package.xml | 6 +++- rmw_dds_common_generators/CMakeLists.txt | 19 ----------- rmw_dds_common_generators/package.xml | 31 ----------------- .../rmw_dds_common_generators-extras.cmake.in | 27 --------------- 11 files changed, 29 insertions(+), 128 deletions(-) delete mode 100644 rmw_dds_common/msg/Gid.idl create mode 100644 rmw_dds_common/msg/Gid.msg delete mode 100644 rmw_dds_common/msg/NodeEntitiesInfo.idl create mode 100644 rmw_dds_common/msg/NodeEntitiesInfo.msg delete mode 100644 rmw_dds_common/msg/ParticipantEntitiesInfo.idl create mode 100644 rmw_dds_common/msg/ParticipantEntitiesInfo.msg delete mode 100644 rmw_dds_common_generators/CMakeLists.txt delete mode 100644 rmw_dds_common_generators/package.xml delete mode 100644 rmw_dds_common_generators/rmw_dds_common_generators-extras.cmake.in diff --git a/rmw_dds_common/CMakeLists.txt b/rmw_dds_common/CMakeLists.txt index 9946a9e..3ce6f92 100644 --- a/rmw_dds_common/CMakeLists.txt +++ b/rmw_dds_common/CMakeLists.txt @@ -15,51 +15,52 @@ find_package(ament_cmake REQUIRED) find_package(rcpputils REQUIRED) find_package(rcutils REQUIRED) find_package(rmw REQUIRED) -find_package(rmw_dds_common_generators REQUIRED) +find_package(rosidl_default_generators REQUIRED) ament_export_dependencies(ament_cmake_core) ament_export_dependencies(rcpputils) ament_export_dependencies(rcutils) ament_export_dependencies(rmw) -ament_export_dependencies(rosidl_runtime_cpp) +ament_export_dependencies(rosidl_default_runtime) rosidl_generate_interfaces( - ${PROJECT_NAME}_interfaces - "msg/Gid.idl" - "msg/NodeEntitiesInfo.idl" - "msg/ParticipantEntitiesInfo.idl" - SKIP_GROUP_MEMBERSHIP_CHECK + ${PROJECT_NAME} + "msg/Gid.msg" + "msg/NodeEntitiesInfo.msg" + "msg/ParticipantEntitiesInfo.msg" ) -add_library(${PROJECT_NAME} SHARED +add_library(${PROJECT_NAME}_library SHARED src/gid_utils.cpp src/graph_cache.cpp) -ament_target_dependencies(${PROJECT_NAME} +set_target_properties(${PROJECT_NAME}_library + PROPERTIES OUTPUT_NAME ${PROJECT_NAME}) +ament_target_dependencies(${PROJECT_NAME}_library "rcpputils" "rcutils" "rmw" "rosidl_runtime_cpp") -add_dependencies(${PROJECT_NAME} - ${PROJECT_NAME}_interfaces) -target_include_directories(${PROJECT_NAME} PUBLIC +add_dependencies(${PROJECT_NAME}_library + ${PROJECT_NAME}) +target_include_directories(${PROJECT_NAME}_library PUBLIC include ${CMAKE_CURRENT_BINARY_DIR}/rosidl_generator_c ${CMAKE_CURRENT_BINARY_DIR}/rosidl_generator_cpp) # Causes the visibility macros to use dllexport rather than dllimport, # which is appropriate when building the dll but not consuming it. -target_compile_definitions(${PROJECT_NAME} +target_compile_definitions(${PROJECT_NAME}_library PRIVATE "RMW_DDS_COMMON_BUILDING_LIBRARY") install( - TARGETS ${PROJECT_NAME} + TARGETS ${PROJECT_NAME}_library ARCHIVE DESTINATION lib LIBRARY DESTINATION lib RUNTIME DESTINATION bin ) ament_export_include_directories(include) -ament_export_libraries(${PROJECT_NAME}) +ament_export_libraries(${PROJECT_NAME}_library) install( DIRECTORY include/ @@ -72,7 +73,7 @@ if(BUILD_TESTING) ament_add_gmock(test_graph_cache test/test_graph_cache.cpp) if(TARGET test_graph_cache) - target_link_libraries(test_graph_cache ${PROJECT_NAME}) + target_link_libraries(test_graph_cache ${PROJECT_NAME}_library) endif() endif() diff --git a/rmw_dds_common/msg/Gid.idl b/rmw_dds_common/msg/Gid.idl deleted file mode 100644 index c3acdb1..0000000 --- a/rmw_dds_common/msg/Gid.idl +++ /dev/null @@ -1,8 +0,0 @@ -module rmw_dds_common { - module msg { - typedef char data_t[24]; - struct Gid { - data_t data; - }; - }; -}; diff --git a/rmw_dds_common/msg/Gid.msg b/rmw_dds_common/msg/Gid.msg new file mode 100644 index 0000000..97d1a4c --- /dev/null +++ b/rmw_dds_common/msg/Gid.msg @@ -0,0 +1 @@ +char[24] data diff --git a/rmw_dds_common/msg/NodeEntitiesInfo.idl b/rmw_dds_common/msg/NodeEntitiesInfo.idl deleted file mode 100644 index 07d8fd0..0000000 --- a/rmw_dds_common/msg/NodeEntitiesInfo.idl +++ /dev/null @@ -1,12 +0,0 @@ -#include "rmw_dds_common/msg/Gid.idl" - -module rmw_dds_common { - module msg { - struct NodeEntitiesInfo { - string<256> node_namespace; - string<256> node_name; - sequence reader_gid_seq; - sequence writer_gid_seq; - }; - }; -}; diff --git a/rmw_dds_common/msg/NodeEntitiesInfo.msg b/rmw_dds_common/msg/NodeEntitiesInfo.msg new file mode 100644 index 0000000..00c410f --- /dev/null +++ b/rmw_dds_common/msg/NodeEntitiesInfo.msg @@ -0,0 +1,4 @@ +string<=256 node_namespace +string<=256 node_name +Gid[] reader_gid_seq +Gid[] writer_gid_seq diff --git a/rmw_dds_common/msg/ParticipantEntitiesInfo.idl b/rmw_dds_common/msg/ParticipantEntitiesInfo.idl deleted file mode 100644 index 0130114..0000000 --- a/rmw_dds_common/msg/ParticipantEntitiesInfo.idl +++ /dev/null @@ -1,14 +0,0 @@ -#include "rmw_dds_common/msg/Gid.idl" -#include "rmw_dds_common/msg/NodeEntitiesInfo.idl" - -module rmw_dds_common { - module msg { - struct ParticipantEntitiesInfo { - // We're not using keyed topics right now. - // Commented out because it is making message generation fail when OpenSplice is available. - // @key - rmw_dds_common::msg::Gid gid; - sequence node_entities_info_seq; - }; - }; -}; diff --git a/rmw_dds_common/msg/ParticipantEntitiesInfo.msg b/rmw_dds_common/msg/ParticipantEntitiesInfo.msg new file mode 100644 index 0000000..968b253 --- /dev/null +++ b/rmw_dds_common/msg/ParticipantEntitiesInfo.msg @@ -0,0 +1,2 @@ +Gid gid +NodeEntitiesInfo[] node_entities_info_seq diff --git a/rmw_dds_common/package.xml b/rmw_dds_common/package.xml index b5deeea..0efded0 100644 --- a/rmw_dds_common/package.xml +++ b/rmw_dds_common/package.xml @@ -9,7 +9,9 @@ Ivan Paunovic ament_cmake - rmw_dds_common_generators + rosidl_default_generators + + rosidl_default_runtime rcutils rcpputils @@ -20,6 +22,8 @@ ament_lint_auto ament_lint_common + rosidl_interface_packages + ament_cmake diff --git a/rmw_dds_common_generators/CMakeLists.txt b/rmw_dds_common_generators/CMakeLists.txt deleted file mode 100644 index ed837e9..0000000 --- a/rmw_dds_common_generators/CMakeLists.txt +++ /dev/null @@ -1,19 +0,0 @@ -cmake_minimum_required(VERSION 3.5) - -project(rmw_dds_common_generators NONE) - -find_package(ament_cmake REQUIRED) - -ament_export_dependencies(ament_cmake_core) -ament_export_dependencies(rosidl_cmake) -ament_export_dependencies(rosidl_generator_c) -ament_export_dependencies(rosidl_generator_cpp) - -if(BUILD_TESTING) - find_package(ament_lint_auto REQUIRED) - ament_lint_auto_find_test_dependencies() -endif() - -ament_package( - CONFIG_EXTRAS "rmw_dds_common_generators-extras.cmake.in" -) diff --git a/rmw_dds_common_generators/package.xml b/rmw_dds_common_generators/package.xml deleted file mode 100644 index f3e8398..0000000 --- a/rmw_dds_common_generators/package.xml +++ /dev/null @@ -1,31 +0,0 @@ - - - - rmw_dds_common_generators - 0.7.3 - Generators used in rmw_dds_common. - Ivan Paunovic - Apache License 2.0 - Ivan Paunovic - - ament_cmake - rosidl_cmake - - ament_cmake - rosidl_cmake - - rosidl_generator_c - rosidl_generator_cpp - - rosidl_typesupport_introspection_c - rosidl_typesupport_introspection_cpp - - ament_lint_auto - ament_lint_common - - rosidl_typesupport_cpp_packages - - - ament_cmake - - diff --git a/rmw_dds_common_generators/rmw_dds_common_generators-extras.cmake.in b/rmw_dds_common_generators/rmw_dds_common_generators-extras.cmake.in deleted file mode 100644 index 700e181..0000000 --- a/rmw_dds_common_generators/rmw_dds_common_generators-extras.cmake.in +++ /dev/null @@ -1,27 +0,0 @@ -# generated from -# rmw_dds_common_generators/rmw_dds_common_generators-extras.cmake - -find_package(ament_cmake_core REQUIRED) -ament_index_get_resources(rosidl_typesupport_cpp_packages "rosidl_typesupport_cpp") -set(_exported_dependencies - ${rosidl_typesupport_cpp_packages} -) - -# find_package() all dependencies (if available) -# and append their DEFINITIONS INCLUDE_DIRS and LIBRARIES variables -# to @PROJECT_NAME@_DEFINITIONS , @PROJECT_NAME@_INCLUDE_DIRS and -# @PROJECT_NAME@_LIBRARIES. -foreach(_dep ${_exported_dependencies}) - find_package("${_dep}" QUIET) - if(${_dep}_FOUND) - if(${_dep}_DEFINITIONS) - list(APPEND @PROJECT_NAME@_DEFINITIONS "${${_dep}_DEFINITIONS}") - endif() - if(${_dep}_INCLUDE_DIRS) - list(APPEND @PROJECT_NAME@_INCLUDE_DIRS "${${_dep}_INCLUDE_DIRS}") - endif() - if(${_dep}_LIBRARIES) - list(APPEND @PROJECT_NAME@_LIBRARIES "${${_dep}_LIBRARIES}") - endif() - endif() -endforeach()