mirror of
https://github.com/reactos/CMake.git
synced 2025-01-22 11:24:56 +00:00
Autogen: Tests: Separate RerunRccDepends test
This commit is contained in:
parent
e9fcd1545f
commit
b1504f9f97
@ -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"
|
||||
|
@ -36,3 +36,4 @@ ADD_AUTOGEN_TEST(RerunMocBasic)
|
||||
if(NOT QT_TEST_VERSION STREQUAL 4)
|
||||
ADD_AUTOGEN_TEST(RerunMocPlugin)
|
||||
endif()
|
||||
ADD_AUTOGEN_TEST(RerunRccDepends)
|
||||
|
@ -1,8 +1,17 @@
|
||||
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")
|
||||
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)
|
||||
@ -10,10 +19,9 @@ 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}"
|
||||
RccDepends
|
||||
CMAKE_FLAGS "-DQT_TEST_VERSION=${QT_TEST_VERSION}"
|
||||
"-DQT_QMAKE_EXECUTABLE:FILEPATH=${QT_QMAKE_EXECUTABLE}"
|
||||
OUTPUT_VARIABLE output
|
||||
)
|
||||
if (NOT RCC_DEPENDS)
|
@ -1,17 +1,6 @@
|
||||
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()
|
||||
cmake_minimum_required(VERSION 3.10)
|
||||
project(RccDepends)
|
||||
include("../../AutogenTest.cmake")
|
||||
|
||||
# Enable AUTORCC for all targets
|
||||
set(CMAKE_AUTORCC ON)
|
||||
@ -23,19 +12,22 @@ 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
|
||||
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)
|
||||
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})
|
||||
target_link_libraries(rccDependsPlain ${QT_QTCORE_TARGET})
|
||||
add_custom_command(TARGET rccDependsPlain POST_BUILD COMMAND
|
||||
${CMAKE_COMMAND} -E echo "$<TARGET_FILE:rccDependsPlain>" > targetPlain.txt)
|
||||
${CMAKE_COMMAND} -E echo "$<TARGET_FILE:rccDependsPlain>" > 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})
|
||||
target_link_libraries(rccDependsGen ${QT_QTCORE_TARGET})
|
||||
add_custom_command(TARGET rccDependsGen POST_BUILD COMMAND
|
||||
${CMAKE_COMMAND} -E echo "$<TARGET_FILE:rccDependsGen>" > targetGen.txt)
|
||||
${CMAKE_COMMAND} -E echo "$<TARGET_FILE:rccDependsGen>" > targetGen.txt
|
||||
)
|
@ -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")
|
@ -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)
|
@ -1,38 +0,0 @@
|
||||
|
||||
#include <QObject>
|
||||
|
||||
#ifdef QT_GUI_LIB
|
||||
#include <QTextDocument>
|
||||
|
||||
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"
|
Loading…
x
Reference in New Issue
Block a user