[llvm] ec10ac7 - [runtimes] Detect changes to Tests.cmake
Petr Hosek via llvm-commits
llvm-commits at lists.llvm.org
Fri Mar 18 10:02:06 PDT 2022
Author: Petr Hosek
Date: 2022-03-18T10:01:52-07:00
New Revision: ec10ac750a8ad96983d85263323635f3dabe92fd
URL: https://github.com/llvm/llvm-project/commit/ec10ac750a8ad96983d85263323635f3dabe92fd
DIFF: https://github.com/llvm/llvm-project/commit/ec10ac750a8ad96983d85263323635f3dabe92fd.diff
LOG: [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
Added:
Modified:
llvm/cmake/modules/LLVMExternalProjectUtils.cmake
llvm/runtimes/CMakeLists.txt
runtimes/Tests.cmake.in
Removed:
################################################################################
diff --git a/llvm/cmake/modules/LLVMExternalProjectUtils.cmake b/llvm/cmake/modules/LLVMExternalProjectUtils.cmake
index f99a50df22801..cf0f18476b60c 100644
--- a/llvm/cmake/modules/LLVMExternalProjectUtils.cmake
+++ b/llvm/cmake/modules/LLVMExternalProjectUtils.cmake
@@ -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
diff --git a/llvm/runtimes/CMakeLists.txt b/llvm/runtimes/CMakeLists.txt
index 5dc014aee19c0..9ee124a5616cc 100644
--- a/llvm/runtimes/CMakeLists.txt
+++ b/llvm/runtimes/CMakeLists.txt
@@ -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()
diff --git a/runtimes/Tests.cmake.in b/runtimes/Tests.cmake.in
index 4df40f237b3f5..7d76a170a090d 100644
--- a/runtimes/Tests.cmake.in
+++ b/runtimes/Tests.cmake.in
@@ -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@)
More information about the llvm-commits
mailing list