From 70ea4e2b294eeac51fc497191990842f48d1aff4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Tue, 28 Oct 2014 13:27:25 +0100 Subject: 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 --- configure | 1 + mkspecs/macx-ios-clang/features/default_post.prf | 2 ++ mkspecs/macx-ios-clang/features/qt_config.prf | 4 ++++ mkspecs/macx-ios-clang/qmake.conf | 4 ++-- 4 files changed, 9 insertions(+), 2 deletions(-) diff --git a/configure b/configure index 1bd7db88b3..979e32e050 100755 --- a/configure +++ b/configure @@ -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. diff --git a/mkspecs/macx-ios-clang/features/default_post.prf b/mkspecs/macx-ios-clang/features/default_post.prf index 34fbac56d0..0245c948d9 100644 --- a/mkspecs/macx-ios-clang/features/default_post.prf +++ b/mkspecs/macx-ios-clang/features/default_post.prf @@ -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)) diff --git a/mkspecs/macx-ios-clang/features/qt_config.prf b/mkspecs/macx-ios-clang/features/qt_config.prf index d9a13f65eb..d1a1a36933 100644 --- a/mkspecs/macx-ios-clang/features/qt_config.prf +++ b/mkspecs/macx-ios-clang/features/qt_config.prf @@ -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 } diff --git a/mkspecs/macx-ios-clang/qmake.conf b/mkspecs/macx-ios-clang/qmake.conf index 7b2e7a17e7..0c083edf80 100644 --- a/mkspecs/macx-ios-clang/qmake.conf +++ b/mkspecs/macx-ios-clang/qmake.conf @@ -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) -- cgit v1.2.3