[MLIR] Fix build with make

https://reviews.llvm.org/D124075 causes MLIR to no longer build
when using make rather than ninja, due to a tablegen-generated
header being used before it is created.

It seems that this is related to the use of LLVM_ENABLE_OBJLIB when
using add_tablgen with a non-Ninja/Xcode generator. In that case an
intermediate objlib target is generated.

This patch fixes the issue by a) declaring dependencies in
add_tablegen for mlir-pdll and b) making sure those dependencies
are added to the objlib target.

Differential Revision: https://reviews.llvm.org/D125010
This commit is contained in:
Nikita Popov 2022-05-05 15:47:34 +02:00
parent 43d8ffeeb1
commit 686bd6dd2b
2 changed files with 15 additions and 8 deletions

View File

@ -877,6 +877,9 @@ macro(add_llvm_executable name)
)
llvm_update_compile_flags(${obj_name})
set(ALL_FILES "$<TARGET_OBJECTS:${obj_name}>")
if(ARG_DEPENDS)
add_dependencies(${obj_name} ${ARG_DEPENDS})
endif()
set_target_properties(${obj_name} PROPERTIES FOLDER "Object Libraries")
endif()

View File

@ -4,18 +4,22 @@ set(LLVM_LINK_COMPONENTS
TableGen
)
set(LIBS
MLIRIR
MLIRPDLLAST
MLIRPDLLCodeGen
MLIRPDLLODS
MLIRPDLLParser
)
add_tablegen(mlir-pdll MLIR_PDLL
mlir-pdll.cpp
DEPENDS
${LIBS}
)
set_target_properties(mlir-pdll PROPERTIES FOLDER "Tablegenning")
target_link_libraries(mlir-pdll
PRIVATE
MLIRIR
MLIRPDLLAST
MLIRPDLLCodeGen
MLIRPDLLODS
MLIRPDLLParser
)
target_link_libraries(mlir-pdll PRIVATE ${LIBS})
mlir_check_all_link_libraries(mlir-pdll)