diff options
author | Stephen Neuendorffer <stephen.neuendorffer@xilinx.com> | 2022-01-09 22:16:58 -0800 |
---|---|---|
committer | Stephen Neuendorffer <stephen.neuendorffer@xilinx.com> | 2022-01-09 23:27:08 -0800 |
commit | 3523876873b25bbb8225fed45e4db79e7d250a4f (patch) | |
tree | 17294137415f7c5b2073ab5e0a336a7ef674bb8a | |
parent | 34a91d7748d47367ed520cb96313aae31026b01a (diff) | |
download | llvm-3523876873b25bbb8225fed45e4db79e7d250a4f.tar.gz |
Fix exported MLIR_TABLEGEN_EXE
LLVM_OPTIMIZED_TABLEGEN results in MLIR_TABLEGEN_EXE pointing to
an absolute path in the build directory. This doesn't work
when exporting to an install directory. This patch fixes the exported
information for an install directory to refer to the installed
mlir-tblgen. (Note that this is probably a debug version if
LLVM_OPTIMIZED_TABLEGEN is set)
-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@") |