[PATCH] D115535: [libunwind] Provide a way to conveniently install libunwind headers
PoYao Chang via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Dec 10 09:14:41 PST 2021
rZhBoYao created this revision.
rZhBoYao added reviewers: compnerd, jgorbe, mstorsjo, ldionne.
rZhBoYao added a project: libunwind.
Herald added subscribers: libcxx-commits, mgorny.
Herald added a reviewer: libunwind.
rZhBoYao requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
This adds a CMake option (defaults to OFF) to activate 2 new targets `install-unwind-headers` and `install-unwind-headers-stripped`.
So, for example, these would install libunwind headers:
cmake -S runtimes -B build -G Ninja \
-DLLVM_ENABLE_RUNTIMES='libcxx;libcxxabi;libunwind' \
-DLIBUNWIND_INSTALL_HEADERS=ON
And then, `ninja -C build install` for the whole package or simply `ninja -C build install-unwind-headers`.
Other than that, currently, `install-unwind` doesn't `DEPENDS` on `install-unwind-headers`, not sure if this is alright.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D115535
Files:
libunwind/CMakeLists.txt
libunwind/include/CMakeLists.txt
Index: libunwind/include/CMakeLists.txt
===================================================================
--- /dev/null
+++ libunwind/include/CMakeLists.txt
@@ -0,0 +1,29 @@
+set(files
+ __libunwind_config.h
+ libunwind.h
+ unwind_arm_ehabi.h
+ unwind_itanium.h
+ unwind.h
+ )
+
+add_library(unwind-headers INTERFACE)
+
+install(FILES ${files}
+ DESTINATION include
+ COMPONENT unwind-headers
+ PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
+)
+
+if(NOT CMAKE_CONFIGURATION_TYPES AND LIBUNWIND_INSTALL_LIBRARY)
+ add_custom_target(install-unwind-headers
+ DEPENDS unwind-headers
+ COMMAND "${CMAKE_COMMAND}"
+ -DCMAKE_INSTALL_COMPONENT=unwind-headers
+ -P "${LIBUNWIND_BINARY_DIR}/cmake_install.cmake")
+ add_custom_target(install-unwind-headers-stripped
+ DEPENDS unwind-headers
+ COMMAND "${CMAKE_COMMAND}"
+ -DCMAKE_INSTALL_COMPONENT=unwind-headers
+ -DCMAKE_INSTALL_DO_STRIP=1
+ -P "${LIBUNWIND_BINARY_DIR}/cmake_install.cmake")
+endif()
Index: libunwind/CMakeLists.txt
===================================================================
--- libunwind/CMakeLists.txt
+++ libunwind/CMakeLists.txt
@@ -78,6 +78,7 @@
option(LIBUNWIND_IS_BAREMETAL "Build libunwind for baremetal targets." OFF)
option(LIBUNWIND_USE_FRAME_HEADER_CACHE "Cache frame headers for unwinding. Requires locking dl_iterate_phdr." OFF)
option(LIBUNWIND_REMEMBER_HEAP_ALLOC "Use heap instead of the stack for .cfi_remember_state." OFF)
+option(LIBUNWIND_INSTALL_HEADERS "Install the libunwind headers." OFF)
set(LIBUNWIND_LIBDIR_SUFFIX "${LLVM_LIBDIR_SUFFIX}" CACHE STRING
"Define suffix of library directory name (32/64)")
@@ -383,3 +384,7 @@
if (LIBUNWIND_INCLUDE_TESTS AND EXISTS ${LLVM_CMAKE_DIR})
add_subdirectory(test)
endif()
+
+if(LIBUNWIND_INSTALL_HEADERS)
+ add_subdirectory(include)
+endif()
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D115535.393517.patch
Type: text/x-patch
Size: 1896 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20211210/8e308627/attachment.bin>
More information about the llvm-commits
mailing list