mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2024-10-09 04:14:11 +00:00
[cmake] Fix tablegen exports
This fixes some fallout from D131282. Currently, add_tablegen() will add the tablegen target to LLVM_EXPORTS and associates the install with LLVMExports. For non-standalone builds, this means that you end up with mlir-tblgen and clang-tblgen in LLVMExports. However, these projects should instead be using MLIR_EXPORTS/MLIRTargets and CLANG_EXPORTS/ClangTargets. To fix this, add an extra EXPORT option and make use of get_target_export_arg() to create the correct export argument. Reviewed By: ashay-github Differential Revision: https://reviews.llvm.org/D131565
This commit is contained in:
parent
6f9423ef06
commit
8f555a52e0
@ -1,6 +1,8 @@
|
||||
set(LLVM_LINK_COMPONENTS Support)
|
||||
|
||||
add_tablegen(clang-tblgen CLANG DESTINATION "${CLANG_TOOLS_INSTALL_DIR}"
|
||||
add_tablegen(clang-tblgen CLANG
|
||||
DESTINATION "${CLANG_TOOLS_INSTALL_DIR}"
|
||||
EXPORT Clang
|
||||
ASTTableGen.cpp
|
||||
ClangASTNodesEmitter.cpp
|
||||
ClangASTPropertiesEmitter.cpp
|
||||
|
@ -2,6 +2,7 @@
|
||||
# while LLVM_TARGET_DEPENDS may contain additional file dependencies.
|
||||
# Extra parameters for `tblgen' may come after `ofn' parameter.
|
||||
# Adds the name of the generated file to TABLEGEN_OUTPUT.
|
||||
include(LLVMDistributionSupport)
|
||||
|
||||
function(tablegen project ofn)
|
||||
cmake_parse_arguments(ARG "" "" "DEPENDS;EXTRA_INCLUDES" ${ARGN})
|
||||
@ -140,7 +141,7 @@ function(add_public_tablegen_target target)
|
||||
endfunction()
|
||||
|
||||
macro(add_tablegen target project)
|
||||
cmake_parse_arguments(ADD_TABLEGEN "" "DESTINATION" "" ${ARGN})
|
||||
cmake_parse_arguments(ADD_TABLEGEN "" "DESTINATION;EXPORT" "" ${ARGN})
|
||||
|
||||
set(${target}_OLD_LLVM_LINK_COMPONENTS ${LLVM_LINK_COMPONENTS})
|
||||
set(LLVM_LINK_COMPONENTS ${LLVM_LINK_COMPONENTS} TableGen)
|
||||
@ -190,14 +191,12 @@ macro(add_tablegen target project)
|
||||
endif()
|
||||
|
||||
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)
|
||||
set(export_to_llvmexports EXPORT LLVMExports)
|
||||
set(export_arg)
|
||||
if(ADD_TABLEGEN_EXPORT)
|
||||
get_target_export_arg(${target} ${ADD_TABLEGEN_EXPORT} export_arg)
|
||||
endif()
|
||||
|
||||
install(TARGETS ${target}
|
||||
${export_to_llvmexports}
|
||||
${export_arg}
|
||||
COMPONENT ${target}
|
||||
RUNTIME DESTINATION "${ADD_TABLEGEN_DESTINATION}")
|
||||
if(NOT LLVM_ENABLE_IDE)
|
||||
@ -206,5 +205,8 @@ macro(add_tablegen target project)
|
||||
COMPONENT ${target})
|
||||
endif()
|
||||
endif()
|
||||
set_property(GLOBAL APPEND PROPERTY LLVM_EXPORTS ${target})
|
||||
if(ADD_TABLEGEN_EXPORT)
|
||||
string(TOUPPER ${ADD_TABLEGEN_EXPORT} export_upper)
|
||||
set_property(GLOBAL APPEND PROPERTY ${export_upper}_EXPORTS ${target})
|
||||
endif()
|
||||
endmacro()
|
||||
|
@ -2,7 +2,9 @@ add_subdirectory(GlobalISel)
|
||||
|
||||
set(LLVM_LINK_COMPONENTS Support)
|
||||
|
||||
add_tablegen(llvm-tblgen LLVM DESTINATION "${LLVM_TOOLS_INSTALL_DIR}"
|
||||
add_tablegen(llvm-tblgen LLVM
|
||||
DESTINATION "${LLVM_TOOLS_INSTALL_DIR}"
|
||||
EXPORT LLVM
|
||||
AsmMatcherEmitter.cpp
|
||||
AsmWriterEmitter.cpp
|
||||
AsmWriterInst.cpp
|
||||
|
@ -12,7 +12,9 @@ set(LIBS
|
||||
MLIRPDLLParser
|
||||
)
|
||||
|
||||
add_tablegen(mlir-pdll MLIR_PDLL DESTINATION "${MLIR_TOOLS_INSTALL_DIR}"
|
||||
add_tablegen(mlir-pdll MLIR_PDLL
|
||||
DESTINATION "${MLIR_TOOLS_INSTALL_DIR}"
|
||||
EXPORT MLIR
|
||||
mlir-pdll.cpp
|
||||
|
||||
DEPENDS
|
||||
|
@ -4,7 +4,9 @@ set(LLVM_LINK_COMPONENTS
|
||||
TableGen
|
||||
)
|
||||
|
||||
add_tablegen(mlir-tblgen MLIR DESTINATION "${MLIR_TOOLS_INSTALL_DIR}"
|
||||
add_tablegen(mlir-tblgen MLIR
|
||||
DESTINATION "${MLIR_TOOLS_INSTALL_DIR}"
|
||||
EXPORT MLIR
|
||||
AttrOrTypeDefGen.cpp
|
||||
AttrOrTypeFormatGen.cpp
|
||||
CodeGenHelpers.cpp
|
||||
|
Loading…
Reference in New Issue
Block a user