author | Eckhart Koeppen <eckhart.koppen@nokia.com> |
Thu, 08 Apr 2010 14:19:33 +0300 | |
branch | RCL_3 |
changeset 8 | 3f74d0d4af4c |
parent 0 | 1918ee327afb |
child 29 | b72c6db6890b |
permissions | -rw-r--r-- |
0 | 1 |
|
2 |
#global defaults |
|
3 |
isEmpty(QMAKE_MOC) { |
|
4 |
contains(QMAKE_HOST.os,Windows):QMAKE_MOC = $$[QT_INSTALL_BINS]\moc.exe |
|
5 |
else:QMAKE_MOC = $$[QT_INSTALL_BINS]/moc |
|
6 |
} |
|
7 |
isEmpty(MOC_DIR):MOC_DIR = . |
|
8 |
isEmpty(QMAKE_H_MOD_MOC):QMAKE_H_MOD_MOC = moc_ |
|
9 |
isEmpty(QMAKE_EXT_CPP_MOC):QMAKE_EXT_CPP_MOC = .moc |
|
10 |
||
11 |
# On Windows, put the includes into a .inc file which moc will read, if the project |
|
12 |
# has too many includes. We do this to overcome a command-line limit on Win < XP |
|
13 |
INCLUDETEMP= |
|
14 |
WIN_INCLUDETEMP= |
|
15 |
win32:count($$list($$INCPATH), 40, >) { |
|
16 |
INCLUDETEMP = $$MOC_DIR/mocinclude.tmp |
|
17 |
||
18 |
WIN_INCLUDETEMP=$$INCLUDETEMP |
|
19 |
||
20 |
EOC = $$escape_expand(\n\t) |
|
21 |
||
22 |
if(contains(TEMPLATE, "vc.*")|contains(TEMPLATE_PREFIX, "vc")) { |
|
23 |
# the VCPROJ generator will replace the \r\h with the coded \r\n: 
 |
|
24 |
# No other generator understands the \h |
|
25 |
if(win32-msvc.net|win32-msvc2*|wince*msvc*): EOC = $$escape_expand(\r\h) |
|
26 |
else: EOC = $$escape_expand(\\)$$escape_expand(\n\t) |
|
27 |
} |
|
28 |
||
29 |
unset(INCFILELIST) |
|
30 |
RET = |
|
31 |
for(incfile, $$list($$INCPATH)) { |
|
32 |
INCFILELIST = -I$$incfile |
|
33 |
isEmpty(RET): RET += @echo $$INCFILELIST> $$WIN_INCLUDETEMP $$EOC |
|
34 |
else: RET += @echo $$INCFILELIST>> $$WIN_INCLUDETEMP $$EOC |
|
35 |
} |
|
36 |
!isEmpty(INCFILELIST):RET += @echo $$INCFILELIST>> $$WIN_INCLUDETEMP $$EOC |
|
37 |
||
38 |
build_pass|isEmpty(BUILDS) { |
|
39 |
mocinclude.target = $$INCLUDETEMP |
|
40 |
mocinclude.commands = $$RET |
|
41 |
QMAKE_EXTRA_TARGETS += mocinclude |
|
42 |
} |
|
43 |
} |
|
44 |
||
45 |
defineReplace(mocCmd) { |
|
46 |
!isEmpty(WIN_INCLUDETEMP) { |
|
47 |
RET = |
|
48 |
if(contains(TEMPLATE, "vc.*")|contains(TEMPLATE_PREFIX, "vc")) { |
|
49 |
RET += $$mocinclude.commands |
|
50 |
} |
|
51 |
RET += $$QMAKE_MOC $(DEFINES) @$$WIN_INCLUDETEMP $$join(QMAKE_COMPILER_DEFINES, " -D", -D) $$1 -o $$2 |
|
52 |
return($$RET) |
|
53 |
} |
|
54 |
return($$QMAKE_MOC $(DEFINES) $(INCPATH) $$join(QMAKE_COMPILER_DEFINES, " -D", -D) $$1 -o $$2) |
|
55 |
} |
|
56 |
||
57 |
#moc headers |
|
58 |
moc_header.CONFIG = moc_verify |
|
59 |
moc_header.dependency_type = TYPE_C |
|
60 |
moc_header.commands = ${QMAKE_FUNC_mocCmd} |
|
61 |
moc_header.output = $$MOC_DIR/$${QMAKE_H_MOD_MOC}${QMAKE_FILE_BASE}$${first(QMAKE_EXT_CPP)} |
|
62 |
moc_header.input = HEADERS |
|
63 |
moc_header.variable_out = SOURCES |
|
64 |
moc_header.name = MOC ${QMAKE_FILE_IN} |
|
65 |
if(!contains(TEMPLATE, "vc.*"):!contains(TEMPLATE_PREFIX, "vc")) { |
|
66 |
!isEmpty(INCLUDETEMP):moc_header.depends += $$INCLUDETEMP |
|
67 |
} |
|
68 |
silent:moc_header.commands = @echo moc ${QMAKE_FILE_IN} && $$moc_header.commands |
|
69 |
QMAKE_EXTRA_COMPILERS += moc_header |
|
70 |
INCREDIBUILD_XGE += moc_header |
|
71 |
||
72 |
#moc sources |
|
73 |
moc_source.CONFIG = no_link moc_verify |
|
74 |
moc_source.dependency_type = TYPE_C |
|
75 |
moc_source.commands = ${QMAKE_FUNC_mocCmd} |
|
76 |
moc_source.output = $$MOC_DIR/$${QMAKE_CPP_MOD_MOC}${QMAKE_FILE_BASE}$${QMAKE_EXT_CPP_MOC} |
|
77 |
moc_source.input = SOURCES OBJECTIVE_SOURCES |
|
78 |
moc_source.name = MOC ${QMAKE_FILE_IN} |
|
79 |
if(!contains(TEMPLATE, "vc.*"):!contains(TEMPLATE_PREFIX, "vc")) { |
|
80 |
!isEmpty(INCLUDETEMP):moc_source.depends += $$INCLUDETEMP |
|
81 |
} |
|
82 |
silent:moc_source.commands = @echo moc ${QMAKE_FILE_IN} && $$moc_source.commands |
|
83 |
QMAKE_EXTRA_COMPILERS += moc_source |
|
84 |
INCREDIBUILD_XGE += moc_source |
|
85 |
||
86 |
#make sure we can include these files |
|
87 |
moc_dir_short = $$MOC_DIR |
|
88 |
contains(QMAKE_HOST.os,Windows):moc_dir_short ~= s,^.:,/, |
|
89 |
contains(moc_dir_short, ^[/\\\\].*):INCLUDEPATH += $$MOC_DIR |
|
90 |
else:INCLUDEPATH += $$OUT_PWD/$$MOC_DIR |
|
91 |
||
92 |
# Backwards compatibility: Make shadow builds with default MOC_DIR work |
|
93 |
# if the user did not add the source dir explicitly. |
|
94 |
equals(MOC_DIR, .) { |
|
95 |
CONFIG -= include_source_dir |
|
96 |
CONFIG = include_source_dir $$CONFIG |
|
97 |
} |
|
98 |
||
99 |
#auto depend on moc |
|
8
3f74d0d4af4c
qt:70947f0f93d948bc89b3b43d00da758a51f1ef84
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
0
diff
changeset
|
100 |
unix:!symbian:!no_mocdepend { |
0 | 101 |
moc_source.depends += $$first(QMAKE_MOC) |
102 |
moc_header.depends += $$first(QMAKE_MOC) |
|
103 |
!contains(TARGET, moc) { #auto build moc |
|
104 |
isEmpty(QMAKE_MOC_SRC):QMAKE_MOC_SRC = "$(QTDIR)/src/tools/moc" |
|
105 |
make_moc.target = $$first(QMAKE_MOC) |
|
106 |
make_moc.commands = (cd $$QMAKE_MOC_SRC && $(MAKE)) |
|
107 |
QMAKE_EXTRA_TARGETS += make_moc |
|
108 |
} |
|
109 |
} |
|
110 |
||
111 |
#generate a mocclean |
|
112 |
build_pass|isEmpty(BUILDS):mocclean.depends = compiler_moc_header_clean compiler_moc_source_clean |
|
113 |
else:mocclean.CONFIG += recursive |
|
114 |
QMAKE_EXTRA_TARGETS += mocclean |
|
115 |
||
116 |
#generate a mocables |
|
117 |
build_pass|isEmpty(BUILDS):mocables.depends = compiler_moc_header_make_all compiler_moc_source_make_all |
|
118 |
else:mocables.CONFIG += recursive |
|
119 |
QMAKE_EXTRA_TARGETS += mocables |