gn build: Merge r374476
[llvm-complete.git] / test / CMakeLists.txt
bloba75be0998d26eaf6c8cddd05f1b5f81627ea7875
1 llvm_canonicalize_cmake_booleans(
2   BUILD_SHARED_LIBS
3   HAVE_LIBXAR
4   HAVE_LIBZ
5   HAVE_OCAMLOPT
6   HAVE_OCAML_OUNIT
7   LLVM_ENABLE_DIA_SDK
8   LLVM_ENABLE_FFI
9   LLVM_ENABLE_THREADS
10   LLVM_INCLUDE_GO_TESTS
11   LLVM_LIBXML2_ENABLED
12   LLVM_LINK_LLVM_DYLIB
13   LLVM_TOOL_LTO_BUILD
14   LLVM_USE_INTEL_JITEVENTS
15   LLVM_BUILD_EXAMPLES
16   LLVM_ENABLE_PLUGINS
17   )
19 configure_lit_site_cfg(
20   ${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.py.in
21   ${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg.py
22   MAIN_CONFIG
23   ${CMAKE_CURRENT_SOURCE_DIR}/lit.cfg.py
24   )
25 configure_lit_site_cfg(
26   ${CMAKE_CURRENT_SOURCE_DIR}/Unit/lit.site.cfg.py.in
27   ${CMAKE_CURRENT_BINARY_DIR}/Unit/lit.site.cfg.py
28   MAIN_CONFIG
29   ${CMAKE_CURRENT_SOURCE_DIR}/Unit/lit.cfg.py
30   )
32 # Don't include check-llvm into check-all without LLVM_BUILD_TOOLS.
33 if(NOT LLVM_BUILD_TOOLS)
34   set(EXCLUDE_FROM_ALL ON)
35 endif()
37 # Set the depends list as a variable so that it can grow conditionally.
38 # NOTE: Sync the substitutions in test/lit.cfg when adding to this list.
39 set(LLVM_TEST_DEPENDS
40           BugpointPasses
41           FileCheck
42           LLVMHello
43           UnitTests
44           bugpoint
45           count
46           llc
47           lli
48           lli-child-target
49           llvm-addr2line
50           llvm-ar
51           llvm-as
52           llvm-bcanalyzer
53           llvm-c-test
54           llvm-cat
55           llvm-cfi-verify
56           llvm-config
57           llvm-cov
58           llvm-cvtres
59           llvm-cxxdump
60           llvm-cxxfilt
61           llvm-cxxmap
62           llvm-diff
63           llvm-dis
64           llvm-dlltool
65           dsymutil
66           llvm-dwarfdump
67           llvm-dwp
68           llvm-elfabi
69           llvm-exegesis
70           llvm-extract
71           llvm-isel-fuzzer
72           llvm-ifs
73           llvm-jitlink
74           llvm-lib
75           llvm-link
76           llvm-lipo
77           llvm-lto2
78           llvm-mc
79           llvm-mca
80           llvm-modextract
81           llvm-mt
82           llvm-nm
83           llvm-objcopy
84           llvm-objdump
85           llvm-opt-fuzzer
86           llvm-opt-report
87           llvm-pdbutil
88           llvm-profdata
89           llvm-ranlib
90           llvm-rc
91           llvm-readobj
92           llvm-readelf
93           llvm-reduce
94           llvm-rtdyld
95           llvm-size
96           llvm-split
97           llvm-strings
98           llvm-strip
99           llvm-symbolizer
100           llvm-tblgen
101           llvm-undname
102           llvm-xray
103           not
104           obj2yaml
105           opt
106           sancov
107           sanstats
108           verify-uselistorder
109           yaml-bench
110           yaml2obj
111         )
113 if(TARGET llvm-lto)
114   set(LLVM_TEST_DEPENDS ${LLVM_TEST_DEPENDS} llvm-lto)
115 endif()
117 # If Intel JIT events are supported, depend on a tool that tests the listener.
118 if( LLVM_USE_INTEL_JITEVENTS )
119   set(LLVM_TEST_DEPENDS ${LLVM_TEST_DEPENDS} llvm-jitlistener)
120 endif( LLVM_USE_INTEL_JITEVENTS )
122 if(TARGET LLVMgold)
123   set(LLVM_TEST_DEPENDS ${LLVM_TEST_DEPENDS} LLVMgold)
124 endif()
126 if(TARGET llvm-go)
127   set(LLVM_TEST_DEPENDS ${LLVM_TEST_DEPENDS} llvm-go)
128 endif()
130 if(TARGET LTO)
131   set(LLVM_TEST_DEPENDS ${LLVM_TEST_DEPENDS} LTO)
132 endif()
134 if(LLVM_BUILD_EXAMPLES)
135   list(APPEND LLVM_TEST_DEPENDS
136     Kaleidoscope-Ch3
137     Kaleidoscope-Ch4
138     Kaleidoscope-Ch5
139     Kaleidoscope-Ch6
140     Kaleidoscope-Ch7
141     )
142 endif()
144 if(TARGET ocaml_llvm)
145   # Clear all non-OCaml cross-target dependencies when building out-of-tree.
146   if(LLVM_OCAML_OUT_OF_TREE)
147     set(LLVM_TEST_DEPENDS)
148   endif()
150   set(LLVM_TEST_DEPENDS ${LLVM_TEST_DEPENDS}
151           ocaml_llvm
152           ocaml_llvm_all_backends
153           ocaml_llvm_analysis
154           ocaml_llvm_bitreader
155           ocaml_llvm_bitwriter
156           ocaml_llvm_executionengine
157           ocaml_llvm_irreader
158           ocaml_llvm_linker
159           ocaml_llvm_target
160           ocaml_llvm_ipo
161           ocaml_llvm_passmgr_builder
162           ocaml_llvm_scalar_opts
163           ocaml_llvm_transform_utils
164           ocaml_llvm_vectorize
165         )
166 endif()
168 add_custom_target(llvm-test-depends DEPENDS ${LLVM_TEST_DEPENDS})
169 set_target_properties(llvm-test-depends PROPERTIES FOLDER "Tests")
171 add_lit_testsuite(check-llvm "Running the LLVM regression tests"
172   ${CMAKE_CURRENT_BINARY_DIR}
173   DEPENDS ${LLVM_TEST_DEPENDS}
174   )
175 set_target_properties(check-llvm PROPERTIES FOLDER "Tests")
177 add_lit_testsuites(LLVM ${CMAKE_CURRENT_SOURCE_DIR}
178   DEPENDS ${LLVM_TEST_DEPENDS}
179   )
181 # Setup a legacy alias for 'check-llvm'. This will likely change to be an
182 # alias for 'check-all' at some point in the future.
183 add_custom_target(check)
184 add_dependencies(check check-llvm)
185 set_target_properties(check PROPERTIES FOLDER "Tests")