Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/llvm/llvm-project.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLouis Dionne <ldionne.2@gmail.com>2022-02-17 19:19:45 +0300
committerLouis Dionne <ldionne.2@gmail.com>2022-03-01 01:22:53 +0300
commit6dfdf79b8c482c892a76406799d285baf5d71198 (patch)
treee3af3f3595f1ff64f3583a482290793df751cda8 /libcxxabi
parent8057a8e26a8ff169c85a6a99786491723a285c51 (diff)
[libc++abi] Install the libc++abi headers from libc++abi
libc++abi should be responsible for installing its own headers, it doesn't make sense for libc++ to be responsible for it. Differential Revision: https://reviews.llvm.org/D101458
Diffstat (limited to 'libcxxabi')
-rw-r--r--libcxxabi/CMakeLists.txt4
-rw-r--r--libcxxabi/include/CMakeLists.txt26
-rw-r--r--libcxxabi/src/CMakeLists.txt4
3 files changed, 32 insertions, 2 deletions
diff --git a/libcxxabi/CMakeLists.txt b/libcxxabi/CMakeLists.txt
index 73cab7d13f8e..ebda5a4fb624 100644
--- a/libcxxabi/CMakeLists.txt
+++ b/libcxxabi/CMakeLists.txt
@@ -121,7 +121,9 @@ endif()
option(LIBCXXABI_INCLUDE_TESTS "Generate build targets for the libc++abi unit tests." ${LLVM_INCLUDE_TESTS})
set(LIBCXXABI_LIBDIR_SUFFIX "${LLVM_LIBDIR_SUFFIX}" CACHE STRING
"Define suffix of library directory name (32/64)")
+option(LIBCXXABI_INSTALL_HEADERS "Install the libc++abi headers." ON)
option(LIBCXXABI_INSTALL_LIBRARY "Install the libc++abi library." ON)
+set(LIBCXXABI_INSTALL_INCLUDE_DIR "include/c++/v1" CACHE PATH "Path to install the libc++abi headers at.")
if(NOT CMAKE_SYSROOT AND LIBCXXABI_SYSROOT)
message(WARNING "LIBCXXABI_SYSROOT is deprecated, please use CMAKE_SYSROOT instead")
@@ -541,7 +543,6 @@ set(LIBCXXABI_LIBUNWIND_INCLUDES "${LIBCXXABI_LIBUNWIND_INCLUDES}" CACHE PATH
set(LIBCXXABI_LIBUNWIND_PATH "${LIBCXXABI_LIBUNWIND_PATH}" CACHE PATH
"Specify path to libunwind source." FORCE)
-include_directories(include)
if (LIBCXXABI_USE_LLVM_UNWINDER OR LLVM_NATIVE_ARCH MATCHES ARM)
find_path(LIBCXXABI_LIBUNWIND_INCLUDES_INTERNAL libunwind.h
PATHS ${LIBCXXABI_LIBUNWIND_INCLUDES}
@@ -565,6 +566,7 @@ endif()
# Add source code. This also contains all of the logic for deciding linker flags
# soname, etc...
+add_subdirectory(include)
add_subdirectory(src)
if (LIBCXXABI_INCLUDE_TESTS)
diff --git a/libcxxabi/include/CMakeLists.txt b/libcxxabi/include/CMakeLists.txt
new file mode 100644
index 000000000000..0deb7b1eb9e7
--- /dev/null
+++ b/libcxxabi/include/CMakeLists.txt
@@ -0,0 +1,26 @@
+set(files
+ __cxxabi_config.h
+ cxxabi.h
+ )
+
+add_library(cxxabi-headers INTERFACE)
+target_include_directories(cxxabi-headers INTERFACE "${CMAKE_CURRENT_SOURCE_DIR}")
+
+if (LIBCXXABI_INSTALL_HEADERS)
+ foreach(file ${files})
+ get_filename_component(dir ${file} DIRECTORY)
+ install(FILES ${file}
+ DESTINATION ${LIBCXXABI_INSTALL_INCLUDE_DIR}/${dir}
+ COMPONENT cxxabi-headers
+ PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
+ )
+ endforeach()
+
+ add_custom_target(install-cxxabi-headers
+ DEPENDS cxxabi-headers
+ COMMAND "${CMAKE_COMMAND}"
+ -DCMAKE_INSTALL_COMPONENT=cxxabi-headers
+ -P "${CMAKE_BINARY_DIR}/cmake_install.cmake")
+ # Stripping is a no-op for headers
+ add_custom_target(install-cxxabi-headers-stripped DEPENDS install-cxxabi-headers)
+endif()
diff --git a/libcxxabi/src/CMakeLists.txt b/libcxxabi/src/CMakeLists.txt
index 762649a965ca..d1c6ad89f74b 100644
--- a/libcxxabi/src/CMakeLists.txt
+++ b/libcxxabi/src/CMakeLists.txt
@@ -178,6 +178,7 @@ endif()
if (LIBCXXABI_ENABLE_SHARED)
add_library(cxxabi_shared SHARED ${LIBCXXABI_SOURCES} ${LIBCXXABI_HEADERS})
target_link_libraries(cxxabi_shared PRIVATE cxx-headers ${LIBCXXABI_SHARED_LIBRARIES} ${LIBCXXABI_LIBRARIES})
+ target_link_libraries(cxxabi_shared PUBLIC cxxabi-headers)
if (TARGET pstl::ParallelSTL)
target_link_libraries(cxxabi_shared PUBLIC pstl::ParallelSTL)
endif()
@@ -233,6 +234,7 @@ endif()
if (LIBCXXABI_ENABLE_STATIC)
add_library(cxxabi_static STATIC ${LIBCXXABI_SOURCES} ${LIBCXXABI_HEADERS})
target_link_libraries(cxxabi_static PRIVATE cxx-headers ${LIBCXXABI_STATIC_LIBRARIES} ${LIBCXXABI_LIBRARIES})
+ target_link_libraries(cxxabi_static PUBLIC cxxabi-headers)
if (TARGET pstl::ParallelSTL)
target_link_libraries(cxxabi_static PUBLIC pstl::ParallelSTL)
endif()
@@ -299,7 +301,7 @@ endif()
if (NOT CMAKE_CONFIGURATION_TYPES AND LIBCXXABI_INSTALL_LIBRARY)
add_custom_target(install-cxxabi
- DEPENDS cxxabi
+ DEPENDS cxxabi install-cxxabi-headers
COMMAND "${CMAKE_COMMAND}"
-DCMAKE_INSTALL_COMPONENT=cxxabi
-P "${LIBCXXABI_BINARY_DIR}/cmake_install.cmake")