summaryrefslogtreecommitdiffstats
path: root/mkspecs/features/uikit
diff options
context:
space:
mode:
Diffstat (limited to 'mkspecs/features/uikit')
-rw-r--r--mkspecs/features/uikit/bitcode.prf2
-rw-r--r--mkspecs/features/uikit/default_post.prf2
-rw-r--r--mkspecs/features/uikit/default_pre.prf4
-rwxr-xr-xmkspecs/features/uikit/device_destinations.sh6
-rwxr-xr-xmkspecs/features/uikit/devices.py (renamed from mkspecs/features/uikit/devices.pl)58
-rw-r--r--mkspecs/features/uikit/watchos_coretext.prf15
-rw-r--r--mkspecs/features/uikit/xcodebuild.mk4
-rw-r--r--mkspecs/features/uikit/xcodebuild.prf6
8 files changed, 70 insertions, 27 deletions
diff --git a/mkspecs/features/uikit/bitcode.prf b/mkspecs/features/uikit/bitcode.prf
index df298171c0..f1fd33981a 100644
--- a/mkspecs/features/uikit/bitcode.prf
+++ b/mkspecs/features/uikit/bitcode.prf
@@ -1,4 +1,4 @@
-lessThan(QMAKE_XCODE_VERSION, "7.0") {
+!versionAtLeast(QMAKE_XCODE_VERSION, 7.0) {
warning("You need to update Xcode to version 7 or newer to support bitcode")
} else: !macx-xcode {
# Simulator builds and all debug builds SHOULD use -fembed-bitcode-marker,
diff --git a/mkspecs/features/uikit/default_post.prf b/mkspecs/features/uikit/default_post.prf
index f7245e48b1..c1b6f38a6c 100644
--- a/mkspecs/features/uikit/default_post.prf
+++ b/mkspecs/features/uikit/default_post.prf
@@ -39,7 +39,7 @@ macx-xcode {
qmake_launch_images.files = $$qmake_copy_image.output
QMAKE_BUNDLE_DATA += qmake_launch_images
- lessThan(QMAKE_XCODE_VERSION, "6.0") {
+ !versionAtLeast(QMAKE_XCODE_VERSION, 6.0) {
warning("You need to update Xcode to version 6 or newer to fully support iPhone6/6+")
} else {
# Set up default LaunchScreen to support iPhone6/6+
diff --git a/mkspecs/features/uikit/default_pre.prf b/mkspecs/features/uikit/default_pre.prf
index 00e29a5c8b..6a44a67bca 100644
--- a/mkspecs/features/uikit/default_pre.prf
+++ b/mkspecs/features/uikit/default_pre.prf
@@ -21,8 +21,8 @@ unset(sim_and_dev)
load(default_pre)
# Check for supported Xcode versions
-lessThan(QMAKE_XCODE_VERSION, "4.3"): \
+!versionAtLeast(QMAKE_XCODE_VERSION, 4.3): \
error("This mkspec requires Xcode 4.3 or later")
-ios:shared:lessThan(QMAKE_IOS_DEPLOYMENT_TARGET, "8.0"): \
+ios:shared:!versionAtLeast(QMAKE_IOS_DEPLOYMENT_TARGET, 8.0): \
QMAKE_IOS_DEPLOYMENT_TARGET = 8.0
diff --git a/mkspecs/features/uikit/device_destinations.sh b/mkspecs/features/uikit/device_destinations.sh
index 162ad01aaf..649dd399a7 100755
--- a/mkspecs/features/uikit/device_destinations.sh
+++ b/mkspecs/features/uikit/device_destinations.sh
@@ -40,10 +40,12 @@
#############################################################################
DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
-booted_simulator=$($DIR/devices.pl "$1" "Booted" "NOT unavailable" | tail -n 1)
+scheme=$1
+shift
+booted_simulator=$($DIR/devices.py --state booted $@ | tail -n 1)
echo "SIMULATOR_DEVICES = $booted_simulator"
-xcodebuild test -scheme $2 -destination 'id=0' -destination-timeout 1 2>&1| sed -n 's/{ \(platform:.*\) }/\1/p' | while read destination; do
+xcodebuild test -scheme $scheme -destination 'id=0' -destination-timeout 1 2>&1| sed -n 's/{ \(platform:.*\) }/\1/p' | while read destination; do
id=$(echo $destination | sed -n -E 's/.*id:([^ ,]+).*/\1/p')
[[ $id == *"placeholder"* ]] && continue
diff --git a/mkspecs/features/uikit/devices.pl b/mkspecs/features/uikit/devices.py
index 8d69a97273..0443e838f2 100755
--- a/mkspecs/features/uikit/devices.pl
+++ b/mkspecs/features/uikit/devices.py
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/python
#############################################################################
##
@@ -39,18 +39,44 @@
##
#############################################################################
-$output = `xcrun simctl list devices --json 2>&1`;
-$output =~ s/\n//g;
-
-BLOCK:
-foreach $block ($output =~ /{.*?}/g) {
- foreach $filter (@ARGV) {
- if ($filter =~ /^NOT\s(.*)/) {
- $block =~ /$1/ && next BLOCK;
- } else {
- $block =~ /$filter/ || next BLOCK;
- }
- }
- $block =~ /udid[:|\s|\"]+(.*)\"/;
- print "$1\n";
-}
+from __future__ import print_function
+
+import argparse
+import json
+import subprocess
+from distutils.version import StrictVersion
+
+def is_suitable_runtime(runtimes, runtime_name, platform, min_version):
+ for runtime in runtimes:
+ identifier = runtime["identifier"]
+ if (runtime["name"] == runtime_name or identifier == runtime_name) \
+ and "unavailable" not in runtime["availability"] \
+ and identifier.startswith("com.apple.CoreSimulator.SimRuntime.{}".format(platform)) \
+ and StrictVersion(runtime["version"]) >= min_version:
+ return True
+ return False
+
+def simctl_runtimes():
+ return json.loads(subprocess.check_output(
+ ["/usr/bin/xcrun", "simctl", "list", "runtimes", "--json"]))["runtimes"]
+
+def simctl_devices():
+ return json.loads(subprocess.check_output(
+ ["/usr/bin/xcrun", "simctl", "list", "devices", "--json"]))["devices"]
+
+if __name__ == "__main__":
+ parser = argparse.ArgumentParser()
+ parser.add_argument('--platform', choices=['iOS', 'tvOS', 'watchOS'], required=True)
+ parser.add_argument('--minimum-deployment-target', type=StrictVersion, default='0.0')
+ parser.add_argument('--state',
+ choices=['booted', 'shutdown', 'creating', 'booting', 'shutting-down'], action='append')
+ args = parser.parse_args()
+
+ runtimes = simctl_runtimes()
+ device_dict = simctl_devices()
+ for runtime_name in device_dict:
+ if is_suitable_runtime(runtimes, runtime_name, args.platform, args.minimum_deployment_target):
+ for device in device_dict[runtime_name]:
+ if "unavailable" not in device["availability"] \
+ and (args.state is None or device["state"].lower() in args.state):
+ print(device["udid"])
diff --git a/mkspecs/features/uikit/watchos_coretext.prf b/mkspecs/features/uikit/watchos_coretext.prf
new file mode 100644
index 0000000000..30e5af2e7e
--- /dev/null
+++ b/mkspecs/features/uikit/watchos_coretext.prf
@@ -0,0 +1,15 @@
+# CoreText is documented to be available on watchOS, but the headers aren't present
+# in the watchOS Simulator SDK like they are supposed to be. Work around the problem
+# by adding the device SDK's headers to the search path as a fallback.
+# rdar://25314492, rdar://27844864
+simulator_system_frameworks = $$xcodeSDKInfo(Path, $${simulator.sdk})/System/Library/Frameworks
+watchos:simulator:!exists($$simulator_system_frameworks/CoreText.framework/Headers/CoreText.h) {
+ device_system_frameworks = $$xcodeSDKInfo(Path, $${device.sdk})/System/Library/Frameworks
+ for (arch, QMAKE_APPLE_SIMULATOR_ARCHS) {
+ QMAKE_CXXFLAGS += \
+ -Xarch_$${arch} \
+ -F$$simulator_system_frameworks \
+ -Xarch_$${arch} \
+ -F$$device_system_frameworks
+ }
+}
diff --git a/mkspecs/features/uikit/xcodebuild.mk b/mkspecs/features/uikit/xcodebuild.mk
index 7d3275df65..0c8d99f4b8 100644
--- a/mkspecs/features/uikit/xcodebuild.mk
+++ b/mkspecs/features/uikit/xcodebuild.mk
@@ -63,7 +63,7 @@ ifneq ($(filter check%,$(MAKECMDGOALS)),)
ifeq ($(DEVICES),)
$(info Enumerating test destinations (you may override this by setting DEVICES explicitly), please wait...)
DESTINATIONS_INCLUDE = /tmp/device_destinations.mk
- $(shell $(MAKEFILE_DIR)device_destinations.sh '$(EXPORT_DEVICE_FILTER)' $(TARGET) > $(DESTINATIONS_INCLUDE))
+ $(shell $(MAKEFILE_DIR)device_destinations.sh $(TARGET) $(EXPORT_DEVICE_FILTER) > $(DESTINATIONS_INCLUDE))
include $(DESTINATIONS_INCLUDE)
endif
endif
@@ -72,7 +72,7 @@ endif
%-device: DEVICES = $(HARDWARE_DEVICES)
GENERIC_DEVICE_DESTINATION := $(EXPORT_GENERIC_DEVICE_DESTINATION)
-GENERIC_SIMULATOR_DESTINATION := "id=$(shell $(MAKEFILE_DIR)devices.pl '$(EXPORT_DEVICE_FILTER)' "NOT unavailable" | tail -n 1)"
+GENERIC_SIMULATOR_DESTINATION := "id=$(shell $(MAKEFILE_DIR)devices.py $(EXPORT_DEVICE_FILTER) | tail -n 1)"
%-simulator: DESTINATION = $(if $(DESTINATION_ID),"id=$(DESTINATION_ID)",$(GENERIC_SIMULATOR_DESTINATION))
%-device: DESTINATION = $(if $(DESTINATION_ID),"id=$(DESTINATION_ID)",$(GENERIC_DEVICE_DESTINATION))
diff --git a/mkspecs/features/uikit/xcodebuild.prf b/mkspecs/features/uikit/xcodebuild.prf
index a766b9ea5c..7a6b2acfc2 100644
--- a/mkspecs/features/uikit/xcodebuild.prf
+++ b/mkspecs/features/uikit/xcodebuild.prf
@@ -40,15 +40,15 @@ CONFIG += no_default_goal_deps
DEVICE_SDK = $${device.sdk}
SIMULATOR_SDK = $${simulator.sdk}
ios {
- DEVICE_FILTER = "iPhone|iPad"
+ DEVICE_FILTER = --platform iOS --minimum-deployment-target $$QMAKE_IOS_DEPLOYMENT_TARGET
GENERIC_DEVICE_DESTINATION = "generic/platform=iOS"
}
tvos {
- DEVICE_FILTER = "Apple TV"
+ DEVICE_FILTER = --platform tvOS --minimum-deployment-target $$QMAKE_TVOS_DEPLOYMENT_TARGET
GENERIC_DEVICE_DESTINATION = "generic/platform=tvOS"
}
watchos {
- DEVICE_FILTER = "Apple Watch"
+ DEVICE_FILTER = --platform watchOS --minimum-deployment-target $$QMAKE_WATCHOS_DEPLOYMENT_TARGET
GENERIC_DEVICE_DESTINATION = "generic/platform=watchOS"
}
QMAKE_EXTRA_VARIABLES += DEVICE_SDK SIMULATOR_SDK DEVICE_FILTER GENERIC_DEVICE_DESTINATION