Debian Codegraph @

usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/qt_functions.prf

raw
1
2 defineReplace(qtPlatformTargetSuffix) {
3 ios:CONFIG(simulator, simulator|device): \
4 suffix = _$${simulator.sdk}
5 else: \
6 suffix =
7
8 CONFIG(debug, debug|release) {
9 !debug_and_release|build_pass {
10 mac: return($${suffix}_debug)
11 win32: return($${suffix}d)
12 }
13 }
14 return($$suffix)
15 }
16
17 defineReplace(qtLibraryTarget) {
18 LIBRARY_NAME = $$1
19 CONFIG(shared, static|shared):contains(QT_CONFIG, qt_framework) {
20 QMAKE_FRAMEWORK_BUNDLE_NAME = $$LIBRARY_NAME
21 export(QMAKE_FRAMEWORK_BUNDLE_NAME)
22 }
23 return($$LIBRARY_NAME$$qtPlatformTargetSuffix())
24 }
25
26 defineReplace(qt5LibraryTarget) {
27 LIBRARY_NAME = $$qtLibraryTarget($$1)
28 isEmpty(QMAKE_FRAMEWORK_BUNDLE_NAME) {
29 # Insert the major version of Qt in the library name
30 # unless it's a framework build.
31 LIBRARY_NAME ~= s,^Qt,Qt$$QT_MAJOR_VERSION,
32 }
33 return($$LIBRARY_NAME)
34 }
35
36 defineReplace(qtRelativeRPathBase) {
37 darwin {
38 if(equals(TEMPLATE, app):app_bundle)|\
39 if(equals(TEMPLATE, lib):plugin:plugin_bundle) {
40 ios: return($$target.path/$${TARGET}.app)
41 return($$target.path/$${TARGET}.app/Contents/MacOS)
42 }
43 equals(TEMPLATE, lib):!plugin:lib_bundle: \
44 return($$target.path/$${TARGET}.framework/Versions/Current)
45 }
46 return($$target.path)
47 }
48
49 defineTest(qtAddLibrary) {
50 warning("qtAddLibrary() is deprecated. Use QT+= instead.")
51
52 # Reverse-engineer the module name from the library name.
53 for(var, QT_MODULES) {
54 isEqual(QT.$${var}.name, $$1) {
55 QT += $$var
56 export(QT)
57 return(true)
58 }
59 }
60 error("No module matching library '$$1' found.")
61 }
62
63 # qt module
64 defineTest(qtHaveModule) {
65 !isEmpty(QT.$$replace(1, -, _).name): \
66 return(true)
67 return(false)
68 }
69
70 # variable, default, [suffix for variable for system() use], [prepare primary variable for system() use]
71 defineTest(qtPrepareTool) {
72 cmd = $$eval(QT_TOOL.$${2}.binary)
73 isEmpty(cmd) {
74 cmd = $$[QT_HOST_BINS]/$$2
75 exists($${cmd}.pl) {
76 $${1}_EXE = $${cmd}.pl
77 cmd = perl -w $$system_path($${cmd}.pl)
78 } else: contains(QMAKE_HOST.os, Windows) {
79 $${1}_EXE = $${cmd}.exe
80 cmd = $$system_path($${cmd}.exe)
81 } else:contains(QMAKE_HOST.os, Darwin) {
82 BUNDLENAME = $${cmd}.app/Contents/MacOS/$$2
83 exists($$BUNDLENAME) {
84 cmd = $$BUNDLENAME
85 }
86 $${1}_EXE = $$cmd
87 } else {
88 $${1}_EXE = $$cmd
89 }
90 } else {
91 $${1}_EXE = $$last(cmd)
92 }
93 export($${1}_EXE)
94 QT_TOOL_ENV += $$eval(QT_TOOL.$${2}.envvars)
95 QT_TOOL_NAME = $$2
96 !isEmpty(3)|!isEmpty(4) {
97 $$1$$3 =
98 for (arg, cmd): \
99 $$1$$3 += $$system_quote($$arg)
100 qtAddTargetEnv($$1$$3, QT_TOOL.$${2}.depends, system)
101 }
102 isEmpty(4) {
103 $$1 =
104 for (arg, cmd): \
105 $$1 += $$shell_quote($$arg)
106 qtAddTargetEnv($$1, QT_TOOL.$${2}.depends, )
107 }
108 }
109
110 # target variable, list of env var names, [non-empty: prepare for system(), not make]
111 defineTest(qtAddToolEnv) {
112 isEmpty(3): \
113 ds = $$QMAKE_DIR_SEP
114 else: \
115 ds = $$DIR_SEPARATOR
116 batch_sets =
117 for(env, 2) {
118 value = $$eval($${env}.value)
119 !isEmpty(value) {
120 name = $$eval($${env}.name)
121 config = $$eval($${env}.CONFIG)
122 equals(ds, /) {
123 contains(config, prepend): infix = \${$$name:+:\$$$name}
124 else: contains(config, always_prepend): infix = :\$$$name
125 else: infix =
126 # Under msys, this path is taken only in the non-system()
127 # case, so using shell_quote() always works.
128 batch_sets += \
129 "$$name=$$shell_quote($$join(value, :))$$infix" \
130 "export $$name"
131 } else {
132 value ~= s,\\^,^^^^,g
133 value ~= s,!,^^!,g
134 value ~= s,\\),^),g
135 contains(config, prepend) {
136 batch_sets += \
137 "if defined $$name (" \
138 " set $$name=$$join(value, ;);!$$name!" \
139 ") else (" \
140 " set $$name=$$join(value, ;)" \
141 ")"
142 } else: contains(config, always_prepend) {
143 batch_sets += "(set $$name=$$join(value, ;);!$$name!)"
144 } else {
145 batch_sets += "(set $$name=$$join(value, ;))"
146 }
147 }
148 }
149 }
150 !isEmpty(batch_sets) {
151 batch_name = wrapper
152 !isEmpty(QT_TOOL_NAME): batch_name = $${QT_TOOL_NAME}_wrapper
153 cmd = $$eval($$1)
154 !isEmpty(cmd): cmd = "$$cmd "
155 equals(ds, /) {
156 batch_name = $${batch_name}.sh
157 batch_cont = \
158 "$$LITERAL_HASH!/bin/sh" \
159 $$batch_sets \
160 "exec $$cmd\"$@\""
161 # It would be nicer to use the '.' command (without 'exec' above),
162 # but that doesn't set the positional arguments under (d)ash.
163 $$1 =
164 } else {
165 batch_name = $${batch_name}.bat
166 batch_cont = \
167 "@echo off" \
168 "SetLocal EnableDelayedExpansion" \
169 $$batch_sets \
170 "$$cmd%*" \
171 "EndLocal"
172 $$1 = call
173 }
174 !build_pass:!write_file($$OUT_PWD/$$batch_name, batch_cont, exe): error("Aborting.")
175 isEmpty(3): \
176 $$1 += $$shell_quote($$shell_path($$OUT_PWD/$$batch_name))
177 else: \
178 $$1 += $$system_quote($$system_path($$OUT_PWD/$$batch_name))
179 QMAKE_DISTCLEAN += $$OUT_PWD/$$batch_name
180 }
181 export($$1)
182 export(QMAKE_DISTCLEAN)
183 }
184
185 # target variable, dependency var name, [non-empty: prepare for system(), not make]
186 defineTest(qtAddTargetEnv) {
187 deps = $$replace($$2, -private$, _private)
188 deps = $$resolve_depends(deps, "QT.", ".depends" ".run_depends")
189 !isEmpty(deps) {
190 deppath.CONFIG = prepend
191 equals(QMAKE_HOST.os, Windows) {
192 deppath.CONFIG = always_prepend
193 deppath.name = PATH
194 } else:contains(QMAKE_HOST.os, Linux|FreeBSD|OpenBSD|NetBSD|DragonFly|SunOS|HP-UX|QNX|GNU) {
195 deppath.name = LD_LIBRARY_PATH
196 } else:contains(QMAKE_HOST.os, ^GNU/.*) {
197 deppath.name = LD_LIBRARY_PATH
198 } else:contains(QMAKE_HOST.os, Haiku) {
199 deppath.name = LIBRARY_PATH
200 } else:equals(QMAKE_HOST.os, Darwin) {
201 contains(QT_CONFIG, qt_framework): \
202 deppath.name = DYLD_FRAMEWORK_PATH
203 else: \
204 deppath.name = DYLD_LIBRARY_PATH
205 } else:equals(QMAKE_HOST.os, AIX) {
206 deppath.name = LIBPATH
207 } else {
208 error("Operating system not supported.")
209 }
210 ptypes =
211 for(dep, deps) {
212 isEmpty(3): \
213 deppath += $$shell_path($$eval(QT.$${dep}.libs))
214 else: \
215 deppath += $$system_path($$eval(QT.$${dep}.libs))
216 ptypes += $$eval(QT.$${dep}.plugin_types)
217 }
218 deppath.value = $$unique(deppath)
219
220 pluginpath.value =
221 ppaths = $$[QT_INSTALL_PLUGINS/get]
222 for(qplug, QT_PLUGINS): \
223 contains(ptypes, $$eval(QT_PLUGIN.$${qplug}.TYPE)): \
224 ppaths += $$eval(QT_PLUGIN.$${qplug}.PATH)
225 ppaths = $$unique(ppaths)
226 for(qplug, ppaths) {
227 isEmpty(3): \
228 pluginpath.value += $$shell_path($$qplug)
229 else: \
230 pluginpath.value += $$system_path($$qplug)
231 }
232 pluginpath.name = QT_PLUGIN_PATH
233 pluginpath.CONFIG = prepend
234
235 QT_TOOL_ENV += deppath pluginpath
236 }
237 qtAddToolEnv($$1, $$QT_TOOL_ENV, $$3)
238 }
239
240 defineReplace(pkgConfigExecutable) {
241 isEmpty(PKG_CONFIG) {
242 !isEmpty(QMAKE_PKG_CONFIG): \
243 PKG_CONFIG = $$QMAKE_PKG_CONFIG
244 else: \
245 PKG_CONFIG = pkg-config
246
247 sysroot.name = PKG_CONFIG_SYSROOT_DIR
248 sysroot.value = $$PKG_CONFIG_SYSROOT_DIR
249 libdir.name = PKG_CONFIG_LIBDIR
250 libdir.value = $$PKG_CONFIG_LIBDIR
251 QT_TOOL_NAME = pkg-config
252 qtAddToolEnv(PKG_CONFIG, sysroot libdir, SYS)
253 }
254
255 equals(QMAKE_HOST.os, Windows): \
256 PKG_CONFIG += 2> NUL
257 else: \
258 PKG_CONFIG += 2> /dev/null
259
260 return($$PKG_CONFIG)
261 }
262
263 defineTest(packagesExist) {
264 contains(QT_CONFIG, no-pkg-config) {
265 warning("pkg-config disabled, can't check package existence")
266 return(false)
267 }
268
269 # this can't be done in global scope here because qt_functions is loaded
270 # before the .pro is parsed, so if the .pro set PKG_CONFIG, we wouldn't know it
271 # yet. oops.
272 pkg_config = $$pkgConfigExecutable()
273
274 for(package, ARGS) {
275 !system($$pkg_config --exists $$package):return(false)
276 }
277
278 return(true)
279 }
280
281 # Prepares target that will iterate through all subdirs (except those
282 # with no_default_target or no_{name_of_target}_target. The prepared
283 # target must still be manually added to QMAKE_EXTRA_TARGETS.
284 defineTest(prepareRecursiveTarget) {
285 target = $$1
286 no_$${target}_target: return()
287
288 for(subdir, SUBDIRS) {
289 subdir_config = $$eval($${subdir}.CONFIG)
290 contains(subdir_config, no_default_target): next()
291 contains(subdir_config, no_$${target}_target): next()
292
293 $${target}.recurse += $$subdir
294 }
295
296 # Set up the recurse target only when there
297 # is something to recurse into.
298 isEmpty($${target}.recurse): return()
299
300 $${target}.CONFIG = recursive
301 $${target}.recurse_target = $${target}
302
303 export($${target}.recurse)
304 export($${target}.CONFIG)
305 export($${target}.recurse_target)
306 }