@@ -21,16 +21,9 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON)
21
21
option (BTCPP_SHARED_LIBS "Build shared libraries" ON )
22
22
option (BTCPP_ENABLE_COROUTINES "Enable boost coroutines" ON )
23
23
option (BTCPP_MANUAL_SELECTOR "Build manual selector node" ON )
24
-
25
- if (${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_CURRENT_SOURCE_DIR} )
26
- option (BTCPP_EXAMPLES "Build tutorials and examples" ON )
27
- option (BTCPP_UNIT_TESTS "Build the unit tests" ON )
28
- option (BTCPP_BUILD_TOOLS "Build commandline tools" ON )
29
- else ()
30
- option (BTCPP_EXAMPLES "Build tutorials and examples" OFF )
31
- option (BTCPP_UNIT_TESTS "Build the unit tests" OFF )
32
- option (BTCPP_BUILD_TOOLS "Build commandline tools" OFF )
33
- endif ()
24
+ option (BTCPP_BUILD_TOOLS "Build commandline tools" ON )
25
+ option (BTCPP_EXAMPLES "Build tutorials and examples" ON )
26
+ option (BTCPP_UNIT_TESTS "Build the unit tests" ON )
34
27
35
28
option (USE_V3_COMPATIBLE_NAMES "Use some alias to compile more easily old 3.x code" OFF )
36
29
@@ -49,7 +42,6 @@ if(BTCPP_ENABLE_COROUTINES)
49
42
add_definitions (-DBT_BOOST_COROUTINE )
50
43
set (BT_COROUTINES_FOUND true )
51
44
endif ()
52
- include_directories (${Boost_INCLUDE_DIRS} )
53
45
endif ()
54
46
55
47
if (NOT DEFINED BT_COROUTINES_FOUND )
@@ -71,13 +63,8 @@ endif()
71
63
find_package (Threads )
72
64
find_package (ZMQ )
73
65
74
- list (APPEND BEHAVIOR_TREE_PUBLIC_LIBRARIES
75
- ${CMAKE_THREAD_LIBS_INIT}
76
- ${CMAKE_DL_LIBS}
77
- )
78
-
79
66
if ( ZMQ_FOUND )
80
- message (STATUS "ZeroMQ found." )
67
+ message (STATUS "ZeroMQ: found." )
81
68
add_definitions ( -DZMQ_FOUND )
82
69
list (APPEND BT_SOURCE src/loggers/bt_zmq_publisher.cpp )
83
70
else ()
@@ -101,8 +88,6 @@ if ( ament_cmake_FOUND )
101
88
message (STATUS "BehaviourTree is being built using AMENT." )
102
89
message (STATUS "------------------------------------------" )
103
90
104
- set (BUILD_TOOL_INCLUDE_DIRS ${ament_INCLUDE_DIRS} )
105
-
106
91
elseif ( CATKIN_DEVEL_PREFIX OR CATKIN_BUILD_BINARY_PACKAGE )
107
92
108
93
set (catkin_FOUND 1 )
@@ -120,9 +105,6 @@ elseif( CATKIN_DEVEL_PREFIX OR CATKIN_BUILD_BINARY_PACKAGE)
120
105
CATKIN_DEPENDS roslib
121
106
)
122
107
123
- list (APPEND BEHAVIOR_TREE_PUBLIC_LIBRARIES ${catkin_LIBRARIES} )
124
- set (BUILD_TOOL_INCLUDE_DIRS ${catkin_INCLUDE_DIRS} )
125
-
126
108
elseif (BTCPP_UNIT_TESTS )
127
109
if (${CMAKE_VERSION} VERSION_LESS "3.11.0" )
128
110
find_package (GTest REQUIRED )
@@ -185,11 +167,8 @@ list(APPEND BT_SOURCE
185
167
if (BTCPP_MANUAL_SELECTOR )
186
168
find_package (Curses QUIET )
187
169
if (CURSES_FOUND )
188
- list (APPEND BT_SOURCE
189
- src/controls/manual_node.cpp
190
- )
191
- list (APPEND BEHAVIOR_TREE_PUBLIC_LIBRARIES ${CURSES_LIBRARIES} )
192
- add_definitions (-DNCURSES_FOUND )
170
+ message (STATUS "NCurses: found." )
171
+ list (APPEND BT_SOURCE src/controls/manual_node.cpp )
193
172
else ()
194
173
message (WARNING "NCurses NOT found. Skipping the build of manual selector node." )
195
174
endif ()
@@ -207,47 +186,56 @@ if (WIN32)
207
186
list (APPEND BT_SOURCE src/shared_library_WIN.cpp )
208
187
endif ()
209
188
210
- if (BUILD_SHARED_LIBS )
189
+ if (BTCPP_SHARED_LIBS )
211
190
set (CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON )
212
191
add_library (${BEHAVIOR_TREE_LIBRARY} SHARED ${BT_SOURCE} )
213
192
else ()
214
193
add_library (${BEHAVIOR_TREE_LIBRARY} STATIC ${BT_SOURCE} )
215
194
endif ()
216
195
217
- if ( ZMQ_FOUND )
218
- list (APPEND BUILD_TOOL_INCLUDE_DIRS ${ZMQ_INCLUDE_DIRS} )
219
- endif ()
220
-
221
196
target_link_libraries (${BEHAVIOR_TREE_LIBRARY}
222
197
PUBLIC
223
- ${BEHAVIOR_TREE_PUBLIC_LIBRARIES}
198
+ ${CMAKE_THREAD_LIBS_INIT}
199
+ ${CMAKE_DL_LIBS}
224
200
PRIVATE
225
- ${Boost_LIBRARIES}
226
- ${ZMQ_LIBRARIES}
227
201
$< BUILD_INTERFACE:foonathan::lexy>
228
202
)
229
203
230
- #get_target_property(my_libs ${BEHAVIOR_TREE_LIBRARY} INTERFACE_LINK_LIBRARIES)
231
- #list(REMOVE_ITEM _libs X)
232
- #message("my_libs: ${my_libs}")
204
+ target_include_directories (${BEHAVIOR_TREE_LIBRARY}
205
+ PUBLIC
206
+ $< BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR} /include>
207
+ $< INSTALL_INTERFACE:include>
208
+ PRIVATE
209
+ $< BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR} /3rdparty>
210
+ $< BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR} /3rdparty/lexy/include>
211
+ $< BUILD_INTERFACE:${BTCPP_EXTRA_INCLUDE_DIRS} >
212
+ )
233
213
234
- #set_target_properties(${BEHAVIOR_TREE_LIBRARY} PROPERTIES INTERFACE_LINK_LIBRARIES "")
214
+ if (ZMQ_FOUND )
215
+ target_link_libraries (${BEHAVIOR_TREE_LIBRARY} PRIVATE
216
+ ${ZMQ_LIBRARIES} )
217
+ target_include_directories (${BEHAVIOR_TREE_LIBRARY} PRIVATE
218
+ ${ZMQ_INCLUDE_DIRS} )
219
+ target_compile_definitions (${BEHAVIOR_TREE_LIBRARY} PRIVATE ZMQ_FOUND )
220
+ endif ()
235
221
236
- target_compile_definitions (${BEHAVIOR_TREE_LIBRARY} PRIVATE $< $< CONFIG:Debug> :TINYXML2_DEBUG> )
222
+ if (BT_COROUTINES_FOUND )
223
+ target_link_libraries (${BEHAVIOR_TREE_LIBRARY} PRIVATE
224
+ ${Boost_LIBRARIES} )
225
+ target_include_directories (${BEHAVIOR_TREE_LIBRARY} PRIVATE
226
+ ${Boost_INCLUDE_DIRS} )
227
+ endif ()
237
228
238
- target_include_directories (${BEHAVIOR_TREE_LIBRARY} PUBLIC
239
- $< BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR} /include>
240
- $< INSTALL_INTERFACE:include>
241
- ${BUILD_TOOL_INCLUDE_DIRS} )
229
+ if (CURSES_FOUND )
230
+ target_link_libraries (${BEHAVIOR_TREE_LIBRARY} PRIVATE
231
+ ${CURSES_LIBRARIES} )
232
+ target_include_directories (${BEHAVIOR_TREE_LIBRARY} PRIVATE
233
+ ${CURSES_INCLUDE_DIRS} )
234
+ target_compile_definitions (${BEHAVIOR_TREE_LIBRARY} PRIVATE NCURSES_FOUND )
235
+ endif ()
242
236
243
- target_include_directories (${BEHAVIOR_TREE_LIBRARY} PRIVATE
244
- $< BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR} /3rdparty>
245
- $< BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR} /3rdparty/lexy/include>
246
- )
247
237
248
- if ( ZMQ_FOUND )
249
- target_compile_definitions (${BEHAVIOR_TREE_LIBRARY} PUBLIC ZMQ_FOUND )
250
- endif ()
238
+ target_compile_definitions (${BEHAVIOR_TREE_LIBRARY} PRIVATE $< $< CONFIG:Debug> :TINYXML2_DEBUG> )
251
239
252
240
if (MSVC )
253
241
else ()
@@ -258,7 +246,13 @@ endif()
258
246
#############################################################
259
247
if (ament_cmake_FOUND )
260
248
find_package (ament_index_cpp REQUIRED )
261
- ament_target_dependencies (${BEHAVIOR_TREE_LIBRARY} PUBLIC ament_index_cpp )
249
+
250
+ target_include_directories (${BEHAVIOR_TREE_LIBRARY} PRIVATE
251
+ $< BUILD_INTERFACE:${ament_index_cpp_INCLUDE_DIRS} > )
252
+
253
+ target_link_libraries (${BEHAVIOR_TREE_LIBRARY} PRIVATE
254
+ $< BUILD_INTERFACE:ament_index_cpp::ament_index_cpp> )
255
+
262
256
ament_export_dependencies (ament_index_cpp )
263
257
264
258
set ( BEHAVIOR_TREE_LIB_DESTINATION lib )
@@ -269,6 +263,13 @@ if(ament_cmake_FOUND)
269
263
ament_export_libraries (${BEHAVIOR_TREE_LIBRARY} )
270
264
ament_package ()
271
265
elseif (catkin_FOUND )
266
+
267
+ target_include_directories (${BEHAVIOR_TREE_LIBRARY} PRIVATE
268
+ ${catkin_INCLUDE_DIRS} )
269
+
270
+ target_link_libraries (${BEHAVIOR_TREE_LIBRARY} PRIVATE
271
+ ${catkin_LIBRARIES} )
272
+
272
273
set ( BEHAVIOR_TREE_LIB_DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION} )
273
274
set ( BEHAVIOR_TREE_INC_DESTINATION ${CATKIN_GLOBAL_INCLUDE_DESTINATION} )
274
275
set ( BEHAVIOR_TREE_BIN_DESTINATION ${CATKIN_GLOBAL_BIN_DESTINATION} )
@@ -321,14 +322,6 @@ configure_package_config_file(
321
322
INSTALL_DESTINATION "${BEHAVIOR_TREE_LIB_DESTINATION} /cmake/${PROJECT_NAME} "
322
323
)
323
324
324
- # This requires to declare to project version in the project() macro
325
-
326
- #write_basic_package_version_file(
327
- # "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake"
328
- # VERSION ${PROJECT_VERSION}
329
- # COMPATIBILITY AnyNewerVersion
330
- #)
331
-
332
325
install (
333
326
FILES
334
327
"${CMAKE_CURRENT_BINARY_DIR} /${PROJECT_NAME} Config.cmake"
0 commit comments