diff options
-rw-r--r-- | mlir/cmake/modules/CMakeLists.txt | 7 | ||||
-rw-r--r-- | mlir/cmake/modules/MLIRConfig.cmake.in | 2 |
2 files changed, 8 insertions, 1 deletions
diff --git a/mlir/cmake/modules/CMakeLists.txt b/mlir/cmake/modules/CMakeLists.txt index 6bed3f62c937..6a8dd42f6c6a 100644 --- a/mlir/cmake/modules/CMakeLists.txt +++ b/mlir/cmake/modules/CMakeLists.txt @@ -27,6 +27,9 @@ set(MLIR_CONFIG_INCLUDE_DIRS "${MLIR_SOURCE_DIR}/include" "${MLIR_BINARY_DIR}/include" ) +# Refer to the best host mlir-tbgen, which might be a host-optimized version +set(MLIR_CONFIG_TABLEGEN_EXE "${MLIR_TABLEGEN_EXE}") + configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/MLIRConfig.cmake.in ${mlir_cmake_builddir}/MLIRConfig.cmake @@ -52,6 +55,10 @@ get_config_exports_includes(MLIR MLIR_CONFIG_INCLUDE_EXPORTS) set(MLIR_CONFIG_INCLUDE_DIRS "\${MLIR_INSTALL_PREFIX}/include" ) +# Ensure that we are using the installed mlir-tblgen. This might not be MLIR_TABLEGEN_EXE +# if we're building with a host-optimized mlir-tblgen (with LLVM_OPTIMIZED_TABLEGEN). +set(MLIR_CONFIG_TABLEGEN_EXE mlir-tblgen) + configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/MLIRConfig.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/MLIRConfig.cmake diff --git a/mlir/cmake/modules/MLIRConfig.cmake.in b/mlir/cmake/modules/MLIRConfig.cmake.in index 9f70647b6a00..cab68ba01657 100644 --- a/mlir/cmake/modules/MLIRConfig.cmake.in +++ b/mlir/cmake/modules/MLIRConfig.cmake.in @@ -8,7 +8,7 @@ find_package(LLVM REQUIRED CONFIG set(MLIR_EXPORTED_TARGETS "@MLIR_EXPORTS@") set(MLIR_CMAKE_DIR "@MLIR_CONFIG_CMAKE_DIR@") set(MLIR_INCLUDE_DIRS "@MLIR_CONFIG_INCLUDE_DIRS@") -set(MLIR_TABLEGEN_EXE "@MLIR_TABLEGEN_EXE@") +set(MLIR_TABLEGEN_EXE "@MLIR_CONFIG_TABLEGEN_EXE@") set(MLIR_INSTALL_AGGREGATE_OBJECTS "@MLIR_INSTALL_AGGREGATE_OBJECTS@") set(MLIR_ENABLE_BINDINGS_PYTHON "@MLIR_ENABLE_BINDINGS_PYTHON@") |