Generalize iOS simulator and device exclusive build
Preparation for Apple tvOS support, which shares a lot with the iOS platform. Change-Id: I543d936b9973a60139889da2a3d4948914e9c2b2 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
This commit is contained in:
parent
7f48655fb8
commit
9daeb6fe9d
2
configure
vendored
2
configure
vendored
@ -3426,7 +3426,7 @@ if [ "$XPLATFORM_IOS" = "yes" ]; then
|
|||||||
# Otherwise we build a joined simulator and device build, which is the default.
|
# Otherwise we build a joined simulator and device build, which is the default.
|
||||||
if [ -z "$OPT_MAC_SDK" ]; then
|
if [ -z "$OPT_MAC_SDK" ]; then
|
||||||
QT_CONFIG="$QT_CONFIG build_all"
|
QT_CONFIG="$QT_CONFIG build_all"
|
||||||
QTCONFIG_CONFIG="$QTCONFIG_CONFIG iphonesimulator_and_iphoneos"
|
QTCONFIG_CONFIG="$QTCONFIG_CONFIG simulator_and_device"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -5,4 +5,16 @@
|
|||||||
QMAKE_PLATFORM += ios
|
QMAKE_PLATFORM += ios
|
||||||
QMAKE_MAC_SDK = iphoneos
|
QMAKE_MAC_SDK = iphoneos
|
||||||
|
|
||||||
|
simulator.sdk = iphonesimulator
|
||||||
|
simulator.target = $${simulator.sdk}
|
||||||
|
simulator.dir_affix = $${simulator.sdk}
|
||||||
|
simulator.CONFIG = $${simulator.sdk}
|
||||||
|
simulator.deployment_identifier = ios-simulator
|
||||||
|
|
||||||
|
device.sdk = iphoneos
|
||||||
|
device.target = $${device.sdk}
|
||||||
|
device.dir_affix = $${device.sdk}
|
||||||
|
device.CONFIG = $${device.sdk}
|
||||||
|
device.deployment_identifier = $${device.sdk}
|
||||||
|
|
||||||
include(mac.conf)
|
include(mac.conf)
|
||||||
|
@ -5,29 +5,24 @@ isEmpty(QMAKE_MAC_SDK): \
|
|||||||
contains(QMAKE_MAC_SDK, .*/.*): \
|
contains(QMAKE_MAC_SDK, .*/.*): \
|
||||||
error("QMAKE_MAC_SDK can only contain short-form SDK names (eg. macosx, iphoneos)")
|
error("QMAKE_MAC_SDK can only contain short-form SDK names (eg. macosx, iphoneos)")
|
||||||
|
|
||||||
isEmpty(QMAKE_MAC_SDK.$${QMAKE_MAC_SDK}.path) {
|
defineReplace(xcodeSDKInfo) {
|
||||||
QMAKE_MAC_SDK_PATH = $$system("/usr/bin/xcodebuild -sdk $$QMAKE_MAC_SDK -version Path 2>/dev/null")
|
info = $$1
|
||||||
isEmpty(QMAKE_MAC_SDK_PATH): error("Could not resolve SDK path for \'$$QMAKE_MAC_SDK\'")
|
sdk = $$2
|
||||||
cache(QMAKE_MAC_SDK.$${QMAKE_MAC_SDK}.path, set stash, QMAKE_MAC_SDK_PATH)
|
isEmpty(sdk): \
|
||||||
} else {
|
sdk = $$QMAKE_MAC_SDK
|
||||||
QMAKE_MAC_SDK_PATH = $$eval(QMAKE_MAC_SDK.$${QMAKE_MAC_SDK}.path)
|
|
||||||
|
isEmpty(QMAKE_MAC_SDK.$${sdk}.$${info}) {
|
||||||
|
QMAKE_MAC_SDK.$${sdk}.$${info} = $$system("/usr/bin/xcodebuild -sdk $$sdk -version $$info 2>/dev/null")
|
||||||
|
isEmpty(QMAKE_MAC_SDK.$${sdk}.$${info}): error("Could not resolve SDK $$info for \'$$sdk\'")
|
||||||
|
cache(QMAKE_MAC_SDK.$${sdk}.$${info}, set stash, QMAKE_MAC_SDK.$${sdk}.$${info})
|
||||||
|
}
|
||||||
|
|
||||||
|
return($$eval(QMAKE_MAC_SDK.$${QMAKE_MAC_SDK}.$${info}))
|
||||||
}
|
}
|
||||||
|
|
||||||
isEmpty(QMAKE_MAC_SDK.$${QMAKE_MAC_SDK}.platform_path) {
|
QMAKE_MAC_SDK_PATH = $$xcodeSDKInfo(Path)
|
||||||
QMAKE_MAC_SDK_PLATFORM_PATH = $$system("/usr/bin/xcodebuild -sdk $$QMAKE_MAC_SDK -version PlatformPath 2>/dev/null")
|
QMAKE_MAC_SDK_PLATFORM_PATH = $$xcodeSDKInfo(PlatformPath)
|
||||||
isEmpty(QMAKE_MAC_SDK_PLATFORM_PATH): error("Could not resolve SDK platform path for \'$$QMAKE_MAC_SDK\'")
|
QMAKE_MAC_SDK_VERSION = $$xcodeSDKInfo(SDKVersion)
|
||||||
cache(QMAKE_MAC_SDK.$${QMAKE_MAC_SDK}.platform_path, set stash, QMAKE_MAC_SDK_PLATFORM_PATH)
|
|
||||||
} else {
|
|
||||||
QMAKE_MAC_SDK_PLATFORM_PATH = $$eval(QMAKE_MAC_SDK.$${QMAKE_MAC_SDK}.platform_path)
|
|
||||||
}
|
|
||||||
|
|
||||||
isEmpty(QMAKE_MAC_SDK.$${QMAKE_MAC_SDK}.version) {
|
|
||||||
QMAKE_MAC_SDK_VERSION = $$system("/usr/bin/xcodebuild -sdk $$QMAKE_MAC_SDK -version SDKVersion 2>/dev/null")
|
|
||||||
isEmpty(QMAKE_MAC_SDK_VERSION): error("Could not resolve SDK version for \'$$QMAKE_MAC_SDK\'")
|
|
||||||
cache(QMAKE_MAC_SDK.$${QMAKE_MAC_SDK}.version, set stash, QMAKE_MAC_SDK_VERSION)
|
|
||||||
} else {
|
|
||||||
QMAKE_MAC_SDK_VERSION = $$eval(QMAKE_MAC_SDK.$${QMAKE_MAC_SDK}.version)
|
|
||||||
}
|
|
||||||
|
|
||||||
!equals(MAKEFILE_GENERATOR, XCODE) {
|
!equals(MAKEFILE_GENERATOR, XCODE) {
|
||||||
QMAKE_CFLAGS += -isysroot $$QMAKE_MAC_SDK_PATH
|
QMAKE_CFLAGS += -isysroot $$QMAKE_MAC_SDK_PATH
|
||||||
@ -59,22 +54,17 @@ for(tool, $$list(QMAKE_CC QMAKE_CXX QMAKE_FIX_RPATH QMAKE_AR QMAKE_RANLIB QMAKE_
|
|||||||
cache($$tool_variable, set stash, $$tool)
|
cache($$tool_variable, set stash, $$tool)
|
||||||
}
|
}
|
||||||
|
|
||||||
isEmpty(QMAKE_MAC_SDK.$${QMAKE_MAC_SDK}.platform_name) {
|
|
||||||
QMAKE_MAC_PLATFORM_NAME = $$system("/usr/libexec/PlistBuddy -c 'print DefaultProperties:PLATFORM_NAME' $$QMAKE_MAC_SDK_PATH/SDKSettings.plist 2>/dev/null")
|
|
||||||
isEmpty(QMAKE_MAC_PLATFORM_NAME): error("Could not resolve platform name for SDK '$$QMAKE_MAC_SDK'")
|
|
||||||
cache(QMAKE_MAC_SDK.$${QMAKE_MAC_SDK}.platform_name, set stash, QMAKE_MAC_PLATFORM_NAME)
|
|
||||||
} else {
|
|
||||||
QMAKE_MAC_PLATFORM_NAME = $$eval(QMAKE_MAC_SDK.$${QMAKE_MAC_SDK}.platform_name)
|
|
||||||
}
|
|
||||||
|
|
||||||
!equals(MAKEFILE_GENERATOR, XCODE) {
|
!equals(MAKEFILE_GENERATOR, XCODE) {
|
||||||
# FIXME: Get the version_min_flag out of the platform's 'Native Build System.xcspec'
|
ios:!host_build {
|
||||||
version_identifier = $$replace(QMAKE_MAC_PLATFORM_NAME, iphonesimulator, ios-simulator)
|
simulator: \
|
||||||
|
version_identifier = $$simulator.deployment_identifier
|
||||||
ios:!host_build: \
|
else: \
|
||||||
|
version_identifier = $$device.deployment_identifier
|
||||||
deployment_target = $$QMAKE_IOS_DEPLOYMENT_TARGET
|
deployment_target = $$QMAKE_IOS_DEPLOYMENT_TARGET
|
||||||
else: \
|
} else: osx {
|
||||||
|
version_identifier = macosx
|
||||||
deployment_target = $$QMAKE_MACOSX_DEPLOYMENT_TARGET
|
deployment_target = $$QMAKE_MACOSX_DEPLOYMENT_TARGET
|
||||||
|
}
|
||||||
|
|
||||||
version_min_flag = -m$${version_identifier}-version-min=$$deployment_target
|
version_min_flag = -m$${version_identifier}-version-min=$$deployment_target
|
||||||
QMAKE_CFLAGS += $$version_min_flag
|
QMAKE_CFLAGS += $$version_min_flag
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
|
|
||||||
defineReplace(qtPlatformTargetSuffix) {
|
defineReplace(qtPlatformTargetSuffix) {
|
||||||
ios:CONFIG(iphonesimulator, iphonesimulator|iphoneos): \
|
ios:CONFIG(simulator, simulator|device): \
|
||||||
suffix = _iphonesimulator
|
suffix = _$${simulator.sdk}
|
||||||
else: \
|
else: \
|
||||||
suffix =
|
suffix =
|
||||||
|
|
||||||
|
@ -63,12 +63,12 @@ macx-xcode {
|
|||||||
}
|
}
|
||||||
|
|
||||||
macx-xcode {
|
macx-xcode {
|
||||||
arch_iphoneos.name = "ARCHS[sdk=iphoneos*]"
|
arch_device.name = "ARCHS[sdk=$${device.sdk}*]"
|
||||||
arch_iphoneos.value = $$QMAKE_IOS_DEVICE_ARCHS
|
arch_device.value = $$QMAKE_IOS_DEVICE_ARCHS
|
||||||
arch_iphonesimulator.name = "ARCHS[sdk=iphonesimulator*]"
|
arch_simulator.name = "ARCHS[sdk=$${simulator.sdk}*]"
|
||||||
arch_iphonesimulator.value = $$QMAKE_IOS_SIMULATOR_ARCHS
|
arch_simulator.value = $$QMAKE_IOS_SIMULATOR_ARCHS
|
||||||
|
|
||||||
QMAKE_MAC_XCODE_SETTINGS += arch_iphoneos arch_iphonesimulator
|
QMAKE_MAC_XCODE_SETTINGS += arch_device arch_simulator
|
||||||
QMAKE_XCODE_ARCHS = $$QMAKE_IOS_DEVICE_ARCHS $$QMAKE_IOS_SIMULATOR_ARCHS
|
QMAKE_XCODE_ARCHS = $$QMAKE_IOS_DEVICE_ARCHS $$QMAKE_IOS_SIMULATOR_ARCHS
|
||||||
|
|
||||||
only_active_arch.name = ONLY_ACTIVE_ARCH
|
only_active_arch.name = ONLY_ACTIVE_ARCH
|
||||||
|
@ -2,15 +2,15 @@
|
|||||||
load(default_pre)
|
load(default_pre)
|
||||||
|
|
||||||
# In case Qt was built for a specific SDK
|
# In case Qt was built for a specific SDK
|
||||||
!iphonesimulator_and_iphoneos:contains(QMAKE_MAC_SDK, ^iphonesimulator.*): \
|
!simulator_and_device:contains(QMAKE_MAC_SDK, ^$${simulator.sdk}.*): \
|
||||||
CONFIG += iphonesimulator
|
CONFIG += simulator $${simulator.sdk}
|
||||||
|
|
||||||
# Check for supported Xcode versions
|
# Check for supported Xcode versions
|
||||||
lessThan(QMAKE_XCODE_VERSION, "4.3"): \
|
lessThan(QMAKE_XCODE_VERSION, "4.3"): \
|
||||||
error("This mkspec requires Xcode 4.3 or later")
|
error("This mkspec requires Xcode 4.3 or later")
|
||||||
|
|
||||||
iphonesimulator_and_iphoneos:iphonesimulator {
|
simulator_and_device:iphonesimulator {
|
||||||
# For a iphonesimulator_and_iphoneos build all the config tests
|
# For a simulator_and_device build all the config tests
|
||||||
# are based on the iPhoneOS ARM SDK, but we know that the simulator
|
# are based on the iPhoneOS ARM SDK, but we know that the simulator
|
||||||
# is i386 and that we support SSE/SSE2.
|
# is i386 and that we support SSE/SSE2.
|
||||||
QT_ARCH = i386
|
QT_ARCH = i386
|
||||||
|
@ -5,7 +5,7 @@ isEmpty(QT_ARCH) {
|
|||||||
# means we fail to pass -arch to the compiler, resulting in broke tests.
|
# 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
|
# 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.
|
# arch based on the SDK, we have to hard-code the arch for configure.
|
||||||
contains(QMAKE_MAC_SDK, iphoneos.*): \
|
contains(QMAKE_MAC_SDK, $${device.sdk}.*): \
|
||||||
QT_ARCH = arm
|
QT_ARCH = arm
|
||||||
else: \ # Simulator
|
else: \ # Simulator
|
||||||
QT_ARCH = i386
|
QT_ARCH = i386
|
||||||
|
@ -3,37 +3,35 @@ xcodebuild {
|
|||||||
# Xcode project files always support both Debug and Release configurations
|
# Xcode project files always support both Debug and Release configurations
|
||||||
# and iOS device and simulator targets, so we make sure the wrapper-makefile
|
# and iOS device and simulator targets, so we make sure the wrapper-makefile
|
||||||
# also does.
|
# also does.
|
||||||
CONFIG += debug_and_release iphonesimulator_and_iphoneos
|
CONFIG += debug_and_release simulator_and_device
|
||||||
}
|
}
|
||||||
|
|
||||||
load(resolve_config)
|
load(resolve_config)
|
||||||
|
|
||||||
CONFIG(iphonesimulator, iphonesimulator|iphoneos): \
|
CONFIG(simulator, simulator|device): \
|
||||||
CONFIG -= iphoneos
|
CONFIG -= device $${device.CONFIG}
|
||||||
else: \
|
else: \
|
||||||
CONFIG -= iphonesimulator
|
CONFIG -= simulator $${simulator.CONFIG}
|
||||||
|
|
||||||
macx-xcode {
|
macx-xcode {
|
||||||
# There is no way to genereate Xcode projects that are limited to either
|
# There is no way to genereate Xcode projects that are limited to either
|
||||||
# simulator or device builds, so iphonesimulator_and_iphoneos is always
|
# simulator or device builds, so simulator_and_device is always
|
||||||
# effectivly active, even if the user disabled it explicitly.
|
# effectivly active, even if the user disabled it explicitly.
|
||||||
# The Xcode generator doesn't support multiple BUILDS though (exclusive
|
# The Xcode generator doesn't support multiple BUILDS though (exclusive
|
||||||
# builds), so we have to manually set up the simulator suffix.
|
# builds), so we have to manually set up the simulator suffix.
|
||||||
library_suffix_iphonesimulator.name = "$${QMAKE_XCODE_LIBRARY_SUFFIX_SETTING}[sdk=iphonesimulator*]"
|
library_suffix_simulator.name = "$${QMAKE_XCODE_LIBRARY_SUFFIX_SETTING}[sdk=$${simulator.sdk}*]"
|
||||||
library_suffix_iphonesimulator.value = "_iphonesimulator$($${QMAKE_XCODE_LIBRARY_SUFFIX_SETTING})"
|
library_suffix_simulator.value = "_$${simulator.sdk}$($${QMAKE_XCODE_LIBRARY_SUFFIX_SETTING})"
|
||||||
QMAKE_MAC_XCODE_SETTINGS += library_suffix_iphonesimulator
|
QMAKE_MAC_XCODE_SETTINGS += library_suffix_simulator
|
||||||
CONFIG *= xcode_dynamic_library_suffix
|
CONFIG *= xcode_dynamic_library_suffix
|
||||||
} else {
|
} else {
|
||||||
iphonesimulator.name = Simulator
|
addExclusiveBuilds(simulator, device)
|
||||||
iphoneos.name = Device
|
|
||||||
addExclusiveBuilds(iphonesimulator, iphoneos)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
equals(TEMPLATE, subdirs) {
|
equals(TEMPLATE, subdirs) {
|
||||||
# Prevent recursion into host_builds
|
# Prevent recursion into host_builds
|
||||||
for(subdir, SUBDIRS) {
|
for(subdir, SUBDIRS) {
|
||||||
contains($${subdir}.CONFIG, host_build) {
|
contains($${subdir}.CONFIG, host_build) {
|
||||||
$${subdir}.CONFIG += no_iphoneos_target no_iphonesimulator_target
|
$${subdir}.CONFIG += no_$${simulator.target}_target no_$${device.target}_target
|
||||||
|
|
||||||
# Other targets which we do want to recurse into may depend on this target,
|
# Other targets which we do want to recurse into may depend on this target,
|
||||||
# for example corelib depends on moc, rcc, bootstrap, etc, and other libs
|
# for example corelib depends on moc, rcc, bootstrap, etc, and other libs
|
||||||
@ -56,9 +54,9 @@ equals(TEMPLATE, subdirs) {
|
|||||||
|
|
||||||
target ~= s,[^a-zA-Z0-9_],-,
|
target ~= s,[^a-zA-Z0-9_],-,
|
||||||
|
|
||||||
$${target}-iphonesimulator.depends = $$target
|
$${target}-$${simulator.target}.depends = $$target
|
||||||
$${target}-iphoneos.depends = $$target
|
$${target}-$${device.target}.depends = $$target
|
||||||
QMAKE_EXTRA_TARGETS += $${target}-iphonesimulator $${target}-iphoneos
|
QMAKE_EXTRA_TARGETS += $${target}-$${simulator.target} $${target}-$${device.target}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,13 +1,14 @@
|
|||||||
# In case the user sets the SDK manually
|
|
||||||
contains(QMAKE_MAC_SDK, ^iphonesimulator.*) {
|
|
||||||
iphonesimulator_and_iphoneos: \
|
|
||||||
error("iOS simulator is handled automatically for iphonesimulator_and_iphoneos")
|
|
||||||
|
|
||||||
CONFIG += iphonesimulator
|
# In case the user sets the SDK manually
|
||||||
|
contains(QMAKE_MAC_SDK, ^$${simulator.sdk}.*) {
|
||||||
|
simulator_and_device: \
|
||||||
|
error("iOS simulator is handled automatically for simulator_and_device")
|
||||||
|
|
||||||
|
CONFIG += simulator $${simulator.sdk}
|
||||||
}
|
}
|
||||||
|
|
||||||
iphonesimulator_and_iphoneos:iphonesimulator: \
|
simulator_and_device:simulator: \
|
||||||
QMAKE_MAC_SDK ~= s,^iphoneos,iphonesimulator,
|
QMAKE_MAC_SDK ~= s,^$${device.sdk},$${simulator.sdk},
|
||||||
|
|
||||||
load(sdk)
|
load(sdk)
|
||||||
|
|
||||||
@ -15,19 +16,17 @@ lessThan(QMAKE_MAC_SDK_VERSION, "8.0"): \
|
|||||||
error("Current $$QMAKE_MAC_SDK SDK version ($$QMAKE_MAC_SDK_VERSION) is too old. Please upgrade Xcode.")
|
error("Current $$QMAKE_MAC_SDK SDK version ($$QMAKE_MAC_SDK_VERSION) is too old. Please upgrade Xcode.")
|
||||||
|
|
||||||
macx-xcode {
|
macx-xcode {
|
||||||
sdk_path_iphoneos.name = "QMAKE_MAC_SDK_PATH[sdk=iphoneos*]"
|
sdk_path_device.name = "QMAKE_MAC_SDK_PATH[sdk=$${device.sdk}*]"
|
||||||
sdk_path_iphoneos.value = $$QMAKE_MAC_SDK_PATH
|
sdk_path_device.value = $$xcodeSDKInfo(Path, $${device.sdk})
|
||||||
QMAKE_MAC_SDK_PATH ~= s,iPhoneOS,iPhoneSimulator,
|
sdk_path_simulator.name = "QMAKE_MAC_SDK_PATH[sdk=$${simulator.sdk}*]"
|
||||||
sdk_path_iphonesimulator.name = "QMAKE_MAC_SDK_PATH[sdk=iphonesimulator*]"
|
sdk_path_simulator.value = $$xcodeSDKInfo(Path, $${simulator.sdk})
|
||||||
sdk_path_iphonesimulator.value = $$QMAKE_MAC_SDK_PATH
|
QMAKE_MAC_XCODE_SETTINGS += sdk_path_device sdk_path_simulator
|
||||||
QMAKE_MAC_XCODE_SETTINGS += sdk_path_iphoneos sdk_path_iphonesimulator
|
|
||||||
QMAKE_MAC_SDK_PATH = "$(QMAKE_MAC_SDK_PATH)"
|
QMAKE_MAC_SDK_PATH = "$(QMAKE_MAC_SDK_PATH)"
|
||||||
|
|
||||||
sdk_platform_path_iphoneos.name = "QMAKE_MAC_SDK_PLATFORM_PATH[sdk=iphoneos*]"
|
sdk_platform_path_device.name = "QMAKE_MAC_SDK_PLATFORM_PATH[sdk=$${device.sdk}*]"
|
||||||
sdk_platform_path_iphoneos.value = $$QMAKE_MAC_SDK_PLATFORM_PATH
|
sdk_platform_path_device.value = $$xcodeSDKInfo(PlatformPath, $${device.sdk})
|
||||||
QMAKE_MAC_SDK_PLATFORM_PATH ~= s,iPhoneOS,iPhoneSimulator,
|
sdk_platform_path_simulator.name = "QMAKE_MAC_SDK_PLATFORM_PATH[sdk=$${simulator.sdk}*]"
|
||||||
sdk_platform_path_iphonesimulator.name = "QMAKE_MAC_SDK_PLATFORM_PATH[sdk=iphonesimulator*]"
|
sdk_platform_path_simulator.value = $$xcodeSDKInfo(PlatformPath, $${simulator.sdk})
|
||||||
sdk_platform_path_iphonesimulator.value = $$QMAKE_MAC_SDK_PLATFORM_PATH
|
QMAKE_MAC_XCODE_SETTINGS += sdk_platform_path_device sdk_platform_path_simulator
|
||||||
QMAKE_MAC_XCODE_SETTINGS += sdk_platform_path_iphoneos sdk_platform_path_iphonesimulator
|
|
||||||
QMAKE_MAC_SDK_PLATFORM_PATH = "$(QMAKE_MAC_SDK_PLATFORM_PATH)"
|
QMAKE_MAC_SDK_PLATFORM_PATH = "$(QMAKE_MAC_SDK_PLATFORM_PATH)"
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user