source: trunk/kBuild/units/qt5.kmk@ 2806

Last change on this file since 2806 was 2806, checked in by bird, 9 years ago

units/qt5.kmk: /4/ -> /5/

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 36.9 KB
Line 
1# $Id: qt5.kmk 2806 2016-01-28 11:29:19Z bird $
2## @file
3# Qt 5 unit.
4#
5
6#
7# Copyright (c) 2008-2016 knut st. osmundsen <bird-kBuild-spam-xiv@anduin.net>
8#
9# This file is part of kBuild.
10#
11# kBuild is free software; you can redistribute it and/or modify
12# it under the terms of the GNU General Public License as published by
13# the Free Software Foundation; either version 2 of the License, or
14# (at your option) any later version.
15#
16# kBuild is distributed in the hope that it will be useful,
17# but WITHOUT ANY WARRANTY; without even the implied warranty of
18# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19# GNU General Public License for more details.
20#
21# You should have received a copy of the GNU General Public License
22# along with kBuild; if not, write to the Free Software
23# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
24#
25#
26# As a special exception you are granted permission to include this file, via
27# the kmk include directive, as you wish without this in itself causing the
28# resulting makefile, program or whatever to be covered by the GPL license.
29# This exception does not however invalidate any other reasons why the makefile,
30# program, whatever should not be covered the GPL.
31#
32#
33
34
35ifdef UNIT_qt5
36 $(error kBuild: The qt5 unit was included twice!)
37endif
38UNIT_qt5 = qt5
39
40
41if !defined(UNIT_qt3) && !defined(UNIT_qt4)
42 # Add our target properties (same as qt3 & qt4).
43 PROPS_SINGLE += QTTOOL MOCTOOL UICTOOL LRCTOOL QT_TRANSLATIONS_INST QT_TRANSLATIONS_TEMPLATE QT_PREFIX
44 PROPS_ACCUMULATE_R += MOCDEFS MOCFLAGS UICFLAGS LRCFLAGS QT_TRANSLATIONS QT_MOCSRCS QT_MOCHDRS
45endif
46PROPS_SINGLE += RCCTOOL QT_INFIX
47PROPS_ACCUMULATE_R += RCCFLAGS QT_MODULES
48
49
50## @todo use pkg-config?
51
52#
53# The QT5 SDK.
54#
55# This is implemented here rather than in sdks/QT5.kmk to enforce the global USES.
56# It also makes things easier to develop, with fewer files I mean.
57#
58## @todo the SDK might actually not be necessary as it turns out... For now it servers
59# a purpose if the host differs from the target, in theory at least.
60SDK_QT5 = Qt5
61
62# SDK Specific Properties
63# PATH_SDK_QT5 - The general Qt5 root directory.
64# PATH_SDK_QT5_INC - The include directory.
65# PATH_SDK_QT5_LIB.amd64 - The lib directory for AMD64.
66# PATH_SDK_QT5_LIB.x86 - The lib directory for X86.
67# PATH_SDK_QT5_LIB - The lib directory for KBUILD_TARGET.
68ifndef PATH_SDK_QT5
69 PATH_SDK_QT5 := $(firstword $(rsort $(wildcard $(KBUILD_DEVTOOLS_TRG)/qt/v5*)))
70 ifeq ($(PATH_SDK_QT5),)
71 # If target == host, try look for Qt in the various platform specific places.
72 ifeq ($(KBUILD_TARGET),$(KBUILD_HOST))
73 ifeq ($(KBUILD_TARGET),darwin)
74 PATH_SDK_QT5 := $(patsubst %/Frameworks/QtCore.framework/Versions/5,%,$(firstword $(wildcard /Library/Frameworks/QtCore.framework/Versions/5)))
75 else ifeq ($(KBUILD_TARGET),win)
76 # No idea here yet...
77 else ifeq ($(KBUILD_TARGET),ose)
78 # No port...
79 else
80 # The Unices. Includes and esp. libs are tricky, so override the PATH_SDK_QT5_LIB* stuff if it doesn't work.
81 # Try find the general root of thing by looking for the qt4to5 program, if not found, then look for rcc.
82 PATH_SDK_QT5 := $(patsubst %/bin/qt4to5-qt5,%,$(firstword $(wildcard \
83 /usr/bin/qt4to5-qt5 \
84 /usr/local/bin/qt4to5-qt5 \
85 /usr/qt/5/bin/qt4to5-qt5 \
86 /usr/share/qt5/bin/qt4to5-qt5 \
87 )))
88 ifeq ($(PATH_SDK_QT5),)
89 PATH_SDK_QT5 := $(patsubst %/bin/qt4to5,%,$(firstword $(wildcard \
90 /usr/bin/qt4to5 \
91 /usr/local/bin/qt4to5 \
92 /usr/qt/5/bin/qt4to5 \
93 /usr/share/qt5/bin/qt4to5 \
94 )))
95 endif
96 ifeq ($(PATH_SDK_QT5),)
97 PATH_SDK_QT5 := $(patsubst %/bin/rcc-qt5,%,$(firstword $(wildcard \
98 /usr/bin/rcc-qt5 \
99 /usr/local/bin/rcc-qt5 \
100 /usr/qt/5/bin/rcc-qt5 \
101 /usr/share/qt5/bin/rcc-qt5 \
102 )))
103 endif
104 ifeq ($(PATH_SDK_QT5),)
105 PATH_SDK_QT5 := $(patsubst %/bin/rcc,%,$(firstword $(wildcard \
106 /usr/bin/rcc \
107 /usr/local/bin/rcc \
108 /usr/qt/5/bin/rcc \
109 /usr/share/qt5/bin/rcc \
110 )))
111 endif
112 ifneq ($(PATH_SDK_QT5),)
113 export PATH_SDK_QT5
114
115 # Locate the include files.
116 ifeq ($(PATH_SDK_QT5_INC),)
117 PATH_SDK_QT5_INC := $(patsubst %/QtCore/qglobal.h,%,$(firstword $(wildcard \
118 $(PATH_SDK_QT5)/include/QtCore/qglobal.h \
119 $(PATH_SDK_QT5)/include/qt5/QtCore/qglobal.h \
120 /usr/include/qt5/QtCore/qtglobal.h \
121 /usr/local/include/qt5/QtCore/qtglobal.h \
122 )))
123 ifneq ($(PATH_SDK_QT5_INC),)
124 export PATH_SDK_QT5_INC
125 endif
126 endif
127
128 # Now for the libraries (mostly for helping out finding the KBUILD_TARGET libs).
129 ifeq ($(PATH_SDK_QT5_LIB.x86),)
130 PATH_SDK_QT5_LIB.x86 := $(patsubst %/libQtCore$(SUFF_DLL),%,$(firstword $(wildcard \
131 $(PATH_SDK_QT5)/lib32/libQtCore$(SUFF_DLL) \
132 $(PATH_SDK_QT5)/lib32/qt5/libQtCore$(SUFF_DLL) \
133 /usr/lib32/libQtCore$(SUFF_DLL) \
134 /usr/lib32/qt5/libQtCore$(SUFF_DLL) \
135 /usr/lib/i386-linux-gnu/libQtCore$(SUFF_DLL) \
136 /usr/local/lib32/libQtCore$(SUFF_DLL) \
137 /usr/local/lib32/qt5/libQtCore$(SUFF_DLL) \
138 /usr/local/lib/i386-linux-gnu/libQtCore$(SUFF_DLL) \
139 $(PATH_SDK_QT5)/lib/libQtCore$(SUFF_DLL) \
140 $(PATH_SDK_QT5)/lib/qt5/libQtCore$(SUFF_DLL) \
141 $(PATH_SDK_QT5)/lib/i386-linux-gnu/libQtCore$(SUFF_DLL) \
142 )))
143 ifneq ($(PATH_SDK_QT5_LIB.x86),)
144 export PATH_SDK_QT5_LIB.x86
145 endif
146 endif
147 ifeq ($(PATH_SDK_QT5_LIB.amd64),)
148 PATH_SDK_QT5_LIB.amd64 := $(patsubst %/libQtCore$(SUFF_DLL),%,$(firstword $(wildcard \
149 $(PATH_SDK_QT5)/lib64/libQtCore$(SUFF_DLL) \
150 $(PATH_SDK_QT5)/lib64/qt5/libQtCore$(SUFF_DLL) \
151 $(PATH_SDK_QT5)/lib/amd64/libQtCore$(SUFF_DLL) \
152 /usr/lib64/libQtCore$(SUFF_DLL) \
153 /usr/lib64/qt5/libQtCore$(SUFF_DLL) \
154 /usr/lib/amd64/libQtCore$(SUFF_DLL) \
155 /usr/lib/x86_64-linux-gnu/libQtCore$(SUFF_DLL) \
156 /usr/local/lib64/libQtCore$(SUFF_DLL) \
157 /usr/local/lib64/qt5/libQtCore$(SUFF_DLL) \
158 /usr/local/lib/amd64/libQtCore$(SUFF_DLL) \
159 /usr/local/lib/x86_64-linux-gnu/libQtCore$(SUFF_DLL) \
160 $(PATH_SDK_QT5)/lib/libQtCore$(SUFF_DLL) \
161 $(PATH_SDK_QT5)/lib/qt5/libQtCore$(SUFF_DLL) \
162 $(PATH_SDK_QT5)/lib/x86_64-linux-gnu/libQtCore$(SUFF_DLL) \
163 )))
164 ifneq ($(PATH_SDK_QT5_LIB.amd64),)
165 export PATH_SDK_QT5_LIB.amd64
166 endif
167 endif
168
169 # And finally, the library path for KBUILD_TARGET.
170 ifeq ($(PATH_SDK_QT5_LIB),)
171 PATH_SDK_QT5_LIB := $(PATH_SDK_QT5_LIB.$(KBUILD_TARGET_ARCH))
172 ifeq ($(PATH_SDK_QT5_LIB),)
173 PATH_SDK_QT5_LIB := $(patsubst %/libQtCore$(SUFF_DLL),%,$(firstword $(wildcard \
174 $(PATH_SDK_QT5)/lib/libQtCore$(SUFF_DLL) \
175 $(PATH_SDK_QT5)/lib/qt5/libQtCore$(SUFF_DLL) \
176 /usr/lib/libQtCore$(SUFF_DLL) \
177 /usr/lib/qt5/libQtCore$(SUFF_DLL) \
178 /usr/local/lib/libQtCore$(SUFF_DLL) \
179 /usr/local/lib/qt5/libQtCore$(SUFF_DLL) \
180 )))
181 endif
182 ifneq ($(PATH_SDK_QT5_LIB),)
183 export PATH_SDK_QT5_LIB
184 endif
185 endif
186
187 endif
188 endif # Unices
189 endif
190 # Found it?
191 ifeq ($(PATH_SDK_QT5),)
192 $(warning kBuild: Couldn't find the Qt5 headers and libaries...)
193 PATH_SDK_QT5 := $(KBUILD_DEVTOOLS_TRG)/qt/not-found
194 endif
195 endif
196else
197 # Resolve any fancy stuff once and for all.
198 PATH_SDK_QT5 := $(PATH_SDK_QT5)
199endif
200
201# Libraries can be in either Frameworks or lib depending on how you
202# build it on the mac. The .dmg installs into Frameworks but builds into lib.
203ifeq ($(KBUILD_TARGET),darwin)
204 ifndef PATH_SDK_QT5_LIB
205 ifneq ($(wildcard $(PATH_SDK_QT5)/Frameworks),)
206 PATH_SDK_QT5_LIB ?= $(PATH_SDK_QT5)/Frameworks
207 else
208 PATH_SDK_QT5_LIB ?= $(PATH_SDK_QT5)/lib
209 endif
210 endif
211else
212 PATH_SDK_QT5_LIB ?= $(PATH_SDK_QT5)/lib
213 PATH_SDK_QT5_INC ?= $(PATH_SDK_QT5)/include
214endif
215
216# The bits that kBuild picks up.
217# (nothing here)
218
219
220#
221# The QT5 tool.
222#
223# This is implemented here rather than in tools/QT5.kmk to enforce the global USES.
224# It also makes things easier to develop, with fewer files I mean.
225#
226TOOL_QT5 = Qt5
227
228# Tool Specific Properties
229# PATH_TOOL_QT5 - Obsolete.
230# PATH_TOOL_QT5_BIN - The
231# TOOL_QT5_BIN_SUFF -
232if !defined(PATH_TOOL_QT5_BIN) && defined(PATH_TOOL_QT5)
233 PATH_TOOL_QT5_BIN := $(PATH_TOOL_QT5)/bin
234endif
235ifndef PATH_TOOL_QT5_BIN
236 PATH_TOOL_QT5_BIN := $(firstword $(rsort $(wildcard $(KBUILD_DEVTOOLS_HST)/qt/v5*/bin)))
237 if "$(PATH_TOOL_QT5_BIN)" == "" && "$(KBUILD_DEVTOOLS_HST_ALT)" != ""
238 PATH_TOOL_QT5_BIN := $(firstword $(rsort $(wildcard $(KBUILD_DEVTOOLS_HST_ALT)/qt/v5*/bin)))
239 endif
240 ifeq ($(PATH_TOOL_QT5_BIN),)
241 ifdef TOOL_QT5_BIN_SUFF
242 TOOL_QT5_BIN_SUFF := $(TOOL_QT5_BIN_SUFF)
243 endif
244 # Try looking for moc-qt5 / moc-$(suffix) first.
245 ifneq ($(TOOL_QT5_BIN_SUFF),)
246 PATH_TOOL_QT5_BIN := $(patsubst %/moc$(TOOL_QT5_BIN_SUFF),%,$(firstword $(wildcard \
247 /usr/lib/qt5/bin/moc$(TOOL_QT5_BIN_SUFF) \
248 /usr/qt/5/bin/moc$(TOOL_QT5_BIN_SUFF) \
249 /usr/share/qt5/bin/moc$(TOOL_QT5_BIN_SUFF) \
250 /usr/local/bin/moc$(TOOL_QT5_BIN_SUFF) \
251 /usr/bin/moc$(TOOL_QT5_BIN_SUFF) \
252 )))
253 else
254 PATH_TOOL_QT5_BIN := $(patsubst %/moc-qt5,%,$(firstword $(wildcard \
255 /usr/lib/qt5/bin/moc-qt5 \
256 /usr/qt/5/bin/moc-qt5 \
257 /usr/share/qt5/bin/moc-qt5 \
258 /usr/local/bin/moc-qt5 \
259 /usr/bin/moc-qt5 \
260 )))
261 ifneq ($(PATH_TOOL_QT5_BIN),)
262 TOOL_QT5_BIN_SUFF := -qt5
263 else
264 # If no luck, try looking for moc in the qt5 specific locations.
265 PATH_TOOL_QT5_BIN := $(patsubst %/moc,%,$(firstword $(wildcard \
266 /usr/lib/qt5/bin/moc \
267 /usr/qt/5/bin/moc \
268 /usr/share/qt5/bin/moc \
269 )))
270 endif
271 endif
272 # If still no go, try looking for qt4to5 and rcc.
273 ifeq ($(PATH_TOOL_QT5_BIN),)
274 PATH_TOOL_QT5_BIN := $(patsubst %/qt4to5,%,$(firstword $(wildcard \
275 /usr/lib/qt5/bin/qt4to5 \
276 /usr/qt/5/bin/qt4to5 \
277 /usr/share/qt5/bin/qt4to5 \
278 /usr/local/bin/qt4to5 \
279 /usr/bin/qt4to5 \
280 )))
281 endif
282 ifeq ($(PATH_TOOL_QT5_BIN),)
283 PATH_TOOL_QT5_BIN := $(patsubst %/rcc$(TOOL_QT5_BIN_SUFF),%,$(firstword $(wildcard \
284 /usr/lib/qt5/bin/rcc$(TOOL_QT5_BIN_SUFF) \
285 /usr/qt/5/bin/rcc$(TOOL_QT5_BIN_SUFF) \
286 /usr/share/qt5/bin/rcc$(TOOL_QT5_BIN_SUFF) \
287 /usr/local/bin/rcc$(TOOL_QT5_BIN_SUFF) \
288 /usr/bin/rcc$(TOOL_QT5_BIN_SUFF) \
289 )))
290 endif
291 if "$(PATH_TOOL_QT5_BIN)" == "" && "$(TOOL_QT5_BIN_SUFF)" != ""
292 PATH_TOOL_QT5_BIN := $(patsubst %/rcc,%,$(firstword $(wildcard \
293 /usr/lib/qt5/bin/rcc \
294 /usr/qt/5/bin/rcc \
295 /usr/share/qt5/bin/rcc \
296 /usr/local/bin/rcc \
297 /usr/bin/rcc \
298 )))
299 endif
300 ifneq ($(PATH_TOOL_QT5_BIN),)
301 export PATH_TOOL_QT5_BIN
302 endif
303 endif
304 # If not found, we'll enter the 'pathless' mode.
305else
306 # Resolve any fancy stuff once and for all.
307 PATH_TOOL_QT5_BIN := $(PATH_TOOL_QT5_BIN)
308endif
309ifneq ($(PATH_TOOL_QT5_BIN),)
310 TOOL_QT5_MOC ?= $(PATH_TOOL_QT5_BIN)/moc$(TOOL_QT5_BIN_SUFF)$(HOST_SUFF_EXE)
311 TOOL_QT5_UIC ?= $(PATH_TOOL_QT5_BIN)/uic$(TOOL_QT5_BIN_SUFF)$(HOST_SUFF_EXE)
312 ifndef TOOL_QT5_RCC
313 TOOL_QT5_RCC := $(PATH_TOOL_QT5_BIN)/rcc$(HOST_SUFF_EXE)
314 ifeq ($(wildcard $(TOOL_QT5_RCC)),)
315 TOOL_QT5_RCC := $(PATH_TOOL_QT5_BIN)/rcc$(TOOL_QT5_BIN_SUFF)$(HOST_SUFF_EXE)
316 endif
317 endif
318 TOOL_QT5_LRC ?= $(PATH_TOOL_QT5_BIN)/lrelease$(TOOL_QT5_BIN_SUFF)$(HOST_SUFF_EXE)
319 TOOL_QT5_LUPDATE ?= $(PATH_TOOL_QT5_BIN)/lupdate$(TOOL_QT5_BIN_SUFF)$(HOST_SUFF_EXE)
320else
321 # Pathless, relies on the environment.
322 TOOL_QT5_MOC ?= moc$(TOOL_QT5_BIN_SUFF)$(HOST_SUFF_EXE)
323 TOOL_QT5_UIC ?= uic$(TOOL_QT5_BIN_SUFF)$(HOST_SUFF_EXE)
324 TOOL_QT5_RCC ?= rcc$(HOST_SUFF_EXE)
325 TOOL_QT5_LRC ?= lrelease$(TOOL_QT5_BIN_SUFF)$(HOST_SUFF_EXE)
326 TOOL_QT5_LUPDATE ?= lupdate$(TOOL_QT5_BIN_SUFF)$(HOST_SUFF_EXE)
327endif
328
329# General Properties used by kBuild and/or units/qt.kmk
330TOOL_QT5_MOCFLAGS ?=
331TOOL_QT5_MOCINCS ?=
332TOOL_QT5_MOCDEFS ?=
333TOOL_QT5_MOCDEFS.darwin ?= __APPLE__ __GNUC__
334TOOL_QT5_MOCDEFS.solaris ?= __sun
335TOOL_QT5_MOCDEFS.win.amd64 ?= WIN64
336TOOL_QT5_MOCDEFS.win.x86 ?= WIN32
337
338
339## MOC a C++ source file.
340# @param $(target) Normalized main target name.
341# @param $(source) Source filename (relative).
342# @param $(out) Object file name. This shall be (re)created by the compilation.
343# @param $(dep) Dependcy file. This may be (re)created by the compilation.
344# @param $(flags) Flags.
345# @param $(defs) Definitions.
346# @param $(incs) Includes.
347# @param $(outbase) Output basename (full). Use this for list files and such.
348#
349TOOL_QT5_MOC_CPP_DEPEND =
350TOOL_QT5_MOC_CPP_DEPORD =
351TOOL_QT5_MOC_CPP_OUTPUT =
352TOOL_QT5_MOC_CPP_OUTPUT_MAYBE =
353define TOOL_QT5_MOC_CPP_CMDS
354 $(QUIET)$(TOOL_QT5_MOC)\
355 $(flags)\
356 $(addprefix -I, $(incs))\
357 $(addprefix -D, $(defs))\
358 -o $(out)\
359 $(source)
360endef
361
362## MOC a C++ header file.
363# @param $(target) Normalized main target name.
364# @param $(source) Source filename (relative).
365# @param $(out) Object file name. This shall be (re)created by the compilation.
366# @param $(dep) Dependcy file. This may be (re)created by the compilation.
367# @param $(flags) Flags.
368# @param $(defs) Definitions.
369# @param $(incs) Includes.
370# @param $(outbase) Output basename (full). Use this for list files and such.
371#
372TOOL_QT5_MOC_HPP_DEPEND =
373TOOL_QT5_MOC_HPP_DEPORD =
374TOOL_QT5_MOC_HPP_OUTPUT =
375TOOL_QT5_MOC_HPP_OUTPUT_MAYBE =
376define TOOL_QT5_MOC_HPP_CMDS
377 $(QUIET)$(TOOL_QT5_MOC)\
378 $(flags)\
379 $(addprefix -I, $(incs))\
380 $(addprefix -D, $(defs))\
381 -o $(out)\
382 $(source)
383endef
384
385## Compile a Qt user interface file (.ui).
386# @param $(target) Normalized main target name.
387# @param $(source) Source filename (relative).
388# @param $(out) Object file name. This shall be (re)created by the compilation.
389# @param $(dep) Dependcy file. This may be (re)created by the compilation.
390# @param $(flags) Flags.
391# @param $(defs) Definitions.
392# @param $(incs) Includes.
393# @param $(outbase) Output basename (full). Use this for list files and such.
394#
395TOOL_QT5_UIC_UI_DEPEND =
396TOOL_QT5_UIC_UI_DEPORD =
397TOOL_QT5_UIC_UI_OUTPUT =
398TOOL_QT5_UIC_UI_OUTPUT_MAYBE =
399define TOOL_QT5_UIC_UI_CMDS
400 $(QUIET)$(TOOL_QT5_UIC)\
401 $(flags)\
402 -o $(out)\
403 $(source)
404endef
405
406## Compile a Qt resource file (.qrc).
407# @param $(target) Normalized main target name.
408# @param $(source) Source filename (relative).
409# @param $(out) Object file name. This shall be (re)created by the compilation.
410# @param $(dep) Dependcy file. This may be (re)created by the compilation.
411# @param $(flags) Flags.
412# @param $(defs) Definitions.
413# @param $(incs) Includes.
414# @param $(outbase) Output basename (full). Use this for list files and such.
415#
416# @remarks The sed script generating the dependency file is a bit naive.
417TOOL_QT5_RCC_QRC_DEPEND =
418TOOL_QT5_RCC_QRC_DEPORD =
419TOOL_QT5_RCC_QRC_OUTPUT =
420TOOL_QT5_RCC_QRC_OUTPUT_MAYBE =
421define TOOL_QT5_RCC_QRC_CMDS
422 $(QUIET)$(TOOL_QT5_RCC)\
423 $(flags)\
424 -o $(out)\
425 $(source)
426 $(QUIET2)$(APPEND) $(dep) '\'
427 $(QUIET2)$(APPEND) $(dep) '$(out): \'
428 $(QUIET2)$(APPEND) $(dep) '$(source) \'
429 $(QUIET2)$(SED) \
430 -e '/^[[:blank:]]*<file[[:blank:]][^>]*>/!d' \
431 -e 's/^.*<file[[:blank:]][^>]*>\([^<]*\)<\/file>.*$$$$/\1/' \
432 -e 's|^[^/][^:]|$(abspathex $(dir $(source)),$(defpath))/&|' \
433 -e 's|$$$$| \\|' \
434 --append $(dep) \
435 $(source)
436 $(QUIET2)$(APPEND) $(dep)
437 $(QUIET2)$(SED) \
438 -e '/^[[:blank:]]*<file[[:blank:]][^>]*>/!d' \
439 -e 's/^.*<file[[:blank:]][^>]*>\([^<]*\)<\/file>.*$$$$/\1/' \
440 -e 's|^[^/][^:]|$(abspathex $(dir $(source)),$(defpath))/&|' \
441 -e 's|$$$$|:\n|' \
442 --append $(dep) \
443 $(source)
444 $(QUIET2)$(APPEND) $(dep)
445endef
446
447## Compile a Qt translation file (.ts).
448# @param $(target) Normalized main target name.
449# @param $(source) Source filename (relative).
450# @param $(out) Object file name. This shall be (re)created by the compilation.
451# @param $(dep) Dependcy file. This may be (re)created by the compilation.
452# @param $(flags) Flags.
453# @param $(defs) Definitions.
454# @param $(incs) Includes.
455# @param $(outbase) Output basename (full). Use this for list files and such.
456#
457TOOL_QT5_LRC_TS_DEPEND =
458TOOL_QT5_LRC_TS_DEPORD =
459TOOL_QT5_LRC_TS_OUTPUT =
460TOOL_QT5_LRC_TS_OUTPUT_MAYBE =
461define TOOL_QT5_LRC_TS_CMDS
462 $(QUIET)$(TOOL_QT5_LRC)\
463 $(flags)\
464 $(source)\
465 -qm $(out)
466endef
467
468
469
470#
471#
472# Back to the Qt5 unit.
473#
474#
475
476
477## wrapper for the lrelease (LRC) command dependencies.
478ifndef NO_COMPILE_CMDS_DEPS
479 _UNIT_QT5_LRC_CMDS_DEP = $$(comp-cmds-ex $$($(target)_$(subst :,_,$(source))_QT5_LRC_CMDS_PREV_),$$(commands $(out)),FORCE)
480else
481 _UNIT_QT5_LRC_CMDS_DEP =
482endif
483
484##
485# def_unit_qt5_target_pre_handle_translation helper that is expanded before evaluation.
486#
487# This is necessary to resolve reference to local variables before doing
488# assignments and setting up commands. They would otherwise be resolved
489# later in a different context and the result would be completely wrong.
490#
491define def_unit_qt5_target_pre_handle_translation_dx
492
493$(out) + $(more_output) +| $(maybe_output): \
494 $(deps) \
495 $(value _UNIT_QT5_LRC_CMDS_DEP) \
496 | \
497 $(orderdeps)
498 %$$(call MSG_TOOL,lrelease,$(target),$(source),$$@)
499 $(QUIET2)$(RM) -f $(out) $(more_output) $(maybe_output) $(dep)
500
501$(cmds)
502
503ifndef NO_COMPILE_CMDS_DEPS
504 %$$(QUIET2)$$(APPEND) '$(dep)'
505 %$$(QUIET2)$$(APPEND) '$(dep)' 'define $(target)_$(subst :,_,$(source))_QT5_LRC_CMDS_PREV_'
506 %$$(QUIET2)$$(APPEND) -c '$(dep)' '$(out)'
507 %$$(QUIET2)$$(APPEND) '$(dep)' 'endef'
508endif
509
510$(target)_CLEAN += $(out) $(more_output) $(maybe_output) $(dep)
511$(target)-inst-nls_SOURCES += $(out)
512
513endef # def_unit_qt5_target_pre_handle_translation_dx
514
515##
516# Handle a source file listed in QT_TRANSLATIONS.
517#
518# The files listed in QT_TRANSLATIONS are translation files (.ts) which needs
519# to be translated into .qm files that are loadble by Qt.
520#
521# @remarks Invoked via $(evalvalctx ).
522define def_unit_qt5_target_pre_handle_translation
523local type := LRC
524
525# fetch the properties.
526local tool := $(kb-src-tool dummy_var)
527local qtnlsdir := $($(target)_0_OUTDIR)/qtnls
528local outbase := $(qtnlsdir)/$(notdir $(basename $(source)))
529local out := $(outbase).qm
530local dep := $(out).dep
531local flags := $(kb-src-prop FLAGS,dummy_var,right-to-left)
532local deps := $(kb-src-prop DEPS,dummy_var,left-to-right)
533local orderdeps := $(call DIRDEP,$(dir $(outbase))) $(kb-src-prop ORDERDEPS,dummy_var,left-to-right)
534
535# default path + source dep.
536ifneq ($(defpath),)
537local source := $(abspathex $(source),$(defpath))
538local deps := $(abspathex $(deps),$(defpath)) $(source)
539local incs := $(abspathex $(incs),$(defpath))
540else
541local deps += $(source)
542endif
543
544# call the tool
545ifndef TOOL_$(tool)_LRC_TS_CMDS
546 $(error kBuild: qt lrelease tool not found: TOOL_$(tool)_LRC_TS_CMDS)
547endif
548local cmds := $(TOOL_$(tool)_LRC_TS_CMDS)
549local more_output := $(TOOL_$(tool)_LRC_TS_OUTPUT)
550local maybe_output := $(TOOL_$(tool)_LRC_TS_OUTPUT_MAYBE)
551local deps += $(TOOL_$(tool)_LRC_TS_DEPEND)
552local orderdeps += $(TOOL_$(tool)_LRC_TS_DEPORD)
553
554# generate the link rule and update some source and target variables.
555ifndef NO_COMPILE_CMDS_DEPS
556 $(eval includedep $(dep))
557endif
558$(eval $(def_unit_qt5_target_pre_handle_translation_dx))
559
560endef # def_unit_qt5_target_pre_handle_translation
561
562
563
564## wrapper for the UIC command dependencies.
565ifndef NO_COMPILE_CMDS_DEPS
566 _UNIT_QT5_RCC_CMDS_DEP = $$(comp-cmds-ex $$($(target)_$(subst :,_,$(source))_QT5_RCC_CMDS_PREV_),$$(commands $(out)),FORCE)
567else
568 _UNIT_QT5_RCC_CMDS_DEP =
569endif
570
571##
572# def_unit_qt5_target_pre_handle_qrc helper that is expanded before evaluation.
573#
574# This is necessary to resolve reference to local variables before doing
575# assignments and setting up commands. They would otherwise be resolved
576# later in a different context and the result would be completely wrong.
577#
578define def_unit_qt5_target_pre_handle_rcc_dx
579
580$(out) +| $(realout) $(more_output) $(maybe_output): \
581 $(deps) \
582 $(value _UNIT_QT5_RCC_CMDS_DEP) \
583 | \
584 $(orderdeps)
585 %$$(call MSG_TOOL,rcc,$(target),$(source),$$@)
586 $(QUIET2)$(RM) -f $(out) $(more_output) $(maybe_output) $(dep)
587
588$(cmds)
589
590 $(QUIET)$(CP) --changed -f $(out) $(realout)
591ifndef NO_COMPILE_CMDS_DEPS
592 %$$(QUIET2)$$(APPEND) '$(dep)'
593 %$$(QUIET2)$$(APPEND) '$(dep)' 'define $(target)_$(subst :,_,$(source))_QT5_RCC_CMDS_PREV_'
594 %$$(QUIET2)$$(APPEND) -c '$(dep)' '$(out)'
595 %$$(QUIET2)$$(APPEND) '$(dep)' 'endef'
596endif
597
598$(target)_INTERMEDIATES += $(realout)
599$(target)_GEN_SOURCES_ += $(realout)
600$(target)_CLEAN += $(out) $(realout) $(more_output) $(maybe_output) $(dep)
601
602endef # def_unit_qt5_target_pre_handle_rcc_dx
603
604##
605# Source handler for .qrc sources (Qt resource files).
606#
607# @remarks $(evalvalctx me).
608define def_unit_qt5_src_handler_qrc
609local type := RCC
610
611# fetch the properties.
612local tool := $(kb-src-tool dummy_var)
613local qtrccdir := $($(target)_0_OUTDIR)/qtrcc
614local outbase := $(qtrccdir)/$(notdir $(basename $(source)))
615local out := $(outbase).tmp.gen.cpp
616local realout := $(outbase).gen.cpp
617local dep := $(realout).dep
618local flags := $(kb-src-prop FLAGS,dummy_var,right-to-left)
619local deps := $(kb-src-prop DEPS,dummy_var,left-to-right)
620local orderdeps := $(call DIRDEP,$(dir $(outbase))) $(kb-src-prop ORDERDEPS,dummy_var,left-to-right)
621
622# default path + source dep.
623ifneq ($(defpath),)
624local source := $(abspathex $(source),$(defpath))
625local deps := $(abspathex $(deps),$(defpath)) $(source)
626local incs := $(abspathex $(incs),$(defpath))
627else
628local deps += $(source)
629endif
630
631# call the tool
632ifndef TOOL_$(tool)_RCC_QRC_CMDS
633 $(error kBuild: qt rcc tool not found: TOOL_$(tool)_RCC_QRC_CMDS)
634endif
635local cmds := $(TOOL_$(tool)_RCC_QRC_CMDS)
636local more_output := $(TOOL_$(tool)_RCC_QRC_OUTPUT)
637local maybe_output := $(TOOL_$(tool)_RCC_QRC_OUTPUT_MAYBE)
638local deps += $(TOOL_$(tool)_RCC_QRC_DEPEND)
639local orderdeps += $(TOOL_$(tool)_RCC_QRC_DEPORD)
640
641# generate the link rule and update some source and target variables.
642ifndef NO_COMPILE_CMDS_DEPS
643 $(eval includedep $(dep))
644endif
645$(eval $(def_unit_qt5_target_pre_handle_rcc_dx))
646
647endef # def_unit_qt5_src_handler_qrc
648
649
650
651## wrapper for the UIC command dependencies.
652ifndef NO_COMPILE_CMDS_DEPS
653 _UNIT_QT5_UIC_CMDS_DEP = $$(comp-cmds-ex $$($(target)_$(subst :,_,$(source))_QT5_UIC_CMDS_PREV_),$$(commands $(out)),FORCE)
654else
655 _UNIT_QT5_UIC_CMDS_DEP =
656endif
657
658##
659# def_unit_qt5_src_handler_ui helper that is expanded before evaluation.
660#
661# This is necessary to resolve reference to local variables before doing
662# assignments and setting up commands. They would otherwise be resolved
663# later in a different context and the result would be completely wrong.
664#
665define def_unit_qt5_target_pre_handle_ui_dx
666
667$(out) +| $(realout) $(more_output) $(maybe_output): \
668 $(deps) \
669 $(value _UNIT_QT5_UIC_CMDS_DEP) \
670 | \
671 $(orderdeps)
672 %$$(call MSG_TOOL,uic,$(target),$(source),$$@)
673 $(QUIET2)$(RM) -f $(out) $(more_output) $(maybe_output) $(dep)
674
675$(cmds)
676
677 $(QUIET)$(CP) --changed -f $(out) $(realout)
678ifndef NO_COMPILE_CMDS_DEPS
679 %$$(QUIET2)$$(APPEND) '$(dep)'
680 %$$(QUIET2)$$(APPEND) '$(dep)' 'define $(target)_$(subst :,_,$(source))_QT5_UIC_CMDS_PREV_'
681 %$$(QUIET2)$$(APPEND) -c '$(dep)' '$(out)'
682 %$$(QUIET2)$$(APPEND) '$(dep)' 'endef'
683endif
684
685$(target)_INTERMEDIATES += $(realout)
686$(target)_CLEAN += $(out) $(realout) $(more_output) $(maybe_output) $(dep)
687
688endef # def_unit_qt5_target_pre_handle_ui_dx
689
690##
691# Source handler for .ui sources.
692#
693# @remarks $(evalvalctx me).
694define def_unit_qt5_src_handler_ui
695local type := UIC
696
697# fetch the properties.
698local tool := $(kb-src-tool dummy_var)
699local qtuicdir := $($(target)_0_OUTDIR)/qtuic
700local outbase := $(qtuicdir)/$(notdir $(basename $(source)))
701local out := $(outbase).tmp.gen.h
702local realout := $(outbase).gen.h
703local dep := $(realout).dep
704local flags := $(kb-src-prop FLAGS,dummy_var,right-to-left)
705local deps := $(kb-src-prop DEPS,dummy_var,left-to-right)
706local orderdeps := $(call DIRDEP,$(dir $(outbase))) $(kb-src-prop ORDERDEPS,dummy_var,left-to-right)
707
708# default path + source dep.
709ifneq ($(defpath),)
710local source := $(abspathex $(source),$(defpath))
711local deps := $(abspathex $(deps),$(defpath)) $(source)
712local incs := $(abspathex $(incs),$(defpath))
713else
714local deps += $(source)
715endif
716
717# call the tool
718ifndef TOOL_$(tool)_UIC_UI_CMDS
719 $(error kBuild: qt uic tool not found: TOOL_$(tool)_UIC_UI_CMDS)
720endif
721local cmds := $(TOOL_$(tool)_UIC_UI_CMDS)
722local more_output := $(TOOL_$(tool)_UIC_UI_OUTPUT)
723local maybe_output := $(TOOL_$(tool)_UIC_UI_OUTPUT_MAYBE)
724local deps += $(TOOL_$(tool)_UIC_UI_DEPEND)
725local orderdeps += $(TOOL_$(tool)_UIC_UI_DEPORD)
726
727# generate the link rule and update some source and target variables.
728ifndef NO_COMPILE_CMDS_DEPS
729 $(eval includedep $(dep))
730endif
731$(eval $(def_unit_qt5_target_pre_handle_ui_dx))
732
733endef # def_unit_qt5_src_handler_ui
734
735
736
737## wrapper for the MOC command dependencies.
738ifndef NO_COMPILE_CMDS_DEPS
739 _UNIT_QT5_MOC_HPP_CMDS_DEP = $$(comp-cmds-ex $$($(target)_$(subst :,_,$(source))_QT5_MOC_HPP_CMDS_PREV_),$$(commands $(out)),FORCE)
740else
741 _UNIT_QT5_MOC_HPP_CMDS_DEP =
742endif
743
744##
745# def_unit_qt5_target_pre_handle_moc_hdr helper that is expanded before evaluation.
746#
747# This is necessary to resolve reference to local variables before doing
748# assignments and setting up commands. They would otherwise be resolved
749# later in a different context and the result would be completely wrong.
750#
751define def_unit_qt5_target_pre_handle_moc_hdr_dx
752
753$(out) +| $(realout) $(more_output) $(maybe_output): \
754 $(deps) \
755 $(value _UNIT_QT5_MOC_HPP_CMDS_DEP) \
756 | \
757 $(orderdeps)
758 %$$(call MSG_TOOL,moc,$(target),$(source),$$@)
759 $(QUIET2)$(RM) -f $(out) $(more_output) $(maybe_output) $(dep)
760
761$(cmds)
762
763 $(QUIET)$(CP) --changed -f $(out) $(realout)
764ifndef NO_COMPILE_CMDS_DEPS
765 %$$(QUIET2)$$(APPEND) '$(dep)'
766 %$$(QUIET2)$$(APPEND) '$(dep)' 'define $(target)_$(subst :,_,$(source))_QT5_MOC_HPP_CMDS_PREV_'
767 %$$(QUIET2)$$(APPEND) -c '$(dep)' '$(out)'
768 %$$(QUIET2)$$(APPEND) '$(dep)' 'endef'
769endif
770
771$(target)_INTERMEDIATES += $(realout)
772$(target)_GEN_SOURCES_ += $(realout)
773$(target)_CLEAN += $(out) $(realout) $(more_output) $(maybe_output) $(dep)
774
775endef
776
777##
778# Handle a source file listed in QT_MOCHDRS.
779#
780# The files listed in QT_MOCHDRS uses the Q_OBJECT macro and we will
781# generate a .cpp file for each of them and add it to the generated
782# sources so that it's compiled and linked. (There is an alternative
783# way to do this where the .cpp file is included, this isn't currently
784# supported by this unit.)
785#
786# @remarks Invoked via $(evalvalctx ).
787define def_unit_qt5_target_pre_handle_moc_hdr
788local type := MOC
789
790# fetch the properties.
791local tool := $(kb-src-tool dummy_var)
792local outbase := $(qtmocdir)/$(notdir $(basename $(source)))
793local out := $(outbase).tmp.cpp
794local realout := $(outbase).cpp
795local dep := $(realout).dep
796local defs := $(kb-src-prop DEFS,dummy_var,left-to-right)
797local incs := $(kb-src-prop INCS,dummy_var,right-to-left)
798local flags := $(kb-src-prop FLAGS,dummy_var,right-to-left)
799local deps := $(kb-src-prop DEPS,dummy_var,left-to-right)
800local orderdeps := $(call DIRDEP,$(dir $(outbase))) $(kb-src-prop ORDERDEPS,dummy_var,left-to-right)
801
802# default path + source dep.
803ifneq ($(defpath),)
804local source := $(abspathex $(source),$(defpath))
805local deps := $(abspathex $(deps),$(defpath)) $(source)
806local incs := $(abspathex $(incs),$(defpath))
807else
808local deps += $(source)
809endif
810
811# call the tool
812ifndef TOOL_$(tool)_MOC_HPP_CMDS
813 $(error kBuild: qt moc tool not found: TOOL_$(tool)_MOC_HPP_CMDS)
814endif
815local cmds := $(TOOL_$(tool)_MOC_HPP_CMDS)
816local more_output := $(TOOL_$(tool)_MOC_HPP_OUTPUT)
817local maybe_output := $(TOOL_$(tool)_MOC_HPP_OUTPUT_MAYBE)
818local deps += $(TOOL_$(tool)_MOC_HPP_DEPEND)
819local orderdeps += $(TOOL_$(tool)_MOC_HPP_DEPORD)
820
821# generate the link rule and update some source and target variables.
822ifndef NO_COMPILE_CMDS_DEPS
823 $(eval includedep $(dep))
824endif
825$(eval $(def_unit_qt5_target_pre_handle_moc_hdr_dx))
826
827endef # def_unit_qt5_target_pre_handle_moc_hdr
828
829
830## wrapper for the MOC command dependencies.
831ifndef NO_COMPILE_CMDS_DEPS
832 _UNIT_QT5_MOC_CPP_CMDS_DEP = $$(comp-cmds-ex $$($(target)_$(subst :,_,$(source))_QT5_MOC_CPP_CMDS_PREV_),$$(commands $(out)),FORCE)
833else
834 _UNIT_QT5_MOC_CPP_CMDS_DEP =
835endif
836
837##
838# def_unit_qt5_target_pre_handle_moc_src helper that is expanded before evaluation.
839#
840# This is necessary to resolve reference to local variables before doing
841# assignments and setting up commands. They would otherwise be resolved
842# later in a different context and the result would be completely wrong.
843#
844define def_unit_qt5_target_pre_handle_moc_src_dx
845
846$(out) +| $(realout) $(more_output) $(maybe_output): \
847 $(deps) \
848 $(value _UNIT_QT5_MOC_CPP_CMDS_DEP) \
849 | \
850 $(orderdeps)
851 %$$(call MSG_TOOL,moc,$(target),$(source),$$@)
852 $(QUIET2)$(RM) -f $(out) $(more_output) $(maybe_output) $(dep)
853
854$(cmds)
855
856 $(QUIET)$(CP) --changed -f $(out) $(realout)
857ifndef NO_COMPILE_CMDS_DEPS
858 %$$(QUIET2)$$(APPEND) '$(dep)'
859 %$$(QUIET2)$$(APPEND) '$(dep)' 'define $(target)_$(subst :,_,$(source))_QT5_MOC_CPP_CMDS_PREV_'
860 %$$(QUIET2)$$(APPEND) -c '$(dep)' '$(out)'
861 %$$(QUIET2)$$(APPEND) '$(dep)' 'endef'
862endif
863
864$(target)_INTERMEDIATES += $(realout)
865$(target)_CLEAN += $(out) $(realout) $(more_output) $(maybe_output) $(dep)
866
867endef
868
869##
870# Handle a source file listed in QT_MOCSRCS.
871#
872# The files listed in QT_MOCSRCS uses the Q_OBJECT macro and will include
873# a .moc file that we're expected to generate here.
874#
875# @remarks Invoked via $(evalvalctx ).
876define def_unit_qt5_target_pre_handle_moc_src
877local type := MOC
878
879# fetch the properties.
880local tool := $(kb-src-tool dummy_var)
881local outbase := $(qtmocdir)/$(notdir $(basename $(source)))
882local out := $(outbase).tmp.moc
883local realout := $(outbase).moc
884local dep := $(realout).dep
885local defs := $(kb-src-prop DEFS,dummy_var,left-to-right)
886local incs := $(kb-src-prop INCS,dummy_var,right-to-left)
887local flags := $(kb-src-prop FLAGS,dummy_var,right-to-left)
888local deps := $(kb-src-prop DEPS,dummy_var,left-to-right)
889local orderdeps := $(call DIRDEP,$(dir $(outbase))) $(kb-src-prop ORDERDEPS,dummy_var,left-to-right)
890
891# default path + source dep.
892ifneq ($(defpath),)
893local source := $(abspathex $(source),$(defpath))
894local deps := $(abspathex $(deps),$(defpath)) $(source)
895local incs := $(abspathex $(incs),$(defpath))
896else
897local deps += $(source)
898endif
899
900# call the tool
901ifndef TOOL_$(tool)_MOC_CPP_CMDS
902 $(error kBuild: qt moc tool not found: TOOL_$(tool)_MOC_CPP_CMDS)
903endif
904local cmds := $(TOOL_$(tool)_MOC_CPP_CMDS)
905local more_output := $(TOOL_$(tool)_MOC_CPP_OUTPUT)
906local maybe_output := $(TOOL_$(tool)_MOC_CPP_OUTPUT_MAYBE)
907local deps += $(TOOL_$(tool)_MOC_CPP_DEPEND)
908local orderdeps += $(TOOL_$(tool)_MOC_CPP_DEPORD)
909
910# generate the link rule and update some source and target variables.
911ifndef NO_COMPILE_CMDS_DEPS
912 $(eval includedep $(dep))
913endif
914$(eval $(def_unit_qt5_target_pre_handle_moc_src_dx))
915
916endef # def_unit_qt5_target_pre_handle_moc_src
917
918
919##
920# Adds sources containing Q_OBJECT to QT_MOCSRCS.
921define def_unit_qt5_target_pre_cpp_source
922ifneq ($(file-size $(source)),-1)
923 ifneq ($(strip $(shell $(SED) -f $(KBUILD_PATH)/units/qt-Q_OBJECT.sed $(source))),)
924 $(eval $(target)_QT_MOCSRCS += $(source))
925 endif
926endif
927endef # def_unit_qt5_target_pre_cpp_source
928
929##
930# Invoked early in the processing of a target that uses the Qt unit.
931#
932# It will append the qt source handlers to the target (.h, .ui, .ts,
933# .png, .bmp, .gif).
934#
935# It will then check all the C++ sources and check which needs
936# a .moc files and generate rules and dependencies fofor these
937#
938define def_unit_qt5_target_pre
939
940# Make QTTOOL the default for the specific Qt tools instead of TOOL.
941ifneq ($($(target)_QTTOOL),)
942 ifeq ($($(target)_MOCTOOL),)
943 $(target)_MOCTOOL := $($(target)_QTTOOL)
944 endif
945 ifeq ($($(target)_UICTOOL),)
946 $(target)_UICTOOL := $($(target)_QTTOOL)
947 endif
948 ifeq ($($(target)_RCCTOOL),)
949 $(target)_RCCTOOL := $($(target)_QTTOOL)
950 endif
951 ifeq ($($(target)_LRCTOOL),)
952 $(target)_LRCTOOL := $($(target)_QTTOOL)
953 endif
954endif
955
956# Deal with QT_MODULES, QT_PREFIX and QT_INFIX.
957local qt_modules := \
958 $($(target)_QT_MODULES.$(bld_trg)) \
959 $($(target)_QT_MODULES.$(bld_trg_arch)) \
960 $($(target)_QT_MODULES.$(bld_trg).$(bld_trg_arch)) \
961 $($(target)_QT_MODULES.$(bld_trg_cpu)) \
962 $($(target)_QT_MODULES.$(bld_type)) \
963 $($(target)_QT_MODULES)
964local qt_prefix := $(firstword \
965 $($(target)_QT_PREFIX.$(bld_trg)) \
966 $($(target)_QT_PREFIX.$(bld_trg_arch)) \
967 $($(target)_QT_PREFIX.$(bld_trg).$(bld_trg_arch)) \
968 $($(target)_QT_PREFIX.$(bld_trg_cpu)) \
969 $($(target)_QT_PREFIX.$(bld_type)) \
970 $($(target)_QT_PREFIX))
971local qt_infix := $(firstword \
972 $($(target)_QT_INFIX.$(bld_trg)) \
973 $($(target)_QT_INFIX.$(bld_trg_arch)) \
974 $($(target)_QT_INFIX.$(bld_trg).$(bld_trg_arch)) \
975 $($(target)_QT_INFIX.$(bld_trg_cpu)) \
976 $($(target)_QT_INFIX.$(bld_type)) \
977 $($(target)_QT_INFIX))
978ifeq ($(bld_trg),darwin)
979 # Adding -F to CXXFLAGS is necessary to make #include <QtCore/qstring.h> stuff work...
980 $(eval $(target)_CXXFLAGS += -F$(PATH_SDK_QT5_LIB) )
981 $(eval $(target)_OBJCXXFLAGS += -F$(PATH_SDK_QT5_LIB) )
982 $(eval $(target)_LDFLAGS += -F$(PATH_SDK_QT5_LIB) $(foreach module,$(qt_modules), -framework $(qt_prefix)Qt$(module)$(qt_infix)) )
983 $(eval $(target)_INCS += $(foreach module,$(qt_modules), $(PATH_SDK_QT5_LIB)/$(qt_prefix)Qt$(module)$(qt_infix).framework/Versions/5/Headers) )
984else
985 ifeq ($(bld_trg),win)
986 $(eval $(target)_LIBS += $(foreach module,$(qt_modules), $(PATH_SDK_QT5_LIB)/$(qt_prefix)Qt$(module)$(qt_infix)4$(SUFF_LIB)) )
987 ifeq ($(tool_do),LINK_PROGRAM)
988 $(eval $(target)_LIBS += $(PATH_SDK_QT5_LIB)/$(qt_prefix)qtmain$(qt_infix)$(SUFF_LIB) )
989 endif
990 else
991 $(eval $(target)_LIBS += $(foreach module,$(qt_modules), $(PATH_SDK_QT5_LIB)/lib$(qt_prefix)Qt$(module)$(qt_infix)$(SUFF_DLL)) )
992 endif
993 $(eval $(target)_INCS += $(addprefix $(PATH_SDK_QT5_INC)/Qt,$(qt_modules)) $(PATH_SDK_QT5_INC) )
994endif
995$(eval $(target)_DEFS += $(foreach module,$(toupper $(qt_modules)), QT_$(module)_LIB) )
996
997
998# Autodetect source files with Q_OBJECT references if QT_MOCSRCS is undefined. (slow)
999# Tip: Use target_QT_MOCSRCS = $(NO_SUCH_VARIABLE) to avoid this.
1000ifndef $(target)_QT_MOCSRCS
1001 $(foreach source, $(filter %.cxx %.CXX %.cpp %.CPP %.cc %.CC,\
1002 $($(target)_SOURCES.$(bld_trg)) \
1003 $($(target)_SOURCES.$(bld_trg_arch)) \
1004 $($(target)_SOURCES.$(bld_trg).$(bld_trg_arch)) \
1005 $($(target)_SOURCES.$(bld_trg_cpu)) \
1006 $($(target)_SOURCES.$(bld_type)) \
1007 $($(target)_SOURCES) \
1008 ), $(evalval def_unit_qt5_target_pre_cpp_source))
1009endif
1010
1011# Install source handlers for .ui files.
1012$(target)_SRC_HANDLERS += \
1013 .ui:def_unit_qt5_src_handler_ui \
1014 .UI:def_unit_qt5_src_handler_ui \
1015 .qrc:def_unit_qt5_src_handler_qrc \
1016 .qrc:def_unit_qt5_src_handler_qrc
1017
1018# Calc the MOC and UI output directories and add them to BLDDIRS and INCS.
1019local qtmocdir := $($(target)_0_OUTDIR)/qtmoc
1020local qtuicdir := $($(target)_0_OUTDIR)/qtuic
1021local qtrccdir := $($(target)_0_OUTDIR)/qtrcc
1022local qtnlsdir := $($(target)_0_OUTDIR)/qtnls
1023$(eval $(target)_BLDDIRS += $(qtmocdir) $(qtuicdir) $(qtrccdir) $(qtnlsdir))
1024$(eval $(target)_INCS += $(qtmocdir) $(qtuicdir))
1025
1026# Deal with QT_MOCSRCS.
1027$(foreach source, \
1028 $($(target)_QT_MOCSRCS.$(bld_trg)) \
1029 $($(target)_QT_MOCSRCS.$(bld_trg_arch)) \
1030 $($(target)_QT_MOCSRCS.$(bld_trg).$(bld_trg_arch)) \
1031 $($(target)_QT_MOCSRCS.$(bld_trg_cpu)) \
1032 $($(target)_QT_MOCSRCS.$(bld_type)) \
1033 $($(target)_QT_MOCSRCS) \
1034 , $(evalvalctx def_unit_qt5_target_pre_handle_moc_src))
1035
1036# Deal with QT_MOCHDRS.
1037$(foreach source, \
1038 $($(target)_QT_MOCHDRS.$(bld_trg)) \
1039 $($(target)_QT_MOCHDRS.$(bld_trg_arch)) \
1040 $($(target)_QT_MOCHDRS.$(bld_trg).$(bld_trg_arch)) \
1041 $($(target)_QT_MOCHDRS.$(bld_trg_cpu)) \
1042 $($(target)_QT_MOCHDRS.$(bld_type)) \
1043 $($(target)_QT_MOCHDRS) \
1044 , $(evalvalctx def_unit_qt5_target_pre_handle_moc_hdr))
1045
1046# Deal with QT_TRANSLATIONS.
1047# ASSUMES (_ALL_)INSTALLS is processed after the targets using this unit.
1048local translations := \
1049 $($(target)_QT_TRANSLATIONS.$(bld_trg)) \
1050 $($(target)_QT_TRANSLATIONS.$(bld_trg_arch)) \
1051 $($(target)_QT_TRANSLATIONS.$(bld_trg).$(bld_trg_arch)) \
1052 $($(target)_QT_TRANSLATIONS.$(bld_trg_cpu)) \
1053 $($(target)_QT_TRANSLATIONS.$(bld_type)) \
1054 $($(target)_QT_TRANSLATIONS)
1055ifneq ($(strip $(translations)),)
1056 local expr := _ALL_INSTALLS_IMPLICIT += $(target)-inst-nls
1057 $(eval $(expr))
1058 ifdef $(target)_QT_TRANSLATIONS_TEMPLATE
1059 $(target)-inst-nls_TEMPLATE := $($(target)_QT_TRANSLATIONS_TEMPLATE)
1060 else
1061 $(target)-inst-nls_MODE := 0644
1062 endif
1063 ifdef $(target)_QT_TRANSLATIONS_INST
1064 $(target)-inst-nls_INST := $($(target)_QT_TRANSLATIONS_INST)
1065 endif
1066 $(target)-inst-nls_SOURCES :=
1067 $(foreach source, $(translations)\
1068 , $(evalvalctx def_unit_qt5_target_pre_handle_translation))
1069endif
1070
1071endef # def_unit_qt5_target_pre
1072
1073
1074#
1075# Rule for debugging.
1076#
1077unit-qt5-show-vars:
1078 @$(ECHO) 'The Qt5 SDK variables:'
1079 @$(ECHO) ' PATH_SDK_QT5 = "$(PATH_SDK_QT5)"'
1080 @$(ECHO) ' PATH_SDK_QT5_INC = "$(PATH_SDK_QT5_INC)"'
1081 @$(ECHO) ' PATH_SDK_QT5_LIB = "$(PATH_SDK_QT5_LIB)"'
1082 @$(ECHO) ' PATH_SDK_QT5_LIB.amd64 = "$(PATH_SDK_QT5_LIB.amd64)"'
1083 @$(ECHO) ' PATH_SDK_QT5_LIB.x86 = "$(PATH_SDK_QT5_LIB.x86)"'
1084 @$(ECHO) 'The Qt5 TOOL variables:'
1085 @$(ECHO) ' PATH_TOOL_QT5_BIN = "$(PATH_TOOL_QT5_BIN)"'
1086 @$(ECHO) ' TOOL_QT5_BIN_SUFF = "$(TOOL_QT5_BIN_SUFF)"'
1087 @$(ECHO) ' TOOL_QT5_MOC = "$(TOOL_QT5_MOC)"'
1088 @$(ECHO) ' TOOL_QT5_UIC = "$(TOOL_QT5_UIC)"'
1089 @$(ECHO) ' TOOL_QT5_RCC = "$(TOOL_QT5_RCC)"'
1090 @$(ECHO) ' TOOL_QT5_LRC = "$(TOOL_QT5_LRC)"'
1091 @$(ECHO) ' TOOL_QT5_LUPDATE = "$(TOOL_QT5_LUPDATE)"'
1092
Note: See TracBrowser for help on using the repository browser.