[libc++abi] Fix the standalone build after the __config_site change

In 5d796645, we stopped looking at the LIBCXXABI_LIBCXX_INCLUDES variable,
which broke users of the Standalone build. This patch reinstates that
variable, however it must point to the *installed* path of the libc++
headers, not the libc++ headers in the source tree (which has always
been the case, but wasn't enforced before).

If LIBCXXABI_LIBCXX_INCLUDES points to the libc++ headers in the source
tree, the `__config_site` header will fail to be found.
This commit is contained in:
Louis Dionne 2020-10-22 19:11:33 -04:00
parent 93953d411a
commit 529ac33197
3 changed files with 21 additions and 3 deletions

View File

@ -138,6 +138,24 @@ if (NOT LIBCXXABI_ENABLE_SHARED AND NOT LIBCXXABI_ENABLE_STATIC)
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()
option(LIBCXXABI_HERMETIC_STATIC_LIBRARY
"Do not export any symbols from the static library." OFF)

View File

@ -56,9 +56,8 @@ class Configuration(LibcxxConfiguration):
super(Configuration, self).configure_compile_flags()
def configure_compile_flags_header_includes(self):
cxx_headers = self.get_lit_conf(
'cxx_headers',
os.path.join(self.project_obj_root, 'include', 'c++', 'v1'))
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:

View File

@ -9,6 +9,7 @@ config.libcxxabi_src_root = "@LIBCXXABI_SOURCE_DIR@"
config.libcxxabi_obj_root = "@LIBCXXABI_BINARY_DIR@"
config.abi_library_path = "@LIBCXXABI_LIBRARY_DIR@"
config.libcxx_src_root = "@LIBCXXABI_LIBCXX_PATH@"
config.cxx_headers = "@LIBCXXABI_LIBCXX_INCLUDES@"
config.libunwind_headers = "@LIBCXXABI_LIBUNWIND_INCLUDES_INTERNAL@"
config.cxx_library_root = "@LIBCXXABI_LIBCXX_LIBRARY_PATH@"
config.llvm_unwinder = @LIBCXXABI_USE_LLVM_UNWINDER@