-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathCMakeLists.txt
68 lines (52 loc) · 1.55 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
64
65
66
67
cmake_minimum_required(VERSION 3.14) # Increased minimum version for FetchContent
project(LLVMExamplePass)
# Set C++17 standard
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
find_package(LLVM REQUIRED CONFIG)
add_definitions(${LLVM_DEFINITIONS})
include_directories(${LLVM_INCLUDE_DIRS})
link_directories(${LLVM_LIBRARY_DIRS})
# Add Z3 library
find_package(Z3 REQUIRED)
include_directories(${Z3_INCLUDE_DIRS})
include_directories(include)
add_library(passes MODULE
lib/ExamplePass.cpp
lib/Pluto/BogusControlFlowPass.cpp
lib/Pluto/CryptoUtils.cpp
lib/Pluto/Flattening.cpp
lib/Pluto/GlobalEncryption.cpp
lib/Pluto/IndirectCall.cpp
lib/Pluto/MBAUtils.cpp
lib/Pluto/MBAObfuscation.cpp
lib/Pluto/Substitution.cpp
lib/PassRegistration.cpp
)
# Link Z3 library to passes
target_link_libraries(passes PRIVATE ${Z3_LIBRARIES})
add_executable(wrapper wrapper/wrapper.cpp)
target_link_libraries(wrapper PRIVATE seccomp)
# Fetch GTest
include(FetchContent)
FetchContent_Declare(
googletest
GIT_REPOSITORY https://github.com/google/googletest.git
GIT_TAG release-1.12.1
)
FetchContent_MakeAvailable(googletest)
# Enable testing
enable_testing()
# Add test executable
add_executable(tests tests/tests.cpp)
target_link_libraries(tests GTest::gtest_main)
# Add test to CTest
add_test(NAME tests COMMAND tests)
# Custom command to run the test
add_custom_target(run_test
COMMAND ${CMAKE_CURRENT_BINARY_DIR}/tests
DEPENDS tests passes
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
COMMENT "Running tests"
)