@@ -21,8 +21,7 @@ if(NOT CMAKE_CXX_STANDARD)
2121endif ()
2222
2323if (CMAKE_CXX_COMPILER_ID MATCHES "GNU" OR CMAKE_CXX_COMPILER_ID MATCHES "Clang" )
24- # add_compile_options(-Wall -Wextra -Wpedantic -Werror -Wdeprecated -fPIC -Wshadow -Wnull-dereference)
25- add_compile_options (-Wall -Wextra -Wpedantic -Wdeprecated -fPIC -Wshadow -Wnull-dereference )
24+ add_compile_options (-Wall -Wextra -Wpedantic -Werror -Wdeprecated -fPIC -Wnull-dereference )
2625 add_compile_options ("$<$<COMPILE_LANGUAGE :CXX >:-Wnon -virtual -dtor >" )
2726endif ()
2827
@@ -51,49 +50,70 @@ endif()
5150# ###############################################
5251# # Find ament macros and libraries
5352find_package (ament_cmake REQUIRED )
53+ find_package (behaviortree_cpp_v3 REQUIRED )
54+ find_package (nav2_behavior_tree REQUIRED )
5455find_package (rclcpp REQUIRED )
5556find_package (rclcpp_action REQUIRED )
5657find_package (rclcpp_lifecycle REQUIRED )
5758find_package (scitos2_msgs REQUIRED )
58- find_package (behaviortree_cpp_v3 REQUIRED )
59- find_package (nav2_behavior_tree REQUIRED )
6059
6160# ##########
6261# # Build ##
6362# ##########
64- # # Specify additional locations of header files
65- # # Your package locations should be listed before other locations
66- include_directories (
67- include
63+ add_library ( scitos2_is_bumper_activated_condition_bt_node SHARED src/condition/is_bumper_activated_condition.cpp )
64+ target_include_directories ( scitos2_is_bumper_activated_condition_bt_node PUBLIC
65+ "$< BUILD_INTERFACE : ${CMAKE_SOURCE_DIR} / include >"
66+ "$< INSTALL_INTERFACE : include / ${PROJECT_NAME} >"
6867)
69-
70- set (dependencies
71- rclcpp
72- rclcpp_action
73- rclcpp_lifecycle
74- scitos2_msgs
75- behaviortree_cpp_v3
76- nav2_behavior_tree
68+ target_link_libraries (scitos2_is_bumper_activated_condition_bt_node
69+ PUBLIC
70+ rclcpp::rclcpp
71+ ${scitos2_msgs_TARGETS}
7772)
78-
79- add_library (scitos2_is_bumper_activated_condition_bt_node SHARED src/condition/is_bumper_activated_condition.cpp )
80- list (APPEND plugin_libs scitos2_is_bumper_activated_condition_bt_node)
73+ ament_target_dependencies (scitos2_is_bumper_activated_condition_bt_node
74+ PUBLIC
75+ behaviortree_cpp_v3
76+ ) # TODO(ajtudela): Fix this in jazzy
77+ target_compile_definitions (scitos2_is_bumper_activated_condition_bt_node PRIVATE BT_PLUGIN_EXPORT )
8178
8279add_library (scitos2_emergency_stop_service_bt_node SHARED src/action/emergency_stop_service.cpp )
83- list (APPEND plugin_libs scitos2_emergency_stop_service_bt_node)
80+ target_include_directories (scitos2_emergency_stop_service_bt_node PUBLIC
81+ "$<BUILD_INTERFACE :${CMAKE_SOURCE_DIR} /include >"
82+ "$<INSTALL_INTERFACE :include /${PROJECT_NAME} >"
83+ )
84+ target_link_libraries (scitos2_emergency_stop_service_bt_node
85+ PUBLIC
86+ ${scitos2_msgs_TARGETS}
87+ )
88+ ament_target_dependencies (scitos2_emergency_stop_service_bt_node
89+ PUBLIC
90+ nav2_behavior_tree
91+ ) # TODO(ajtudela): Fix this in jazzy
92+ target_compile_definitions (scitos2_emergency_stop_service_bt_node PRIVATE BT_PLUGIN_EXPORT )
8493
8594add_library (scitos2_reset_motor_stop_service_bt_node SHARED src/action/reset_motor_stop_service.cpp )
86- list (APPEND plugin_libs scitos2_reset_motor_stop_service_bt_node)
87-
88- foreach (bt_plugin ${plugin_libs} )
89- ament_target_dependencies (${bt_plugin} ${dependencies} )
90- target_compile_definitions (${bt_plugin} PRIVATE BT_PLUGIN_EXPORT )
91- endforeach ()
95+ target_include_directories (scitos2_reset_motor_stop_service_bt_node PUBLIC
96+ "$<BUILD_INTERFACE :${CMAKE_SOURCE_DIR} /include >"
97+ "$<INSTALL_INTERFACE :include /${PROJECT_NAME} >"
98+ )
99+ target_link_libraries (scitos2_reset_motor_stop_service_bt_node
100+ PUBLIC
101+ ${scitos2_msgs_TARGETS}
102+ )
103+ ament_target_dependencies (scitos2_reset_motor_stop_service_bt_node
104+ PUBLIC
105+ nav2_behavior_tree
106+ ) # TODO(ajtudela): Fix this in jazzy
107+ target_compile_definitions (scitos2_reset_motor_stop_service_bt_node PRIVATE BT_PLUGIN_EXPORT )
92108
93109# ############
94110# # Install ##
95111# ############
96- install (TARGETS ${plugin_libs}
112+ install (TARGETS
113+ scitos2_is_bumper_activated_condition_bt_node
114+ scitos2_emergency_stop_service_bt_node
115+ scitos2_reset_motor_stop_service_bt_node
116+ EXPORT ${PROJECT_NAME}
97117 ARCHIVE DESTINATION lib
98118 LIBRARY DESTINATION lib
99119 RUNTIME DESTINATION bin
@@ -104,14 +124,14 @@ set(GENERATED_DIR ${CMAKE_CURRENT_BINARY_DIR}/gen)
104124configure_file (plugins_list.hpp.in ${GENERATED_DIR} /plugins_list.hpp )
105125
106126add_executable (generate_scitos2_tree_nodes_xml src/generate_scitos2_tree_nodes_xml.cpp )
107- ament_target_dependencies (generate_scitos2_tree_nodes_xml ${dependencies} )
127+ ament_target_dependencies (generate_scitos2_tree_nodes_xml PUBLIC behaviortree_cpp_v3 ) # TODO(ajtudela): Fix this in jazzy
108128
109129# allow generate_scitos2_tree_nodes_xml to find plugins_list.hpp
110130target_include_directories (generate_scitos2_tree_nodes_xml PRIVATE ${GENERATED_DIR} )
111131install (TARGETS generate_scitos2_tree_nodes_xml DESTINATION lib/${PROJECT_NAME} )
112132
113133install (DIRECTORY include/
114- DESTINATION include/
134+ DESTINATION include/${PROJECT_NAME}
115135)
116136
117137install (DIRECTORY test/utils/
@@ -137,7 +157,19 @@ endif()
137157# ##################################
138158# # ament specific configuration ##
139159# ##################################
140- ament_export_include_directories (include )
141- ament_export_libraries (${plugin_libs} )
142- ament_export_dependencies (${dependencies} )
160+ ament_export_include_directories (include /${PROJECT_NAME} )
161+ ament_export_libraries (
162+ scitos2_is_bumper_activated_condition_bt_node
163+ scitos2_emergency_stop_service_bt_node
164+ scitos2_reset_motor_stop_service_bt_node
165+ )
166+ ament_export_dependencies (
167+ behaviortree_cpp_v3
168+ nav2_behavior_tree
169+ rclcpp
170+ rclcpp_action
171+ rclcpp_lifecycle
172+ scitos2_msgs
173+ )
174+ ament_export_targets (${PROJECT_NAME} )
143175ament_package ()
0 commit comments