Skip to content

Commit 7eda756

Browse files
committed
Add options to opt-out of vendored libraries
1 parent 5118048 commit 7eda756

File tree

1 file changed

+60
-11
lines changed

1 file changed

+60
-11
lines changed

CMakeLists.txt

Lines changed: 60 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,15 @@ option(USE_AFLPLUSPLUS "Use AFL++ instead of libFuzzer" OFF)
1919
option(ENABLE_DEBUG "Enable debug build with full symbols" OFF)
2020
option(FORCE_STATIC_LINKING "Force static linking of all dependencies" OFF)
2121

22+
option(USE_VENDORED_CPPSQLITE "Use the bundled version of cpp-sqlite" ON)
23+
option(USE_VENDORED_CPPZMQ "Use the bundled version of cppzmq" ON)
24+
option(USE_VENDORED_FLATBUFFERS "Use the bundled version of flatbuffers" ON)
25+
option(USE_VENDORED_LEXY "Use the bundled version of lexy" ON)
26+
option(USE_VENDORED_MINICORO "Use the bundled version of minicoro" ON)
27+
option(USE_VENDORED_MINITRACE "Use the bundled version of minitrace" ON)
28+
option(USE_VENDORED_TINYXML2 "Use the bundled version of tinyxml2" ON)
29+
option(USE_VENDORED_WILDCARDS "Use the bundled version of wildcards" ON)
30+
2231
set(BASE_FLAGS "")
2332

2433
if(ENABLE_DEBUG)
@@ -61,10 +70,6 @@ if(USE_V3_COMPATIBLE_NAMES)
6170
add_definitions(-DUSE_BTCPP3_OLD_NAMES)
6271
endif()
6372

64-
#---- Find other packages ----
65-
find_package(Threads REQUIRED)
66-
67-
6873
set(BEHAVIOR_TREE_LIBRARY ${PROJECT_NAME})
6974

7075
# Update the policy setting to avoid an error when loading the ament_cmake package
@@ -90,19 +95,63 @@ else()
9095
endif()
9196

9297
#############################################################
93-
# LIBRARY
98+
# Handle dependencies
99+
100+
find_package(Threads REQUIRED)
101+
102+
if(BTCPP_GROOT_INTERFACE)
103+
find_package(ZeroMQ REQUIRED)
104+
endif()
105+
106+
if(BTCPP_SQLITE_LOGGING)
107+
if(USE_VENDORED_CPPSQLITE)
108+
add_subdirectory(3rdparty/cpp-sqlite)
109+
else()
110+
find_package(cpp-sqlite REQUIRED)
111+
endif()
112+
endif()
113+
114+
if(USE_VENDORED_CPPZMQ)
115+
add_subdirectory(3rdparty/cppzmq)
116+
else()
117+
find_package(cppzmq REQUIRED)
118+
endif()
119+
120+
if(USE_VENDORED_FLATBUFFERS)
121+
add_subdirectory(3rdparty/flatbuffers)
122+
else()
123+
find_package(flatbuffers REQUIRED)
124+
endif()
94125

95-
if(NOT BUILDING_WITH_CONAN)
126+
if(USE_VENDORED_LEXY)
127+
add_subdirectory(3rdparty/lexy)
128+
else()
129+
find_package(lexy REQUIRED)
130+
endif()
131+
132+
if(USE_VENDORED_MINICORO)
96133
add_subdirectory(3rdparty/minicoro)
134+
else()
135+
find_package(minicoro REQUIRED)
136+
endif()
137+
138+
if(USE_VENDORED_MINITRACE)
97139
add_subdirectory(3rdparty/minitrace)
140+
else()
141+
find_package(minitrace REQUIRED)
142+
endif()
143+
144+
if(USE_VENDORED_TINYXML2)
98145
add_subdirectory(3rdparty/tinyxml2)
146+
else()
147+
find_package(tinyxml2 REQUIRED)
99148
endif()
100149

101-
# Libraries not yet supported by conan
102-
add_subdirectory(3rdparty/lexy)
103-
add_subdirectory(3rdparty/cpp-sqlite) # https://github.com/conan-io/conan-center-index/pull/28407
104-
add_subdirectory(3rdparty/cppzmq)
105-
add_subdirectory(3rdparty/wildcards) # The version supported by conan is newer and not compatible with behaviortree.cpp
150+
if(USE_VENDORED_WILDCARDS)
151+
add_subdirectory(3rdparty/wildcards)
152+
else()
153+
find_package(wildcards REQUIRED)
154+
endif()
106155

107156
list(APPEND BT_SOURCE
108157
src/action_node.cpp

0 commit comments

Comments
 (0)