Skip to content

Commit 3523876

Browse files
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)
1 parent 34a91d7 commit 3523876

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

mlir/cmake/modules/CMakeLists.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@ set(MLIR_CONFIG_INCLUDE_DIRS
2727
"${MLIR_SOURCE_DIR}/include"
2828
"${MLIR_BINARY_DIR}/include"
2929
)
30+
# Refer to the best host mlir-tbgen, which might be a host-optimized version
31+
set(MLIR_CONFIG_TABLEGEN_EXE "${MLIR_TABLEGEN_EXE}")
32+
3033
configure_file(
3134
${CMAKE_CURRENT_SOURCE_DIR}/MLIRConfig.cmake.in
3235
${mlir_cmake_builddir}/MLIRConfig.cmake
@@ -52,6 +55,10 @@ get_config_exports_includes(MLIR MLIR_CONFIG_INCLUDE_EXPORTS)
5255
set(MLIR_CONFIG_INCLUDE_DIRS
5356
"\${MLIR_INSTALL_PREFIX}/include"
5457
)
58+
# Ensure that we are using the installed mlir-tblgen. This might not be MLIR_TABLEGEN_EXE
59+
# if we're building with a host-optimized mlir-tblgen (with LLVM_OPTIMIZED_TABLEGEN).
60+
set(MLIR_CONFIG_TABLEGEN_EXE mlir-tblgen)
61+
5562
configure_file(
5663
${CMAKE_CURRENT_SOURCE_DIR}/MLIRConfig.cmake.in
5764
${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/MLIRConfig.cmake

mlir/cmake/modules/MLIRConfig.cmake.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ find_package(LLVM REQUIRED CONFIG
88
set(MLIR_EXPORTED_TARGETS "@MLIR_EXPORTS@")
99
set(MLIR_CMAKE_DIR "@MLIR_CONFIG_CMAKE_DIR@")
1010
set(MLIR_INCLUDE_DIRS "@MLIR_CONFIG_INCLUDE_DIRS@")
11-
set(MLIR_TABLEGEN_EXE "@MLIR_TABLEGEN_EXE@")
11+
set(MLIR_TABLEGEN_EXE "@MLIR_CONFIG_TABLEGEN_EXE@")
1212
set(MLIR_INSTALL_AGGREGATE_OBJECTS "@MLIR_INSTALL_AGGREGATE_OBJECTS@")
1313
set(MLIR_ENABLE_BINDINGS_PYTHON "@MLIR_ENABLE_BINDINGS_PYTHON@")
1414

0 commit comments

Comments
 (0)