[PATCH] D134637: clang-tblgen build: avoid duplicate inclusion of libLLVMSupport
Nicolai Hähnle via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Oct 13 11:40:32 PDT 2022
nhaehnle updated this revision to Diff 467550.
nhaehnle added a comment.
- use the object library version of clangSupport if available
Thank you for the pointers. Using this object library makes a lot of
sense to me and it does appear to work. Judging by AddClang.cmake though,
the object library is only available if (NOT XCODE), so I kept the
previous way of doing things as an alternative. In all cases, I'm using an
alias so that the complexity is contained within the clangSupport CMakeLists.txt
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D134637/new/
https://reviews.llvm.org/D134637
Files:
clang/lib/Support/CMakeLists.txt
clang/utils/TableGen/CMakeLists.txt
Index: clang/utils/TableGen/CMakeLists.txt
===================================================================
--- clang/utils/TableGen/CMakeLists.txt
+++ clang/utils/TableGen/CMakeLists.txt
@@ -25,6 +25,6 @@
TableGen.cpp
)
-target_link_libraries(clang-tblgen PRIVATE clangSupport)
+target_link_libraries(clang-tblgen PRIVATE clangSupport_tablegen)
set_target_properties(clang-tblgen PROPERTIES FOLDER "Clang tablegenning")
Index: clang/lib/Support/CMakeLists.txt
===================================================================
--- clang/lib/Support/CMakeLists.txt
+++ clang/lib/Support/CMakeLists.txt
@@ -9,8 +9,24 @@
Support
)
-add_clang_library(clangSupport
+set(clangSupport_sources
RISCVVIntrinsicUtils.cpp
)
+add_clang_library(clangSupport ${clangSupport_sources})
+
+if (NOT XCODE)
+ add_library(clangSupport_tablegen ALIAS obj.clangSupport)
+elseif (NOT LLVM_LINK_LLVM_DYLIB)
+ add_library(clangSupport_tablegen ALIAS clangSupport)
+else()
+ # Build a version of the support library that does not link against
+ # libLLVM-*.so, to be used by clang-tblgen. This is so clang-tblgen doesn't
+ # link against libLLVMSupport twice (once statically and once via
+ # libLLVM-*.so).
+ add_llvm_library(clangSupport_tablegen
+ BUILDTREE_ONLY STATIC DISABLE_LLVM_LINK_LLVM_DYLIB
+ ${clangSupport_sources})
+endif()
+
set(LLVM_COMMON_DEPENDS ${LLVM_COMMON_DEPENDS_OLD})
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D134637.467550.patch
Type: text/x-patch
Size: 1412 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20221013/49290df9/attachment.bin>
More information about the cfe-commits
mailing list