diff --git a/mlir/test/CMakeLists.txt b/mlir/test/CMakeLists.txt --- a/mlir/test/CMakeLists.txt +++ b/mlir/test/CMakeLists.txt @@ -17,6 +17,11 @@ MLIR_ENABLE_VULKAN_RUNNER ) +# Passed to lit.site.cfg.py.so that the out of tree Standalone dialect test +# can find MLIR's CMake configuration +set(MLIR_CMAKE_CONFIG_DIR + "${CMAKE_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX}/cmake/mlir") + # Passed to lit.site.cfg.py.in to set up the path where to find the libraries # for linalg integration tests. set(MLIR_DIALECT_LINALG_INTEGRATION_TEST_LIB_DIR ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}) diff --git a/mlir/test/Examples/standalone/lit.local.cfg b/mlir/test/Examples/standalone/lit.local.cfg --- a/mlir/test/Examples/standalone/lit.local.cfg +++ b/mlir/test/Examples/standalone/lit.local.cfg @@ -2,3 +2,5 @@ config.substitutions.append(("%host_cxx", config.host_cxx)) config.substitutions.append(("%host_cc", config.host_cc)) config.substitutions.append(("%enable_libcxx", config.enable_libcxx)) +config.substitutions.append( + ("%mlir_cmake_config_dir", config.mlir_cmake_config_dir)) diff --git a/mlir/test/Examples/standalone/test.toy b/mlir/test/Examples/standalone/test.toy --- a/mlir/test/Examples/standalone/test.toy +++ b/mlir/test/Examples/standalone/test.toy @@ -1,4 +1,4 @@ -# RUN: %cmake %mlir_src_root/examples/standalone -DCMAKE_CXX_COMPILER=%host_cxx -DCMAKE_C_COMPILER=%host_cc -DLLVM_ENABLE_LIBCXX=%enable_libcxx -DMLIR_DIR=%llvm_lib_dir/cmake/mlir ; %cmake --build . --target check-standalone | tee %t | FileCheck %s +# RUN: %cmake %mlir_src_root/examples/standalone -DCMAKE_CXX_COMPILER=%host_cxx -DCMAKE_C_COMPILER=%host_cc -DLLVM_ENABLE_LIBCXX=%enable_libcxx -DMLIR_DIR=%mlir_cmake_config_dir ; %cmake --build . --target check-standalone | tee %t | FileCheck %s # CHECK: Passed: 3 # UNSUPPORTED: windows, android diff --git a/mlir/test/lit.site.cfg.py.in b/mlir/test/lit.site.cfg.py.in --- a/mlir/test/lit.site.cfg.py.in +++ b/mlir/test/lit.site.cfg.py.in @@ -34,6 +34,7 @@ config.mlir_obj_root = "@MLIR_BINARY_DIR@" config.mlir_runner_utils_dir = "@MLIR_RUNNER_UTILS_DIR@" config.mlir_tools_dir = "@MLIR_TOOLS_DIR@" +config.mlir_cmake_config_dir = "@MLIR_CMAKE_CONFIG_DIR@" config.linalg_test_lib_dir = "@MLIR_DIALECT_LINALG_INTEGRATION_TEST_LIB_DIR@" config.build_examples = @LLVM_BUILD_EXAMPLES@ config.run_cuda_tests = @MLIR_ENABLE_CUDA_CONVERSIONS@