From b1504f9f97849777f4690565f8b5879372e7dd51 Mon Sep 17 00:00:00 2001 From: Sebastian Holtermann Date: Sat, 9 Dec 2017 13:30:54 +0100 Subject: Autogen: Tests: Separate RerunRccDepends test --- Tests/CMakeLists.txt | 30 ----- Tests/QtAutogen/CommonTests.cmake | 1 + Tests/QtAutogen/RerunRccDepends/CMakeLists.txt | 139 +++++++++++++++++++++ .../RerunRccDepends/RccDepends/CMakeLists.txt | 33 +++++ .../QtAutogen/RerunRccDepends/RccDepends/main.cpp | 5 + .../RerunRccDepends/RccDepends/resGen/input.txt.in | 1 + .../RccDepends/resGen/inputAdded.txt.in | 1 + .../RerunRccDepends/RccDepends/resGenA.qrc.in | 5 + .../RerunRccDepends/RccDepends/resGenB.qrc.in | 6 + .../RccDepends/resPlain/input.txt.in | 1 + .../RccDepends/resPlain/inputAdded.txt.in | 1 + .../RerunRccDepends/RccDepends/resPlainA.qrc.in | 5 + .../RerunRccDepends/RccDepends/resPlainB.qrc.in | 6 + Tests/QtAutogen/RerunRccDepends/dummy.cpp | 5 + Tests/QtAutogenRerun/CMakeLists.txt | 43 ------- Tests/QtAutogenRerun/defines_test/CMakeLists.txt | 4 - Tests/QtAutogenRerun/defines_test/defines_test.cpp | 38 ------ Tests/QtAutogenRerun/dummy.cpp | 5 - Tests/QtAutogenRerun/rccDepends.cmake | 131 ------------------- Tests/QtAutogenRerun/rccDepends/CMakeLists.txt | 41 ------ Tests/QtAutogenRerun/rccDepends/main.cpp | 5 - .../QtAutogenRerun/rccDepends/resGen/input.txt.in | 1 - .../rccDepends/resGen/inputAdded.txt.in | 1 - Tests/QtAutogenRerun/rccDepends/resGenA.qrc.in | 5 - Tests/QtAutogenRerun/rccDepends/resGenB.qrc.in | 6 - .../rccDepends/resPlain/input.txt.in | 1 - .../rccDepends/resPlain/inputAdded.txt.in | 1 - Tests/QtAutogenRerun/rccDepends/resPlainA.qrc.in | 5 - Tests/QtAutogenRerun/rccDepends/resPlainB.qrc.in | 6 - 29 files changed, 209 insertions(+), 323 deletions(-) create mode 100644 Tests/QtAutogen/RerunRccDepends/CMakeLists.txt create mode 100644 Tests/QtAutogen/RerunRccDepends/RccDepends/CMakeLists.txt create mode 100644 Tests/QtAutogen/RerunRccDepends/RccDepends/main.cpp create mode 100644 Tests/QtAutogen/RerunRccDepends/RccDepends/resGen/input.txt.in create mode 100644 Tests/QtAutogen/RerunRccDepends/RccDepends/resGen/inputAdded.txt.in create mode 100644 Tests/QtAutogen/RerunRccDepends/RccDepends/resGenA.qrc.in create mode 100644 Tests/QtAutogen/RerunRccDepends/RccDepends/resGenB.qrc.in create mode 100644 Tests/QtAutogen/RerunRccDepends/RccDepends/resPlain/input.txt.in create mode 100644 Tests/QtAutogen/RerunRccDepends/RccDepends/resPlain/inputAdded.txt.in create mode 100644 Tests/QtAutogen/RerunRccDepends/RccDepends/resPlainA.qrc.in create mode 100644 Tests/QtAutogen/RerunRccDepends/RccDepends/resPlainB.qrc.in create mode 100644 Tests/QtAutogen/RerunRccDepends/dummy.cpp delete mode 100644 Tests/QtAutogenRerun/CMakeLists.txt delete mode 100644 Tests/QtAutogenRerun/defines_test/CMakeLists.txt delete mode 100644 Tests/QtAutogenRerun/defines_test/defines_test.cpp delete mode 100644 Tests/QtAutogenRerun/dummy.cpp delete mode 100644 Tests/QtAutogenRerun/rccDepends.cmake delete mode 100644 Tests/QtAutogenRerun/rccDepends/CMakeLists.txt delete mode 100644 Tests/QtAutogenRerun/rccDepends/main.cpp delete mode 100644 Tests/QtAutogenRerun/rccDepends/resGen/input.txt.in delete mode 100644 Tests/QtAutogenRerun/rccDepends/resGen/inputAdded.txt.in delete mode 100644 Tests/QtAutogenRerun/rccDepends/resGenA.qrc.in delete mode 100644 Tests/QtAutogenRerun/rccDepends/resGenB.qrc.in delete mode 100644 Tests/QtAutogenRerun/rccDepends/resPlain/input.txt.in delete mode 100644 Tests/QtAutogenRerun/rccDepends/resPlain/inputAdded.txt.in delete mode 100644 Tests/QtAutogenRerun/rccDepends/resPlainA.qrc.in delete mode 100644 Tests/QtAutogenRerun/rccDepends/resPlainB.qrc.in diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index b0bf887..46dc224 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -1263,21 +1263,6 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release if(CMake_TEST_Qt5 AND Qt5Widgets_FOUND) add_subdirectory(Qt5Autogen) - add_test(NAME Qt5AutogenRerun COMMAND ${CMAKE_CTEST_COMMAND} - --build-and-test - "${CMake_SOURCE_DIR}/Tests/QtAutogenRerun" - "${CMake_BINARY_DIR}/Tests/Qt5AutogenRerun" - ${build_generator_args} - --build-project QtAutogenRerun - --build-exe-dir "${CMake_BINARY_DIR}/Tests/Qt5AutogenRerun" - --force-new-ctest-process - --build-options ${build_options} - -DQT_QMAKE_EXECUTABLE:FILEPATH=${QT_QMAKE_EXECUTABLE} - -DQT_TEST_VERSION=5 - ${QtAutogen_BUILD_OPTIONS} - ) - list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/Qt5AutogenRerun") - add_test(Qt5AutoUicInterface ${CMAKE_CTEST_COMMAND} --build-and-test "${CMake_SOURCE_DIR}/Tests/QtAutoUicInterface" @@ -1295,21 +1280,6 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release if(QT4_WORKS AND QT_QTGUI_FOUND) add_subdirectory(Qt4Autogen) - add_test(NAME Qt4AutogenRerun COMMAND ${CMAKE_CTEST_COMMAND} - --build-and-test - "${CMake_SOURCE_DIR}/Tests/QtAutogenRerun" - "${CMake_BINARY_DIR}/Tests/Qt4AutogenRerun" - ${build_generator_args} - --build-project QtAutogenRerun - --build-exe-dir "${CMake_BINARY_DIR}/Tests/Qt4AutogenRerun" - --force-new-ctest-process - --build-options ${build_options} - -DQT_QMAKE_EXECUTABLE:FILEPATH=${QT_QMAKE_EXECUTABLE} - -DQT_TEST_VERSION=4 - ${QtAutogen_BUILD_OPTIONS} - ) - list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/Qt4AutogenRerun") - add_test(Qt4AutoUicInterface ${CMAKE_CTEST_COMMAND} --build-and-test "${CMake_SOURCE_DIR}/Tests/QtAutoUicInterface" diff --git a/Tests/QtAutogen/CommonTests.cmake b/Tests/QtAutogen/CommonTests.cmake index b03c282..5746ab5 100644 --- a/Tests/QtAutogen/CommonTests.cmake +++ b/Tests/QtAutogen/CommonTests.cmake @@ -36,3 +36,4 @@ ADD_AUTOGEN_TEST(RerunMocBasic) if(NOT QT_TEST_VERSION STREQUAL 4) ADD_AUTOGEN_TEST(RerunMocPlugin) endif() +ADD_AUTOGEN_TEST(RerunRccDepends) diff --git a/Tests/QtAutogen/RerunRccDepends/CMakeLists.txt b/Tests/QtAutogen/RerunRccDepends/CMakeLists.txt new file mode 100644 index 0000000..2e6a5bd --- /dev/null +++ b/Tests/QtAutogen/RerunRccDepends/CMakeLists.txt @@ -0,0 +1,139 @@ +cmake_minimum_required(VERSION 3.10) +project(RerunRccDepends) +include("../AutogenTest.cmake") + +# Tests rcc rebuilding when a resource file changes + +# Dummy executable to generate a clean target +add_executable(dummy dummy.cpp) + +# When a .qrc or a file listed in a .qrc file changes, +# the target must be rebuilt +set(timeformat "%Y%j%H%M%S") +set(rccDepSD "${CMAKE_CURRENT_SOURCE_DIR}/RccDepends") +set(rccDepBD "${CMAKE_CURRENT_BINARY_DIR}/RccDepends") + +# Initial build +configure_file(${rccDepSD}/resPlainA.qrc.in ${rccDepBD}/resPlain.qrc COPYONLY) +configure_file(${rccDepSD}/resGenA.qrc.in ${rccDepBD}/resGen.qrc.in COPYONLY) +try_compile(RCC_DEPENDS + "${rccDepBD}" + "${rccDepSD}" + RccDepends + CMAKE_FLAGS "-DQT_TEST_VERSION=${QT_TEST_VERSION}" + "-DQT_QMAKE_EXECUTABLE:FILEPATH=${QT_QMAKE_EXECUTABLE}" + OUTPUT_VARIABLE output +) +if (NOT RCC_DEPENDS) + message(SEND_ERROR "Initial build of rccDepends failed. Output: ${output}") +endif() + +# Get name of the output binaries +file(STRINGS "${rccDepBD}/targetPlain.txt" targetListPlain ENCODING UTF-8) +file(STRINGS "${rccDepBD}/targetGen.txt" targetListGen ENCODING UTF-8) +list(GET targetListPlain 0 rccDepBinPlain) +list(GET targetListGen 0 rccDepBinGen) +message("Target that uses a plain .qrc file is:\n ${rccDepBinPlain}") +message("Target that uses a GENERATED .qrc file is:\n ${rccDepBinGen}") + + +message("Changing a resource files listed in the .qrc file") +# - Acquire binary timestamps before the build +file(TIMESTAMP "${rccDepBinPlain}" rdPlainBefore "${timeformat}") +file(TIMESTAMP "${rccDepBinGen}" rdGenBefore "${timeformat}") +# - Ensure that the timestamp will change +# - Change a resource files listed in the .qrc file +# - Rebuild +execute_process(COMMAND "${CMAKE_COMMAND}" -E sleep 1) +execute_process(COMMAND "${CMAKE_COMMAND}" -E touch "${rccDepBD}/resPlain/input.txt") +execute_process(COMMAND "${CMAKE_COMMAND}" -E touch "${rccDepBD}/resGen/input.txt") +execute_process(COMMAND "${CMAKE_COMMAND}" --build . WORKING_DIRECTORY "${rccDepBD}" RESULT_VARIABLE result) +if (result) + message(SEND_ERROR "Second build of rccDepends failed.") +endif() +# - Acquire binary timestamps after the build +file(TIMESTAMP "${rccDepBinPlain}" rdPlainAfter "${timeformat}") +file(TIMESTAMP "${rccDepBinGen}" rdGenAfter "${timeformat}") +# - Test if timestamps changed +if (NOT rdPlainAfter GREATER rdPlainBefore) + message(SEND_ERROR "Plain .qrc binary ${rccDepBinPlain}) should have changed!") +endif() +if (NOT rdGenAfter GREATER rdGenBefore) + message(SEND_ERROR "GENERATED .qrc binary ${rccDepBinGen} should have changed!") +endif() + + +message("Changing a the .qrc file") +# - Acquire binary timestamps before the build +file(TIMESTAMP "${rccDepBinPlain}" rdPlainBefore "${timeformat}") +file(TIMESTAMP "${rccDepBinGen}" rdGenBefore "${timeformat}") +# - Ensure that the timestamp will change +# - Change the .qrc file +# - Rebuild +execute_process(COMMAND "${CMAKE_COMMAND}" -E sleep 1) +configure_file(${rccDepSD}/resPlainB.qrc.in ${rccDepBD}/resPlain.qrc COPYONLY) +configure_file(${rccDepSD}/resGenB.qrc.in ${rccDepBD}/resGen.qrc.in COPYONLY) +execute_process(COMMAND "${CMAKE_COMMAND}" --build . WORKING_DIRECTORY "${rccDepBD}" RESULT_VARIABLE result) +if (result) + message(SEND_ERROR "Third build of rccDepends failed.") +endif() +# - Acquire binary timestamps after the build +file(TIMESTAMP "${rccDepBinPlain}" rdPlainAfter "${timeformat}") +file(TIMESTAMP "${rccDepBinGen}" rdGenAfter "${timeformat}") +# - Test if timestamps changed +if (NOT rdPlainAfter GREATER rdPlainBefore) + message(SEND_ERROR "Plain .qrc binary ${rccDepBinPlain}) should have changed!") +endif() +if (NOT rdGenAfter GREATER rdGenBefore) + message(SEND_ERROR "GENERATED .qrc binary ${rccDepBinGen} should have changed!") +endif() + + +message("Changing a newly added resource files listed in the .qrc file") +# - Acquire binary timestamps before the build +file(TIMESTAMP "${rccDepBinPlain}" rdPlainBefore "${timeformat}") +file(TIMESTAMP "${rccDepBinGen}" rdGenBefore "${timeformat}") +# - Ensure that the timestamp will change +# - Change a newly added resource files listed in the .qrc file +# - Rebuild +execute_process(COMMAND "${CMAKE_COMMAND}" -E sleep 1) +execute_process(COMMAND "${CMAKE_COMMAND}" -E touch "${rccDepBD}/resPlain/inputAdded.txt") +execute_process(COMMAND "${CMAKE_COMMAND}" -E touch "${rccDepBD}/resGen/inputAdded.txt") +execute_process(COMMAND "${CMAKE_COMMAND}" --build . WORKING_DIRECTORY "${rccDepBD}" RESULT_VARIABLE result) +if (result) + message(SEND_ERROR "Fourth build of rccDepends failed.") +endif() +# - Acquire binary timestamps after the build +file(TIMESTAMP "${rccDepBinPlain}" rdPlainAfter "${timeformat}") +file(TIMESTAMP "${rccDepBinGen}" rdGenAfter "${timeformat}") +# - Test if timestamps changed +if (NOT rdPlainAfter GREATER rdPlainBefore) + message(SEND_ERROR "Plain .qrc binary ${rccDepBinPlain}) should have changed!") +endif() +if (NOT rdGenAfter GREATER rdGenBefore) + message(SEND_ERROR "GENERATED .qrc binary ${rccDepBinGen} should have changed!") +endif() + + +message("Changing nothing in the .qrc file") +# - Acquire binary timestamps before the build +file(TIMESTAMP "${rccDepBinPlain}" rdPlainBefore "${timeformat}") +file(TIMESTAMP "${rccDepBinGen}" rdGenBefore "${timeformat}") +# - Ensure that the timestamp will change +# - Change nothing +# - Rebuild +execute_process(COMMAND "${CMAKE_COMMAND}" -E sleep 1) +execute_process(COMMAND "${CMAKE_COMMAND}" --build . WORKING_DIRECTORY "${rccDepBD}" RESULT_VARIABLE result) +if (result) + message(SEND_ERROR "Fifth build of rccDepends failed.") +endif() +# - Acquire binary timestamps after the build +file(TIMESTAMP "${rccDepBinPlain}" rdPlainAfter "${timeformat}") +file(TIMESTAMP "${rccDepBinGen}" rdGenAfter "${timeformat}") +# - Test if timestamps changed +if (rdPlainAfter GREATER rdPlainBefore) + message(SEND_ERROR "Plain .qrc binary ${rccDepBinPlain}) should NOT have changed!") +endif() +if (rdGenAfter GREATER rdGenBefore) + message(SEND_ERROR "GENERATED .qrc binary ${rccDepBinGen} should NOT have changed!") +endif() diff --git a/Tests/QtAutogen/RerunRccDepends/RccDepends/CMakeLists.txt b/Tests/QtAutogen/RerunRccDepends/RccDepends/CMakeLists.txt new file mode 100644 index 0000000..0507e61 --- /dev/null +++ b/Tests/QtAutogen/RerunRccDepends/RccDepends/CMakeLists.txt @@ -0,0 +1,33 @@ +cmake_minimum_required(VERSION 3.10) +project(RccDepends) +include("../../AutogenTest.cmake") + +# Enable AUTORCC for all targets +set(CMAKE_AUTORCC ON) + +# Initial resource files setup +configure_file(resPlain/input.txt.in resPlain/input.txt COPYONLY) +configure_file(resPlain/input.txt.in resPlain/inputAdded.txt COPYONLY) +configure_file(resGen/input.txt.in resGen/input.txt COPYONLY) +configure_file(resGen/input.txt.in resGen/inputAdded.txt COPYONLY) + +# Generated qrc file with dependency +add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/resGen.qrc + DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/resGen.qrc.in + COMMAND ${CMAKE_COMMAND} -E sleep 2 + COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_BINARY_DIR}/resGen.qrc.in ${CMAKE_CURRENT_BINARY_DIR}/resGen.qrc +) + +# Target that uses a plain .qrc file +add_executable(rccDependsPlain main.cpp ${CMAKE_CURRENT_BINARY_DIR}/resPlain.qrc) +target_link_libraries(rccDependsPlain ${QT_QTCORE_TARGET}) +add_custom_command(TARGET rccDependsPlain POST_BUILD COMMAND + ${CMAKE_COMMAND} -E echo "$" > targetPlain.txt +) + +# Target that uses a GENERATED .qrc file +add_executable(rccDependsGen main.cpp ${CMAKE_CURRENT_BINARY_DIR}/resGen.qrc ) +target_link_libraries(rccDependsGen ${QT_QTCORE_TARGET}) +add_custom_command(TARGET rccDependsGen POST_BUILD COMMAND + ${CMAKE_COMMAND} -E echo "$" > targetGen.txt +) diff --git a/Tests/QtAutogen/RerunRccDepends/RccDepends/main.cpp b/Tests/QtAutogen/RerunRccDepends/RccDepends/main.cpp new file mode 100644 index 0000000..766b775 --- /dev/null +++ b/Tests/QtAutogen/RerunRccDepends/RccDepends/main.cpp @@ -0,0 +1,5 @@ + +int main() +{ + return 0; +} diff --git a/Tests/QtAutogen/RerunRccDepends/RccDepends/resGen/input.txt.in b/Tests/QtAutogen/RerunRccDepends/RccDepends/resGen/input.txt.in new file mode 100644 index 0000000..4f24589 --- /dev/null +++ b/Tests/QtAutogen/RerunRccDepends/RccDepends/resGen/input.txt.in @@ -0,0 +1 @@ +Generated resource input. diff --git a/Tests/QtAutogen/RerunRccDepends/RccDepends/resGen/inputAdded.txt.in b/Tests/QtAutogen/RerunRccDepends/RccDepends/resGen/inputAdded.txt.in new file mode 100644 index 0000000..4f24589 --- /dev/null +++ b/Tests/QtAutogen/RerunRccDepends/RccDepends/resGen/inputAdded.txt.in @@ -0,0 +1 @@ +Generated resource input. diff --git a/Tests/QtAutogen/RerunRccDepends/RccDepends/resGenA.qrc.in b/Tests/QtAutogen/RerunRccDepends/RccDepends/resGenA.qrc.in new file mode 100644 index 0000000..c131a34 --- /dev/null +++ b/Tests/QtAutogen/RerunRccDepends/RccDepends/resGenA.qrc.in @@ -0,0 +1,5 @@ + + + resGen/input.txt + + diff --git a/Tests/QtAutogen/RerunRccDepends/RccDepends/resGenB.qrc.in b/Tests/QtAutogen/RerunRccDepends/RccDepends/resGenB.qrc.in new file mode 100644 index 0000000..8c7e643 --- /dev/null +++ b/Tests/QtAutogen/RerunRccDepends/RccDepends/resGenB.qrc.in @@ -0,0 +1,6 @@ + + + resGen/input.txt + resGen/inputAdded.txt + + diff --git a/Tests/QtAutogen/RerunRccDepends/RccDepends/resPlain/input.txt.in b/Tests/QtAutogen/RerunRccDepends/RccDepends/resPlain/input.txt.in new file mode 100644 index 0000000..a5e407a --- /dev/null +++ b/Tests/QtAutogen/RerunRccDepends/RccDepends/resPlain/input.txt.in @@ -0,0 +1 @@ +Plaint resource input. diff --git a/Tests/QtAutogen/RerunRccDepends/RccDepends/resPlain/inputAdded.txt.in b/Tests/QtAutogen/RerunRccDepends/RccDepends/resPlain/inputAdded.txt.in new file mode 100644 index 0000000..a5e407a --- /dev/null +++ b/Tests/QtAutogen/RerunRccDepends/RccDepends/resPlain/inputAdded.txt.in @@ -0,0 +1 @@ +Plaint resource input. diff --git a/Tests/QtAutogen/RerunRccDepends/RccDepends/resPlainA.qrc.in b/Tests/QtAutogen/RerunRccDepends/RccDepends/resPlainA.qrc.in new file mode 100644 index 0000000..c135d85 --- /dev/null +++ b/Tests/QtAutogen/RerunRccDepends/RccDepends/resPlainA.qrc.in @@ -0,0 +1,5 @@ + + + resPlain/input.txt + + diff --git a/Tests/QtAutogen/RerunRccDepends/RccDepends/resPlainB.qrc.in b/Tests/QtAutogen/RerunRccDepends/RccDepends/resPlainB.qrc.in new file mode 100644 index 0000000..186b653 --- /dev/null +++ b/Tests/QtAutogen/RerunRccDepends/RccDepends/resPlainB.qrc.in @@ -0,0 +1,6 @@ + + + resPlain/input.txt + resPlain/inputAdded.txt + + diff --git a/Tests/QtAutogen/RerunRccDepends/dummy.cpp b/Tests/QtAutogen/RerunRccDepends/dummy.cpp new file mode 100644 index 0000000..4837a76 --- /dev/null +++ b/Tests/QtAutogen/RerunRccDepends/dummy.cpp @@ -0,0 +1,5 @@ + +int main(int argv, char** args) +{ + return 0; +} diff --git a/Tests/QtAutogenRerun/CMakeLists.txt b/Tests/QtAutogenRerun/CMakeLists.txt deleted file mode 100644 index 9f1ee28..0000000 --- a/Tests/QtAutogenRerun/CMakeLists.txt +++ /dev/null @@ -1,43 +0,0 @@ -cmake_minimum_required(VERSION 3.9) -cmake_policy(SET CMP0071 NEW) -project(QtAutogenRerun) - -# Tell find_package(Qt5) where to find Qt. -if(QT_QMAKE_EXECUTABLE) - get_filename_component(Qt_BIN_DIR "${QT_QMAKE_EXECUTABLE}" PATH) - get_filename_component(Qt_PREFIX_DIR "${Qt_BIN_DIR}" PATH) - list(APPEND CMAKE_PREFIX_PATH ${Qt_PREFIX_DIR}) -endif() - -if (QT_TEST_VERSION STREQUAL 4) - find_package(Qt4 REQUIRED) - - # Include this directory before using the UseQt4 file. - add_subdirectory(defines_test) - - include(UseQt4) - - set(QT_QTCORE_TARGET Qt4::QtCore) - -else() - if (NOT QT_TEST_VERSION STREQUAL 5) - message(SEND_ERROR "Invalid Qt version specified.") - endif() - find_package(Qt5Widgets REQUIRED) - - set(QT_QTCORE_TARGET Qt5::Core) - - include_directories(${Qt5Widgets_INCLUDE_DIRS}) - set(QT_LIBRARIES Qt5::Widgets) - - if(Qt5_POSITION_INDEPENDENT_CODE AND CMAKE_CXX_COMPILE_OPTIONS_PIC) - add_definitions(${CMAKE_CXX_COMPILE_OPTIONS_PIC}) - endif() - -endif() - -# Dummy executable to generate clean target -add_executable(dummy dummy.cpp) - -# -- Test -include("rccDepends.cmake") diff --git a/Tests/QtAutogenRerun/defines_test/CMakeLists.txt b/Tests/QtAutogenRerun/defines_test/CMakeLists.txt deleted file mode 100644 index 9ee9a22..0000000 --- a/Tests/QtAutogenRerun/defines_test/CMakeLists.txt +++ /dev/null @@ -1,4 +0,0 @@ - -add_executable(defines_test defines_test.cpp) -set_target_properties(defines_test PROPERTIES AUTOMOC TRUE) -target_link_libraries(defines_test Qt4::QtGui) diff --git a/Tests/QtAutogenRerun/defines_test/defines_test.cpp b/Tests/QtAutogenRerun/defines_test/defines_test.cpp deleted file mode 100644 index cf4e9cb..0000000 --- a/Tests/QtAutogenRerun/defines_test/defines_test.cpp +++ /dev/null @@ -1,38 +0,0 @@ - -#include - -#ifdef QT_GUI_LIB -#include - -class SomeDocument : public QTextDocument -{ - Q_OBJECT - -Q_SIGNALS: - void someSig(); -}; -#endif - -#ifdef QT_CORE_LIB -class SomeObject : public QObject -{ - Q_OBJECT - -Q_SIGNALS: - void someSig(); -}; -#endif - -int main(int argc, char** argv) -{ -#ifdef QT_CORE_LIB - QMetaObject sosmo = SomeObject::staticMetaObject; -#endif -#ifdef QT_GUI_LIB - QMetaObject sdsmo = SomeDocument::staticMetaObject; -#endif - - return 0; -} - -#include "defines_test.moc" diff --git a/Tests/QtAutogenRerun/dummy.cpp b/Tests/QtAutogenRerun/dummy.cpp deleted file mode 100644 index 4837a76..0000000 --- a/Tests/QtAutogenRerun/dummy.cpp +++ /dev/null @@ -1,5 +0,0 @@ - -int main(int argv, char** args) -{ - return 0; -} diff --git a/Tests/QtAutogenRerun/rccDepends.cmake b/Tests/QtAutogenRerun/rccDepends.cmake deleted file mode 100644 index 68e1482..0000000 --- a/Tests/QtAutogenRerun/rccDepends.cmake +++ /dev/null @@ -1,131 +0,0 @@ -# When a .qrc or a file listed in a .qrc file changes, -# the target must be rebuilt -set(timeformat "%Y%j%H%M%S") -set(rccDepSD "${CMAKE_CURRENT_SOURCE_DIR}/rccDepends") -set(rccDepBD "${CMAKE_CURRENT_BINARY_DIR}/rccDepends") - -# Initial build -configure_file(${rccDepSD}/resPlainA.qrc.in ${rccDepBD}/resPlain.qrc COPYONLY) -configure_file(${rccDepSD}/resGenA.qrc.in ${rccDepBD}/resGen.qrc.in COPYONLY) -try_compile(RCC_DEPENDS - "${rccDepBD}" - "${rccDepSD}" - rccDepends - CMAKE_FLAGS "-DQT_QMAKE_EXECUTABLE:FILEPATH=${QT_QMAKE_EXECUTABLE}" - "-DQT_TEST_VERSION=${QT_TEST_VERSION}" - "-DCMAKE_PREFIX_PATH=${Qt_PREFIX_DIR}" - OUTPUT_VARIABLE output -) -if (NOT RCC_DEPENDS) - message(SEND_ERROR "Initial build of rccDepends failed. Output: ${output}") -endif() - -# Get name of the output binaries -file(STRINGS "${rccDepBD}/targetPlain.txt" targetListPlain ENCODING UTF-8) -file(STRINGS "${rccDepBD}/targetGen.txt" targetListGen ENCODING UTF-8) -list(GET targetListPlain 0 rccDepBinPlain) -list(GET targetListGen 0 rccDepBinGen) -message("Target that uses a plain .qrc file is:\n ${rccDepBinPlain}") -message("Target that uses a GENERATED .qrc file is:\n ${rccDepBinGen}") - - -message("Changing a resource files listed in the .qrc file") -# - Acquire binary timestamps before the build -file(TIMESTAMP "${rccDepBinPlain}" rdPlainBefore "${timeformat}") -file(TIMESTAMP "${rccDepBinGen}" rdGenBefore "${timeformat}") -# - Ensure that the timestamp will change -# - Change a resource files listed in the .qrc file -# - Rebuild -execute_process(COMMAND "${CMAKE_COMMAND}" -E sleep 1) -execute_process(COMMAND "${CMAKE_COMMAND}" -E touch "${rccDepBD}/resPlain/input.txt") -execute_process(COMMAND "${CMAKE_COMMAND}" -E touch "${rccDepBD}/resGen/input.txt") -execute_process(COMMAND "${CMAKE_COMMAND}" --build . WORKING_DIRECTORY "${rccDepBD}" RESULT_VARIABLE result) -if (result) - message(SEND_ERROR "Second build of rccDepends failed.") -endif() -# - Acquire binary timestamps after the build -file(TIMESTAMP "${rccDepBinPlain}" rdPlainAfter "${timeformat}") -file(TIMESTAMP "${rccDepBinGen}" rdGenAfter "${timeformat}") -# - Test if timestamps changed -if (NOT rdPlainAfter GREATER rdPlainBefore) - message(SEND_ERROR "Plain .qrc binary ${rccDepBinPlain}) should have changed!") -endif() -if (NOT rdGenAfter GREATER rdGenBefore) - message(SEND_ERROR "GENERATED .qrc binary ${rccDepBinGen} should have changed!") -endif() - - -message("Changing a the .qrc file") -# - Acquire binary timestamps before the build -file(TIMESTAMP "${rccDepBinPlain}" rdPlainBefore "${timeformat}") -file(TIMESTAMP "${rccDepBinGen}" rdGenBefore "${timeformat}") -# - Ensure that the timestamp will change -# - Change the .qrc file -# - Rebuild -execute_process(COMMAND "${CMAKE_COMMAND}" -E sleep 1) -configure_file(${rccDepSD}/resPlainB.qrc.in ${rccDepBD}/resPlain.qrc COPYONLY) -configure_file(${rccDepSD}/resGenB.qrc.in ${rccDepBD}/resGen.qrc.in COPYONLY) -execute_process(COMMAND "${CMAKE_COMMAND}" --build . WORKING_DIRECTORY "${rccDepBD}" RESULT_VARIABLE result) -if (result) - message(SEND_ERROR "Third build of rccDepends failed.") -endif() -# - Acquire binary timestamps after the build -file(TIMESTAMP "${rccDepBinPlain}" rdPlainAfter "${timeformat}") -file(TIMESTAMP "${rccDepBinGen}" rdGenAfter "${timeformat}") -# - Test if timestamps changed -if (NOT rdPlainAfter GREATER rdPlainBefore) - message(SEND_ERROR "Plain .qrc binary ${rccDepBinPlain}) should have changed!") -endif() -if (NOT rdGenAfter GREATER rdGenBefore) - message(SEND_ERROR "GENERATED .qrc binary ${rccDepBinGen} should have changed!") -endif() - - -message("Changing a newly added resource files listed in the .qrc file") -# - Acquire binary timestamps before the build -file(TIMESTAMP "${rccDepBinPlain}" rdPlainBefore "${timeformat}") -file(TIMESTAMP "${rccDepBinGen}" rdGenBefore "${timeformat}") -# - Ensure that the timestamp will change -# - Change a newly added resource files listed in the .qrc file -# - Rebuild -execute_process(COMMAND "${CMAKE_COMMAND}" -E sleep 1) -execute_process(COMMAND "${CMAKE_COMMAND}" -E touch "${rccDepBD}/resPlain/inputAdded.txt") -execute_process(COMMAND "${CMAKE_COMMAND}" -E touch "${rccDepBD}/resGen/inputAdded.txt") -execute_process(COMMAND "${CMAKE_COMMAND}" --build . WORKING_DIRECTORY "${rccDepBD}" RESULT_VARIABLE result) -if (result) - message(SEND_ERROR "Fourth build of rccDepends failed.") -endif() -# - Acquire binary timestamps after the build -file(TIMESTAMP "${rccDepBinPlain}" rdPlainAfter "${timeformat}") -file(TIMESTAMP "${rccDepBinGen}" rdGenAfter "${timeformat}") -# - Test if timestamps changed -if (NOT rdPlainAfter GREATER rdPlainBefore) - message(SEND_ERROR "Plain .qrc binary ${rccDepBinPlain}) should have changed!") -endif() -if (NOT rdGenAfter GREATER rdGenBefore) - message(SEND_ERROR "GENERATED .qrc binary ${rccDepBinGen} should have changed!") -endif() - - -message("Changing nothing in the .qrc file") -# - Acquire binary timestamps before the build -file(TIMESTAMP "${rccDepBinPlain}" rdPlainBefore "${timeformat}") -file(TIMESTAMP "${rccDepBinGen}" rdGenBefore "${timeformat}") -# - Ensure that the timestamp will change -# - Change nothing -# - Rebuild -execute_process(COMMAND "${CMAKE_COMMAND}" -E sleep 1) -execute_process(COMMAND "${CMAKE_COMMAND}" --build . WORKING_DIRECTORY "${rccDepBD}" RESULT_VARIABLE result) -if (result) - message(SEND_ERROR "Fifth build of rccDepends failed.") -endif() -# - Acquire binary timestamps after the build -file(TIMESTAMP "${rccDepBinPlain}" rdPlainAfter "${timeformat}") -file(TIMESTAMP "${rccDepBinGen}" rdGenAfter "${timeformat}") -# - Test if timestamps changed -if (rdPlainAfter GREATER rdPlainBefore) - message(SEND_ERROR "Plain .qrc binary ${rccDepBinPlain}) should NOT have changed!") -endif() -if (rdGenAfter GREATER rdGenBefore) - message(SEND_ERROR "GENERATED .qrc binary ${rccDepBinGen} should NOT have changed!") -endif() diff --git a/Tests/QtAutogenRerun/rccDepends/CMakeLists.txt b/Tests/QtAutogenRerun/rccDepends/CMakeLists.txt deleted file mode 100644 index 291592e..0000000 --- a/Tests/QtAutogenRerun/rccDepends/CMakeLists.txt +++ /dev/null @@ -1,41 +0,0 @@ -cmake_minimum_required(VERSION 3.9) -project(rccDepends CXX) - -if (QT_TEST_VERSION STREQUAL 4) - find_package(Qt4 REQUIRED) - set(QT_CORE_TARGET Qt4::QtCore) -else() - if (NOT QT_TEST_VERSION STREQUAL 5) - message(SEND_ERROR "Invalid Qt version specified.") - endif() - - find_package(Qt5Core REQUIRED) - set(QT_CORE_TARGET Qt5::Core) -endif() - -# Enable AUTORCC for all targets -set(CMAKE_AUTORCC ON) - -# Initial resource files setup -configure_file(resPlain/input.txt.in resPlain/input.txt COPYONLY) -configure_file(resPlain/input.txt.in resPlain/inputAdded.txt COPYONLY) -configure_file(resGen/input.txt.in resGen/input.txt COPYONLY) -configure_file(resGen/input.txt.in resGen/inputAdded.txt COPYONLY) - -# Generated qrc file with dependency -add_custom_command(OUTPUT resGen.qrc - DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/resGen.qrc.in - COMMAND ${CMAKE_COMMAND} -E sleep 2 - COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_BINARY_DIR}/resGen.qrc.in ${CMAKE_CURRENT_BINARY_DIR}/resGen.qrc) - -# Target that uses a plain .qrc file -add_executable(rccDependsPlain main.cpp ${CMAKE_CURRENT_BINARY_DIR}/resPlain.qrc) -target_link_libraries(rccDependsPlain ${QT_CORE_TARGET}) -add_custom_command(TARGET rccDependsPlain POST_BUILD COMMAND - ${CMAKE_COMMAND} -E echo "$" > targetPlain.txt) - -# Target that uses a GENERATED .qrc file -add_executable(rccDependsGen main.cpp ${CMAKE_CURRENT_BINARY_DIR}/resGen.qrc ) -target_link_libraries(rccDependsGen ${QT_CORE_TARGET}) -add_custom_command(TARGET rccDependsGen POST_BUILD COMMAND - ${CMAKE_COMMAND} -E echo "$" > targetGen.txt) diff --git a/Tests/QtAutogenRerun/rccDepends/main.cpp b/Tests/QtAutogenRerun/rccDepends/main.cpp deleted file mode 100644 index 766b775..0000000 --- a/Tests/QtAutogenRerun/rccDepends/main.cpp +++ /dev/null @@ -1,5 +0,0 @@ - -int main() -{ - return 0; -} diff --git a/Tests/QtAutogenRerun/rccDepends/resGen/input.txt.in b/Tests/QtAutogenRerun/rccDepends/resGen/input.txt.in deleted file mode 100644 index 4f24589..0000000 --- a/Tests/QtAutogenRerun/rccDepends/resGen/input.txt.in +++ /dev/null @@ -1 +0,0 @@ -Generated resource input. diff --git a/Tests/QtAutogenRerun/rccDepends/resGen/inputAdded.txt.in b/Tests/QtAutogenRerun/rccDepends/resGen/inputAdded.txt.in deleted file mode 100644 index 4f24589..0000000 --- a/Tests/QtAutogenRerun/rccDepends/resGen/inputAdded.txt.in +++ /dev/null @@ -1 +0,0 @@ -Generated resource input. diff --git a/Tests/QtAutogenRerun/rccDepends/resGenA.qrc.in b/Tests/QtAutogenRerun/rccDepends/resGenA.qrc.in deleted file mode 100644 index c131a34..0000000 --- a/Tests/QtAutogenRerun/rccDepends/resGenA.qrc.in +++ /dev/null @@ -1,5 +0,0 @@ - - - resGen/input.txt - - diff --git a/Tests/QtAutogenRerun/rccDepends/resGenB.qrc.in b/Tests/QtAutogenRerun/rccDepends/resGenB.qrc.in deleted file mode 100644 index 8c7e643..0000000 --- a/Tests/QtAutogenRerun/rccDepends/resGenB.qrc.in +++ /dev/null @@ -1,6 +0,0 @@ - - - resGen/input.txt - resGen/inputAdded.txt - - diff --git a/Tests/QtAutogenRerun/rccDepends/resPlain/input.txt.in b/Tests/QtAutogenRerun/rccDepends/resPlain/input.txt.in deleted file mode 100644 index a5e407a..0000000 --- a/Tests/QtAutogenRerun/rccDepends/resPlain/input.txt.in +++ /dev/null @@ -1 +0,0 @@ -Plaint resource input. diff --git a/Tests/QtAutogenRerun/rccDepends/resPlain/inputAdded.txt.in b/Tests/QtAutogenRerun/rccDepends/resPlain/inputAdded.txt.in deleted file mode 100644 index a5e407a..0000000 --- a/Tests/QtAutogenRerun/rccDepends/resPlain/inputAdded.txt.in +++ /dev/null @@ -1 +0,0 @@ -Plaint resource input. diff --git a/Tests/QtAutogenRerun/rccDepends/resPlainA.qrc.in b/Tests/QtAutogenRerun/rccDepends/resPlainA.qrc.in deleted file mode 100644 index c135d85..0000000 --- a/Tests/QtAutogenRerun/rccDepends/resPlainA.qrc.in +++ /dev/null @@ -1,5 +0,0 @@ - - - resPlain/input.txt - - diff --git a/Tests/QtAutogenRerun/rccDepends/resPlainB.qrc.in b/Tests/QtAutogenRerun/rccDepends/resPlainB.qrc.in deleted file mode 100644 index 186b653..0000000 --- a/Tests/QtAutogenRerun/rccDepends/resPlainB.qrc.in +++ /dev/null @@ -1,6 +0,0 @@ - - - resPlain/input.txt - resPlain/inputAdded.txt - - -- cgit v0.12