[PATCH] D80093: [MLIR][cmake] Fix unittest/Tablegen by special casing LLVMMLIRTableGen
Stephen Neuendorffer via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sun May 17 15:58:26 PDT 2020
stephenneuendorffer created this revision.
Herald added subscribers: llvm-commits, jurahul, Kayjukh, frgossen, grosul1, Joonsoo, liufengdb, aartbik, lucyrfox, mgester, arpith-jacob, nicolasvasilache, antiagainst, shauheen, jpienaar, rriddle, mehdi_amini, mgorny.
Herald added a reviewer: antiagainst.
Herald added a project: LLVM.
unittest/Tablegen generates an executable that depends on MLIRIR and
LLVMMLIRTableGen. Avoid specifying linkage dependence on LLVM
libraries here because then everyone has to depend on those libraries.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D80093
Files:
mlir/lib/TableGen/CMakeLists.txt
Index: mlir/lib/TableGen/CMakeLists.txt
===================================================================
--- mlir/lib/TableGen/CMakeLists.txt
+++ mlir/lib/TableGen/CMakeLists.txt
@@ -1,7 +1,13 @@
-# This library is unusual, since mlir-tblgen depends on it.
-# For non-obvious reasons, linking mlir-tblgen fails with
-# LLVM_BUILD_LLVM_DYLIB and LLVM_LINK_LLVM_DYLIB unless
-# DISABLE_LLVM_LINK_LLVM_DYLIB is set.
+# This library is unusual, since mlir-tblgen depends on it, which is
+# built with DISABLE_LLVM_LINK_LLVM_DYLIB, this must also be built
+# with that option. Otherwise builds with LLVM_BUILD_LLVM_DYLIB and
+# LLVM_LINK_LLVM_DYLIB fail. (Note that even if this has no llvm
+# component dependencies, LLVM_LINK_LLVM_DYLIB tends to introduce a
+# dependence on libLLVM.so) However, it must also be linkable against
+# libMLIR.so in some contexts (see unittests/Tablegen, for instance, which
+# has a dependance on MLIRIR, which must depend on libLLVM.so). This works
+# in this special case because this library is static.
+
llvm_add_library(LLVMMLIRTableGen STATIC
Argument.cpp
Attribute.cpp
@@ -24,10 +30,6 @@
ADDITIONAL_HEADER_DIRS
${MLIR_MAIN_INCLUDE_DIR}/mlir/TableGen
-
- LINK_COMPONENTS
- TableGen
- Demangle
- )
+)
mlir_check_all_link_libraries(LLVMMLIRTableGen)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D80093.264518.patch
Type: text/x-patch
Size: 1311 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200517/736af79d/attachment.bin>
More information about the llvm-commits
mailing list