-
Notifications
You must be signed in to change notification settings - Fork 15
/
Copy pathCMakeLists.txt
63 lines (55 loc) · 2.01 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
cmake_minimum_required(VERSION 2.8.12)
project(bpftrace)
add_compile_options("-std=c++14")
add_compile_options("-Wno-format-security")
#add_compile_options("-Wall")
#add_compile_options("-Wextra")
#add_compile_options("-Wundef")
#add_compile_options("-Wpointer-arith")
#add_compile_options("-Wcast-align")
#add_compile_options("-Wwrite-strings")
#add_compile_options("-Wcast-qual")
#add_compile_options("-Wswitch-default")
#add_compile_options("-Wswitch-enum")
#add_compile_options("-Wconversion")
#add_compile_options("-Wunreachable-code")
#add_compile_options("-Wformat=2")
#add_compile_options("-Wstrict-overflow=5")
#add_compile_options("-Wdisabled-optimization")
enable_testing()
if (OFFLINE_BUILDS)
include(ExternalProject)
ExternalProject_Add(bcc
GIT_REPOSITORY https://github.com/iovisor/bcc
STEP_TARGETS build update
EXCLUDE_FROM_ALL 1
UPDATE_DISCONNECTED 1
BUILD_COMMAND ${CMAKE_COMMAND} --build . --target bcc-static
)
else()
include(ExternalProject)
ExternalProject_Add(bcc
GIT_REPOSITORY https://github.com/iovisor/bcc
STEP_TARGETS build update
EXCLUDE_FROM_ALL 1
BUILD_COMMAND ${CMAKE_COMMAND} --build . --target bcc-static
)
endif()
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
find_package(LibElf REQUIRED)
include_directories(${LIBELF_INCLUDE_DIRS})
find_package(BISON REQUIRED)
find_package(FLEX REQUIRED)
bison_target(bison_parser src/parser.yy ${CMAKE_BINARY_DIR}/parser.tab.cc)
flex_target(flex_lexer src/lexer.l ${CMAKE_BINARY_DIR}/lex.yy.cc)
add_flex_bison_dependency(flex_lexer bison_parser)
add_library(parser ${BISON_bison_parser_OUTPUTS} ${FLEX_flex_lexer_OUTPUTS})
target_include_directories(parser PUBLIC src src/ast ${CMAKE_BINARY_DIR})
find_package(LLVM REQUIRED CONFIG)
include_directories(${LLVM_INCLUDE_DIRS})
add_definitions(${LLVM_DEFINITIONS})
set(STATIC_LINKING OFF CACHE BOOL "Build bpftrace as a statically linked executable")
add_subdirectory(src/arch)
add_subdirectory(src/ast)
add_subdirectory(src)
add_subdirectory(tests)