[runtimes] Revert the libc++ __config_site change
This is a massive revert of the following commits (from most revent to oldest):
2b9b7b5775a1d8fcd7aa5abaa8fc0bc303434f1a.
529ac33197f6408952ae995075ac5e2dc5287e81
28270234f1478047e35879f4ba8838b47edfcc14
69c2087283cf7b17ca75f69daebf4ffc158b754a
b5aa67446e01bd277727b05710a42e69ac41e74b
5d796645d6c8cadeb003715c33e231a8ba05b6de
After checking-in the __config_site change, a lot of things started breaking
due to widespread reliance on various aspects of libc++'s build, notably the
fact that we can include the headers from the source tree, but also reliance
on various "internal" CMake variables used by the runtimes build and compiler-rt.
These were unintended consequences of the change, and after two days, we
still haven't restored all the bots to being green. Instead, now that I
understand what specific areas this will blow up in, I should be able to
chop up the patch into smaller ones that are easier to digest.
See https://reviews.llvm.org/D89041 for more details on this adventure.
GitOrigin-RevId: 48e4b0fd3a3d68cc9774699964cf4c6c2be38cf3
diff --git a/CMakeLists.txt b/CMakeLists.txt
index a5d3a06..3f37dbf 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -138,23 +138,9 @@
message(FATAL_ERROR "libc++abi must be built as either a shared or static library.")
endif()
-# TODO: This is a hack 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 the installed libc++ includes. This is only relevant for Standalone builds, where the location of the headers can't be determined automatically.")
-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()
+set(LIBCXXABI_LIBCXX_INCLUDES "${LIBCXXABI_LIBCXX_PATH}/include" CACHE PATH
+ "Specify path to libc++ includes.")
+message(STATUS "Libc++abi will be using libc++ includes from ${LIBCXXABI_LIBCXX_INCLUDES}")
option(LIBCXXABI_HERMETIC_STATIC_LIBRARY
"Do not export any symbols from the static library." OFF)
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 8d4d84c..e9e4540 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -55,6 +55,8 @@
endif()
endif()
+include_directories("${LIBCXXABI_LIBCXX_INCLUDES}")
+
if (LIBCXXABI_HAS_CXA_THREAD_ATEXIT_IMPL)
add_definitions(-DHAVE___CXA_THREAD_ATEXIT_IMPL)
endif()
@@ -166,7 +168,7 @@
if(COMMAND llvm_setup_rpath)
llvm_setup_rpath(cxxabi_shared)
endif()
- target_link_libraries(cxxabi_shared PRIVATE cxx-headers ${LIBCXXABI_SHARED_LIBRARIES} ${LIBCXXABI_LIBRARIES})
+ target_link_libraries(cxxabi_shared PRIVATE ${LIBCXXABI_SHARED_LIBRARIES} ${LIBCXXABI_LIBRARIES})
if (TARGET pstl::ParallelSTL)
target_link_libraries(cxxabi_shared PUBLIC pstl::ParallelSTL)
endif()
@@ -231,7 +233,7 @@
# Build the static library.
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 PRIVATE ${LIBCXXABI_STATIC_LIBRARIES} ${LIBCXXABI_LIBRARIES})
if (TARGET pstl::ParallelSTL)
target_link_libraries(cxxabi_static PUBLIC pstl::ParallelSTL)
endif()
diff --git a/test/libcxxabi/test/config.py b/test/libcxxabi/test/config.py
index f9e17e9..45fb0f5 100644
--- a/test/libcxxabi/test/config.py
+++ b/test/libcxxabi/test/config.py
@@ -56,8 +56,10 @@
super(Configuration, self).configure_compile_flags()
def configure_compile_flags_header_includes(self):
- cxx_headers = self.get_lit_conf('cxx_headers', None) or \
- os.path.join(self.project_obj_root, 'include', 'c++', 'v1')
+ self.configure_config_site_header()
+ cxx_headers = self.get_lit_conf(
+ 'cxx_headers',
+ os.path.join(self.libcxx_src_root, '/include'))
if cxx_headers == '':
self.lit_config.note('using the systems c++ headers')
else: