Make Component Manager public (#1065)

* make functions public & virtual

Signed-off-by: Karsten Knese <karsten@openrobotics.org>

* flexible resource index for cmake macros

Signed-off-by: Karsten Knese <karsten@openrobotics.org>

* review comments

Signed-off-by: Karsten Knese <karsten@openrobotics.org>

* remove superfluous include

Signed-off-by: Karsten Knese <karsten@openrobotics.org>

* remove wrong dllexort

Signed-off-by: Karsten Knese <karsten@openrobotics.org>

* check for empty plugin & executable args

Signed-off-by: Karsten Knese <karsten@openrobotics.org>

* remove commented lines

Signed-off-by: Karsten Knese <karsten@openrobotics.org>

* fix typo

Signed-off-by: Karsten Knese <karsten@openrobotics.org>

* relax macro constraints

Signed-off-by: Karsten Knese <karsten@openrobotics.org>
This commit is contained in:
Karsten Knese 2020-04-15 19:08:04 -07:00 committed by GitHub
parent 44fa4fe019
commit 50d500e84e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 146 additions and 40 deletions

View file

@ -21,6 +21,8 @@
# :type target: string
# :param ARGN: the unique plugin names being exported using class_loader
# :type ARGN: list of strings
# :param RESOURCE_INDEX: the ament resource index to register the components
# :type RESOURCE_INDEX: string
#
macro(rclcpp_components_register_nodes target)
if(NOT TARGET ${target})
@ -29,6 +31,13 @@ macro(rclcpp_components_register_nodes target)
"rclcpp_components_register_nodes() first argument "
"'${target}' is not a target")
endif()
cmake_parse_arguments(ARGS "" "RESOURCE_INDEX" "" ${ARGN})
# default to rclcpp_components if not specified otherwise
set(resource_index "rclcpp_components")
if(NOT "${ARGS_RESOURCE_INDEX}" STREQUAL "")
set(resource_index ${ARGS_RESOURCE_INDEX})
message(STATUS "Setting component resource index to non-default value ${resource_index}")
endif()
get_target_property(_target_type ${target} TYPE)
if(NOT _target_type STREQUAL "SHARED_LIBRARY")
message(
@ -40,7 +49,7 @@ macro(rclcpp_components_register_nodes target)
if(${ARGC} GREATER 0)
_rclcpp_components_register_package_hook()
set(_unique_names)
foreach(_arg ${ARGN})
foreach(_arg ${ARGS_UNPARSED_ARGUMENTS})
if(_arg IN_LIST _unique_names)
message(
FATAL_ERROR
@ -54,8 +63,9 @@ macro(rclcpp_components_register_nodes target)
else()
set(_path "lib")
endif()
set(_RCLCPP_COMPONENTS__NODES
"${_RCLCPP_COMPONENTS__NODES}${_arg};${_path}/$<TARGET_FILE_NAME:${target}>\n")
set(_RCLCPP_COMPONENTS_${resource_index}__NODES
"${_RCLCPP_COMPONENTS_${resource_index}__NODES}${_arg};${_path}/$<TARGET_FILE_NAME:${target}>\n")
list(APPEND _RCLCPP_COMPONENTS_PACKAGE_RESOURCE_INDICES ${resource_index})
endforeach()
endif()
endmacro()