[libcxx-commits] [PATCH] D98367: [libcxxabi] Use cxx-headers target to consume libcxx headers
Petr Hosek via Phabricator via libcxx-commits
libcxx-commits at lists.llvm.org
Tue Mar 23 12:25:58 PDT 2021
This revision was automatically updated to reflect the committed changes.
Closed by commit rG72728e12806a: [libcxxabi] Use cxx-headers target to consume libcxx headers (authored by phosek).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D98367/new/
https://reviews.llvm.org/D98367
Files:
libcxxabi/CMakeLists.txt
libcxxabi/src/CMakeLists.txt
libcxxabi/test/libcxxabi/test/config.py
Index: libcxxabi/test/libcxxabi/test/config.py
===================================================================
--- libcxxabi/test/libcxxabi/test/config.py
+++ libcxxabi/test/libcxxabi/test/config.py
@@ -57,9 +57,8 @@
def configure_compile_flags_header_includes(self):
self.configure_config_site_header()
- cxx_headers = self.get_lit_conf(
- 'cxx_headers',
- os.path.join(self.libcxx_src_root, '/include'))
+ cxx_headers = self.get_lit_conf('cxx_headers', None) or \
+ os.path.join(self.project_obj_root, 'include', 'c++', 'v1')
if cxx_headers == '':
self.lit_config.note('using the systems c++ headers')
else:
Index: libcxxabi/src/CMakeLists.txt
===================================================================
--- libcxxabi/src/CMakeLists.txt
+++ libcxxabi/src/CMakeLists.txt
@@ -55,8 +55,6 @@
endif()
endif()
-include_directories("${LIBCXXABI_LIBCXX_INCLUDES}")
-
# stdlib_stdexcept.cpp depends on libc++ internals.
include_directories("${LIBCXXABI_LIBCXX_PATH}")
@@ -177,7 +175,7 @@
# Build the shared library.
if (LIBCXXABI_ENABLE_SHARED)
add_library(cxxabi_shared SHARED ${LIBCXXABI_SOURCES} ${LIBCXXABI_HEADERS})
- target_link_libraries(cxxabi_shared PRIVATE ${LIBCXXABI_SHARED_LIBRARIES} ${LIBCXXABI_LIBRARIES})
+ target_link_libraries(cxxabi_shared PRIVATE cxx-headers ${LIBCXXABI_SHARED_LIBRARIES} ${LIBCXXABI_LIBRARIES})
if (TARGET pstl::ParallelSTL)
target_link_libraries(cxxabi_shared PUBLIC pstl::ParallelSTL)
endif()
@@ -244,7 +242,7 @@
# Build the static library.
if (LIBCXXABI_ENABLE_STATIC)
add_library(cxxabi_static STATIC ${LIBCXXABI_SOURCES} ${LIBCXXABI_HEADERS})
- target_link_libraries(cxxabi_static PRIVATE ${LIBCXXABI_STATIC_LIBRARIES} ${LIBCXXABI_LIBRARIES})
+ target_link_libraries(cxxabi_static PRIVATE cxx-headers ${LIBCXXABI_STATIC_LIBRARIES} ${LIBCXXABI_LIBRARIES})
if (TARGET pstl::ParallelSTL)
target_link_libraries(cxxabi_static PUBLIC pstl::ParallelSTL)
endif()
Index: libcxxabi/CMakeLists.txt
===================================================================
--- libcxxabi/CMakeLists.txt
+++ libcxxabi/CMakeLists.txt
@@ -156,9 +156,23 @@
message(FATAL_ERROR "libc++abi must be built as either a shared or static library.")
endif()
-set(LIBCXXABI_LIBCXX_INCLUDES "${LIBCXXABI_LIBCXX_PATH}/include" CACHE PATH
+# TODO: This is a workaround for the fact that Standalone builds can't use
+# targets from the other runtimes (so the cxx-headers target doesn't exist).
+set(LIBCXXABI_LIBCXX_INCLUDES "" CACHE PATH
"Specify path to libc++ includes.")
-message(STATUS "Libc++abi will be using libc++ includes from ${LIBCXXABI_LIBCXX_INCLUDES}")
+if (LIBCXXABI_STANDALONE_BUILD)
+ if (NOT IS_DIRECTORY ${LIBCXXABI_LIBCXX_INCLUDES})
+ message(FATAL_ERROR
+ "LIBCXXABI_LIBCXX_INCLUDES=${LIBCXXABI_LIBCXX_INCLUDES} is not a valid directory. "
+ "Please provide the path to where the libc++ headers have been installed.")
+ endif()
+ add_library(cxx-headers INTERFACE)
+ if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC" OR "${CMAKE_CXX_SIMULATE_ID}" STREQUAL "MSVC")
+ target_compile_options(cxx-headers INTERFACE /I "${LIBCXXABI_LIBCXX_INCLUDES}")
+ else()
+ target_compile_options(cxx-headers INTERFACE -I "${LIBCXXABI_LIBCXX_INCLUDES}")
+ endif()
+endif()
option(LIBCXXABI_HERMETIC_STATIC_LIBRARY
"Do not export any symbols from the static library." OFF)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D98367.332755.patch
Type: text/x-patch
Size: 3467 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20210323/73dbef71/attachment.bin>
More information about the libcxx-commits
mailing list