diff options
author | Orkun Tokdemir <ilhanorkuntokdemir@gmail.com> | 2023-10-23 15:34:01 (GMT) |
---|---|---|
committer | Orkun Tokdemir <ilhanorkuntokdemir@gmail.com> | 2024-01-17 15:02:58 (GMT) |
commit | 596e84b0d55c080b93a5ba2d2a4d24357375378c (patch) | |
tree | 4fae89db1f882f3dcc8e8140b771ad9c43eb7047 /Tests | |
parent | 7c39dabdbc505587f91ae41b4fd7c287d41443e5 (diff) | |
download | CMake-596e84b0d55c080b93a5ba2d2a4d24357375378c.zip CMake-596e84b0d55c080b93a5ba2d2a4d24357375378c.tar.gz CMake-596e84b0d55c080b93a5ba2d2a4d24357375378c.tar.bz2 |
NinjaMultiConfig: Update tests for the new dependency change
* Tests were updated for the cases both `AUTOGEN_BETTER_GRAPH_MULTI_CONFIG` is ON and OFF
This commit reimplements e454314daaed0ab5f86bba0015747eb296efb8da
Diffstat (limited to 'Tests')
3 files changed, 85 insertions, 22 deletions
diff --git a/Tests/RunCMake/NinjaMultiConfig/QtX-debug-in-release-graph-build-check.cmake b/Tests/RunCMake/NinjaMultiConfig/QtX-debug-in-release-graph-build-check.cmake deleted file mode 100644 index 2d8df13..0000000 --- a/Tests/RunCMake/NinjaMultiConfig/QtX-debug-in-release-graph-build-check.cmake +++ /dev/null @@ -1,7 +0,0 @@ -check_files("${RunCMake_TEST_BINARY_DIR}" - INCLUDE - ${AUTOGEN_FILES} - - ${TARGET_FILE_exe_Debug} - ${TARGET_OBJECT_FILES_exe_Debug} - ) diff --git a/Tests/RunCMake/NinjaMultiConfig/QtX.cmake b/Tests/RunCMake/NinjaMultiConfig/QtX.cmake index 130f883..4d1bf13 100644 --- a/Tests/RunCMake/NinjaMultiConfig/QtX.cmake +++ b/Tests/RunCMake/NinjaMultiConfig/QtX.cmake @@ -19,16 +19,32 @@ if(${QtX}Core_VERSION VERSION_GREATER_EQUAL "5.15.0") set(moc_writes_depfiles 1) endif() -set(autogen_files) -if(moc_writes_depfiles) - list(APPEND autogen_files "${CMAKE_BINARY_DIR}/exe_autogen/deps") - list(APPEND autogen_files "${CMAKE_BINARY_DIR}/exe_autogen/timestamp") -endif() -foreach(c IN LISTS CMAKE_CONFIGURATION_TYPES) - list(APPEND autogen_files "${CMAKE_BINARY_DIR}/exe_autogen/mocs_compilation_${c}.cpp") - list(APPEND autogen_files "${CMAKE_BINARY_DIR}/exe_autogen/include_${c}/moc_qt5.cpp") +foreach(CONFIG IN LISTS CMAKE_CONFIGURATION_TYPES) + set(config_suffix "_${CONFIG}") + if (CMAKE_AUTOGEN_BETTER_GRAPH_MULTI_CONFIG) + set(autogen_files_config_suffix "${config_suffix}") + endif() + set(autogen_files) if(moc_writes_depfiles) - list(APPEND autogen_files "${CMAKE_BINARY_DIR}/exe_autogen/include_${c}/moc_qt5.cpp.d") + list(APPEND autogen_files "${CMAKE_BINARY_DIR}/exe_autogen/deps${autogen_files_config_suffix}") + list(APPEND autogen_files "${CMAKE_BINARY_DIR}/exe_autogen/timestamp${autogen_files_config_suffix}") endif() + if (CMAKE_AUTOGEN_BETTER_GRAPH_MULTI_CONFIG) + list(APPEND autogen_files "${CMAKE_BINARY_DIR}/exe_autogen/mocs_compilation${config_suffix}.cpp") + list(APPEND autogen_files "${CMAKE_BINARY_DIR}/exe_autogen/include${config_suffix}/moc_qt5.cpp") + if(moc_writes_depfiles) + list(APPEND autogen_files "${CMAKE_BINARY_DIR}/exe_autogen/include${config_suffix}/moc_qt5.cpp.d") + endif() + else() + foreach(c IN LISTS CMAKE_CONFIGURATION_TYPES) + list(APPEND autogen_files "${CMAKE_BINARY_DIR}/exe_autogen/mocs_compilation_${c}.cpp") + list(APPEND autogen_files "${CMAKE_BINARY_DIR}/exe_autogen/include_${c}/moc_qt5.cpp") + if(moc_writes_depfiles) + list(APPEND autogen_files "${CMAKE_BINARY_DIR}/exe_autogen/include_${c}/moc_qt5.cpp.d") + endif() + endforeach() + endif() + + file(APPEND "${CMAKE_BINARY_DIR}/target_files.cmake" "set(AUTOGEN_FILES${config_suffix} [==[${autogen_files}]==])\n") + unset(autogen_files) endforeach() -file(APPEND "${CMAKE_BINARY_DIR}/target_files.cmake" "set(AUTOGEN_FILES [==[${autogen_files}]==])\n") diff --git a/Tests/RunCMake/NinjaMultiConfig/RunCMakeTest.cmake b/Tests/RunCMake/NinjaMultiConfig/RunCMakeTest.cmake index 5c6a22d..88fd1e8 100644 --- a/Tests/RunCMake/NinjaMultiConfig/RunCMakeTest.cmake +++ b/Tests/RunCMake/NinjaMultiConfig/RunCMakeTest.cmake @@ -488,11 +488,65 @@ if(CMake_TEST_Qt_version) "-D${QtX}Core_DIR=${${QtX}Core_DIR}" "-DCMAKE_PREFIX_PATH:STRING=${CMAKE_PREFIX_PATH}" ) - run_cmake_configure(QtX) - unset(RunCMake_TEST_OPTIONS) - include(${RunCMake_TEST_BINARY_DIR}/target_files.cmake) - run_cmake_build(QtX debug-in-release-graph Release exe:Debug) + + foreach(use_better_graph IN ITEMS ON OFF) + foreach(target_config IN ITEMS Debug Release RelWithDebInfo) + foreach(ninja_config IN ITEMS Debug Release RelWithDebInfo) + block() + set(target_config_suffix "_${target_config}") + if (use_better_graph) + set(autogen_files_config_suffix "${target_config_suffix}") + else() + set(autogen_files_config_suffix "") + endif() + set(prefix "QtX") + set(case "${target_config}-in-${ninja_config}-better-graph-${use_better_graph}") + set(test_path "${prefix}-${case}") + set(RunCMake_TEST_VARIANT_DESCRIPTION "-${case}-configure") + set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/${test_path}-build) + run_cmake_with_options(QtX ${RunCMake_TEST_OPTIONS} + "-DCMAKE_AUTOGEN_BETTER_GRAPH_MULTI_CONFIG=${use_better_graph}") + unset(RunCMake_TEST_VARIANT_DESCRIPTION) + include(${RunCMake_TEST_BINARY_DIR}/target_files.cmake) + run_cmake_build(${test_path} "" ${ninja_config} exe:${target_config}) + check_files("${RunCMake_TEST_BINARY_DIR}" + INCLUDE + "${AUTOGEN_FILES${target_config_suffix}}" + "${TARGET_FILE_exe${target_config_suffix}}" + "${TARGET_OBJECT_FILES_exe${target_config_suffix}}" + ) + if (DEFINED RunCMake_TEST_FAILED AND NOT RunCMake_TEST_FAILED STREQUAL "") + message(FATAL_ERROR "RunCMake_TEST_FAILED:${RunCMake_TEST_FAILED}") + else() + message(STATUS "${test_path}-check-files - PASSED") + endif() + + check_file_contents("${RunCMake_TEST_BINARY_DIR}/exe_autogen/deps${autogen_files_config_suffix}" + "exe_autogen/timestamp${autogen_files_config_suffix}") + if (DEFINED RunCMake_TEST_FAILED AND NOT RunCMake_TEST_FAILED STREQUAL "") + message(FATAL_ERROR "RunCMake_TEST_FAILED:${RunCMake_TEST_FAILED}") + endif() + endblock() + endforeach() + endforeach() + endforeach() + if(CMake_TEST_${QtX}Core_Version VERSION_GREATER_EQUAL 5.15.0) - run_ninja(QtX automoc-check build-Debug.ninja -t query exe_autogen/timestamp) + foreach(use_better_graph IN ITEMS ON OFF) + foreach(target_config IN ITEMS Debug Release RelWithDebInfo) + foreach(ninja_config IN ITEMS Debug Release RelWithDebInfo) + set(prefix "QtX") + set(case "${target_config}-in-${ninja_config}-better-graph-${use_better_graph}") + set(test_path "${prefix}-${case}") + if (use_better_graph) + set(autogen_files_config_suffix "_${target_config}") + else() + set(autogen_files_config_suffix "") + endif() + set(RunCMake_TEST_VARIANT_DESCRIPTION "-automoc-check") + run_ninja(${test_path} "" build-${ninja_config}.ninja -t query exe_autogen/timestamp${autogen_files_config_suffix}) + endforeach() + endforeach() + endforeach() endif() endif() |