aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/qml/qmlcachegen/CMakeLists.txt
blob: 53cd86404d785897b8019fdb628252ed509c7169 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
# Generated from qmlcachegen.pro.

#####################################################################
## tst_qmlcachegen Test:
#####################################################################

# 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
        ../../shared/util.cpp ../../shared/util.h
        tst_qmlcachegen.cpp
        scriptstringprops.h
    INCLUDE_DIRECTORIES
        ../../shared
    PUBLIC_LIBRARIES
        Qt::CorePrivate
        Qt::Gui
        Qt::QmlPrivate
    TESTDATA ${test_data}
)

qt6_add_qml_module(tst_qmlcachegen
    URI cachegentest
    VERSION 1.0
)

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\\\"
)