Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
B
bpftrace
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
bpftrace
Commits
ac16ae51
Commit
ac16ae51
authored
Jul 22, 2018
by
Alastair Robertson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Link to libclang
parent
b834cd3b
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
38 additions
and
25 deletions
+38
-25
CMakeLists.txt
CMakeLists.txt
+12
-2
src/CMakeLists.txt
src/CMakeLists.txt
+0
-8
src/ast/CMakeLists.txt
src/ast/CMakeLists.txt
+25
-1
tests/CMakeLists.txt
tests/CMakeLists.txt
+1
-14
No files found.
CMakeLists.txt
View file @
ac16ae51
cmake_minimum_required
(
VERSION 2.8.12
)
project
(
bpftrace
)
set
(
STATIC_LINKING OFF CACHE BOOL
"Build bpftrace as a statically linked executable"
)
add_compile_options
(
"-std=c++14"
)
add_compile_options
(
"-Wno-format-security"
)
#add_compile_options("-Wall")
...
...
@@ -39,6 +41,13 @@ else()
)
endif
()
if
(
STATIC_LINKING
)
set
(
CMAKE_EXE_LINKER_FLAGS
"-static"
)
set
(
CMAKE_FIND_LIBRARY_SUFFIXES
".a"
)
set
(
CMAKE_LINK_SEARCH_START_STATIC TRUE
)
set
(
CMAKE_LINK_SEARCH_END_STATIC TRUE
)
endif
()
set
(
CMAKE_MODULE_PATH
${
CMAKE_MODULE_PATH
}
${
CMAKE_CURRENT_SOURCE_DIR
}
/cmake
)
find_package
(
LibElf REQUIRED
)
include_directories
(
${
LIBELF_INCLUDE_DIRS
}
)
...
...
@@ -51,11 +60,12 @@ 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
)
find_package
(
LLVM REQUIRED
)
include_directories
(
${
LLVM_INCLUDE_DIRS
}
)
add_definitions
(
${
LLVM_DEFINITIONS
}
)
set
(
STATIC_LINKING OFF CACHE BOOL
"Build bpftrace as a statically linked executable"
)
find_package
(
Clang REQUIRED
)
include_directories
(
${
CLANG_INCLUDE_DIRS
}
)
add_subdirectory
(
src/arch
)
add_subdirectory
(
src/ast
)
...
...
src/CMakeLists.txt
View file @
ac16ae51
if
(
STATIC_LINKING
)
set
(
CMAKE_EXE_LINKER_FLAGS
"-static"
)
endif
()
add_executable
(
bpftrace
attached_probe.cpp
bpftrace.cpp
...
...
@@ -16,10 +12,6 @@ add_executable(bpftrace
target_link_libraries
(
bpftrace arch ast parser
)
llvm_map_components_to_libnames
(
llvm_libs bpfcodegen ipo irreader mcjit orcjit
)
target_link_libraries
(
bpftrace
${
llvm_libs
}
)
add_dependencies
(
bpftrace bcc-build
)
ExternalProject_Get_Property
(
bcc source_dir binary_dir
)
target_include_directories
(
bpftrace PUBLIC
${
source_dir
}
/src/cc
)
target_link_libraries
(
bpftrace
${
binary_dir
}
/src/cc/libbpf.a
)
...
...
src/ast/CMakeLists.txt
View file @
ac16ae51
...
...
@@ -11,6 +11,30 @@ target_include_directories(ast PUBLIC ${CMAKE_SOURCE_DIR}/src/ast)
target_include_directories
(
ast PUBLIC
${
CMAKE_BINARY_DIR
}
)
target_link_libraries
(
ast arch
)
add_dependencies
(
ast bcc-build
)
add_dependencies
(
ast bcc-build
parser
)
ExternalProject_Get_Property
(
bcc source_dir
)
target_include_directories
(
ast PUBLIC
${
source_dir
}
/src/cc
)
if
(
STATIC_LINKING
)
set
(
clang_libs
libclang.a
clangAST
clangAnalysis
clangBasic
clangDriver
clangEdit
clangFormat
clangFrontend
clangIndex
clangLex
clangParse
clangRewrite
clangSema
clangSerialization
clangToolingCore
)
llvm_map_components_to_libnames
(
llvm_libs bpfcodegen ipo irreader mcjit orcjit
${
LLVM_TARGETS_TO_BUILD
}
)
target_link_libraries
(
ast
${
clang_libs
}
)
target_link_libraries
(
ast
${
llvm_libs
}
)
else
()
target_link_libraries
(
ast LLVM libclang
)
endif
()
tests/CMakeLists.txt
View file @
ac16ae51
if
(
STATIC_LINKING
)
set
(
CMAKE_EXE_LINKER_FLAGS
"-static"
)
endif
()
add_compile_options
(
"-Wno-undef"
)
add_compile_options
(
"-Wno-switch-default"
)
add_compile_options
(
"-Wno-switch-enum"
)
...
...
@@ -21,19 +17,10 @@ add_executable(bpftrace_test
${
CMAKE_SOURCE_DIR
}
/src/mapkey.cpp
${
CMAKE_SOURCE_DIR
}
/src/printf.cpp
${
CMAKE_SOURCE_DIR
}
/src/types.cpp
${
CMAKE_SOURCE_DIR
}
/src/ast/ast.cpp
${
CMAKE_SOURCE_DIR
}
/src/ast/codegen_llvm.cpp
${
CMAKE_SOURCE_DIR
}
/src/ast/irbuilderbpf.cpp
${
CMAKE_SOURCE_DIR
}
/src/ast/printer.cpp
${
CMAKE_SOURCE_DIR
}
/src/ast/semantic_analyser.cpp
)
target_link_libraries
(
bpftrace_test arch parser
)
llvm_map_components_to_libnames
(
llvm_libs bpfcodegen ipo irreader mcjit
)
target_link_libraries
(
bpftrace_test
${
llvm_libs
}
)
target_link_libraries
(
bpftrace_test arch ast parser
)
add_dependencies
(
bpftrace_test bcc-build
)
ExternalProject_Get_Property
(
bcc source_dir binary_dir
)
target_include_directories
(
bpftrace_test PUBLIC
${
source_dir
}
/src/cc
)
target_link_libraries
(
bpftrace_test
${
binary_dir
}
/src/cc/libbpf.a
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment