diff --git a/libcxx/CMakeLists.txt b/libcxx/CMakeLists.txt --- a/libcxx/CMakeLists.txt +++ b/libcxx/CMakeLists.txt @@ -66,6 +66,7 @@ option(LIBCXX_ENABLE_FILESYSTEM "Build filesystem as part of the main libc++ library" ${ENABLE_FILESYSTEM_DEFAULT}) option(LIBCXX_INCLUDE_TESTS "Build the libc++ tests." ${LLVM_INCLUDE_TESTS}) +option(LIBCXX_TEST_ONLY "Only run the libc++ test-suite without building the runtime." OFF) option(LIBCXX_ENABLE_PARALLEL_ALGORITHMS "Enable the parallel algorithms library. This requires the PSTL to be available." OFF) option(LIBCXX_ENABLE_DEBUG_MODE "Whether to build libc++ with the debug mode enabled. @@ -131,6 +132,10 @@ message(STATUS "Using libc++ testing configuration: ${LIBCXX_TEST_CONFIG}") set(LIBCXX_TEST_PARAMS "" CACHE STRING "A list of parameters to run the Lit test suite with.") +set(LIBCXX_EXTERNAL_HEADER_DIR "${LIBCXX_EXTERNAL_HEADER_DIR}" CACHE PATH + "The path to an external header directory to be used with the test-suite.") +set(LIBCXX_EXTERNAL_LIBRARY_DIR "${LIBCXX_EXTERNAL_LIBRARY_DIR}" CACHE PATH + "The path to an external library directory to be used with the test-suite.") # Benchmark options ----------------------------------------------------------- option(LIBCXX_INCLUDE_BENCHMARKS "Build the libc++ benchmarks and their dependencies" ON) @@ -919,8 +924,10 @@ #=============================================================================== # Setup Source Code And Tests #=============================================================================== -add_subdirectory(include) -add_subdirectory(src) +if (NOT LIBCXX_TEST_ONLY) + add_subdirectory(include) + add_subdirectory(src) +endif() add_subdirectory(utils) set(LIBCXX_TEST_DEPS "cxx_experimental") diff --git a/libcxx/test/CMakeLists.txt b/libcxx/test/CMakeLists.txt --- a/libcxx/test/CMakeLists.txt +++ b/libcxx/test/CMakeLists.txt @@ -60,14 +60,20 @@ ${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg MAIN_CONFIG "${CMAKE_CURRENT_SOURCE_DIR}/lit.cfg.py") - add_custom_target(cxx-test-depends - DEPENDS cxx ${LIBCXX_TEST_DEPS} - COMMENT "Builds dependencies required to run the test suite.") - - add_lit_testsuite(check-cxx - "Running libcxx tests" - ${CMAKE_CURRENT_BINARY_DIR} - DEPENDS cxx-test-depends) + if (LIBCXX_TEST_ONLY) + add_lit_testsuite(check-cxx + "Running libcxx tests" + ${CMAKE_CURRENT_BINARY_DIR}) + else() + add_custom_target(cxx-test-depends + DEPENDS cxx ${LIBCXX_TEST_DEPS} + COMMENT "Builds dependencies required to run the test suite.") + + add_lit_testsuite(check-cxx + "Running libcxx tests" + ${CMAKE_CURRENT_BINARY_DIR} + DEPENDS cxx-test-depends) + endif() endif() if (LIBCXX_GENERATE_COVERAGE) diff --git a/libcxx/test/configs/cmake-bridge.cfg.in b/libcxx/test/configs/cmake-bridge.cfg.in --- a/libcxx/test/configs/cmake-bridge.cfg.in +++ b/libcxx/test/configs/cmake-bridge.cfg.in @@ -26,8 +26,13 @@ import shlex config.substitutions.append(('%{cxx}', shlex.quote('@CMAKE_CXX_COMPILER@'))) config.substitutions.append(('%{libcxx}', '@LIBCXX_SOURCE_DIR@')) -config.substitutions.append(('%{include}', '@LIBCXX_GENERATED_INCLUDE_DIR@')) config.substitutions.append(('%{target-include}', '@LIBCXX_GENERATED_INCLUDE_TARGET_DIR@')) -config.substitutions.append(('%{lib}', '@LIBCXX_LIBRARY_DIR@')) config.substitutions.append(('%{executor}', '@LIBCXX_EXECUTOR@')) config.substitutions.append(('%{test-tools}', '@LIBCXX_TEST_TOOLS_PATH@')) + +if '@LIBCXX_TEST_ONLY@'.lower() == 'on' : + config.substitutions.append(('%{include}', '@LIBCXX_EXTERNAL_HEADER_DIR@')) + config.substitutions.append(('%{lib}', '@LIBCXX_EXTERNAL_LIBRARY_DIR@')) +else: + config.substitutions.append(('%{include}', '@LIBCXX_GENERATED_INCLUDE_DIR@')) + config.substitutions.append(('%{lib}', '@LIBCXX_LIBRARY_DIR@')) diff --git a/libcxxabi/CMakeLists.txt b/libcxxabi/CMakeLists.txt --- a/libcxxabi/CMakeLists.txt +++ b/libcxxabi/CMakeLists.txt @@ -173,6 +173,9 @@ set(LIBCXXABI_TEST_PARAMS "" CACHE STRING "A list of parameters to run the Lit test suite with.") +set(LIBCXXABI_EXTERNAL_HEADER_DIR "${LIBCXX_EXTERNAL_HEADER_DIR}") +set(LIBCXXABI_EXTERNAL_LIBRARY_DIR "${LIBCXX_EXTERNAL_LIBRARY_DIR}") + #=============================================================================== # Configure System #=============================================================================== @@ -505,8 +508,10 @@ # Add source code. This also contains all of the logic for deciding linker flags # soname, etc... -add_subdirectory(include) -add_subdirectory(src) +if (NOT LIBCXX_TEST_ONLY) + add_subdirectory(include) + add_subdirectory(src) +endif() if (LIBCXXABI_INCLUDE_TESTS) add_subdirectory(test) diff --git a/libcxxabi/test/CMakeLists.txt b/libcxxabi/test/CMakeLists.txt --- a/libcxxabi/test/CMakeLists.txt +++ b/libcxxabi/test/CMakeLists.txt @@ -68,6 +68,11 @@ ${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg MAIN_CONFIG "${CMAKE_CURRENT_SOURCE_DIR}/lit.cfg.py") -add_lit_testsuite(check-cxxabi "Running libcxxabi tests" - ${CMAKE_CURRENT_BINARY_DIR} - DEPENDS ${LIBCXXABI_TEST_DEPS}) +if (LIBCXX_TEST_ONLY) + add_lit_testsuite(check-cxxabi "Running libcxxabi tests" + ${CMAKE_CURRENT_BINARY_DIR}) +else() + add_lit_testsuite(check-cxxabi "Running libcxxabi tests" + ${CMAKE_CURRENT_BINARY_DIR} + DEPENDS ${LIBCXXABI_TEST_DEPS}) +endif() diff --git a/libcxxabi/test/configs/cmake-bridge.cfg.in b/libcxxabi/test/configs/cmake-bridge.cfg.in --- a/libcxxabi/test/configs/cmake-bridge.cfg.in +++ b/libcxxabi/test/configs/cmake-bridge.cfg.in @@ -28,12 +28,17 @@ config.substitutions.append(('%{cxx}', '@CMAKE_CXX_COMPILER@')) config.substitutions.append(('%{libcxx}', '@LIBCXXABI_LIBCXX_PATH@')) -config.substitutions.append(('%{include}', '@LIBCXXABI_SOURCE_DIR@/include')) config.substitutions.append(('%{cxx-include}', '@LIBCXXABI_HEADER_DIR@/include/c++/v1')) config.substitutions.append(('%{cxx-target-include}', '@LIBCXXABI_HEADER_DIR@/include/%{triple}/c++/v1')) -config.substitutions.append(('%{lib}', '@LIBCXXABI_LIBRARY_DIR@')) config.substitutions.append(('%{executor}', '@LIBCXXABI_EXECUTOR@')) +if '@LIBCXX_TEST_ONLY@'.lower() == 'on': + config.substitutions.append(('%{include}', '@LIBCXXABI_EXTERNAL_HEADER_DIR@')) + config.substitutions.append(('%{lib}', '@LIBCXXABI_EXTERNAL_LIBRARY_DIR@')) +else: + config.substitutions.append(('%{include}', '@LIBCXXABI_SOURCE_DIR@/include')) + config.substitutions.append(('%{lib}', '@LIBCXXABI_LIBRARY_DIR@')) + if @LIBCXXABI_USE_LLVM_UNWINDER@: config.substitutions.append(('%{maybe-include-libunwind}', '-I "@LIBCXXABI_LIBUNWIND_INCLUDES_INTERNAL@"')) else: diff --git a/libunwind/CMakeLists.txt b/libunwind/CMakeLists.txt --- a/libunwind/CMakeLists.txt +++ b/libunwind/CMakeLists.txt @@ -97,6 +97,9 @@ option(LIBUNWIND_HIDE_SYMBOLS "Do not export any symbols from the static library." ${LIBUNWIND_DEFAULT_HIDE_SYMBOLS}) +set(LIBUNWIND_EXTERNAL_HEADER_DIR "${LIBCXX_EXTERNAL_HEADER_DIR}") +set(LIBUNWIND_EXTERNAL_LIBRARY_DIR "${LIBCXX_EXTERNAL_LIBRARY_DIR}") + #=============================================================================== # Configure System #=============================================================================== @@ -321,9 +324,10 @@ # Setup Source Code #=============================================================================== -add_subdirectory(include) - -add_subdirectory(src) +if (NOT LIBCXX_TEST_ONLY) + add_subdirectory(include) + add_subdirectory(src) +endif() if (LIBUNWIND_INCLUDE_DOCS) add_subdirectory(docs) diff --git a/libunwind/test/CMakeLists.txt b/libunwind/test/CMakeLists.txt --- a/libunwind/test/CMakeLists.txt +++ b/libunwind/test/CMakeLists.txt @@ -47,6 +47,11 @@ ${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg MAIN_CONFIG "${CMAKE_CURRENT_SOURCE_DIR}/lit.cfg.py") -add_lit_testsuite(check-unwind "Running libunwind tests" - ${CMAKE_CURRENT_BINARY_DIR} - DEPENDS unwind ${LIBUNWIND_TEST_DEPS}) +if (LIBCXX_TEST_ONLY) + add_lit_testsuite(check-unwind "Running libunwind tests" + ${CMAKE_CURRENT_BINARY_DIR}) +else() + add_lit_testsuite(check-unwind "Running libunwind tests" + ${CMAKE_CURRENT_BINARY_DIR} + DEPENDS unwind ${LIBUNWIND_TEST_DEPS}) +endif() diff --git a/libunwind/test/configs/cmake-bridge.cfg.in b/libunwind/test/configs/cmake-bridge.cfg.in --- a/libunwind/test/configs/cmake-bridge.cfg.in +++ b/libunwind/test/configs/cmake-bridge.cfg.in @@ -34,3 +34,10 @@ config.substitutions.append(('%{executor}', '@LIBUNWIND_EXECUTOR@')) config.substitutions.append(('%{include}', '@LIBUNWIND_SOURCE_DIR@/include')) config.substitutions.append(('%{lib}', '@LIBUNWIND_LIBRARY_DIR@')) + +if '@LIBCXX_TEST_ONLY@'.lower() == 'on' : + config.substitutions.append(('%{include}', '@LIBUNWIND_EXTERNAL_HEADER_DIR@')) + config.substitutions.append(('%{lib}', '@LIBUNWIND_EXTERNAL_LIBRARY_DIR@')) +else: + config.substitutions.append(('%{include}', '@LIBUNWIND_SOURCE_DIR@/include')) + config.substitutions.append(('%{lib}', '@LIBUNWIND_LIBRARY_DIR@'))