[libcxx-commits] [PATCH] D98129: [CMake][runtimes] Add file level dependency to merge_archives commands
Markus Böck via Phabricator via libcxx-commits
libcxx-commits at lists.llvm.org
Sat Mar 6 14:12:34 PST 2021
zero9178 created this revision.
zero9178 added a reviewer: ldionne.
Herald added a subscriber: mgorny.
zero9178 requested review of this revision.
Herald added projects: libc++, libc++abi.
Herald added a subscriber: libcxx-commits.
Herald added a reviewer: libc++.
Herald added a reviewer: libc++abi.
Both libc++ and libc++abi have options of merging with another archive. In the case of libc++abi, libunwind can be merged into it and in the case of libc++, libc++abi can be merged into it.
This is realized using add_custom_command with POST_BUILD and the usage of the CMake generator expression TARGET_LINKER_FILE in the arguments. For such generator expressions CMake doc states: "This target-level dependency does NOT add a file-level dependency that would cause the custom command to re-run whenever the executable is recompiled" [1]
This patch adds a DEPENDS argument to both add_custom_command invocations so that the archives also have a file-level dependency on the target they are merging with. That way, changes in say, libunwind source code, will be updated in the libc++abi and/or libc++ static libraries as well.
[1] https://cmake.org/cmake/help/v3.20/command/add_custom_command.html
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D98129
Files:
libcxx/src/CMakeLists.txt
libcxxabi/src/CMakeLists.txt
Index: libcxxabi/src/CMakeLists.txt
===================================================================
--- libcxxabi/src/CMakeLists.txt
+++ libcxxabi/src/CMakeLists.txt
@@ -302,6 +302,7 @@
"$<TARGET_LINKER_FILE:cxxabi_static>"
"$<TARGET_LINKER_FILE:unwind_static>"
WORKING_DIRECTORY ${LIBCXXABI_BUILD_DIR}
+ DEPENDS unwind_static
)
endif()
endif()
Index: libcxx/src/CMakeLists.txt
===================================================================
--- libcxx/src/CMakeLists.txt
+++ libcxx/src/CMakeLists.txt
@@ -293,6 +293,9 @@
else()
set(MERGE_ARCHIVES_ABI_TARGET
"${CMAKE_STATIC_LIBRARY_PREFIX}${LIBCXX_CXX_STATIC_ABI_LIBRARY}${CMAKE_STATIC_LIBRARY_SUFFIX}")
+ if (LIBCXX_CXX_ABI_LIBRARY_PATH)
+ set(MERGE_ARCHIVES_ABI_TARGET "${LIBCXX_CXX_ABI_LIBRARY_PATH}/${MERGE_ARCHIVES_ABI_TARGET}")
+ endif ()
endif()
if (APPLE)
set(MERGE_ARCHIVES_LIBTOOL "--use-libtool" "--libtool" "${CMAKE_LIBTOOL}")
@@ -308,6 +311,7 @@
"${MERGE_ARCHIVES_ABI_TARGET}"
"${MERGE_ARCHIVES_SEARCH_PATHS}"
WORKING_DIRECTORY ${LIBCXX_BUILD_DIR}
+ DEPENDS ${MERGE_ARCHIVES_ABI_TARGET}
)
endif()
endif()
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D98129.328820.patch
Type: text/x-patch
Size: 1202 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20210306/1253dfe5/attachment.bin>
More information about the libcxx-commits
mailing list