@@ -3,6 +3,10 @@ project(behavior_tree_core)
3
3
4
4
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -pthread -Werror=return-type -Wall -Wpedantic -Wattributes" )
5
5
set (CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_LIST_DIR} /cmake" )
6
+
7
+ option (BUILD_EXAMPLES "Build tutorials and examples" ON )
8
+ option (BUILD_UNIT_TESTS "Build the unit tests" ON )
9
+
6
10
#############################################################
7
11
# http://answers.ros.org/question/230877/optionally-build-a-package-with-catkin/
8
12
#
@@ -30,7 +34,7 @@ else(catkin_FOUND)
30
34
set (CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR} /bin )
31
35
set (CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR} /bin )
32
36
set (CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR} /bin )
33
-
37
+
34
38
find_package (GTest )
35
39
include_directories (${GTEST_INCLUDE_DIRS} )
36
40
if (NOT GTEST_FOUND )
@@ -41,14 +45,14 @@ endif(catkin_FOUND)
41
45
42
46
43
47
set (BT_Source
44
- src/action_node.cpp
48
+ src/action_node.cpp
45
49
src/basic_types.cpp
46
50
src/decorator_node.cpp
47
- src/condition_node.cpp
48
- src/control_node.cpp
49
- src/exceptions.cpp
50
- src/leaf_node.cpp
51
- src/tick_engine.cpp
51
+ src/condition_node.cpp
52
+ src/control_node.cpp
53
+ src/exceptions.cpp
54
+ src/leaf_node.cpp
55
+ src/tick_engine.cpp
52
56
src/tree_node.cpp
53
57
src/bt_factory.cpp
54
58
src/behavior_tree.cpp
@@ -100,11 +104,11 @@ target_link_libraries(behavior_tree_core dl)
100
104
######################################################
101
105
# EXAMPLES and TOOLS
102
106
######################################################
103
-
104
- add_subdirectory (tools )
105
- add_subdirectory (sample_nodes )
106
- add_subdirectory (examples )
107
-
107
+ if ( BUILD_EXAMPLES )
108
+ add_subdirectory (tools )
109
+ add_subdirectory (sample_nodes )
110
+ add_subdirectory (examples )
111
+ endif ()
108
112
######################################################
109
113
# TESTS
110
114
######################################################
@@ -126,8 +130,8 @@ if(catkin_FOUND AND CATKIN_ENABLE_TESTING)
126
130
target_link_libraries (behavior_tree_core_test
127
131
${BEHAVIOR_TREE_LIBRARIES} crossdoor_nodes
128
132
${catkin_LIBRARIES} )
129
-
130
- elseif (GTEST_FOUND )
133
+
134
+ elseif (GTEST_FOUND AND BUILD_UNIT_TESTS )
131
135
include_directories (gtest/include )
132
136
133
137
add_executable (behavior_tree_core_test ${BT_Tests} )
@@ -136,9 +140,5 @@ elseif(GTEST_FOUND)
136
140
${GTEST_LIBRARIES}
137
141
${GTEST_MAIN_LIBRARIES}
138
142
)
139
-
140
- endif ()
141
-
142
-
143
-
144
143
144
+ endif ()
0 commit comments