[PATCH] D131282: [mlir] fix `add_tablegen()` macro to allow installing mlir-pdll
Ashay Rane via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sun Aug 7 03:48:07 PDT 2022
ashay-github updated this revision to Diff 450614.
ashay-github added a comment.
Herald added subscribers: cfe-commits, sdasgup3, wenzhicui, wrengr, cota, teijeong, rdzhabarov, tatianashp, msifontes, jurahul, Kayjukh, grosul1, Joonsoo, liufengdb, aartbik, mgester, arpith-jacob, nicolasvasilache, antiagainst, shauheen, mehdi_amini.
Herald added projects: clang, MLIR.
Added optional `DESTINATION` argument to `add_tablegen()`. Also updated all
invocations of the macro.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D131282/new/
https://reviews.llvm.org/D131282
Files:
clang/utils/TableGen/CMakeLists.txt
llvm/cmake/modules/TableGen.cmake
llvm/utils/TableGen/CMakeLists.txt
mlir/tools/mlir-pdll/CMakeLists.txt
mlir/tools/mlir-tblgen/CMakeLists.txt
Index: mlir/tools/mlir-tblgen/CMakeLists.txt
===================================================================
--- mlir/tools/mlir-tblgen/CMakeLists.txt
+++ mlir/tools/mlir-tblgen/CMakeLists.txt
@@ -4,7 +4,7 @@
TableGen
)
-add_tablegen(mlir-tblgen MLIR
+add_tablegen(mlir-tblgen MLIR DESTINATION "${MLIR_TOOLS_INSTALL_DIR}"
AttrOrTypeDefGen.cpp
AttrOrTypeFormatGen.cpp
CodeGenHelpers.cpp
Index: mlir/tools/mlir-pdll/CMakeLists.txt
===================================================================
--- mlir/tools/mlir-pdll/CMakeLists.txt
+++ mlir/tools/mlir-pdll/CMakeLists.txt
@@ -12,7 +12,7 @@
MLIRPDLLParser
)
-add_tablegen(mlir-pdll MLIR_PDLL
+add_tablegen(mlir-pdll MLIR_PDLL DESTINATION "${MLIR_TOOLS_INSTALL_DIR}"
mlir-pdll.cpp
DEPENDS
Index: llvm/utils/TableGen/CMakeLists.txt
===================================================================
--- llvm/utils/TableGen/CMakeLists.txt
+++ llvm/utils/TableGen/CMakeLists.txt
@@ -2,7 +2,7 @@
set(LLVM_LINK_COMPONENTS Support)
-add_tablegen(llvm-tblgen LLVM
+add_tablegen(llvm-tblgen LLVM DESTINATION "${LLVM_TOOLS_INSTALL_DIR}"
AsmMatcherEmitter.cpp
AsmWriterEmitter.cpp
AsmWriterInst.cpp
Index: llvm/cmake/modules/TableGen.cmake
===================================================================
--- llvm/cmake/modules/TableGen.cmake
+++ llvm/cmake/modules/TableGen.cmake
@@ -140,6 +140,12 @@
endfunction()
macro(add_tablegen target project)
+ set(options "")
+ set(oneValueArgs "DESTINATION")
+ set(multiValueArgs "")
+ cmake_parse_arguments(ADD_TABLEGEN "${options}" "${oneValueArgs}"
+ "${multiValueArgs}" ${ARGN})
+
set(${target}_OLD_LLVM_LINK_COMPONENTS ${LLVM_LINK_COMPONENTS})
set(LLVM_LINK_COMPONENTS ${LLVM_LINK_COMPONENTS} TableGen)
@@ -149,7 +155,8 @@
set(LLVM_ENABLE_OBJLIB ON)
endif()
- add_llvm_executable(${target} DISABLE_LLVM_LINK_LLVM_DYLIB ${ARGN})
+ add_llvm_executable(${target} DISABLE_LLVM_LINK_LLVM_DYLIB
+ ${ADD_TABLEGEN_UNPARSED_ARGUMENTS})
set(LLVM_LINK_COMPONENTS ${${target}_OLD_LLVM_LINK_COMPONENTS})
set(${project}_TABLEGEN "${target}" CACHE
@@ -186,7 +193,7 @@
endif()
endif()
- if ((${project} STREQUAL LLVM OR ${project} STREQUAL MLIR) AND NOT LLVM_INSTALL_TOOLCHAIN_ONLY AND LLVM_BUILD_UTILS)
+ if (ADD_TABLEGEN_DESTINATION AND NOT LLVM_INSTALL_TOOLCHAIN_ONLY AND LLVM_BUILD_UTILS)
set(export_to_llvmexports)
if(${target} IN_LIST LLVM_DISTRIBUTION_COMPONENTS OR
NOT LLVM_DISTRIBUTION_COMPONENTS)
@@ -196,7 +203,7 @@
install(TARGETS ${target}
${export_to_llvmexports}
COMPONENT ${target}
- RUNTIME DESTINATION "${${project}_TOOLS_INSTALL_DIR}")
+ RUNTIME DESTINATION "${ADD_TABLEGEN_DESTINATION}")
if(NOT LLVM_ENABLE_IDE)
add_llvm_install_targets("install-${target}"
DEPENDS ${target}
Index: clang/utils/TableGen/CMakeLists.txt
===================================================================
--- clang/utils/TableGen/CMakeLists.txt
+++ clang/utils/TableGen/CMakeLists.txt
@@ -1,6 +1,6 @@
set(LLVM_LINK_COMPONENTS Support)
-add_tablegen(clang-tblgen CLANG
+add_tablegen(clang-tblgen CLANG DESTINATION "${CLANG_TOOLS_INSTALL_DIR}"
ASTTableGen.cpp
ClangASTNodesEmitter.cpp
ClangASTPropertiesEmitter.cpp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D131282.450614.patch
Type: text/x-patch
Size: 3325 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220807/87ff3268/attachment.bin>
More information about the llvm-commits
mailing list