source: branches/vendor/trolltech/qt/current/mkspecs/features/moc.prf @ 2

Last change on this file since 2 was 2, checked in by Dmitry A. Kuminov, 12 years ago

Initially imported qt-all-opensource-src-4.5.1 from Trolltech.

File size: 3.7 KB
Line 
1
2#global defaults
3isEmpty(QMAKE_MOC) {
4    win32:QMAKE_MOC = $$[QT_INSTALL_BINS]\moc.exe
5    else:QMAKE_MOC = $$[QT_INSTALL_BINS]/moc
6}
7isEmpty(MOC_DIR):MOC_DIR = .
8isEmpty(QMAKE_H_MOD_MOC):QMAKE_H_MOD_MOC = moc_
9isEmpty(QMAKE_EXT_CPP_MOC):QMAKE_EXT_CPP_MOC = .moc
10
11# This function on Windows puts the includes into a .inc file which moc will read, if the project
12# has more than 30 includes. We do this to overcome a command-line limit on Win < XP
13# Otherwise the function simply returns the normal command-line for moc
14defineReplace(mocCmd) {
15    win32:count($$list($$INCPATH), 40, >) {
16        EOC = $$escape_expand(\n\t)
17
18        if(contains(TEMPLATE, "vc.*")|contains(TEMPLATE_PREFIX, "vc")) {
19            # the VCPROJ generator will replace the \r\h with the coded \r\n: &#x0d;&#x0a;
20            # No other generator understands the \h
21            if(win32-msvc.net|win32-msvc2*|wince*msvc*): EOC = $$escape_expand(\r\h)
22            else: EOC = $$escape_expand(\\)$$escape_expand(\n\t)
23        }
24
25        INCLUDETEMP = mocinclude.tmp
26        unset(INCFILELIST)
27        RET =
28        for(incfile, $$list($$INCPATH)) {
29            INCFILELIST = -I$$incfile
30            isEmpty(RET): RET += @echo $$INCFILELIST> $$INCLUDETEMP $$EOC
31            else:         RET += @echo $$INCFILELIST>> $$INCLUDETEMP $$EOC
32        }
33        !isEmpty(INCFILELIST):RET += @echo $$INCFILELIST>> $$INCLUDETEMP $$EOC
34        RET += $$QMAKE_MOC $(DEFINES) @$$INCLUDETEMP $$join(QMAKE_COMPILER_DEFINES, " -D", -D) $$1 -o $$2
35        return($$RET)
36    }
37    return($$QMAKE_MOC $(DEFINES) $(INCPATH) $$join(QMAKE_COMPILER_DEFINES, " -D", -D) $$1 -o $$2)
38}
39
40#moc headers
41moc_header.CONFIG = moc_verify
42moc_header.dependency_type = TYPE_C
43moc_header.commands = ${QMAKE_FUNC_mocCmd}
44moc_header.output = $$MOC_DIR/$${QMAKE_H_MOD_MOC}${QMAKE_FILE_BASE}$${first(QMAKE_EXT_CPP)}
45moc_header.input = HEADERS
46moc_header.variable_out = SOURCES
47moc_header.name = MOC ${QMAKE_FILE_IN}
48silent:moc_header.commands = @echo moc ${QMAKE_FILE_IN} && $$moc_header.commands
49QMAKE_EXTRA_COMPILERS += moc_header
50INCREDIBUILD_XGE += moc_header
51
52#moc sources
53moc_source.CONFIG = no_link moc_verify
54moc_source.dependency_type = TYPE_C
55moc_source.commands = ${QMAKE_FUNC_mocCmd}
56moc_source.output = $$MOC_DIR/$${QMAKE_CPP_MOD_MOC}${QMAKE_FILE_BASE}$${QMAKE_EXT_CPP_MOC}
57moc_source.input = SOURCES OBJECTIVE_SOURCES
58moc_source.name = MOC ${QMAKE_FILE_IN}
59silent:moc_source.commands = @echo moc ${QMAKE_FILE_IN} && $$moc_source.commands
60QMAKE_EXTRA_COMPILERS += moc_source
61INCREDIBUILD_XGE += moc_source
62
63#make sure we can include these files
64moc_dir_short = $$MOC_DIR
65win32:moc_dir_short ~= s,^.:,/,
66contains(moc_dir_short, ^[/\\\\].*):INCLUDEPATH += $$MOC_DIR
67else:INCLUDEPATH += $$OUT_PWD/$$MOC_DIR
68
69# Backwards compatibility: Make shadow builds with default MOC_DIR work
70# if the user did not add the source dir explicitly.
71equals(MOC_DIR, .) {
72    CONFIG -= include_source_dir
73    CONFIG = include_source_dir $$CONFIG
74}
75
76#auto depend on moc
77unix:!no_mocdepend {
78     moc_source.depends += $$first(QMAKE_MOC)
79     moc_header.depends += $$first(QMAKE_MOC)
80     !contains(TARGET, moc) { #auto build moc
81         isEmpty(QMAKE_MOC_SRC):QMAKE_MOC_SRC = "$(QTDIR)/src/tools/moc"
82         make_moc.target = $$first(QMAKE_MOC)
83             make_moc.commands = (cd $$QMAKE_MOC_SRC && $(MAKE))
84             QMAKE_EXTRA_TARGETS += make_moc
85     }
86}
87
88#generate a mocclean
89build_pass|isEmpty(BUILDS):mocclean.depends = compiler_moc_header_clean compiler_moc_source_clean
90else:mocclean.CONFIG += recursive
91QMAKE_EXTRA_TARGETS += mocclean
92
93#generate a mocables
94build_pass|isEmpty(BUILDS):mocables.depends = compiler_moc_header_make_all compiler_moc_source_make_all
95else:mocables.CONFIG += recursive
96QMAKE_EXTRA_TARGETS += mocables
Note: See TracBrowser for help on using the repository browser.