-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
123 lines (100 loc) · 3.4 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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
cmake_minimum_required(VERSION 3.5)
project(SeaCut)
message(STATUS "LLVM_DIR is ${LLVM_DIR}")
find_package(LLVM 9.0 REQUIRED CONFIG EXACT PATHS ${LLVM_DIR})
message(STATUS "Found LLVM ${LLVM_PACKAGE_VERSION}")
message(STATUS "Using LLVMConfig.cmake in: ${LLVM_DIR}")
list(APPEND CMAKE_MODULE_PATH "${LLVM_CMAKE_DIR}")
include(AddLLVM)
include(HandleLLVMOptions)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${LLVM_CXXFLAGS}")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${LLVM_LDFLAGS}")
include_directories(${LLVM_INCLUDE_DIRS})
link_directories(${LLVM_LIBRARY_DIRS})
add_definitions(${LLVM_DEFINITIONS})
file(TO_NATIVE_PATH "${LLVM_TOOLS_BINARY_DIR}/llvm-config${CMAKE_EXECUTABLE_SUFFIX}" LLVM_CONFIG)
execute_process(COMMAND ${LLVM_CONFIG} --system-libs --link-static OUTPUT_VARIABLE LLVM_SYSTEM_LIBS_RAW)
string(STRIP "${LLVM_SYSTEM_LIBS_RAW}" LLVM_SYSTEM_LIBS_RAW) # strip whitespace from start & end
string(REPLACE " " ";" LLVM_SYSTEM_LIBS "${LLVM_SYSTEM_LIBS_RAW}") # convert into a list
if("${LLVM_SYSTEM_LIBS}" STREQUAL "")
message(WARNING "'llvm-config --system-libs --link-static' is empty; this is possibly wrong.")
endif()
execute_process(COMMAND ${LLVM_CONFIG} --libs OUTPUT_VARIABLE LLVM_LIBS_RAW)
string(STRIP "${LLVM_LIBS_RAW}" LLVM_LIBS_RAW) # strip whitespace from start & end
string(REPLACE " " ";" LLVM_LIBS "${LLVM_LIBS_RAW}") # convert into a list
if("${LLVM_LIBS}" STREQUAL "")
message(WARNING "'llvm-config --libs' is empty; this is possibly wrong.")
endif()
SET(CLANG_LIBS
clangAnalysis
clangARCMigrate
clangAST
clangASTMatchers
clangBasic
clangCodeGen
clangCrossTU
clangDriver
clangDynamicASTMatchers
clangEdit
clangFormat
clangFrontend
clangFrontendTool
clangHandleCXX
clangHandleLLVM
clangIndex
clangLex
clangParse
clangRewrite
clangRewriteFrontend
clangSema
clangSerialization
clangStaticAnalyzerCheckers
clangStaticAnalyzerCore
clangStaticAnalyzerFrontend
clangTooling
clangToolingASTDiff
clangToolingCore
clangToolingInclusions
clangToolingRefactoring
clangToolingSyntax
)
add_compile_options(-fno-rtti)
add_compile_options(-fno-exceptions)
#add_compile_options(-march=native)
if (SEACUT_USE_LINKER)
set(OLD_CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS})
set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -fuse-ld=${SEACUT_USE_LINKER}")
check_cxx_source_compiles("int main() { return 0; }" CXX_SUPPORTS_CUSTOM_LINKER)
if (NOT CXX_SUPPORTS_CUSTOM_LINKER)
message(FATAL_ERROR "Host compiler does not support '-fuse-ld=${SEACUT_USE_LINKER}'")
endif()
set(CMAKE_REQUIRED_FLAGS ${OLD_CMAKE_REQUIRED_FLAGS})
append("-fuse-ld=${SEACUT_USE_LINKER}"
CMAKE_EXE_LINKER_FLAGS CMAKE_MODULE_LINKER_FLAGS CMAKE_SHARED_LINKER_FLAGS)
message(STATUS "Using linker: ${SEACUT_USE_LINKER}")
endif()
# set(LLVM_LINK_COMPONENTS
# Support
# )
set(SEACUT_SOURCES
)
add_executable(sea-cut sea-cut.cpp
${SEACUT_SOURCES}
)
#llvm_config(sea-cut ${LLVM_LINK_COMPONENTS})
set(THREADS_PREFER_PTHREAD_FLAG ON)
find_package(Threads REQUIRED)
target_link_libraries(sea-cut
${LLVM_SYSTEM_LIBS}
${LLVM_LIBS}
${CLANG_LIBS}
)
add_subdirectory(tests)
# add_executable(test-smt-jit doctest_main_smt_jit.cpp
# ${SEACUT_SOURCES}
# parser_tests.cpp
# )
# llvm_config(test-smt-jit ${LLVM_LINK_COMPONENTS})
# target_link_libraries(test-smt-jit LINK_PUBLIC bvlib sexpresso)
# enable_testing()
# add_test(NAME test-smt-jit COMMAND test-smt-jit DEPENDS test-smt-jit)