[libcxx] Allow tests to link with static libc++abi/libc++ even if the shared version is present

Summary:
This is essentially D71894, but for libc++.

This is needed for running libc++ tests over SSH.

Reviewers: EricWF, ldionne, phosek, mehdi_amini, mclow.lists, jroelofs, bcraig, #libc

Reviewed By: ldionne, phosek, #libc

Subscribers: mgorny, christof, dexonsmith, libcxx-commits

Tags: #libc

Differential Revision: https://reviews.llvm.org/D72687
This commit is contained in:
Sergej Jaskiewicz 2020-03-25 15:27:05 +03:00
parent 05606329e2
commit eed57dd591
2 changed files with 32 additions and 2 deletions

View File

@ -26,10 +26,40 @@ if (LIBCXX_ENABLE_ABI_LINKER_SCRIPT)
set(LIBCXXABI_USE_LLVM_UNWINDER OFF)
endif()
option(LIBCXX_LINK_TESTS_WITH_SHARED_LIBCXXABI
"Whether the libc++ tests should link with the shared libc++abi library"
${LIBCXXABI_ENABLE_SHARED})
option(LIBCXX_LINK_TESTS_WITH_SHARED_LIBCXX
"Whether the libc++ tests should link with the shared libc++ library"
${LIBCXX_ENABLE_SHARED})
if(DEFINED LIBCXXABI_ENABLE_SHARED
AND LIBCXX_LINK_TESTS_WITH_SHARED_LIBCXXABI
AND NOT LIBCXXABI_ENABLE_SHARED)
message(FATAL_ERROR "LIBCXX_LINK_TESTS_WITH_SHARED_LIBCXXABI being ON requires LIBCXXABI_ENABLE_SHARED to be ON")
endif()
if(DEFINED LIBCXXABI_ENABLE_STATIC
AND NOT LIBCXX_LINK_TESTS_WITH_SHARED_LIBCXXABI
AND NOT LIBCXXABI_ENABLE_STATIC)
message(FATAL_ERROR "LIBCXX_LINK_TESTS_WITH_SHARED_LIBCXXABI being OFF requires LIBCXXABI_ENABLE_STATIC to be ON")
endif()
if(LIBCXX_LINK_TESTS_WITH_SHARED_LIBCXX AND NOT LIBCXX_ENABLE_SHARED)
message(FATAL_ERROR "LIBCXX_LINK_TESTS_WITH_SHARED_LIBCXX being ON requires LIBCXX_ENABLE_SHARED to be ON")
endif()
if(NOT LIBCXX_LINK_TESTS_WITH_SHARED_LIBCXX AND NOT LIBCXX_ENABLE_STATIC)
message(FATAL_ERROR "LIBCXX_LINK_TESTS_WITH_SHARED_LIBCXX being OFF requires LIBCXX_ENABLE_STATIC to be ON")
endif()
pythonize_bool(LIBCXX_ENABLE_EXCEPTIONS)
pythonize_bool(LIBCXX_ENABLE_EXPERIMENTAL_LIBRARY)
pythonize_bool(LIBCXX_ENABLE_RTTI)
pythonize_bool(LIBCXX_ENABLE_SHARED)
pythonize_bool(LIBCXX_LINK_TESTS_WITH_SHARED_LIBCXX)
pythonize_bool(LIBCXX_LINK_TESTS_WITH_SHARED_LIBCXXABI)
pythonize_bool(LIBCXX_ENABLE_FILESYSTEM)
pythonize_bool(LIBCXX_BUILD_32_BITS)
pythonize_bool(LIBCXX_GENERATE_COVERAGE)

View File

@ -8,7 +8,7 @@ config.enable_exceptions = @LIBCXX_ENABLE_EXCEPTIONS@
config.enable_experimental = @LIBCXX_ENABLE_EXPERIMENTAL_LIBRARY@
config.enable_filesystem = @LIBCXX_ENABLE_FILESYSTEM@
config.enable_rtti = @LIBCXX_ENABLE_RTTI@
config.enable_shared = @LIBCXX_ENABLE_SHARED@
config.enable_shared = @LIBCXX_LINK_TESTS_WITH_SHARED_LIBCXX@
config.enable_32bit = @LIBCXX_BUILD_32_BITS@
config.cxx_abi = "@LIBCXX_CXX_ABI_LIBNAME@"
config.use_sanitizer = "@LLVM_USE_SANITIZER@"
@ -31,7 +31,7 @@ config.builtins_library = "@LIBCXX_BUILTINS_LIBRARY@"
config.has_libatomic = @LIBCXX_HAS_ATOMIC_LIB@
config.use_libatomic = @LIBCXX_HAVE_CXX_ATOMICS_WITH_LIB@
config.debug_build = @LIBCXX_DEBUG_BUILD@
config.libcxxabi_shared = @LIBCXXABI_ENABLE_SHARED@
config.libcxxabi_shared = @LIBCXX_LINK_TESTS_WITH_SHARED_LIBCXXABI@
config.cxx_ext_threads = @LIBCXX_BUILD_EXTERNAL_THREAD_LIBRARY@
config.pstl_src_root = "@ParallelSTL_SOURCE_DIR@" if @LIBCXX_ENABLE_PARALLEL_ALGORITHMS@ else None
config.pstl_obj_root = "@ParallelSTL_BINARY_DIR@" if @LIBCXX_ENABLE_PARALLEL_ALGORITHMS@ else None