Commit 2ef64081 authored by Sebastian Holtermann's avatar Sebastian Holtermann

Autogen: Tests: Differentiate between Qt core and Qt gui tests

Some AUTOGEN tests require the Qt core libraries only and
some require the Qt gui libraries to function.
This replaces the AutogenTest.cmake script with two specific
AutogenCoreTest.cmake and AutogenGuiTest.cmake scripts that
are included on demand.
parent b736f5f2
# 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 EQUAL 4)
find_package(Qt4 REQUIRED QtCore)
include(UseQt4)
set(QT_QTCORE_TARGET Qt4::QtCore)
# Qt macros
macro(qtx_wrap_cpp)
qt4_wrap_cpp(${ARGN})
endmacro()
macro(qtx_generate_moc)
qt4_generate_moc(${ARGN})
endmacro()
elseif(QT_TEST_VERSION EQUAL 5)
find_package(Qt5Core REQUIRED)
set(QT_QTCORE_TARGET Qt5::Core)
set(QT_LIBRARIES Qt5::Core)
# Include directories
include_directories(${Qt5Core_INCLUDE_DIRS})
# Definitions
if(Qt5_POSITION_INDEPENDENT_CODE AND CMAKE_CXX_COMPILE_OPTIONS_PIC)
add_definitions(${CMAKE_CXX_COMPILE_OPTIONS_PIC})
endif()
# Qt macros
macro(qtx_wrap_cpp)
qt5_wrap_cpp(${ARGN})
endmacro()
macro(qtx_generate_moc)
qt5_generate_moc(${ARGN})
endmacro()
else()
message(SEND_ERROR "Invalid Qt version specified: ${QT_TEST_VERSION}")
endif()
# Get Qt compile features
get_property(QT_COMPILE_FEATURES
TARGET ${QT_QTCORE_TARGET}
PROPERTY INTERFACE_COMPILE_FEATURES
)
......@@ -7,11 +7,11 @@ if(QT_QMAKE_EXECUTABLE)
endif()
if (QT_TEST_VERSION EQUAL 4)
find_package(Qt4 REQUIRED)
include(UseQt4)
set(QT_QTCORE_TARGET Qt4::QtCore)
set(QT_QTGUI_TARGET Qt4::QtGui)
# Qt macros
macro(qtx_wrap_cpp)
......@@ -22,14 +22,16 @@ if (QT_TEST_VERSION EQUAL 4)
endmacro()
elseif(QT_TEST_VERSION EQUAL 5)
find_package(Qt5Widgets REQUIRED)
set(QT_QTCORE_TARGET Qt5::Core)
set(QT_QTGUI_TARGET Qt5::Widgets)
set(QT_LIBRARIES Qt5::Widgets)
# Include directories
include_directories(${Qt5Widgets_INCLUDE_DIRS})
set(QT_LIBRARIES Qt5::Widgets)
# Definitions
if(Qt5_POSITION_INDEPENDENT_CODE AND CMAKE_CXX_COMPILE_OPTIONS_PIC)
add_definitions(${CMAKE_CXX_COMPILE_OPTIONS_PIC})
endif()
......
cmake_minimum_required(VERSION 3.11)
project(AutogenOriginDependsOff)
include("../AutogenTest.cmake")
include("../AutogenCoreTest.cmake")
set(CSD ${CMAKE_CURRENT_SOURCE_DIR})
set(CBD ${CMAKE_CURRENT_BINARY_DIR})
......
cmake_minimum_required(VERSION 3.10)
project(AutogenOriginDependsOn)
include("../AutogenTest.cmake")
include("../AutogenCoreTest.cmake")
include_directories(${CMAKE_CURRENT_BINARY_DIR})
set(CSD ${CMAKE_CURRENT_SOURCE_DIR})
......
cmake_minimum_required(VERSION 3.10)
project(AutogenTargetDepends)
include("../AutogenTest.cmake")
include("../AutogenCoreTest.cmake")
include_directories(${CMAKE_CURRENT_BINARY_DIR})
set(CSD ${CMAKE_CURRENT_SOURCE_DIR})
......
cmake_minimum_required(VERSION 3.10)
project(Complex)
include("../AutogenTest.cmake")
include("../AutogenGuiTest.cmake")
# -- Test: AUTOMOC AUTORCC AUTOUIC
add_definitions(-DFOO -DSomeDefine="Barx")
......
cmake_minimum_required(VERSION 3.12)
project(GlobalAutogenTarget)
include("../AutogenTest.cmake")
include("../AutogenCoreTest.cmake")
# This tests
# CMAKE_GLOBAL_AUTOGEN_TARGET,
......
cmake_minimum_required(VERSION 3.12)
project(GAT)
include("../../AutogenTest.cmake")
include("../../AutogenCoreTest.cmake")
# Include directories
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
......
# Use a low minimum version
cmake_minimum_required(VERSION 3.0)
project(LowMinimumVersion)
include("../AutogenTest.cmake")
include("../AutogenGuiTest.cmake")
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTOUIC ON)
......
cmake_minimum_required(VERSION 3.10)
project(MacOsFW)
include("../AutogenTest.cmake")
include("../AutogenGuiTest.cmake")
find_package(Qt5Test REQUIRED)
......
cmake_minimum_required(VERSION 3.10)
project(MocCMP0071)
include("../AutogenTest.cmake")
include("../AutogenCoreTest.cmake")
add_subdirectory(OLD)
add_subdirectory(NEW)
cmake_minimum_required(VERSION 3.10)
project(MocIncludeRelaxed)
include("../AutogenTest.cmake")
include("../AutogenCoreTest.cmake")
# Test moc include patterns
set(CMAKE_AUTOMOC_RELAXED_MODE TRUE)
......
cmake_minimum_required(VERSION 3.10)
project(MocIncludeStrict)
include("../AutogenTest.cmake")
include("../AutogenCoreTest.cmake")
# Test moc include patterns
set(CMAKE_AUTOMOC_RELAXED_MODE FALSE)
......
cmake_minimum_required(VERSION 3.10)
project(MocMacroName)
include("../AutogenTest.cmake")
include("../AutogenCoreTest.cmake")
# Test CMAKE_AUTOMOC_MACRO_NAMES and AUTOMOC_MACRO_NAMES
list(APPEND CMAKE_AUTOMOC_MACRO_NAMES "QO1_ALIAS")
......
cmake_minimum_required(VERSION 3.10)
project(MocOnly)
include("../AutogenTest.cmake")
include("../AutogenCoreTest.cmake")
add_executable(mocOnly
main.cpp
......
cmake_minimum_required(VERSION 3.10)
project(MocOptions)
include("../AutogenTest.cmake")
include("../AutogenCoreTest.cmake")
# Test extra options passed to moc via AUTOMOC_MOC_OPTIONS
add_executable(mocOptions Object.cpp main.cpp)
......
cmake_minimum_required(VERSION 3.11)
project(MocOsMacros)
include("../AutogenTest.cmake")
include("../AutogenCoreTest.cmake")
# Tests if moc processes Q_OS_XXX macros
......
cmake_minimum_required(VERSION 3.10)
project(MocSkipSource)
include("../AutogenTest.cmake")
include("../AutogenCoreTest.cmake")
# Test for SKIP_AUTOMOC and SKIP_AUTOGEN on an AUTOMOC enabled target
......
cmake_minimum_required(VERSION 3.10)
project(ObjectLibrary)
include("../AutogenTest.cmake")
include("../AutogenCoreTest.cmake")
set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_AUTOMOC ON)
......
cmake_minimum_required(VERSION 3.10)
project(Parallel)
include("../AutogenTest.cmake")
include("../AutogenGuiTest.cmake")
# Test different values for AUTOGEN_PARALLEL
include("../Parallel/parallel.cmake")
......
cmake_minimum_required(VERSION 3.10)
project(Parallel1)
include("../AutogenTest.cmake")
include("../AutogenGuiTest.cmake")
# Test different values for AUTOGEN_PARALLEL
include("../Parallel/parallel.cmake")
......
cmake_minimum_required(VERSION 3.10)
project(Parallel2)
include("../AutogenTest.cmake")
include("../AutogenGuiTest.cmake")
# Test different values for AUTOGEN_PARALLEL
include("../Parallel/parallel.cmake")
......
cmake_minimum_required(VERSION 3.10)
project(Parallel3)
include("../AutogenTest.cmake")
include("../AutogenGuiTest.cmake")
# Test different values for AUTOGEN_PARALLEL
include("../Parallel/parallel.cmake")
......
cmake_minimum_required(VERSION 3.10)
project(Parallel4)
include("../AutogenTest.cmake")
include("../AutogenGuiTest.cmake")
# Test different values for AUTOGEN_PARALLEL
include("../Parallel/parallel.cmake")
......
cmake_minimum_required(VERSION 3.10)
project(ParallelAUTO)
include("../AutogenTest.cmake")
include("../AutogenGuiTest.cmake")
# Test different values for AUTOGEN_PARALLEL
include("../Parallel/parallel.cmake")
......
cmake_minimum_required(VERSION 3.10)
project(RccEmpty)
include("../AutogenTest.cmake")
include("../AutogenCoreTest.cmake")
# Test AUTORCC on a .qrc file with no resource files
add_executable(rccEmpty rccEmpty.cpp rccEmptyRes.qrc)
......
cmake_minimum_required(VERSION 3.10)
project(RccOffMocLibrary)
include("../AutogenTest.cmake")
include("../AutogenCoreTest.cmake")
# Add not_generated_file.qrc to the source list to get the file-level
# dependency, but don't generate a c++ file from it. Disable the AUTORCC
......
cmake_minimum_required(VERSION 3.10)
project(RccOnly)
include("../AutogenTest.cmake")
include("../AutogenCoreTest.cmake")
# Test AUTORCC being enabled only
add_executable(rccOnly rccOnly.cpp rccOnlyRes.qrc)
......
cmake_minimum_required(VERSION 3.10)
project(RccSkipSource)
include("../AutogenTest.cmake")
include("../AutogenCoreTest.cmake")
# Test for SKIP_AUTORCC and SKIP_AUTOGEN on an AUTORCC enabled target
set(skipRccSources
......
cmake_minimum_required(VERSION 3.10)
project(RerunMocBasic)
include("../AutogenTest.cmake")
include("../AutogenCoreTest.cmake")
# Dummy executable to generate a clean target
add_executable(dummy dummy.cpp)
......
cmake_minimum_required(VERSION 3.10)
project(MocBasic)
include("../../AutogenTest.cmake")
include("../../AutogenCoreTest.cmake")
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
......
cmake_minimum_required(VERSION 3.10)
project(RerunMocPlugin)
include("../AutogenTest.cmake")
include("../AutogenCoreTest.cmake")
# Tests Q_PLUGIN_METADATA and CMAKE_AUTOMOC_DEPEND_FILTERS
# json file change detection
......
cmake_minimum_required(VERSION 3.10)
project(MocPlugin)
include("../../AutogenTest.cmake")
include("../../AutogenGuiTest.cmake")
if (QT_TEST_VERSION LESS 5)
message(SEND_ERROR "Qt 5 or higher required.")
......
cmake_minimum_required(VERSION 3.11.2)
project(RerunRccConfigChange)
include("../AutogenTest.cmake")
include("../AutogenCoreTest.cmake")
# Tests rcc rebuilding after a configuration change
......
cmake_minimum_required(VERSION 3.11.2)
project(RccConfigChange)
include("../../AutogenTest.cmake")
include("../../AutogenCoreTest.cmake")
# Enable AUTORCC for all targets
set(CMAKE_AUTORCC ON)
......
cmake_minimum_required(VERSION 3.10)
project(RerunRccDepends)
include("../AutogenTest.cmake")
include("../AutogenCoreTest.cmake")
# Tests rcc rebuilding when a resource file changes
......
cmake_minimum_required(VERSION 3.10)
project(RccDepends)
include("../../AutogenTest.cmake")
include("../../AutogenCoreTest.cmake")
# Enable AUTORCC for all targets
set(CMAKE_AUTORCC ON)
......
cmake_minimum_required(VERSION 3.10)
project(SameName)
include("../AutogenTest.cmake")
include("../AutogenGuiTest.cmake")
# Test AUTOMOC and AUTORCC on source files with the same name
# but in different subdirectories
......
cmake_minimum_required(VERSION 3.10)
project(StaticLibraryCycle)
include("../AutogenTest.cmake")
include("../AutogenCoreTest.cmake")
# Test AUTOMOC on cyclic static libraries
......
cmake_minimum_required(VERSION 3.10)
project(UicInclude)
include("../AutogenTest.cmake")
include("../AutogenGuiTest.cmake")
# Test uic include patterns
set(CMAKE_AUTOUIC_SEARCH_PATHS "dirA")
......
cmake_minimum_required(VERSION 3.10)
project(UicInterface)
include("../AutogenTest.cmake")
include("../AutogenGuiTest.cmake")
set(CMAKE_INCLUDE_CURRENT_DIR_IN_INTERFACE ON)
set(CMAKE_AUTOMOC ON)
......@@ -43,12 +43,12 @@ set(INC_DIR "include" )
endif()
add_library(LibWidget libwidget.cpp)
target_link_libraries(LibWidget KI18n ${QT_QTGUI_TARGET})
target_link_libraries(LibWidget KI18n ${QT_LIBRARIES})
set_property(TARGET LibWidget PROPERTY NO_KUIT_SEMANTIC ON)
set_property(TARGET LibWidget PROPERTY TRANSLATION_DOMAIN customdomain)
add_library(MyWidget mywidget.cpp)
target_link_libraries(MyWidget KI18n ${QT_QTGUI_TARGET})
target_link_libraries(MyWidget KI18n ${QT_LIBRARIES})
add_executable(QtAutoUicInterface main.cpp)
target_compile_definitions(QtAutoUicInterface
......
cmake_minimum_required(VERSION 3.10)
project(UicOnly)
include("../AutogenTest.cmake")
include("../AutogenGuiTest.cmake")
# Test AUTOUIC being enabled only
add_executable(uicOnly main.cpp UicOnly.cpp)
......
cmake_minimum_required(VERSION 3.10)
project(UicSkipSource)
include("../AutogenTest.cmake")
include("../AutogenGuiTest.cmake")
# Test for SKIP_AUTOUIC and SKIP_AUTOGEN on an AUTOUIC enabled target
set(skipUicSources
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment