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