2011-04-27 10:05:43 +00:00
|
|
|
|
|
|
|
#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
|
|
|
|
|
2014-01-27 21:00:29 +00:00
|
|
|
MOC_INCLUDEPATH =
|
|
|
|
for (inc, INCLUDEPATH): \
|
|
|
|
MOC_INCLUDEPATH += $$absolute_path($$inc, $$_PRO_FILE_PWD_)
|
2014-02-02 01:26:33 +00:00
|
|
|
!no_include_pwd:!isEqual(OUT_PWD, $$_PRO_FILE_PWD_): \
|
|
|
|
MOC_INCLUDEPATH += .
|
2014-01-27 21:00:29 +00:00
|
|
|
MOC_INCLUDEPATH = $$QMAKESPEC $$_PRO_FILE_PWD_ $$MOC_INCLUDEPATH $$QMAKE_DEFAULT_INCDIRS
|
2014-01-27 20:30:45 +00:00
|
|
|
|
2011-04-27 10:05:43 +00:00
|
|
|
# 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
|
|
|
|
WIN_INCLUDETEMP=
|
2014-01-27 20:30:45 +00:00
|
|
|
win32:count(MOC_INCLUDEPATH, 40, >) {
|
2015-09-29 07:20:45 +00:00
|
|
|
WIN_INCLUDETEMP = $$MOC_DIR/mocinclude.opt
|
2011-04-27 10:05:43 +00:00
|
|
|
|
2014-01-27 20:30:45 +00:00
|
|
|
WIN_INCLUDETEMP_CONT =
|
|
|
|
for (inc, MOC_INCLUDEPATH): \
|
|
|
|
WIN_INCLUDETEMP_CONT += -I$$inc
|
2016-07-14 14:50:02 +00:00
|
|
|
write_file($$absolute_path($$WIN_INCLUDETEMP, $$OUT_PWD), WIN_INCLUDETEMP_CONT)|error()
|
2011-04-27 10:05:43 +00:00
|
|
|
}
|
|
|
|
|
2015-08-22 00:08:19 +00:00
|
|
|
# QNX's compiler sets "gcc" config, but does not support the -dM option;
|
Remove simulator_and_device handling for the Makefile generator
This patch moves towards a more sensible layout for UIKit platforms,
where both the device and simulator architectures for binaries are
combined into a single Mach-O file instead of separating out the
simulator architecutures into separate _simulator.a files.
This approach is both more common in the iOS ecosystem at large and
significantly simplifies the implementation details for Qt, especially
with the upcoming support for shared libraries on UIKit platforms.
This patch takes advantage of the -Xarch compiler option to pass the
appropriate -isysroot, -syslibroot, and -m*-version-min compiler and
linker flags to the clang frontend, operating in exactly the same way
as a normal multi-arch build for device or simulator did previously.
Exclusive builds are still enabled for the xcodebuild wrapper Makefile,
which builds all four configurations of a UIKit Xcode project as before,
as expected.
A particularly advantageous benefit of this change is that it flows very
well with existing Xcode workflows, namely that:
- Slicing out unused architectures is handled completely automatically
for static builds, as an executable linking to a library with more
architectures than it itself is linked as, the unused architectures
will be ignored silently, resulting in the same behavior for users
(and the App Store won't let you submit Intel architectures either).
- Removing architectures from a fat binary using lipo does NOT
invalidate the code signature of that file or its container if it is a
bundle. This allows shared library and framework builds of Qt to work
mostly automatically as well, since an Xcode shell script build phase
can remove unused architectures from the embedded frameworks when that
is implemented, and if Qt ever starts signing its SDK releases, it
won't interfere with that either (though binaries are just resigned).
Change-Id: I6c3578c78f75845a2fcc85f3a5b728ec997dbe90
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
2016-08-25 13:07:54 +00:00
|
|
|
# UIKit builds are always multi-arch due to simulator_and_device (unless
|
|
|
|
# -sdk is used) so this feature cannot possibly work.
|
2017-02-24 18:57:17 +00:00
|
|
|
if(gcc|intel_icl|msvc):!rim_qcc:!uikit:!no_moc_predefs:if(!macos|count(QMAKE_APPLE_DEVICE_ARCHS, 1)) {
|
2016-11-24 15:53:53 +00:00
|
|
|
moc_predefs.name = "Generate moc_predefs.h"
|
2015-08-22 00:08:19 +00:00
|
|
|
moc_predefs.CONFIG = no_link
|
|
|
|
gcc: moc_predefs.commands = $$QMAKE_CXX $$QMAKE_CXXFLAGS -dM -E -o ${QMAKE_FILE_OUT} ${QMAKE_FILE_IN}
|
2016-12-07 01:54:47 +00:00
|
|
|
else:intel_icl: moc_predefs.commands = $$QMAKE_CXX $$QMAKE_CXXFLAGS -QdM -P -Za -Fi${QMAKE_FILE_OUT} ${QMAKE_FILE_IN}
|
2015-08-22 00:08:19 +00:00
|
|
|
else:msvc {
|
2016-11-24 13:19:12 +00:00
|
|
|
moc_predefs.commands += $$QMAKE_CXX -Bx$$shell_quote($$shell_path($$QMAKE_QMAKE)) $$QMAKE_CXXFLAGS \
|
2016-12-07 01:54:47 +00:00
|
|
|
-E -Za ${QMAKE_FILE_IN} 2>NUL >${QMAKE_FILE_OUT}
|
2015-08-22 00:08:19 +00:00
|
|
|
} else: error("Oops, I messed up")
|
|
|
|
moc_predefs.output = $$MOC_DIR/moc_predefs.h
|
|
|
|
moc_predefs.input = MOC_PREDEF_FILE
|
|
|
|
silent: moc_predefs.commands = @echo generating $$moc_predefs.output$$escape_expand(\n\t)@$$moc_predefs.commands
|
|
|
|
QMAKE_EXTRA_COMPILERS += moc_predefs
|
|
|
|
MOC_PREDEF_FILE = $$[QT_HOST_DATA/src]/mkspecs/features/data/dummy.cpp
|
|
|
|
}
|
|
|
|
|
2011-04-27 10:05:43 +00:00
|
|
|
defineReplace(mocCmdBase) {
|
|
|
|
!isEmpty(WIN_INCLUDETEMP) {
|
2013-03-14 18:09:05 +00:00
|
|
|
incvar = @$$WIN_INCLUDETEMP
|
|
|
|
} else {
|
2014-01-27 20:44:00 +00:00
|
|
|
incvar =
|
|
|
|
for (inc, MOC_INCLUDEPATH): \
|
|
|
|
incvar += -I$$shell_quote($$inc)
|
2013-12-09 18:56:31 +00:00
|
|
|
incvar += $$QMAKE_FRAMEWORKPATH_FLAGS
|
2011-04-27 10:05:43 +00:00
|
|
|
}
|
2015-08-22 00:08:19 +00:00
|
|
|
|
|
|
|
RET = $$QMAKE_MOC $(DEFINES)
|
2016-04-14 00:25:37 +00:00
|
|
|
msvc: RET += --compiler-flavor=msvc
|
2015-08-22 00:08:19 +00:00
|
|
|
|
|
|
|
isEmpty(MOC_PREDEF_FILE): RET += $$join(QMAKE_COMPILER_DEFINES, " -D", -D)
|
2017-02-11 04:44:11 +00:00
|
|
|
else: RET += --include $$shell_quote($$moc_predefs.output)
|
2015-08-22 00:08:19 +00:00
|
|
|
|
|
|
|
RET += $$incvar $$QMAKE_MOC_OPTIONS
|
2013-03-14 18:09:05 +00:00
|
|
|
return($$RET)
|
2011-04-27 10:05:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#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}
|
2015-08-22 00:08:19 +00:00
|
|
|
moc_header.depends += $$WIN_INCLUDETEMP $$moc_predefs.output
|
2011-04-27 10:05:43 +00:00
|
|
|
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}
|
2016-10-21 19:16:10 +00:00
|
|
|
moc_source.input = SOURCES
|
2011-04-27 10:05:43 +00:00
|
|
|
moc_source.name = MOC ${QMAKE_FILE_IN}
|
2015-08-22 00:08:19 +00:00
|
|
|
moc_source.depends += $$WIN_INCLUDETEMP $$moc_predefs.output
|
2011-04-27 10:05:43 +00:00
|
|
|
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
|
2012-12-06 14:35:19 +00:00
|
|
|
INCLUDEPATH += $$absolute_path($$MOC_DIR, $$OUT_PWD)
|
2011-04-27 10:05:43 +00:00
|
|
|
|
|
|
|
#auto depend on moc
|
2016-04-05 16:19:47 +00:00
|
|
|
!no_mocdepend {
|
|
|
|
moc_source.depends += $$QMAKE_MOC_EXE
|
|
|
|
moc_header.depends += $$QMAKE_MOC_EXE
|
2011-04-27 10:05:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#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
|