d9ba123c6e
unlike the real compiler, moc does not have these directories built in, so it would not find headers from a system install of qt. Task-number: QTBUG-28870 Change-Id: I86f18cdc8953145190163746dae59f4e784f2d78 Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com>
101 lines
3.3 KiB
Plaintext
101 lines
3.3 KiB
Plaintext
|
|
#global defaults
|
|
qtPrepareTool(QMAKE_MOC, moc)
|
|
isEmpty(MOC_DIR):MOC_DIR = .
|
|
isEmpty(QMAKE_H_MOD_MOC):QMAKE_H_MOD_MOC = moc_
|
|
isEmpty(QMAKE_EXT_CPP_MOC):QMAKE_EXT_CPP_MOC = .moc
|
|
|
|
# On Windows, put the includes into a .inc file which moc will read, if the project
|
|
# has too many includes. We do this to overcome a command-line limit on Win < XP
|
|
INCLUDETEMP=
|
|
WIN_INCLUDETEMP=
|
|
win32:count(INCLUDEPATH, 40, >) {
|
|
INCLUDETEMP = $$MOC_DIR/mocinclude.tmp
|
|
|
|
WIN_INCLUDETEMP=$$INCLUDETEMP
|
|
|
|
EOC = $$escape_expand(\\n\\t)
|
|
|
|
contains(TEMPLATE, "vc.*") {
|
|
# the VCPROJ generator will replace the \r\h with the coded \r\n: 

|
|
EOC = $$escape_expand(\\r\\h)
|
|
}
|
|
|
|
unset(INCFILELIST)
|
|
RET =
|
|
for(incfile, INCLUDEPATH) {
|
|
INCFILELIST = -I$$incfile
|
|
isEmpty(RET): RET += @echo $$INCFILELIST> $$WIN_INCLUDETEMP $$EOC
|
|
else: RET += @echo $$INCFILELIST>> $$WIN_INCLUDETEMP $$EOC
|
|
}
|
|
!isEmpty(INCFILELIST):RET += @echo $$INCFILELIST>> $$WIN_INCLUDETEMP $$EOC
|
|
|
|
build_pass|isEmpty(BUILDS) {
|
|
mocinclude.target = $$INCLUDETEMP
|
|
mocinclude.commands = $$RET
|
|
QMAKE_EXTRA_TARGETS += mocinclude
|
|
}
|
|
}
|
|
|
|
defineReplace(mocCmdBase) {
|
|
RET =
|
|
!isEmpty(WIN_INCLUDETEMP) {
|
|
contains(TEMPLATE, "vc.*") {
|
|
RET += $$mocinclude.commands
|
|
}
|
|
incvar = @$$WIN_INCLUDETEMP
|
|
} else {
|
|
incvar = $(INCPATH)
|
|
}
|
|
RET += $$QMAKE_MOC $(DEFINES) $$join(QMAKE_COMPILER_DEFINES, " -D", -D) $$incvar $$join(QMAKE_DEFAULT_INCDIRS, " -I", -I) $$QMAKE_MOC_OPTIONS
|
|
return($$RET)
|
|
}
|
|
|
|
#moc headers
|
|
moc_header.CONFIG = moc_verify
|
|
moc_header.dependency_type = TYPE_C
|
|
moc_header.commands = ${QMAKE_FUNC_mocCmdBase} ${QMAKE_FILE_IN} -o ${QMAKE_FILE_OUT}
|
|
moc_header.output = $$MOC_DIR/$${QMAKE_H_MOD_MOC}${QMAKE_FILE_BASE}$${first(QMAKE_EXT_CPP)}
|
|
moc_header.input = HEADERS
|
|
moc_header.variable_out = SOURCES
|
|
moc_header.name = MOC ${QMAKE_FILE_IN}
|
|
!contains(TEMPLATE, "vc.*") {
|
|
!isEmpty(INCLUDETEMP):moc_header.depends += $$INCLUDETEMP
|
|
}
|
|
silent:moc_header.commands = @echo moc ${QMAKE_FILE_IN} && $$moc_header.commands
|
|
QMAKE_EXTRA_COMPILERS += moc_header
|
|
INCREDIBUILD_XGE += moc_header
|
|
|
|
#moc sources
|
|
moc_source.CONFIG = no_link moc_verify
|
|
moc_source.dependency_type = TYPE_C
|
|
moc_source.commands = ${QMAKE_FUNC_mocCmdBase} ${QMAKE_FILE_IN} -o ${QMAKE_FILE_OUT}
|
|
moc_source.output = $$MOC_DIR/$${QMAKE_CPP_MOD_MOC}${QMAKE_FILE_BASE}$${QMAKE_EXT_CPP_MOC}
|
|
moc_source.input = SOURCES OBJECTIVE_SOURCES
|
|
moc_source.name = MOC ${QMAKE_FILE_IN}
|
|
!contains(TEMPLATE, "vc.*") {
|
|
!isEmpty(INCLUDETEMP):moc_source.depends += $$INCLUDETEMP
|
|
}
|
|
silent:moc_source.commands = @echo moc ${QMAKE_FILE_IN} && $$moc_source.commands
|
|
QMAKE_EXTRA_COMPILERS += moc_source
|
|
INCREDIBUILD_XGE += moc_source
|
|
|
|
#make sure we can include these files
|
|
INCLUDEPATH += $$absolute_path($$MOC_DIR, $$OUT_PWD)
|
|
|
|
#auto depend on moc
|
|
unix:!no_mocdepend {
|
|
moc_source.depends += $$first(QMAKE_MOC)
|
|
moc_header.depends += $$first(QMAKE_MOC)
|
|
}
|
|
|
|
#generate a mocclean
|
|
build_pass|isEmpty(BUILDS):mocclean.depends = compiler_moc_header_clean compiler_moc_source_clean
|
|
else:mocclean.CONFIG += recursive
|
|
QMAKE_EXTRA_TARGETS += mocclean
|
|
|
|
#generate a mocables
|
|
build_pass|isEmpty(BUILDS):mocables.depends = compiler_moc_header_make_all compiler_moc_source_make_all
|
|
else:mocables.CONFIG += recursive
|
|
QMAKE_EXTRA_TARGETS += mocables
|