forked from intel/llvm
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
206 lines (187 loc) · 4.69 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
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
# Test runner infrastructure for Clang. This configures the Clang test trees
# for use by Lit, and delegates to LLVM's lit test handlers.
llvm_canonicalize_cmake_booleans(
CLANG_BUILD_EXAMPLES
CLANG_BUILT_STANDALONE
CLANG_DEFAULT_PIE_ON_LINUX
CLANG_ENABLE_ARCMT
CLANG_ENABLE_STATIC_ANALYZER
CLANG_PLUGIN_SUPPORT
CLANG_SPAWN_CC1
CLANG_ENABLE_CIR
ENABLE_BACKTRACES
LLVM_ENABLE_ZLIB
LLVM_ENABLE_ZSTD
LLVM_ENABLE_PER_TARGET_RUNTIME_DIR
LLVM_ENABLE_THREADS
LLVM_ENABLE_REVERSE_ITERATION
LLVM_WITH_Z3
PPC_LINUX_DEFAULT_IEEELONGDOUBLE
LLVM_TOOL_LLVM_DRIVER_BUILD
)
configure_lit_site_cfg(
${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.py.in
${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg.py
MAIN_CONFIG
${CMAKE_CURRENT_SOURCE_DIR}/lit.cfg.py
PATHS
"LLVM_SOURCE_DIR"
"LLVM_BINARY_DIR"
"LLVM_TOOLS_DIR"
"LLVM_LIBS_DIR"
"SHLIBDIR"
"LLVM_LIT_TOOLS_DIR"
"LLVM_EXTERNAL_LIT"
"CLANG_BINARY_DIR"
"CLANG_SOURCE_DIR"
"CURRENT_TOOLS_DIR"
"CMAKE_LIBRARY_OUTPUT_DIRECTORY"
)
configure_lit_site_cfg(
${CMAKE_CURRENT_SOURCE_DIR}/Unit/lit.site.cfg.py.in
${CMAKE_CURRENT_BINARY_DIR}/Unit/lit.site.cfg.py
MAIN_CONFIG
${CMAKE_CURRENT_SOURCE_DIR}/Unit/lit.cfg.py
PATHS
"LLVM_SOURCE_DIR"
"LLVM_BINARY_DIR"
"LLVM_TOOLS_DIR"
"LLVM_LIBS_DIR"
"CLANG_BINARY_DIR"
"SHLIBDIR"
)
option(CLANG_TEST_USE_VG "Run Clang tests under Valgrind" OFF)
if(CLANG_TEST_USE_VG)
set(CLANG_TEST_EXTRA_ARGS ${CLANG_TEST_EXTRA_ARGS} "--vg")
endif ()
list(APPEND CLANG_TEST_DEPS
apinotes-test
c-index-test
clang
clang-fuzzer-dictionary
clang-resource-headers
clang-format
clang-tblgen
clang-offload-bundler
clang-offload-deps
clang-offload-extract
clang-import-test
clang-rename
clang-refactor
clang-diff
clang-installapi
clang-scan-deps
clang-linker-wrapper
clang-offload-bundler
clang-offload-packager
diagtool
hmaptool
)
if(CLANG_ENABLE_STATIC_ANALYZER)
list(APPEND CLANG_TEST_DEPS
clang-check
clang-extdef-mapping
)
endif()
if (CLANG_ENABLE_ARCMT)
list(APPEND CLANG_TEST_DEPS
arcmt-test
c-arcmt-test
)
endif ()
if(CLANG_BUILD_EXAMPLES AND CLANG_PLUGIN_SUPPORT)
list(APPEND CLANG_TEST_DEPS
Attribute
AnnotateFunctions
CallSuperAttr
PluginsOrder
PrintFunctionNames
LLVMPrintFunctionNames
)
endif ()
set(CLANG_TEST_PARAMS
USE_Z3_SOLVER=0
)
if( NOT CLANG_BUILT_STANDALONE )
list(APPEND CLANG_TEST_DEPS
llvm-config
FileCheck count not
append-file
llc
llvm-ar
llvm-as
llvm-ar
llvm-bcanalyzer
llvm-cat
llvm-cxxfilt
llvm-dis
llvm-dwarfdump
llvm-ifs
llvm-lto2
llvm-modextract
llvm-nm
llvm-objcopy
llvm-objdump
llvm-pdbutil
llvm-profdata
llvm-rc
llvm-readelf
llvm-readobj
llvm-readtapi
llvm-strip
llvm-symbolizer
llvm-windres
obj2yaml
opt
split-file
yaml2obj
)
if(TARGET llvm-lto)
list(APPEND CLANG_TEST_DEPS llvm-lto)
endif()
endif()
if(CLANG_ENABLE_STATIC_ANALYZER)
if(CLANG_PLUGIN_SUPPORT AND LLVM_ENABLE_PLUGINS) # Determine if we built them
list(APPEND CLANG_TEST_DEPS
SampleAnalyzerPlugin
CheckerDependencyHandlingAnalyzerPlugin
CheckerOptionHandlingAnalyzerPlugin
)
endif()
endif()
if (HAVE_CLANG_REPL_SUPPORT)
list(APPEND CLANG_TEST_DEPS
clang-repl
)
endif()
# Copy gen_ast_dump_json_test.py to the clang build dir. This allows invoking
# it without having to pass the --clang= argument
configure_file(AST/gen_ast_dump_json_test.py
${CLANG_BINARY_DIR}/bin/gen_ast_dump_json_test.py COPYONLY)
add_custom_target(clang-test-depends DEPENDS ${CLANG_TEST_DEPS})
set_target_properties(clang-test-depends PROPERTIES FOLDER "Clang tests")
add_lit_testsuite(check-clang "Running the Clang regression tests"
${CMAKE_CURRENT_BINARY_DIR}
#LIT ${LLVM_LIT}
PARAMS ${CLANG_TEST_PARAMS}
DEPENDS ${CLANG_TEST_DEPS}
ARGS ${CLANG_TEST_EXTRA_ARGS}
)
set_target_properties(check-clang PROPERTIES FOLDER "Clang tests")
add_lit_testsuites(CLANG ${CMAKE_CURRENT_SOURCE_DIR}
PARAMS ${CLANG_TEST_PARAMS}
DEPENDS ${CLANG_TEST_DEPS}
FOLDER "Clang tests/Suites"
)
# Add a legacy target spelling: clang-test
add_custom_target(clang-test)
add_dependencies(clang-test check-clang)
set_target_properties(clang-test PROPERTIES FOLDER "Clang tests")
# FIXME: This logic can be removed once all buildbots have moved
# debuginfo-test from clang/test to llvm/projects or monorepo.
if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/debuginfo-tests)
message(WARNING "Including debuginfo-tests in clang/test is deprecated. Move to llvm/projects or use monorepo.")
if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/debuginfo-tests/CMakeLists.txt)
add_subdirectory(debuginfo-tests)
endif()
endif()