aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/configure.cmake
blob: 60e9c00517350fcf14b9a35551a32d57b78f3678 (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
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244


#### Inputs



#### Libraries


# special case begin
qt_find_package(LTTngUST PROVIDED_TARGETS LTTng::UST MODULE_NAME qml QMAKE_LIB lttng-ust)
# special case end

#### Tests

# cxx14_make_unique
qt_config_compile_test(cxx14_make_unique
    LABEL "C++14 make_unique()"
    CODE
"
#include <memory>

int main(int argc, char **argv)
{
    (void)argc; (void)argv;
    /* BEGIN TEST: */
std::unique_ptr<int> ptr = std::make_unique<int>();
    /* END TEST: */
    return 0;
}
")

# pointer_32bit
qt_config_compile_test(pointer_32bit
    LABEL "32bit pointers"
    CODE
"


int main(int argc, char **argv)
{
    (void)argc; (void)argv;
    /* BEGIN TEST: */
static_assert(sizeof(void *) == 4, \"fail\");
    /* END TEST: */
    return 0;
}
")

# pointer_64bit
qt_config_compile_test(pointer_64bit
    LABEL "64bit pointers"
    CODE
"


int main(int argc, char **argv)
{
    (void)argc; (void)argv;
    /* BEGIN TEST: */
static_assert(sizeof(void *) == 8, \"fail\");
    /* END TEST: */
    return 0;
}
")

# arm_thumb
qt_config_compile_test(arm_thumb
    LABEL "THUMB mode on ARM"
    CODE
"


int main(int argc, char **argv)
{
    (void)argc; (void)argv;
    /* BEGIN TEST: */
#if defined(thumb2) || defined(__thumb2__)
#    define THUMB_OK
#elif (defined(__thumb) || defined(__thumb__)) && __TARGET_ARCH_THUMB-0 == 4
#    define THUMB_OK
#elif defined(__ARM_ARCH_ISA_THUMB) && __ARM_ARCH_ISA_THUMB == 2
// clang 3.5 and later will set this if the core supports the Thumb-2 ISA.
#    define THUMB_OK
#else
#    error \"fail\"
#endif
    /* END TEST: */
    return 0;
}
")

# arm_fp
qt_config_compile_test(arm_fp
    LABEL "Sufficiently recent FPU on ARM"
    CODE
"


int main(int argc, char **argv)
{
    (void)argc; (void)argv;
    /* BEGIN TEST: */
// if !defined(__ARM_FP) we might be on MSVC or we might have a device
// without an FPU.
// TODO: The latter case is not supported, but the test still succeeds.
#if defined(__ARM_FP) && (__ARM_FP <= 0x04)
#    error \"fail\"
#endif
    /* END TEST: */
    return 0;
}
")



#### Features

qt_feature("cxx14_make_unique" PRIVATE
    LABEL "C++14 make_unique"
    CONDITION QT_FEATURE_cxx14 OR TEST_cxx14_make_unique
)
qt_feature("qml-network" PUBLIC
    SECTION "QML"
    LABEL "QML network support"
    PURPOSE "Provides network transparency."
    CONDITION QT_FEATURE_network
)
# On arm and arm64 we need a specialization of cacheFlush() for each OS to be enabeled. Therefore the config white list. Also Mind that e.g. x86_32 has arch.x86_64 but 32bit pointers. Therefore the checks for architecture and pointer size. Finally, ios and tvos can technically use the JIT but Apple does not allow it. Therefore, it's disabled by default.
qt_feature("qml-jit" PRIVATE
    SECTION "QML"
    LABEL "QML just-in-time compiler"
    PURPOSE "Provides a JIT for QML and JavaScript"
    AUTODETECT NOT IOS AND NOT TVOS
    CONDITION ( ( ( TEST_architecture_arch STREQUAL i386 ) AND TEST_pointer_32bit AND QT_FEATURE_sse2 ) OR ( ( TEST_architecture_arch STREQUAL x86_64 ) AND TEST_pointer_64bit AND QT_FEATURE_sse2 ) OR ( ( TEST_architecture_arch STREQUAL arm ) AND TEST_pointer_32bit AND TEST_arm_fp AND TEST_arm_thumb AND ( LINUX OR IOS OR TVOS OR QNX ) ) OR ( ( TEST_architecture_arch STREQUAL arm64 ) AND TEST_pointer_64bit AND TEST_arm_fp AND ( LINUX OR IOS OR TVOS OR QNX OR INTEGRITY ) ) )
)
# special case begin
# When doing macOS universal builds, JIT needs to be disabled for the ARM slice.
# Because both arm and x86_64 slices are built in one clang frontend invocation
# we need this hack to ensure each backend invocation sees the correct value
# of the feature definition.
qt_extra_definition("QT_QML_JIT_SUPPORTED_IMPL" "0
// Unset dummy value
#undef QT_QML_JIT_SUPPORTED_IMPL
// Compute per-arch value and save in extra define
#if QT_CONFIG(qml_jit) && !(defined(Q_OS_MACOS) && defined(Q_PROCESSOR_ARM))
#define QT_QML_JIT_SUPPORTED_IMPL 1
#else
#define QT_QML_JIT_SUPPORTED_IMPL 0
#endif
// Unset original feature value
#undef QT_FEATURE_qml_jit
// Set new value based on previous computation
#if QT_QML_JIT_SUPPORTED_IMPL
#define QT_FEATURE_qml_jit 1
#else
#define QT_FEATURE_qml_jit -1
#endif
" PRIVATE)
# special case end
qt_feature("qml-debug" PUBLIC
    SECTION "QML"
    LABEL "QML debugging and profiling support"
    PURPOSE "Provides infrastructure and plugins for debugging and profiling."
)
qt_feature("qml-profiler" PRIVATE
    SECTION "QML"
    LABEL "Command line QML Profiler"
    PURPOSE "Supports retrieving QML tracing data from an application."
    CONDITION ( QT_FEATURE_commandlineparser ) AND ( QT_FEATURE_qml_debug ) AND ( QT_FEATURE_qml_network AND QT_FEATURE_localserver ) AND ( QT_FEATURE_xmlstreamwriter )
)
qt_feature("qml-preview" PRIVATE
    SECTION "QML"
    LABEL "Command line QML Preview tool"
    PURPOSE "Updates QML documents in your application live as you change them on disk"
    CONDITION ( QT_FEATURE_commandlineparser ) AND ( QT_FEATURE_filesystemwatcher ) AND ( QT_FEATURE_qml_network AND QT_FEATURE_localserver ) AND ( QT_FEATURE_process ) AND ( QT_FEATURE_qml_debug )
)
qt_feature("qml-devtools" PRIVATE
    SECTION "QML"
    LABEL "QML Development Tools"
    PURPOSE "Provides the QmlDevtools library and various utilities."
)
qt_feature("qml-sequence-object" PRIVATE
    SECTION "QML"
    LABEL "QML sequence object"
    PURPOSE "Supports mapping sequence types into QML."
)
qt_feature("qml-xml-http-request" PRIVATE
    SECTION "QML"
    LABEL "QML XML http request"
    PURPOSE "Provides support for sending XML http requests."
    CONDITION ( QT_FEATURE_xmlstreamreader ) AND ( QT_FEATURE_qml_network )
)
qt_feature("qml-locale" PRIVATE
    SECTION "QML"
    LABEL "QML Locale"
    PURPOSE "Provides support for locales in QML."
)
qt_feature("qml-animation" PRIVATE
    SECTION "QML"
    LABEL "QML Animations"
    PURPOSE "Provides support for animations and timers in QML."
    CONDITION QT_FEATURE_animation
)
qt_feature("qml-worker-script" PRIVATE
    SECTION "QML"
    LABEL "QML WorkerScript"
    PURPOSE "Enables the use of threads in QML."
    CONDITION QT_FEATURE_thread
)
qt_feature("qml-itemmodel" PRIVATE
    SECTION "QML"
    LABEL "QML Item Model"
    PURPOSE "Provides the item model for item views in QML"
    CONDITION QT_FEATURE_itemmodel
)
qt_feature("qml-xmllistmodel" PRIVATE
    SECTION "QML"
    LABEL "QML XmlListModel"
    PURPOSE "Enable XmlListModel in QML"
    CONDITION QT_FEATURE_qml_itemmodel AND QT_FEATURE_future
)

# special case begin
qt_qml_find_python(__qt_qml_python_path __qt_qml_python_found)
# special case end

qt_feature("qml-python" PRIVATE
    LABEL "python"
    CONDITION __qt_qml_python_found # special case
)
qt_configure_add_summary_section(NAME "Qt QML")
qt_configure_add_summary_entry(ARGS "qml-network")
qt_configure_add_summary_entry(ARGS "qml-debug")
qt_configure_add_summary_entry(ARGS "qml-jit")
qt_configure_add_summary_entry(ARGS "qml-sequence-object")
qt_configure_add_summary_entry(ARGS "qml-xml-http-request")
qt_configure_add_summary_entry(ARGS "qml-locale")
qt_configure_end_summary_section() # end of "Qt QML" section
qt_configure_add_report_entry(
    TYPE ERROR
    MESSAGE "Python is required to build QtQml."
    CONDITION NOT QT_FEATURE_qml_python
)