summaryrefslogtreecommitdiffstats
path: root/mkspecs
diff options
context:
space:
mode:
authorJake Petroules <jake.petroules@qt.io>2016-09-20 20:18:45 -0700
committerJake Petroules <jake.petroules@qt.io>2016-09-29 21:51:18 +0000
commit28f5d7931656d210364a0aba0b87f1b412e10165 (patch)
tree78b861af9aa3b4206e186de6d09d97a630750600 /mkspecs
parente66d181e659a08d19ab7d144c3ba0619d537de83 (diff)
Share the multi-arch infrastructure between UIKit and macOS
There's no reason for this to be separated, regardless of the support status of i386 macOS builds. Additional architectures may appear in the future (and currently there's actually 3 - i386, x86_64, and x86_64h for Haswell CPUs). So this feature could be used to get combined generic x86_64 and Haswell builds. Some system libraries appear to have an x86_64h slice in Sierra. [ChangeLog][Build System] Support for universal binaries on macOS has been re-introduced. Change-Id: I1c89904addf024431fdb3ad03ea8ab85da7240ad Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com> Reviewed-by: Jake Petroules <jake.petroules@qt.io>
Diffstat (limited to 'mkspecs')
-rw-r--r--mkspecs/common/macx.conf6
-rw-r--r--mkspecs/features/mac/default_post.prf59
-rw-r--r--mkspecs/features/mac/sdk.prf73
-rw-r--r--mkspecs/features/moc.prf2
-rw-r--r--mkspecs/features/qt_configure.prf6
-rw-r--r--mkspecs/features/uikit/default_post.prf35
-rw-r--r--mkspecs/features/uikit/qt_config.prf19
-rw-r--r--mkspecs/features/uikit/sdk.prf2
-rw-r--r--mkspecs/macx-clang/qmake.conf2
-rw-r--r--mkspecs/macx-g++/qmake.conf2
10 files changed, 109 insertions, 97 deletions
diff --git a/mkspecs/common/macx.conf b/mkspecs/common/macx.conf
index 69d731b48a..4be0eb3c39 100644
--- a/mkspecs/common/macx.conf
+++ b/mkspecs/common/macx.conf
@@ -5,4 +5,10 @@
QMAKE_PLATFORM += macos osx macx
QMAKE_MAC_SDK = macosx
+device.sdk = macosx
+device.target = device
+device.dir_affix = $${device.sdk}
+device.CONFIG = $${device.sdk}
+device.deployment_identifier = $${device.sdk}
+
include(mac.conf)
diff --git a/mkspecs/features/mac/default_post.prf b/mkspecs/features/mac/default_post.prf
index 7e6a845024..c799487354 100644
--- a/mkspecs/features/mac/default_post.prf
+++ b/mkspecs/features/mac/default_post.prf
@@ -1,4 +1,9 @@
load(default_post)
+
+# Ensure that we process sdk.prf first, as it will update QMAKE_CXX
+# and friends that other features/extra compilers may depend on.
+sdk: load(sdk)
+
!no_objective_c:CONFIG += objective_c
qt {
@@ -33,18 +38,54 @@ qt {
!bitcode: QMAKE_LFLAGS += $$QMAKE_LFLAGS_HEADERPAD
-macx-xcode:!isEmpty(QMAKE_XCODE_DEBUG_INFORMATION_FORMAT) {
- debug_information_format.name = DEBUG_INFORMATION_FORMAT
- debug_information_format.value = $$QMAKE_XCODE_DEBUG_INFORMATION_FORMAT
- debug_information_format.build = debug
- QMAKE_MAC_XCODE_SETTINGS += debug_information_format
+macx-xcode {
+ !isEmpty(QMAKE_XCODE_DEBUG_INFORMATION_FORMAT) {
+ debug_information_format.name = DEBUG_INFORMATION_FORMAT
+ debug_information_format.value = $$QMAKE_XCODE_DEBUG_INFORMATION_FORMAT
+ debug_information_format.build = debug
+ QMAKE_MAC_XCODE_SETTINGS += debug_information_format
+ }
+
+ QMAKE_XCODE_ARCHS =
+
+ arch_device.name = "ARCHS[sdk=$${device.sdk}*]"
+ arch_device.value = $$QMAKE_APPLE_DEVICE_ARCHS
+ QMAKE_XCODE_ARCHS += $$QMAKE_APPLE_DEVICE_ARCHS
+ QMAKE_MAC_XCODE_SETTINGS += arch_device
+
+ simulator {
+ arch_simulator.name = "ARCHS[sdk=$${simulator.sdk}*]"
+ arch_simulator.value = $$QMAKE_APPLE_SIMULATOR_ARCHS
+ QMAKE_XCODE_ARCHS += $$QMAKE_APPLE_SIMULATOR_ARCHS
+ QMAKE_MAC_XCODE_SETTINGS += arch_simulator
+ }
+
+ only_active_arch.name = ONLY_ACTIVE_ARCH
+ only_active_arch.value = YES
+ only_active_arch.build = debug
+ QMAKE_MAC_XCODE_SETTINGS += only_active_arch
+} else {
+ VALID_ARCHS =
+ !simulator|simulator_and_device: VALID_ARCHS += $$QMAKE_APPLE_DEVICE_ARCHS
+ simulator: VALID_ARCHS += $$QMAKE_APPLE_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))
+
+ QMAKE_EXTRA_VARIABLES += VALID_ARCHS ACTIVE_ARCHS ARCH_ARGS
+
+ arch_flags = $(EXPORT_ARCH_ARGS)
+
+ QMAKE_CFLAGS += $$arch_flags
+ QMAKE_CXXFLAGS += $$arch_flags
+ QMAKE_LFLAGS += $$arch_flags
+
+ QMAKE_PCH_ARCHS = $$VALID_ARCHS
}
cache(QMAKE_XCODE_DEVELOPER_PATH, stash)
cache(QMAKE_XCODE_VERSION, stash)
QMAKE_XCODE_LIBRARY_SUFFIX = $$qtPlatformTargetSuffix()
-
-# Ensure that we process sdk.prf first, as it will update QMAKE_CXX
-# and friends that other features/extra compilers may depend on.
-sdk: load(sdk)
diff --git a/mkspecs/features/mac/sdk.prf b/mkspecs/features/mac/sdk.prf
index 0d43fbe5a1..087212f45b 100644
--- a/mkspecs/features/mac/sdk.prf
+++ b/mkspecs/features/mac/sdk.prf
@@ -49,25 +49,33 @@ for(tool, $$list(QMAKE_CC QMAKE_CXX QMAKE_FIX_RPATH QMAKE_AR QMAKE_RANLIB QMAKE_
}
!equals(MAKEFILE_GENERATOR, XCODE) {
- uikit:!host_buildĀ {
- ios: deployment_target = $$QMAKE_IOS_DEPLOYMENT_TARGET
- tvos: deployment_target = $$QMAKE_TVOS_DEPLOYMENT_TARGET
- watchos: deployment_target = $$QMAKE_WATCHOS_DEPLOYMENT_TARGET
-
- !simulator|simulator_and_device: device_archs = $$QMAKE_APPLE_DEVICE_ARCHS
- simulator: simulator_archs = $$QMAKE_APPLE_SIMULATOR_ARCHS
- archs = $$device_archs $$simulator_archs
+ macos: deployment_target = $$QMAKE_MACOSX_DEPLOYMENT_TARGET
+ ios: deployment_target = $$QMAKE_IOS_DEPLOYMENT_TARGET
+ tvos: deployment_target = $$QMAKE_TVOS_DEPLOYMENT_TARGET
+ watchos: deployment_target = $$QMAKE_WATCHOS_DEPLOYMENT_TARGET
+
+ !simulator|simulator_and_device: device_archs = $$QMAKE_APPLE_DEVICE_ARCHS
+ simulator: simulator_archs = $$QMAKE_APPLE_SIMULATOR_ARCHS
+ archs = $$device_archs $$simulator_archs
+
+ single_arch {
+ device_archs = $$first(device_archs)
+ simulator_archs = $$first(simulator_archs)
+ archs = $$first(archs)
+ }
+ # If we're doing a simulator_and_device build, device and simulator architectures
+ # use different paths and flags for the sysroot and deployment target switch, so we
+ # must multiplex them across multiple architectures using -Xarch. Otherwise we fall
+ # back to the simple path. This is not strictly necessary but results in cleaner
+ # command lines and makes it easier for people to override EXPORT_VALID_ARCHS to
+ # limit individual rules to a different set of architecture(s) from the overall
+ # build (such as machtest in QtCore).
+ simulator_and_device {
QMAKE_XARCH_CFLAGS =
QMAKE_XARCH_LFLAGS =
QMAKE_EXTRA_VARIABLES += QMAKE_XARCH_CFLAGS QMAKE_XARCH_LFLAGS
- single_arch {
- device_archs = $$first(device_archs)
- simulator_archs = $$first(simulator_archs)
- archs = $$first(archs)
- }
-
for(arch, archs) {
contains(simulator_archs, $$arch) {
sdk = $$simulator.sdk
@@ -95,27 +103,30 @@ for(tool, $$list(QMAKE_CC QMAKE_CXX QMAKE_FIX_RPATH QMAKE_AR QMAKE_RANLIB QMAKE_
QMAKE_XARCH_LFLAGS_$${arch}
}
- QMAKE_CFLAGS_USE_PRECOMPILE =
- for(arch, archs) {
- QMAKE_CFLAGS_USE_PRECOMPILE += \
- -Xarch_$${arch} \
- -include${QMAKE_PCH_OUTPUT_$${arch}}
- }
- QMAKE_CXXFLAGS_USE_PRECOMPILE = $$QMAKE_CFLAGS_USE_PRECOMPILE
- QMAKE_OBJCFLAGS_USE_PRECOMPILE = $$QMAKE_CFLAGS_USE_PRECOMPILE
- QMAKE_OBJCXXFLAGS_USE_PRECOMPILE = $$QMAKE_CFLAGS_USE_PRECOMPILE
-
- QMAKE_PCH_OUTPUT_EXT = _${QMAKE_PCH_ARCH}$${QMAKE_PCH_OUTPUT_EXT}
- } else: osx {
- version_identifier = macosx
- deployment_target = $$QMAKE_MACOSX_DEPLOYMENT_TARGET
+ QMAKE_CFLAGS += $(EXPORT_QMAKE_XARCH_CFLAGS)
+ QMAKE_CXXFLAGS += $(EXPORT_QMAKE_XARCH_CFLAGS)
+ QMAKE_LFLAGS += $(EXPORT_QMAKE_XARCH_LFLAGS)
+ } else {
+ simulator: \
+ version_identifier = $$simulator.deployment_identifier
+ else: \
+ version_identifier = $$device.deployment_identifier
version_min_flag = -m$${version_identifier}-version-min=$$deployment_target
QMAKE_CFLAGS += -isysroot $$QMAKE_MAC_SDK_PATH $$version_min_flag
QMAKE_CXXFLAGS += -isysroot $$QMAKE_MAC_SDK_PATH $$version_min_flag
QMAKE_LFLAGS += -Wl,-syslibroot,$$QMAKE_MAC_SDK_PATH $$version_min_flag
}
- QMAKE_CFLAGS += $(EXPORT_QMAKE_XARCH_CFLAGS)
- QMAKE_CXXFLAGS += $(EXPORT_QMAKE_XARCH_CFLAGS)
- QMAKE_LFLAGS += $(EXPORT_QMAKE_XARCH_LFLAGS)
+ # Enable precompiled headers for multiple architectures
+ QMAKE_CFLAGS_USE_PRECOMPILE =
+ for(arch, archs) {
+ QMAKE_CFLAGS_USE_PRECOMPILE += \
+ -Xarch_$${arch} \
+ -include${QMAKE_PCH_OUTPUT_$${arch}}
+ }
+ QMAKE_CXXFLAGS_USE_PRECOMPILE = $$QMAKE_CFLAGS_USE_PRECOMPILE
+ QMAKE_OBJCFLAGS_USE_PRECOMPILE = $$QMAKE_CFLAGS_USE_PRECOMPILE
+ QMAKE_OBJCXXFLAGS_USE_PRECOMPILE = $$QMAKE_CFLAGS_USE_PRECOMPILE
+
+ QMAKE_PCH_OUTPUT_EXT = _${QMAKE_PCH_ARCH}$${QMAKE_PCH_OUTPUT_EXT}
}
diff --git a/mkspecs/features/moc.prf b/mkspecs/features/moc.prf
index 4c81ee5c74..c9ea4e9de5 100644
--- a/mkspecs/features/moc.prf
+++ b/mkspecs/features/moc.prf
@@ -27,7 +27,7 @@ win32:count(MOC_INCLUDEPATH, 40, >) {
# QNX's compiler sets "gcc" config, but does not support the -dM option;
# UIKit builds are always multi-arch due to simulator_and_device (unless
# -sdk is used) so this feature cannot possibly work.
-if(gcc|intel_icl|msvc):!rim_qcc:!uikit {
+if(gcc|intel_icl|msvc):!rim_qcc:!uikit:if(!macos|count(QMAKE_APPLE_DEVICE_ARCHS, 1)) {
moc_predefs.CONFIG = no_link
gcc: moc_predefs.commands = $$QMAKE_CXX $$QMAKE_CXXFLAGS -dM -E -o ${QMAKE_FILE_OUT} ${QMAKE_FILE_IN}
else:intel_icl: moc_predefs.commands = $$QMAKE_CXX $$QMAKE_CXXFLAGS -QdM -P -Fi${QMAKE_FILE_OUT} ${QMAKE_FILE_IN}
diff --git a/mkspecs/features/qt_configure.prf b/mkspecs/features/qt_configure.prf
index e34d7ad194..b0b1eb2968 100644
--- a/mkspecs/features/qt_configure.prf
+++ b/mkspecs/features/qt_configure.prf
@@ -703,7 +703,7 @@ defineTest(qtConfTest_compile) {
qmake_args += -qtconf $$system_quote($$QMAKE_QTCONF)
# Disable qmake features which are typically counterproductive for tests
- qmake_args += "\"CONFIG -= qt debug_and_release app_bundle lib_bundle\""
+ qmake_args += "\"CONFIG -= qt debug_and_release simulator app_bundle lib_bundle\""
# allow tests to behave differently depending on the type of library
# being built (shared/static). e.g. see config.tests/unix/icu
@@ -719,6 +719,10 @@ defineTest(qtConfTest_compile) {
# can work with a regular main() entry point on Windows.
qmake_configs += "console"
+ # for platforms with multiple architectures (macOS, iOS, tvOS, watchOS),
+ # make sure tests are only built for a single architecture
+ qmake_configs += "single_arch"
+
qmake_args += "\"CONFIG += $$qmake_configs\""
!$$host {
diff --git a/mkspecs/features/uikit/default_post.prf b/mkspecs/features/uikit/default_post.prf
index 9a231ffc84..cfd5388d33 100644
--- a/mkspecs/features/uikit/default_post.prf
+++ b/mkspecs/features/uikit/default_post.prf
@@ -67,38 +67,3 @@ macx-xcode {
}
}
}
-
-macx-xcode {
- arch_device.name = "ARCHS[sdk=$${device.sdk}*]"
- arch_simulator.name = "ARCHS[sdk=$${simulator.sdk}*]"
-
- arch_device.value = $$QMAKE_APPLE_DEVICE_ARCHS
- arch_simulator.value = $$QMAKE_APPLE_SIMULATOR_ARCHS
- QMAKE_XCODE_ARCHS = $$QMAKE_APPLE_DEVICE_ARCHS $$QMAKE_APPLE_SIMULATOR_ARCHS
-
- QMAKE_MAC_XCODE_SETTINGS += arch_device arch_simulator
-
- only_active_arch.name = ONLY_ACTIVE_ARCH
- only_active_arch.value = YES
- only_active_arch.build = debug
- QMAKE_MAC_XCODE_SETTINGS += only_active_arch
-} else {
- VALID_ARCHS =
- !simulator|simulator_and_device: VALID_ARCHS += $$QMAKE_APPLE_DEVICE_ARCHS
- simulator: VALID_ARCHS += $$QMAKE_APPLE_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))
-
- QMAKE_EXTRA_VARIABLES += VALID_ARCHS ACTIVE_ARCHS ARCH_ARGS
-
- arch_flags = $(EXPORT_ARCH_ARGS)
-
- QMAKE_CFLAGS += $$arch_flags
- QMAKE_CXXFLAGS += $$arch_flags
- QMAKE_LFLAGS += $$arch_flags
-
- QMAKE_PCH_ARCHS = $$VALID_ARCHS
-}
diff --git a/mkspecs/features/uikit/qt_config.prf b/mkspecs/features/uikit/qt_config.prf
deleted file mode 100644
index 5fa5a536f8..0000000000
--- a/mkspecs/features/uikit/qt_config.prf
+++ /dev/null
@@ -1,19 +0,0 @@
-load(qt_config)
-
-isEmpty(QT_ARCH) {
- # The configure tests are run without QT_ARCH being resolved yet, which
- # means we fail to pass -arch to the compiler, resulting in broke tests.
- # As the Xcode toolchain doesn't seem to have a way to auto-detect the
- # arch based on the SDK, we have to hard-code the arch for configure.
- contains(QMAKE_MAC_SDK, $${device.sdk}.*) {
- QT_ARCH = arm
- } else { # Simulator
- ios: QT_ARCH = i386
- tvos: QT_ARCH = x64
- watchos: 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/features/uikit/sdk.prf b/mkspecs/features/uikit/sdk.prf
index 54674eb396..0ab553f587 100644
--- a/mkspecs/features/uikit/sdk.prf
+++ b/mkspecs/features/uikit/sdk.prf
@@ -7,7 +7,7 @@ contains(QMAKE_MAC_SDK, ^$${simulator.sdk}.*) {
CONFIG += simulator $${simulator.sdk}
}
-build_pass:simulator: \
+build_pass:!simulator_and_device:simulator: \
QMAKE_MAC_SDK ~= s,^$${device.sdk},$${simulator.sdk},
load(sdk)
diff --git a/mkspecs/macx-clang/qmake.conf b/mkspecs/macx-clang/qmake.conf
index b78f249f65..ebae6e36ca 100644
--- a/mkspecs/macx-clang/qmake.conf
+++ b/mkspecs/macx-clang/qmake.conf
@@ -4,6 +4,8 @@
QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.9
+QMAKE_APPLE_DEVICE_ARCHS = x86_64
+
include(../common/macx.conf)
include(../common/gcc-base-mac.conf)
include(../common/clang.conf)
diff --git a/mkspecs/macx-g++/qmake.conf b/mkspecs/macx-g++/qmake.conf
index 880cc7d930..7cabdaab12 100644
--- a/mkspecs/macx-g++/qmake.conf
+++ b/mkspecs/macx-g++/qmake.conf
@@ -12,6 +12,8 @@ QMAKE_INCREMENTAL_STYLE = sublib
QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.9
+QMAKE_APPLE_DEVICE_ARCHS = x86_64
+
include(../common/macx.conf)
include(../common/gcc-base-mac.conf)
include(../common/g++-macx.conf)