[runtimes][CMake] Simplify the propagation of test dependencies (#93558)
Instead of using FOO_TEST_DEPS global variables that don't get updated properly from subdirectories, use targets to propagate the dependencies across directories.
This commit is contained in:
parent
633ea41b54
commit
bd135c3b9f
10 changed files with 15 additions and 36 deletions
|
|
@ -856,15 +856,14 @@ endfunction()
|
|||
#===============================================================================
|
||||
# Setup Source Code And Tests
|
||||
#===============================================================================
|
||||
add_custom_target(cxx-test-depends
|
||||
COMMENT "Build dependencies required to run the libc++ test suite.")
|
||||
|
||||
add_subdirectory(include)
|
||||
add_subdirectory(src)
|
||||
add_subdirectory(utils)
|
||||
add_subdirectory(modules)
|
||||
|
||||
set(LIBCXX_TEST_DEPS "cxx_experimental")
|
||||
|
||||
list(APPEND LIBCXX_TEST_DEPS generate-cxx-modules)
|
||||
|
||||
if (LIBCXX_INCLUDE_BENCHMARKS)
|
||||
add_subdirectory(benchmarks)
|
||||
endif()
|
||||
|
|
|
|||
|
|
@ -252,10 +252,6 @@ endforeach()
|
|||
if (LIBCXX_INCLUDE_TESTS)
|
||||
include(AddLLVM)
|
||||
|
||||
if (NOT DEFINED LIBCXX_TEST_DEPS)
|
||||
message(FATAL_ERROR "Expected LIBCXX_TEST_DEPS to be defined")
|
||||
endif()
|
||||
|
||||
configure_lit_site_cfg(
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.py.in
|
||||
${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg.py)
|
||||
|
|
@ -265,6 +261,6 @@ if (LIBCXX_INCLUDE_TESTS)
|
|||
add_lit_target(check-cxx-benchmarks
|
||||
"Running libcxx benchmarks tests"
|
||||
${CMAKE_CURRENT_BINARY_DIR}
|
||||
DEPENDS cxx-benchmarks ${LIBCXX_TEST_DEPS}
|
||||
DEPENDS cxx-benchmarks cxx-test-depends
|
||||
ARGS ${BENCHMARK_LIT_ARGS})
|
||||
endif()
|
||||
|
|
|
|||
|
|
@ -202,6 +202,7 @@ add_custom_target(generate-cxx-modules
|
|||
ALL DEPENDS
|
||||
${_all_modules}
|
||||
)
|
||||
add_dependencies(cxx-test-depends generate-cxx-modules)
|
||||
|
||||
# Configure the modules manifest.
|
||||
# Use the relative path between the installation and the module in the json
|
||||
|
|
|
|||
|
|
@ -322,6 +322,7 @@ endif()
|
|||
|
||||
# Add a meta-target for both libraries.
|
||||
add_custom_target(cxx DEPENDS ${LIBCXX_BUILD_TARGETS})
|
||||
add_dependencies(cxx-test-depends cxx)
|
||||
|
||||
set(LIBCXX_EXPERIMENTAL_SOURCES
|
||||
experimental/keep.cpp
|
||||
|
|
@ -366,6 +367,7 @@ set_target_properties(cxx_experimental
|
|||
)
|
||||
cxx_add_common_build_flags(cxx_experimental)
|
||||
target_compile_options(cxx_experimental PUBLIC -D_LIBCPP_ENABLE_EXPERIMENTAL)
|
||||
add_dependencies(cxx-test-depends cxx_experimental)
|
||||
|
||||
if (LIBCXX_INSTALL_SHARED_LIBRARY)
|
||||
install(TARGETS cxx_shared
|
||||
|
|
|
|||
|
|
@ -1,11 +1,5 @@
|
|||
include(HandleLitArguments)
|
||||
add_subdirectory(tools)
|
||||
# When the tools add clang-tidy support, the dependencies need to be updated.
|
||||
# This cannot be done in the tools CMakeLists.txt since that does not update
|
||||
# the status in this (a parent) directory.
|
||||
if(TARGET cxx-tidy)
|
||||
list(APPEND LIBCXX_TEST_DEPS cxx-tidy)
|
||||
endif()
|
||||
|
||||
# By default, libcxx and libcxxabi share a library directory.
|
||||
if (NOT LIBCXX_CXX_ABI_LIBRARY_PATH)
|
||||
|
|
@ -40,10 +34,6 @@ endif()
|
|||
|
||||
serialize_lit_params_list(SERIALIZED_LIT_PARAMS LIBCXX_TEST_PARAMS)
|
||||
|
||||
if (NOT DEFINED LIBCXX_TEST_DEPS)
|
||||
message(FATAL_ERROR "Expected LIBCXX_TEST_DEPS to be defined")
|
||||
endif()
|
||||
|
||||
if (MSVC)
|
||||
# Shared code for initializing some parameters used by all
|
||||
# llvm-libc++-*-clangcl.cfg.in test configs.
|
||||
|
|
@ -81,10 +71,6 @@ if (LIBCXX_INCLUDE_TESTS)
|
|||
${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}
|
||||
|
|
|
|||
|
|
@ -110,3 +110,5 @@ set_target_properties(cxx-tidy PROPERTIES
|
|||
|
||||
set_target_properties(cxx-tidy PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
|
||||
set(CMAKE_SHARED_MODULE_SUFFIX_CXX .plugin) # Use a portable suffix to simplify how we can find it from Lit
|
||||
|
||||
add_dependencies(cxx-test-depends cxx-tidy)
|
||||
|
|
|
|||
|
|
@ -443,6 +443,9 @@ if (NOT "${LIBCXXABI_LIBUNWIND_INCLUDES_INTERNAL}" STREQUAL "")
|
|||
include_directories("${LIBCXXABI_LIBUNWIND_INCLUDES_INTERNAL}")
|
||||
endif()
|
||||
|
||||
add_custom_target(cxxabi-test-depends
|
||||
COMMENT "Build dependencies required to run the libc++abi test suite.")
|
||||
|
||||
# Add source code. This also contains all of the logic for deciding linker flags
|
||||
# soname, etc...
|
||||
add_subdirectory(include)
|
||||
|
|
|
|||
|
|
@ -304,6 +304,7 @@ endif()
|
|||
|
||||
# Add a meta-target for both libraries.
|
||||
add_custom_target(cxxabi DEPENDS ${LIBCXXABI_BUILD_TARGETS})
|
||||
add_dependencies(cxxabi-test-depends cxxabi cxx)
|
||||
|
||||
if (LIBCXXABI_INSTALL_LIBRARY)
|
||||
install(TARGETS ${LIBCXXABI_INSTALL_TARGETS}
|
||||
|
|
|
|||
|
|
@ -10,17 +10,6 @@ endmacro()
|
|||
|
||||
pythonize_bool(LIBCXXABI_USE_LLVM_UNWINDER)
|
||||
|
||||
if (LIBCXXABI_ENABLE_SHARED)
|
||||
set(LIBCXXABI_TEST_DEPS cxxabi_shared)
|
||||
else()
|
||||
set(LIBCXXABI_TEST_DEPS cxxabi_static)
|
||||
endif()
|
||||
|
||||
list(APPEND LIBCXXABI_TEST_DEPS cxx)
|
||||
if (LIBCXXABI_USE_LLVM_UNWINDER AND TARGET unwind)
|
||||
list(APPEND LIBCXXABI_TEST_DEPS unwind)
|
||||
endif()
|
||||
|
||||
set(AUTO_GEN_COMMENT "## Autogenerated by libcxxabi configuration.\n# Do not edit!")
|
||||
set(SERIALIZED_LIT_PARAMS "# Lit parameters serialized here for llvm-lit to pick them up\n")
|
||||
|
||||
|
|
@ -59,4 +48,4 @@ configure_lit_site_cfg(
|
|||
|
||||
add_lit_testsuite(check-cxxabi "Running libcxxabi tests"
|
||||
${CMAKE_CURRENT_BINARY_DIR}
|
||||
DEPENDS ${LIBCXXABI_TEST_DEPS})
|
||||
DEPENDS cxxabi-test-depends)
|
||||
|
|
|
|||
|
|
@ -47,4 +47,4 @@ configure_lit_site_cfg(
|
|||
|
||||
add_lit_testsuite(check-unwind "Running libunwind tests"
|
||||
${CMAKE_CURRENT_BINARY_DIR}
|
||||
DEPENDS unwind ${LIBUNWIND_TEST_DEPS})
|
||||
DEPENDS unwind)
|
||||
|
|
|
|||
Loading…
Reference in a new issue