[runtimes] Detect changes to Tests.cmake

This ensures that Tests.cmake is tracked by Ninja and any changes to
this file from the subbuilds are correctly detected.

Differential Revision: https://reviews.llvm.org/D121647
This commit is contained in:
Petr Hosek 2022-03-14 14:21:26 -07:00
parent dbe96c8da0
commit ec10ac750a
3 changed files with 17 additions and 16 deletions

View File

@ -56,12 +56,14 @@ endfunction()
# Use provided strip tool instead of the default one.
# TARGET_TRIPLE triple
# Optional target triple to pass to the compiler
# BYPRODUCTS files...
# Files generated as a byproduct of this build.
# )
function(llvm_ExternalProject_Add name source_dir)
cmake_parse_arguments(ARG
"USE_TOOLCHAIN;EXCLUDE_FROM_ALL;NO_INSTALL;ALWAYS_CLEAN"
"SOURCE_DIR"
"CMAKE_ARGS;TOOLCHAIN_TOOLS;RUNTIME_LIBRARIES;DEPENDS;EXTRA_TARGETS;PASSTHROUGH_PREFIXES;STRIP_TOOL;TARGET_TRIPLE"
"CMAKE_ARGS;TOOLCHAIN_TOOLS;RUNTIME_LIBRARIES;DEPENDS;EXTRA_TARGETS;PASSTHROUGH_PREFIXES;STRIP_TOOL;TARGET_TRIPLE;BYPRODUCTS"
${ARGN})
canonicalize_tool_name(${name} nameCanon)
@ -322,6 +324,7 @@ function(llvm_ExternalProject_Add name source_dir)
INSTALL_COMMAND ""
STEP_TARGETS configure build
BUILD_ALWAYS 1
BUILD_BYPRODUCTS ${ARG_BYPRODUCTS}
USES_TERMINAL_CONFIGURE 1
USES_TERMINAL_BUILD 1
USES_TERMINAL_INSTALL 1

View File

@ -220,13 +220,11 @@ function(runtime_default_target)
endforeach()
if(LLVM_INCLUDE_TESTS)
include(${LLVM_BINARY_DIR}/runtimes/Tests.cmake OPTIONAL RESULT_VARIABLE have_tests)
include(${LLVM_BINARY_DIR}/runtimes/Tests.cmake OPTIONAL)
set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS ${LLVM_BINARY_DIR}/runtimes/Tests.cmake)
if(have_tests)
set_property(GLOBAL APPEND PROPERTY LLVM_LIT_TESTSUITES ${RUNTIMES_LIT_TESTSUITES})
set_property(GLOBAL APPEND PROPERTY LLVM_LIT_PARAMS ${RUNTIMES_LIT_PARAMS})
set_property(GLOBAL APPEND PROPERTY LLVM_LIT_EXTRA_ARGS ${RUNTIMES_LIT_EXTRA_ARGS})
endif()
set_property(GLOBAL APPEND PROPERTY LLVM_LIT_TESTSUITES ${SUB_LIT_TESTSUITES})
set_property(GLOBAL APPEND PROPERTY LLVM_LIT_PARAMS ${SUB_LIT_PARAMS})
set_property(GLOBAL APPEND PROPERTY LLVM_LIT_EXTRA_ARGS ${SUB_LIT_EXTRA_ARGS})
list(APPEND test_targets runtimes-test-depends check-runtimes)
endif()
@ -262,6 +260,7 @@ function(runtime_default_target)
${SUB_INSTALL_TARGETS}
USE_TOOLCHAIN
TARGET_TRIPLE ${LLVM_TARGET_TRIPLE}
BYPRODUCTS ${LLVM_BINARY_DIR}/runtimes/Tests.cmake
${EXTRA_ARGS})
endfunction()
@ -303,13 +302,11 @@ function(runtime_register_target name target)
endforeach()
if(LLVM_INCLUDE_TESTS)
include(${LLVM_BINARY_DIR}/runtimes/${name}/Tests.cmake OPTIONAL RESULT_VARIABLE have_tests)
include(${LLVM_BINARY_DIR}/runtimes/${name}/Tests.cmake OPTIONAL)
set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS ${LLVM_BINARY_DIR}/runtimes/${name}/Tests.cmake)
if(have_tests)
set_property(GLOBAL APPEND PROPERTY LLVM_LIT_TESTSUITES ${RUNTIMES_LIT_TESTSUITES})
set_property(GLOBAL APPEND PROPERTY LLVM_LIT_PARAMS ${RUNTIMES_LIT_PARAMS})
set_property(GLOBAL APPEND PROPERTY LLVM_LIT_EXTRA_ARGS ${RUNTIMES_LIT_EXTRA_ARGS})
endif()
set_property(GLOBAL APPEND PROPERTY LLVM_LIT_TESTSUITES ${SUB_LIT_TESTSUITES})
set_property(GLOBAL APPEND PROPERTY LLVM_LIT_PARAMS ${SUB_LIT_PARAMS})
set_property(GLOBAL APPEND PROPERTY LLVM_LIT_EXTRA_ARGS ${SUB_LIT_EXTRA_ARGS})
set(runtimes-test-depends-${name} runtimes-test-depends)
set(check-runtimes-${name} check-runtimes)
list(APPEND ${name}_test_targets runtimes-test-depends-${name} check-runtimes-${name})
@ -369,6 +366,7 @@ function(runtime_register_target name target)
${${name}_test_targets}
USE_TOOLCHAIN
TARGET_TRIPLE ${target}
BYPRODUCTS ${LLVM_BINARY_DIR}/runtimes/${name}/Tests.cmake
${EXTRA_ARGS})
endfunction()

View File

@ -1,3 +1,3 @@
set(RUNTIMES_LIT_TESTSUITES @RUNTIMES_LIT_TESTSUITES@)
set(RUNTIMES_LIT_PARAMS @RUNTIMES_LIT_PARAMS@)
set(RUNTIMES_LIT_EXTRA_ARGS @RUNTIMES_LIT_EXTRA_ARGS@)
set(SUB_LIT_TESTSUITES @RUNTIMES_LIT_TESTSUITES@)
set(SUB_LIT_PARAMS @RUNTIMES_LIT_PARAMS@)
set(SUB_LIT_EXTRA_ARGS @RUNTIMES_LIT_EXTRA_ARGS@)