Revision control

Copy as Markdown

# Copyright (C) 2022 The Qt Company Ltd.
# SPDX-License-Identifier: BSD-3-Clause
# Generated from qmlcachegen.pro.
#####################################################################
## tst_qmlcachegen Test:
#####################################################################
if(NOT QT_BUILD_STANDALONE_TESTS AND NOT QT_BUILDING_QT)
cmake_minimum_required(VERSION 3.16)
project(tst_qmlcachegen LANGUAGES CXX)
find_package(Qt6BuildInternals REQUIRED COMPONENTS STANDALONE_TEST)
endif()
# Collect test data
file(GLOB_RECURSE test_data_glob
RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
data/*)
list(APPEND test_data ${test_data_glob})
qt_internal_add_test(tst_qmlcachegen
SOURCES
tst_qmlcachegen.cpp
scriptstringprops.h
LIBRARIES
Qt::CorePrivate
Qt::Gui
Qt::Qml
Qt::QmlPrivate
Qt::QuickTestUtilsPrivate
Qt::QmlCompilerPrivate
TESTDATA ${test_data}
)
qt6_add_qml_module(tst_qmlcachegen
URI cachegentest
RESOURCE_PREFIX "/"
NO_GENERATE_EXTRA_QMLDIRS
)
qt_add_library(tst_qmlcachegen_aotstats STATIC)
qt_autogen_tools_initial_setup(tst_qmlcachegen_aotstats)
qt_add_qml_module(tst_qmlcachegen_aotstats
URI Aotstats
QML_FILES
AotstatsClean.qml
AotstatsMixed.qml
SOURCES
scriptstringprops.h
OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/Aotstats"
RESOURCE_PREFIX "/"
)
qt_autogen_tools_initial_setup(tst_qmlcachegen_aotstatsplugin)
add_dependencies(tst_qmlcachegen tst_qmlcachegen_aotstats)
# A module whose QML source is discarded from the resources (QT_DISCARD_FILE_CONTENTS), so a binding's
# source can only be recovered from the ahead-of-time-compiled unit, never reparsed at run time.
qt_add_library(tst_qmlcachegen_discard STATIC)
qt_autogen_tools_initial_setup(tst_qmlcachegen_discard)
qt_add_qml_module(tst_qmlcachegen_discard
URI cachegendiscard
QML_FILES
DiscardScriptStringTest.qml
SOURCES
discardprobe.h
DISCARD_QML_CONTENTS
OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/cachegendiscard"
RESOURCE_PREFIX "/"
)
qt_autogen_tools_initial_setup(tst_qmlcachegen_discardplugin)
add_dependencies(tst_qmlcachegen tst_qmlcachegen_discard)
target_link_libraries(tst_qmlcachegen PRIVATE tst_qmlcachegen_discardplugin)
set(qmake_workerscripts_test_qml_files
"data/worker.js"
"data/worker.qml"
)
qt6_target_qml_sources(tst_qmlcachegen
PREFIX
"/workerscripts"
QML_FILES
${qmake_workerscripts_test_qml_files}
)
set_source_files_properties("data/trickypaths.qml"
PROPERTIES QT_RESOURCE_ALIAS "file name with spaces.qml"
)
set_source_files_properties("data/versionStyleSuffix-1.2-core-yc.qml"
PROPERTIES QT_RESOURCE_ALIAS "versionStyleSuffix-1.2-core-yc.qml"
)
set_source_files_properties("data/versionStyleSuffix-1.2-more.qml"
PROPERTIES QT_RESOURCE_ALIAS "versionStyleSuffix-1.2-more.qml"
)
set(trickypaths_qml_files
"data/trickypaths.qml"
"data/versionStyleSuffix-1.2-core-yc.qml"
"data/versionStyleSuffix-1.2-more.qml"
)
qt6_target_qml_sources(tst_qmlcachegen
PREFIX
"/directory with spaces"
QML_FILES
${trickypaths_qml_files}
)
set_source_files_properties("data/Retain.qml"
PROPERTIES QT_RESOURCE_ALIAS "Retain.qml"
)
set(retain_qml_files
"data/Retain.qml"
)
qt6_target_qml_sources(tst_qmlcachegen
PREFIX
"/"
QML_FILES
${retain_qml_files}
)
set_source_files_properties("data/SkipQmlCacheGen.qml"
PROPERTIES QT_RESOURCE_ALIAS "Skip.qml"
QT_QML_SKIP_CACHEGEN 1
)
set(skip_qml_files
"data/SkipQmlCacheGen.qml"
)
qt6_target_qml_sources(tst_qmlcachegen
PREFIX
"/not/"
QML_FILES
${skip_qml_files}
)
set(qmake_immediate_qml_files
"data/Enums.qml"
"data/componentInItem.qml"
"data/jsimport.qml"
"data/jsmoduleimport.qml"
"data/library.js"
"data/module.mjs"
"data/parameterAdjustment.qml"
"data/script.js"
"data/script.mjs"
"data/utils.mjs"
"data/versionchecks.qml"
"data/scriptstring.qml"
)
qt6_target_qml_sources(tst_qmlcachegen
PREFIX
"/"
QML_FILES
${qmake_immediate_qml_files}
)
## Scopes:
#####################################################################
if(UNIX)
# Resources:
set_source_files_properties("data/umlaut.qml"
PROPERTIES QT_RESOURCE_ALIAS "Bäh.qml"
)
set(trickypaths_umlaut_qml_files
"data/umlaut.qml"
)
qt6_target_qml_sources(tst_qmlcachegen
PREFIX
"/"
QML_FILES
${trickypaths_umlaut_qml_files}
)
endif()
# Add those files to the resource system so that they get copied to the data
# directory in the build directory, which is preferred by qFindTestData
# over the one in the source directory where they are always placed.
set(qml_additional_qml_files
"data/posthocrequired.qml"
"data/inlineComponentWithId.qml"
)
qt6_target_qml_sources(tst_qmlcachegen
PREFIX "/"
QML_FILES ${qml_additional_qml_files}
)
qt_internal_extend_target(tst_qmlcachegen CONDITION ANDROID OR IOS
DEFINES
QT_QMLTEST_DATADIR=":/data"
)
qt_internal_extend_target(tst_qmlcachegen CONDITION NOT ANDROID AND NOT IOS
DEFINES
QT_QMLTEST_DATADIR="${CMAKE_CURRENT_SOURCE_DIR}/data"
)
qt_internal_extend_target(tst_qmlcachegen CONDITION CMAKE_CROSSCOMPILING
DEFINES
QTEST_CROSS_COMPILED
)
qt_internal_extend_target(tst_qmlcachegen
DEFINES
AOTSTATS_MODULE_RCC_QMLCACHE_FOLDER="${CMAKE_CURRENT_BINARY_DIR}/.rcc/qmlcache"
)