@@ -3,14 +3,22 @@ project(cactus_rt)
33
44set (CMAKE_EXPORT_COMPILE_COMMANDS ON )
55
6+ #################
7+ # Setup options #
8+ #################
9+
10+ # Used for building cactus-rt when all dependencies are vendored
11+ option (CACTUS_RT_ENABLE_FETCH_DEPENDENCIES "Fetch dependencies during build" ON )
12+
13+ # Used to disable tracing in some builds where the overhead of tracing is unwanted.
14+ option (CACTUS_RT_ENABLE_TRACING "Enable runtime tracing support" ON )
15+
16+ # Below are internal options
617option (ENABLE_CLANG_TIDY "Run clang-tidy" OFF )
718option (ENABLE_EXAMPLES "Build example programs" ON )
8- option (ENABLE_TRACING "Enable runtime tracing support" ON )
919option (ENABLE_ROS2 "Enables ROS2 support" OFF )
1020option (BUILD_DOCS "Build documentations" OFF )
1121
12- # Used for building cactus-rt when all dependencies are vendored
13- option (CACTUS_RT_ENABLE_FETCH_DEPENDENCIES "Fetch dependencies during build" ON )
1422
1523# https://stackoverflow.com/questions/5395309/how-do-i-force-cmake-to-include-pthread-option-during-compilation
1624set (CMAKE_THREAD_PREFER_PTHREAD TRUE )
@@ -105,10 +113,8 @@ endfunction()
105113# Cactus RT library #
106114#####################
107115
108- if (${CMAKE_PROJECT_NAME} STREQUAL ${PROJECT_NAME} )
109- if (ENABLE_TRACING)
110- add_subdirectory (protos)
111- endif ()
116+ if (CACTUS_RT_ENABLE_TRACING)
117+ add_subdirectory (protos)
112118endif ()
113119
114120add_library (cactus_rt
@@ -136,28 +142,28 @@ target_link_libraries(cactus_rt
136142# Use a bounded queue
137143target_compile_definitions (cactus_rt PUBLIC QUILL_USE_BOUNDED_QUEUE)
138144
139- if (${CMAKE_PROJECT_NAME} STREQUAL ${PROJECT_NAME} )
140- if (ENABLE_TRACING)
141- target_sources (cactus_rt
142- PRIVATE
143- src/cactus_rt/tracing/sink.cc
144- src/cactus_rt/tracing/thread_tracer.cc
145- src/cactus_rt/tracing/trace_aggregator.cc
146- src/cactus_rt/tracing/tracing_enabled.cc
147- src/cactus_rt/tracing/utils/string_interner.cc
148- )
145+ if (CACTUS_RT_ENABLE_TRACING)
146+ target_sources (cactus_rt
147+ PRIVATE
148+ src/cactus_rt/tracing/sink.cc
149+ src/cactus_rt/tracing/thread_tracer.cc
150+ src/cactus_rt/tracing/trace_aggregator.cc
151+ src/cactus_rt/tracing/tracing_enabled.cc
152+ src/cactus_rt/tracing/utils/string_interner.cc
153+ )
149154
150- target_link_libraries (cactus_rt
151- PUBLIC
152- cactus_tracing_embedded_perfetto_protos
153- )
155+ target_link_libraries (cactus_rt
156+ PUBLIC
157+ cactus_tracing_embedded_perfetto_protos
158+ )
154159
155- target_compile_definitions (cactus_rt
156- PUBLIC
157- CACTUS_RT_TRACING_ENABLED=1
158- )
159- endif ()
160+ target_compile_definitions (cactus_rt
161+ PUBLIC
162+ CACTUS_RT_TRACING_ENABLED=1
163+ )
164+ endif ()
160165
166+ if (${CMAKE_PROJECT_NAME} STREQUAL ${PROJECT_NAME} )
161167 if (ENABLE_CLANG_TIDY)
162168 find_program (CLANG_TIDY clang-tidy clang-tidy-18 clang-tidy-17 clang-tidy-16 clang-tidy-15 clang-tidy-14)
163169 else ()
@@ -191,7 +197,7 @@ if(${CMAKE_PROJECT_NAME} STREQUAL ${PROJECT_NAME})
191197 add_subdirectory (examples/simple_example)
192198 add_subdirectory (examples/random_example)
193199
194- if (ENABLE_TRACING )
200+ if (CACTUS_RT_ENABLE_TRACING )
195201 add_subdirectory (examples/tracing_protos_example)
196202 add_subdirectory (examples/tracing_example)
197203 add_subdirectory (examples/tracing_example_no_rt)
0 commit comments