summaryrefslogtreecommitdiff
path: root/Tests/QtAutogen/RerunRccConfigChange
diff options
context:
space:
mode:
Diffstat (limited to 'Tests/QtAutogen/RerunRccConfigChange')
-rw-r--r--Tests/QtAutogen/RerunRccConfigChange/CMakeLists.txt47
-rw-r--r--Tests/QtAutogen/RerunRccConfigChange/RccConfigChange/CMakeLists.txt26
-rw-r--r--Tests/QtAutogen/RerunRccConfigChange/RccConfigChange/main.cpp5
-rw-r--r--Tests/QtAutogen/RerunRccConfigChange/RccConfigChange/resGen.qrc.in6
-rw-r--r--Tests/QtAutogen/RerunRccConfigChange/RccConfigChange/resGen/input1.txt.in1
-rw-r--r--Tests/QtAutogen/RerunRccConfigChange/RccConfigChange/resGen/input2.txt.in1
-rw-r--r--Tests/QtAutogen/RerunRccConfigChange/RccConfigChange/resPlain.qrc6
-rw-r--r--Tests/QtAutogen/RerunRccConfigChange/RccConfigChange/resPlain/input1.txt1
-rw-r--r--Tests/QtAutogen/RerunRccConfigChange/RccConfigChange/resPlain/input2.txt1
-rw-r--r--Tests/QtAutogen/RerunRccConfigChange/dummy.cpp5
10 files changed, 99 insertions, 0 deletions
diff --git a/Tests/QtAutogen/RerunRccConfigChange/CMakeLists.txt b/Tests/QtAutogen/RerunRccConfigChange/CMakeLists.txt
new file mode 100644
index 000000000..33c01acbe
--- /dev/null
+++ b/Tests/QtAutogen/RerunRccConfigChange/CMakeLists.txt
@@ -0,0 +1,47 @@
+cmake_minimum_required(VERSION 3.11.2)
+project(RerunRccConfigChange)
+include("../AutogenCoreTest.cmake")
+
+# Tests rcc rebuilding after a configuration change
+
+# 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(rccDepSD "${CMAKE_CURRENT_SOURCE_DIR}/RccConfigChange")
+set(rccDepBD "${CMAKE_CURRENT_BINARY_DIR}/RccConfigChange")
+
+# Rebuild macro
+macro(rebuild CFG)
+ message(STATUS "Rebuilding rccConfigChange in ${CFG} configuration.")
+ execute_process(
+ COMMAND "${CMAKE_COMMAND}" --build . --config "${CFG}"
+ WORKING_DIRECTORY "${rccDepBD}"
+ RESULT_VARIABLE result)
+ if (result)
+ message(FATAL_ERROR "${CFG} build of rccConfigChange failed.")
+ else()
+ message(STATUS "${CFG} build of rccConfigChange finished.")
+ endif()
+endmacro()
+
+# Initial build
+try_compile(RCC_DEPENDS
+ "${rccDepBD}"
+ "${rccDepSD}"
+ RccConfigChange
+ CMAKE_FLAGS "-DQT_TEST_VERSION=${QT_TEST_VERSION}"
+ "-DCMAKE_AUTOGEN_VERBOSE=${CMAKE_AUTOGEN_VERBOSE}"
+ "-DQT_QMAKE_EXECUTABLE:FILEPATH=${QT_QMAKE_EXECUTABLE}"
+ OUTPUT_VARIABLE output
+)
+if (NOT RCC_DEPENDS)
+ message(FATAL_ERROR "Initial build of rccConfigChange failed. Output: ${output}")
+endif()
+
+# Rebuild: Release
+rebuild(Release)
+
+# Rebuild: Debug
+rebuild(Debug)
diff --git a/Tests/QtAutogen/RerunRccConfigChange/RccConfigChange/CMakeLists.txt b/Tests/QtAutogen/RerunRccConfigChange/RccConfigChange/CMakeLists.txt
new file mode 100644
index 000000000..e2dd0ac38
--- /dev/null
+++ b/Tests/QtAutogen/RerunRccConfigChange/RccConfigChange/CMakeLists.txt
@@ -0,0 +1,26 @@
+cmake_minimum_required(VERSION 3.11.2)
+project(RccConfigChange)
+include("../../AutogenCoreTest.cmake")
+
+# Enable AUTORCC for all targets
+set(CMAKE_AUTORCC ON)
+
+# Initial resource files setup
+configure_file(resGen/input1.txt.in resGen/input1.txt COPYONLY)
+configure_file(resGen/input2.txt.in resGen/input2.txt COPYONLY)
+configure_file(resGen.qrc.in resGen.qrc COPYONLY)
+
+# Generated qrc file with dependency
+add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/resGen.qrc
+ DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/resGen.qrc.in
+ COMMAND ${CMAKE_COMMAND} -E sleep 2
+ COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/resGen.qrc.in ${CMAKE_CURRENT_BINARY_DIR}/resGen.qrc
+)
+
+# Target that uses a plain .qrc file
+add_executable(rccConfigChangePlain main.cpp resPlain.qrc)
+target_link_libraries(rccConfigChangePlain ${QT_QTCORE_TARGET})
+
+# Target that uses a GENERATED .qrc file
+add_executable(rccConfigChangeGen main.cpp ${CMAKE_CURRENT_BINARY_DIR}/resGen.qrc )
+target_link_libraries(rccConfigChangeGen ${QT_QTCORE_TARGET})
diff --git a/Tests/QtAutogen/RerunRccConfigChange/RccConfigChange/main.cpp b/Tests/QtAutogen/RerunRccConfigChange/RccConfigChange/main.cpp
new file mode 100644
index 000000000..766b7751b
--- /dev/null
+++ b/Tests/QtAutogen/RerunRccConfigChange/RccConfigChange/main.cpp
@@ -0,0 +1,5 @@
+
+int main()
+{
+ return 0;
+}
diff --git a/Tests/QtAutogen/RerunRccConfigChange/RccConfigChange/resGen.qrc.in b/Tests/QtAutogen/RerunRccConfigChange/RccConfigChange/resGen.qrc.in
new file mode 100644
index 000000000..967477252
--- /dev/null
+++ b/Tests/QtAutogen/RerunRccConfigChange/RccConfigChange/resGen.qrc.in
@@ -0,0 +1,6 @@
+<RCC>
+ <qresource prefix="/TextsGenerated">
+ <file>resGen/input1.txt</file>
+ <file>resGen/input2.txt</file>
+ </qresource>
+</RCC>
diff --git a/Tests/QtAutogen/RerunRccConfigChange/RccConfigChange/resGen/input1.txt.in b/Tests/QtAutogen/RerunRccConfigChange/RccConfigChange/resGen/input1.txt.in
new file mode 100644
index 000000000..4f24589b0
--- /dev/null
+++ b/Tests/QtAutogen/RerunRccConfigChange/RccConfigChange/resGen/input1.txt.in
@@ -0,0 +1 @@
+Generated resource input.
diff --git a/Tests/QtAutogen/RerunRccConfigChange/RccConfigChange/resGen/input2.txt.in b/Tests/QtAutogen/RerunRccConfigChange/RccConfigChange/resGen/input2.txt.in
new file mode 100644
index 000000000..4f24589b0
--- /dev/null
+++ b/Tests/QtAutogen/RerunRccConfigChange/RccConfigChange/resGen/input2.txt.in
@@ -0,0 +1 @@
+Generated resource input.
diff --git a/Tests/QtAutogen/RerunRccConfigChange/RccConfigChange/resPlain.qrc b/Tests/QtAutogen/RerunRccConfigChange/RccConfigChange/resPlain.qrc
new file mode 100644
index 000000000..e448726a0
--- /dev/null
+++ b/Tests/QtAutogen/RerunRccConfigChange/RccConfigChange/resPlain.qrc
@@ -0,0 +1,6 @@
+<RCC>
+ <qresource prefix="/TextsPlain">
+ <file>resPlain/input1.txt</file>
+ <file>resPlain/input2.txt</file>
+ </qresource>
+</RCC>
diff --git a/Tests/QtAutogen/RerunRccConfigChange/RccConfigChange/resPlain/input1.txt b/Tests/QtAutogen/RerunRccConfigChange/RccConfigChange/resPlain/input1.txt
new file mode 100644
index 000000000..03969c6a5
--- /dev/null
+++ b/Tests/QtAutogen/RerunRccConfigChange/RccConfigChange/resPlain/input1.txt
@@ -0,0 +1 @@
+Plain resource input.
diff --git a/Tests/QtAutogen/RerunRccConfigChange/RccConfigChange/resPlain/input2.txt b/Tests/QtAutogen/RerunRccConfigChange/RccConfigChange/resPlain/input2.txt
new file mode 100644
index 000000000..03969c6a5
--- /dev/null
+++ b/Tests/QtAutogen/RerunRccConfigChange/RccConfigChange/resPlain/input2.txt
@@ -0,0 +1 @@
+Plain resource input.
diff --git a/Tests/QtAutogen/RerunRccConfigChange/dummy.cpp b/Tests/QtAutogen/RerunRccConfigChange/dummy.cpp
new file mode 100644
index 000000000..4837a76b8
--- /dev/null
+++ b/Tests/QtAutogen/RerunRccConfigChange/dummy.cpp
@@ -0,0 +1,5 @@
+
+int main(int argv, char** args)
+{
+ return 0;
+}