Make DEVICE_ARCHS and SIMULATOR_ARCHS variables platform independent

This reduces unnecessary OS conditions in qmake since these platforms
are mutually exclusive, and also opens up their potential for use on
macOS to transparently support multi-arch builds like UIKit platforms.

This is also more similar to what Xcode does, as the DEPLOYMENT_TARGET
variables are platform specific, while the ARCHS variable is not.

DEPLOYMENT_TARGET has a use case for being OS specific in qmake (host
tools vs targets), while ARCHS does not.

Change-Id: Icee838a39e84259c2089faff08cc11d5f849758d
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
This commit is contained in:
Jake Petroules 2016-08-30 10:26:57 -07:00
parent 2997a60e1e
commit 603628b1ea
5 changed files with 17 additions and 37 deletions

View File

@ -50,13 +50,12 @@ for(tool, $$list(QMAKE_CC QMAKE_CXX QMAKE_FIX_RPATH QMAKE_AR QMAKE_RANLIB QMAKE_
!equals(MAKEFILE_GENERATOR, XCODE) {
uikit:!host_build {
ios: os_var = IOS
tvos: os_var = TVOS
watchos: os_var = WATCHOS
ios: deployment_target = $$QMAKE_IOS_DEPLOYMENT_TARGET
tvos: deployment_target = $$QMAKE_TVOS_DEPLOYMENT_TARGET
watchos: deployment_target = $$QMAKE_WATCHOS_DEPLOYMENT_TARGET
deployment_target = $$eval(QMAKE_$${os_var}_DEPLOYMENT_TARGET)
!simulator|simulator_and_device: device_archs = $$eval(QMAKE_$${os_var}_DEVICE_ARCHS)
simulator: simulator_archs = $$eval(QMAKE_$${os_var}_SIMULATOR_ARCHS)
!simulator|simulator_and_device: device_archs = $$QMAKE_APPLE_DEVICE_ARCHS
simulator: simulator_archs = $$QMAKE_APPLE_SIMULATOR_ARCHS
archs = $$device_archs $$simulator_archs
QMAKE_XARCH_CFLAGS =

View File

@ -68,21 +68,10 @@ macx-xcode {
macx-xcode {
arch_device.name = "ARCHS[sdk=$${device.sdk}*]"
arch_simulator.name = "ARCHS[sdk=$${simulator.sdk}*]"
ios {
arch_device.value = $$QMAKE_IOS_DEVICE_ARCHS
arch_simulator.value = $$QMAKE_IOS_SIMULATOR_ARCHS
QMAKE_XCODE_ARCHS = $$QMAKE_IOS_DEVICE_ARCHS $$QMAKE_IOS_SIMULATOR_ARCHS
}
tvos {
arch_device.value = $$QMAKE_TVOS_DEVICE_ARCHS
arch_simulator.value = $$QMAKE_TVOS_SIMULATOR_ARCHS
QMAKE_XCODE_ARCHS = $$QMAKE_TVOS_DEVICE_ARCHS $$QMAKE_TVOS_SIMULATOR_ARCHS
}
watchos {
arch_device.value = $$QMAKE_WATCHOS_DEVICE_ARCHS
arch_simulator.value = $$QMAKE_WATCHOS_SIMULATOR_ARCHS
QMAKE_XCODE_ARCHS = $$QMAKE_WATCHOS_DEVICE_ARCHS $$QMAKE_WATCHOS_SIMULATOR_ARCHS
}
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
@ -92,16 +81,8 @@ macx-xcode {
QMAKE_MAC_XCODE_SETTINGS += only_active_arch
} else {
VALID_ARCHS =
!simulator|simulator_and_device {
ios: VALID_ARCHS += $$QMAKE_IOS_DEVICE_ARCHS
tvos: VALID_ARCHS += $$QMAKE_TVOS_DEVICE_ARCHS
watchos: VALID_ARCHS += $$QMAKE_WATCHOS_DEVICE_ARCHS
}
simulator {
ios: VALID_ARCHS += $$QMAKE_IOS_SIMULATOR_ARCHS
tvos: VALID_ARCHS += $$QMAKE_TVOS_SIMULATOR_ARCHS
watchos: VALID_ARCHS += $$QMAKE_WATCHOS_SIMULATOR_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)

View File

@ -7,8 +7,8 @@ QMAKE_IOS_DEPLOYMENT_TARGET = 7.0
# Universal target (iPhone and iPad)
QMAKE_IOS_TARGETED_DEVICE_FAMILY = 1,2
QMAKE_IOS_DEVICE_ARCHS = armv7 arm64
QMAKE_IOS_SIMULATOR_ARCHS = i386 x86_64
QMAKE_APPLE_DEVICE_ARCHS = armv7 arm64
QMAKE_APPLE_SIMULATOR_ARCHS = i386 x86_64
include(../common/ios.conf)
include(../common/gcc-base-mac.conf)

View File

@ -8,8 +8,8 @@ INCLUDEPATH += $$PWD/tvos
QMAKE_TVOS_TARGETED_DEVICE_FAMILY = 3
QMAKE_TVOS_DEVICE_ARCHS = arm64
QMAKE_TVOS_SIMULATOR_ARCHS = x86_64
QMAKE_APPLE_DEVICE_ARCHS = arm64
QMAKE_APPLE_SIMULATOR_ARCHS = x86_64
include(../common/tvos.conf)
include(../common/gcc-base-mac.conf)

View File

@ -8,8 +8,8 @@ INCLUDEPATH += $$PWD/watchos
QMAKE_WATCHOS_TARGETED_DEVICE_FAMILY = 4
QMAKE_WATCHOS_DEVICE_ARCHS = armv7k
QMAKE_WATCHOS_SIMULATOR_ARCHS = i386
QMAKE_APPLE_DEVICE_ARCHS = armv7k
QMAKE_APPLE_SIMULATOR_ARCHS = i386
include(../common/watchos.conf)
include(../common/gcc-base-mac.conf)