From 84d668b0d5d56c7ba6ce09b919e3763f6c87ebf9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20G=C3=B6rner?= Date: Sat, 29 May 2021 00:38:02 +0200 Subject: [PATCH] Split ClassLoader plugin code from main libraries (#271) to work around https://github.com/ros/class_loader/issues/131 --- core/CMakeLists.txt | 1 + core/motion_planning_stages_plugin_description.xml | 2 +- core/src/stages/CMakeLists.txt | 7 ++++++- core/src/stages/current_state.cpp | 4 ---- core/src/stages/plugins.cpp | 7 +++++++ 5 files changed, 15 insertions(+), 6 deletions(-) create mode 100644 core/src/stages/plugins.cpp diff --git a/core/CMakeLists.txt b/core/CMakeLists.txt index 7032b57d..d16658c3 100644 --- a/core/CMakeLists.txt +++ b/core/CMakeLists.txt @@ -18,6 +18,7 @@ catkin_package( LIBRARIES ${PROJECT_NAME} ${PROJECT_NAME}_stages + ${PROJECT_NAME}_stage_plugins INCLUDE_DIRS include CATKIN_DEPENDS diff --git a/core/motion_planning_stages_plugin_description.xml b/core/motion_planning_stages_plugin_description.xml index 75af7442..389c11ff 100644 --- a/core/motion_planning_stages_plugin_description.xml +++ b/core/motion_planning_stages_plugin_description.xml @@ -1,4 +1,4 @@ - + diff --git a/core/src/stages/CMakeLists.txt b/core/src/stages/CMakeLists.txt index 857a4977..2becaa63 100644 --- a/core/src/stages/CMakeLists.txt +++ b/core/src/stages/CMakeLists.txt @@ -41,6 +41,11 @@ add_library(${PROJECT_NAME}_stages ) target_link_libraries(${PROJECT_NAME}_stages ${PROJECT_NAME} ${catkin_LIBRARIES}) -install(TARGETS ${PROJECT_NAME}_stages +add_library(${PROJECT_NAME}_stage_plugins + plugins.cpp +) +target_link_libraries(${PROJECT_NAME}_stage_plugins ${PROJECT_NAME}_stages ${catkin_LIBRARIES}) + +install(TARGETS ${PROJECT_NAME}_stages ${PROJECT_NAME}_stage_plugins ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION} LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}) diff --git a/core/src/stages/current_state.cpp b/core/src/stages/current_state.cpp index 51c5abc9..822dc5c3 100644 --- a/core/src/stages/current_state.cpp +++ b/core/src/stages/current_state.cpp @@ -96,7 +96,3 @@ void CurrentState::compute() { } // namespace stages } // namespace task_constructor } // namespace moveit - -/// register plugin -#include -PLUGINLIB_EXPORT_CLASS(moveit::task_constructor::stages::CurrentState, moveit::task_constructor::Stage) diff --git a/core/src/stages/plugins.cpp b/core/src/stages/plugins.cpp new file mode 100644 index 00000000..9b9864f8 --- /dev/null +++ b/core/src/stages/plugins.cpp @@ -0,0 +1,7 @@ +#include + +#include + +/// register plugins to use with ClassLoader + +PLUGINLIB_EXPORT_CLASS(moveit::task_constructor::stages::CurrentState, moveit::task_constructor::Stage)