Skip to content

Commit

Permalink
allowing examples and tests to not be built
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
juchem authored and yonghong-song committed Dec 29, 2020
1 parent 61d2896 commit 8fac710
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,9 @@ option(ENABLE_RTTI "Enable compiling with real time type information" OFF)
option(ENABLE_LLVM_SHARED "Enable linking LLVM as a shared library" OFF)
option(ENABLE_CLANG_JIT "Enable Loading BPF through Clang Frontend" ON)
option(ENABLE_USDT "Enable User-level Statically Defined Tracing" ON)
option(ENABLE_EXAMPLES "Build examples" ON)
option(ENABLE_MAN "Build man pages" ON)
option(ENABLE_TESTS "Build tests" ON)
CMAKE_DEPENDENT_OPTION(ENABLE_CPP_API "Enable C++ API" ON "ENABLE_USDT" OFF)

set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
Expand Down Expand Up @@ -119,10 +121,14 @@ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall ${CXX_ISYSTEM_DIRS}")
add_subdirectory(src)
add_subdirectory(introspection)
if(ENABLE_CLANG_JIT)
if(ENABLE_EXAMPLES)
add_subdirectory(examples)
endif(ENABLE_EXAMPLES)
if(ENABLE_MAN)
add_subdirectory(man)
endif(ENABLE_MAN)
if(ENABLE_TESTS)
add_subdirectory(tests)
endif(ENABLE_TESTS)
add_subdirectory(tools)
endif(ENABLE_CLANG_JIT)

0 comments on commit 8fac710

Please sign in to comment.