Skip to content

Commit 8fac710

Browse files
juchemyonghong-song
authored andcommitted
allowing examples and tests to not be built
Building examples and tests take up a lot of time and disk space. In many use-cases, though, `bcc` is built solely for the library portion, as a dependency of another project. This patch allows one to opt out of building the examples and tests, saving up time and disk space in the process. Default behavior (build them) is kept. In my machine this lowers build time from 1.5 hours to 18 minutes.
1 parent 61d2896 commit 8fac710

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

CMakeLists.txt

+6
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,9 @@ option(ENABLE_RTTI "Enable compiling with real time type information" OFF)
3939
option(ENABLE_LLVM_SHARED "Enable linking LLVM as a shared library" OFF)
4040
option(ENABLE_CLANG_JIT "Enable Loading BPF through Clang Frontend" ON)
4141
option(ENABLE_USDT "Enable User-level Statically Defined Tracing" ON)
42+
option(ENABLE_EXAMPLES "Build examples" ON)
4243
option(ENABLE_MAN "Build man pages" ON)
44+
option(ENABLE_TESTS "Build tests" ON)
4345
CMAKE_DEPENDENT_OPTION(ENABLE_CPP_API "Enable C++ API" ON "ENABLE_USDT" OFF)
4446

4547
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
@@ -119,10 +121,14 @@ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall ${CXX_ISYSTEM_DIRS}")
119121
add_subdirectory(src)
120122
add_subdirectory(introspection)
121123
if(ENABLE_CLANG_JIT)
124+
if(ENABLE_EXAMPLES)
122125
add_subdirectory(examples)
126+
endif(ENABLE_EXAMPLES)
123127
if(ENABLE_MAN)
124128
add_subdirectory(man)
125129
endif(ENABLE_MAN)
130+
if(ENABLE_TESTS)
126131
add_subdirectory(tests)
132+
endif(ENABLE_TESTS)
127133
add_subdirectory(tools)
128134
endif(ENABLE_CLANG_JIT)

0 commit comments

Comments
 (0)