-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathCMakeLists.txt
executable file
·136 lines (115 loc) · 2.87 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
123
124
125
126
127
128
129
130
131
132
133
134
135
136
cmake_minimum_required (VERSION 2.6)
project (Sherlock)
set( CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin )
set( CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib )
set( CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib )
set( LLVM_HOME /.../compiler/llvm )
set( LLVM_SRC_DIR ${LLVM_HOME}/llvm )
set( CLANG_SRC_DIR ${LLVM_HOME}/llvm/tools/clang )
set( LLVM_BUILD_DIR ${LLVM_HOME}/llvm_build )
set( CLANG_BUILD_DIR ${LLVM_HOME}/llvm_build/tools/clang)
add_definitions (-D__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS)
add_definitions (-D_GNU_SOURCE -DHAVE_CLANG_CONFIG_H)
set (CMAKE_CXX_COMPILER "${LLVM_BUILD_DIR}/bin/clang++")
set (CMAKE_CC_COMPILER "${LLVM_BUILD_DIR}/bin/clang")
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}
-fPIC
-fno-common
-Woverloaded-virtual
-Wcast-qual
-fno-strict-aliasing
-pedantic
-Wno-long-long
-Wall
-Wno-unused-parameter
-Wwrite-strings
-fno-exceptions
-fno-rtti"
)
set(CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LANGUAGE_STANDARD "c++11")
set(CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LIBRARY "libc++")
set (CMAKE_MODULE_LINKER_FLAGS "-Wl,-flat_namespace -Wl,-undefined -Wl,suppress")
set (LLVM_LIBS
LLVMX86CodeGen
LLVMX86AsmParser
LLVMX86Disassembler
LLVMExecutionEngine
LLVMAsmPrinter
LLVMSelectionDAG
LLVMX86AsmPrinter
LLVMX86Info
LLVMMCParser
LLVMCodeGen
LLVMX86Utils
LLVMScalarOpts
LLVMInstCombine
LLVMTransformUtils
LLVMAnalysis
LLVMTarget
LLVMCore
LLVMMC
LLVMSupport
LLVMBitReader
LLVMOption
LLVMProfileData
)
macro(add_clang_plugin name)
set (srcs ${ARGN})
include_directories( "${LLVM_SRC_DIR}/include"
"${CLANG_SRC_DIR}/include"
"${LLVM_BUILD_DIR}/include"
"${CLANG_BUILD_DIR}/include" )
link_directories( "${LLVM_BUILD_DIR}/lib" )
add_library( ${name} SHARED ${srcs} )
if (SYMBOL_FILE)
set_target_properties( ${name} PROPERTIES LINK_FlAGS
"-exported_symbols_list ${SYMBOL_FILE}")
endif()
foreach (clang_lib ${CLANG_LIBS})
target_link_libraries( ${name} ${clang_lib} )
endforeach()
foreach (llvm_lib ${LLVM_LIBS})
target_link_libraries( ${name} ${llvm_lib} )
endforeach()
foreach (user_lib ${USER_LIBS})
target_link_libraries( ${name} ${user_lib} )
endforeach()
endmacro(add_clang_plugin)
set(SYMBOL_FILE Sherlock.exports)
set (CLANG_LIBS
clang
clangFrontend
clangAST
clangAnalysis
clangBasic
clangCodeGen
clangDriver
clangFrontendTool
clangLex
clangParse
clangSema
clangEdit
clangSerialization
clangStaticAnalyzerCheckers
clangStaticAnalyzerCore
clangStaticAnalyzerFrontend
)
set (USER_LIBS
pthread
curses
z
)
add_clang_plugin(Sherlock
SherlockConfigure.hpp
Sherlock.hpp
Sherlock.cpp
SherlockInitDesign.hpp
SherlockInitDesign.cpp
SherlockObservePairing.hpp
SherlockObservePairing.cpp
SherlockParser.hpp
SherlockParser.cpp
)
set_target_properties(Sherlock PROPERTIES
LINKER_LANGUAGE CXX
PREFIX "")