[Mlir-commits] [mlir] 3523876 - Fix exported MLIR_TABLEGEN_EXE

Stephen Neuendorffer llvmlistbot at llvm.org
Sun Jan 9 23:27:26 PST 2022


Author: Stephen Neuendorffer
Date: 2022-01-09T23:27:08-08:00
New Revision: 3523876873b25bbb8225fed45e4db79e7d250a4f

URL: https://github.com/llvm/llvm-project/commit/3523876873b25bbb8225fed45e4db79e7d250a4f
DIFF: https://github.com/llvm/llvm-project/commit/3523876873b25bbb8225fed45e4db79e7d250a4f.diff

LOG: 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)

Added: 
    

Modified: 
    mlir/cmake/modules/CMakeLists.txt
    mlir/cmake/modules/MLIRConfig.cmake.in

Removed: 
    


################################################################################
diff  --git a/mlir/cmake/modules/CMakeLists.txt b/mlir/cmake/modules/CMakeLists.txt
index 6bed3f62c9376..6a8dd42f6c6af 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 9f70647b6a003..cab68ba01657c 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@")
 


        


More information about the Mlir-commits mailing list