1add_subdirectory(Bindings)
2add_subdirectory(CAPI)
3add_subdirectory(EDSC)
4add_subdirectory(mlir-cpu-runner)
5add_subdirectory(SDBM)
6add_subdirectory(lib)
7
8llvm_canonicalize_cmake_booleans(
9  MLIR_BINDINGS_PYTHON_ENABLED
10  LLVM_BUILD_EXAMPLES
11  MLIR_CUDA_CONVERSIONS_ENABLED
12  MLIR_CUDA_RUNNER_ENABLED
13  MLIR_ROCM_CONVERSIONS_ENABLED
14  MLIR_ROCM_RUNNER_ENABLED
15  MLIR_VULKAN_RUNNER_ENABLED
16  )
17
18# Passed to lit.site.cfg.py.in to set up the path where to find the libraries
19# for linalg integration tests.
20set(MLIR_DIALECT_LINALG_INTEGRATION_TEST_LIB_DIR ${CMAKE_LIBRARY_OUTPUT_DIRECTORY})
21set(MLIR_RUNNER_UTILS_DIR ${CMAKE_LIBRARY_OUTPUT_DIRECTORY})
22
23# Passed to lit.site.cfg.py.in to set up the path where to find the libraries
24# for the mlir cuda / rocm / spirv / vulkan runner tests.
25set(MLIR_CUDA_WRAPPER_LIBRARY_DIR ${CMAKE_LIBRARY_OUTPUT_DIRECTORY})
26set(MLIR_ROCM_WRAPPER_LIBRARY_DIR ${CMAKE_LIBRARY_OUTPUT_DIRECTORY})
27set(MLIR_SPIRV_WRAPPER_LIBRARY_DIR ${CMAKE_LIBRARY_OUTPUT_DIRECTORY})
28set(MLIR_VULKAN_WRAPPER_LIBRARY_DIR ${CMAKE_LIBRARY_OUTPUT_DIRECTORY})
29
30configure_lit_site_cfg(
31  ${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.py.in
32  ${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg.py
33  MAIN_CONFIG
34  ${CMAKE_CURRENT_SOURCE_DIR}/lit.cfg.py
35  )
36configure_lit_site_cfg(
37  ${CMAKE_CURRENT_SOURCE_DIR}/Unit/lit.site.cfg.py.in
38  ${CMAKE_CURRENT_BINARY_DIR}/Unit/lit.site.cfg.py
39  MAIN_CONFIG
40  ${CMAKE_CURRENT_SOURCE_DIR}/Unit/lit.cfg.py
41  )
42
43set(MLIR_TEST_DEPENDS
44  FileCheck count not
45  MLIRUnitTests
46  mlir-capi-ir-test
47  mlir-capi-pass-test
48  mlir-cpu-runner
49  mlir-edsc-builder-api-test
50  mlir-linalg-ods-gen
51  mlir-opt
52  mlir-reduce
53  mlir-sdbm-api-test
54  mlir-tblgen
55  mlir-translate
56  mlir_test_cblas
57  mlir_test_cblas_interface
58  mlir_runner_utils
59  mlir_c_runner_utils
60  mlir_async_runtime
61  )
62
63if(LLVM_BUILD_EXAMPLES)
64  list(APPEND MLIR_TEST_DEPENDS
65    toyc-ch1
66    toyc-ch2
67    toyc-ch3
68    toyc-ch4
69    toyc-ch5
70    toyc-ch6
71    toyc-ch7
72    )
73endif()
74
75if(MLIR_CUDA_RUNNER_ENABLED)
76  list(APPEND MLIR_TEST_DEPENDS
77    mlir-cuda-runner
78  )
79endif()
80
81if(MLIR_ROCM_RUNNER_ENABLED)
82  list(APPEND MLIR_TEST_DEPENDS
83    mlir-rocm-runner
84  )
85endif()
86
87if(MLIR_SPIRV_CPU_RUNNER_ENABLED)
88  add_subdirectory(mlir-spirv-cpu-runner)
89  list(APPEND MLIR_TEST_DEPENDS
90    mlir-spirv-cpu-runner
91    mlir_test_spirv_cpu_runner_c_wrappers
92  )
93endif()
94
95if(MLIR_VULKAN_RUNNER_ENABLED)
96  list(APPEND MLIR_TEST_DEPENDS
97    mlir-vulkan-runner
98  )
99endif()
100
101if(MLIR_BINDINGS_PYTHON_ENABLED)
102  list(APPEND MLIR_TEST_DEPENDS
103    MLIRBindingsPythonExtension
104    MLIRBindingsPythonTestOps
105    MLIRTransformsBindingsPythonExtension
106  )
107endif()
108
109add_lit_testsuite(check-mlir "Running the MLIR regression tests"
110  ${CMAKE_CURRENT_BINARY_DIR}
111  DEPENDS ${MLIR_TEST_DEPENDS}
112  )
113set_target_properties(check-mlir PROPERTIES FOLDER "Tests")
114
115add_lit_testsuites(MLIR ${CMAKE_CURRENT_SOURCE_DIR}
116  DEPENDS ${MLIR_TEST_DEPENDS}
117)
118