xref: /llvm-project/mlir/lib/TableGen/CMakeLists.txt (revision 064391df493927729fa79fb5b966efba2eb1e170)
1# This library is unusual, since mlir-tblgen depends on it, which is
2# built with DISABLE_LLVM_LINK_LLVM_DYLIB, this must also be built
3# with that option.  Otherwise builds with LLVM_BUILD_LLVM_DYLIB and
4# LLVM_LINK_LLVM_DYLIB fail.  (Note that even if this has no llvm
5# component dependencies, LLVM_LINK_LLVM_DYLIB tends to introduce a
6# dependence on libLLVM.so)  However, it must also be linkable against
7# libMLIR.so in some contexts (see unittests/Tablegen, for instance, which
8# has a dependence on MLIRIR, which must depend on libLLVM.so).  This works
9# in this special case because this library is static.
10#
11# In order for this arrangement to be sound, it must not depend on libraries
12# that may be transitively included in libMLIR.so or libLLVM.so. Specifically,
13# this means that MLIRSupport (outside of header-only access) cannot be used.
14llvm_add_library(MLIRTableGen STATIC
15  Argument.cpp
16  Attribute.cpp
17  AttrOrTypeDef.cpp
18  Builder.cpp
19  Class.cpp
20  CodeGenHelpers.cpp
21  Constraint.cpp
22  Dialect.cpp
23  Format.cpp
24  GenInfo.cpp
25  Interfaces.cpp
26  Operator.cpp
27  Pass.cpp
28  Pattern.cpp
29  Predicate.cpp
30  Property.cpp
31  Region.cpp
32  SideEffects.cpp
33  Successor.cpp
34  Trait.cpp
35  Type.cpp
36
37  DISABLE_LLVM_LINK_LLVM_DYLIB
38
39  ADDITIONAL_HEADER_DIRS
40  ${MLIR_MAIN_INCLUDE_DIR}/mlir/TableGen
41  ${MLIR_MAIN_INCLUDE_DIR}/mlir/Support
42)
43set_target_properties(MLIRTableGen PROPERTIES FOLDER "MLIR/Tablegenning")
44
45mlir_check_all_link_libraries(MLIRTableGen)
46
47add_mlir_library_install(MLIRTableGen)
48