iOS: Enable fat builds containing both armv7 and arm64 slices

Apple will from February 1, 2015, require all applications uploaded to
the App Store to be built for both 32-bit (armv7/s) and 64-bit (arm64).

https://developer.apple.com/news/?id=10202014a

We enable fat Qt binaries by passing both -arch armv7 and -arch arm64
to clang, which takes care of lipoing together the two slices for each
object file. This unfortunately means twice the build time and twice
the binary size for our libraries.

Since precompiled headers are architecture specific, and the -Xarch
option can't be used with -include-pch, we need to disable precompiled
headers globally. This can be improved in the future by switching to
pretokenized headers (http://clang.llvm.org/docs/PTHInternals.html).

Since we're enabling 64-bit ARM builds, we're also switching the
simulator builds from i386 to fat i386 and x86_64 builds, so that
we are able to test 64-bit builds using the simulator, but we're
keeping i386 as the architecture Qt is aware of when it's building
for simulator, as we need the CPU features to match the lowest
common denominator.

Change-Id: I277e60bddae549d24ca3c6301d842405180aded6
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
This commit is contained in:
Tor Arne Vestbø 2014-10-28 13:27:25 +01:00 committed by Jani Heikkinen
parent 88b2f5e868
commit 70ea4e2b29
4 changed files with 9 additions and 2 deletions

1
configure vendored
View File

@ -3152,6 +3152,7 @@ if [ "$XPLATFORM_IOS" = "yes" ]; then
CFG_NOBUILD_PARTS="$CFG_NOBUILD_PARTS examples"
CFG_SHARED="no" # iOS builds should be static to be able to submit to the App Store
CFG_SKIP_MODULES="$CFG_SKIP_MODULES qtconnectivity qtdoc qtmacextras qtserialport qtwebkit qtwebkit-examples"
CFG_PRECOMPILE="no" # Precompiled headers not supported with multiple -arch arguments
# If the user passes -sdk on the command line we build a SDK-specific Qt build.
# Otherwise we build a joined simulator and device build, which is the default.

View File

@ -209,6 +209,8 @@ macx-xcode {
else: \
VALID_ARCHS = $$QMAKE_IOS_SIMULATOR_ARCHS
single_arch: VALID_ARCHS = $$first(VALID_ARCHS)
ACTIVE_ARCHS = $(filter $(EXPORT_VALID_ARCHS), $(ARCHS))
ARCH_ARGS = $(foreach arch, $(if $(EXPORT_ACTIVE_ARCHS), $(EXPORT_ACTIVE_ARCHS), $(EXPORT_VALID_ARCHS)), -arch $(arch))

View File

@ -9,4 +9,8 @@ isEmpty(QT_ARCH) {
QT_ARCH = arm
else: \ # Simulator
QT_ARCH = i386
# Prevent the arch/config tests from building as multi-arch binaries,
# as we only want the lowest common denominator features.
CONFIG += single_arch
}

View File

@ -15,8 +15,8 @@ DEFINES += DARWIN_NO_CARBON QT_NO_PRINTER QT_NO_PRINTDIALOG
# Universal target (iPhone and iPad)
QMAKE_IOS_TARGETED_DEVICE_FAMILY = 1,2
QMAKE_IOS_DEVICE_ARCHS = armv7
QMAKE_IOS_SIMULATOR_ARCHS = i386
QMAKE_IOS_DEVICE_ARCHS = armv7 arm64
QMAKE_IOS_SIMULATOR_ARCHS = i386 x86_64
include(../common/ios.conf)
include(../common/gcc-base-mac.conf)