diff options
-rw-r--r-- | mkspecs/common/ios.conf | 2 | ||||
-rw-r--r-- | mkspecs/features/uikit/default_post.prf | 101 | ||||
-rw-r--r-- | mkspecs/features/uikit/default_pre.prf (renamed from mkspecs/macx-ios-clang/features/default_pre.prf) | 0 | ||||
-rwxr-xr-x | mkspecs/features/uikit/device_destinations.sh (renamed from mkspecs/macx-ios-clang/ios_destinations.sh) | 10 | ||||
-rw-r--r-- | mkspecs/features/uikit/exclusive_builds_post.prf (renamed from mkspecs/macx-ios-clang/features/exclusive_builds_post.prf) | 0 | ||||
-rw-r--r-- | mkspecs/features/uikit/qt.prf (renamed from mkspecs/macx-ios-clang/features/qt.prf) | 20 | ||||
-rw-r--r-- | mkspecs/features/uikit/qt_config.prf (renamed from mkspecs/macx-ios-clang/features/qt_config.prf) | 5 | ||||
-rw-r--r-- | mkspecs/features/uikit/qt_parts.prf (renamed from mkspecs/macx-ios-clang/features/qt_parts.prf) | 0 | ||||
-rw-r--r-- | mkspecs/features/uikit/resolve_config.prf (renamed from mkspecs/macx-ios-clang/features/resolve_config.prf) | 0 | ||||
-rw-r--r-- | mkspecs/features/uikit/sdk.prf (renamed from mkspecs/macx-ios-clang/features/sdk.prf) | 2 | ||||
-rw-r--r-- | mkspecs/features/uikit/testcase.prf (renamed from mkspecs/macx-ios-clang/features/testcase.prf) | 0 | ||||
-rw-r--r-- | mkspecs/features/uikit/testcase_targets.prf (renamed from mkspecs/macx-ios-clang/features/testcase_targets.prf) | 0 | ||||
-rw-r--r-- | mkspecs/features/uikit/xcodebuild.mk (renamed from mkspecs/macx-ios-clang/xcodebuild.mk) | 19 | ||||
-rw-r--r-- | mkspecs/features/uikit/xcodebuild.prf (renamed from mkspecs/macx-ios-clang/features/xcodebuild.prf) | 8 | ||||
-rw-r--r-- | mkspecs/macx-ios-clang/features/default_post.prf | 97 |
15 files changed, 139 insertions, 125 deletions
diff --git a/mkspecs/common/ios.conf b/mkspecs/common/ios.conf index a40ab48ac5..dea9a25efd 100644 --- a/mkspecs/common/ios.conf +++ b/mkspecs/common/ios.conf @@ -2,7 +2,7 @@ # qmake common configuration for iOS # -QMAKE_PLATFORM += ios +QMAKE_PLATFORM += ios uikit QMAKE_MAC_SDK = iphoneos simulator.sdk = iphonesimulator diff --git a/mkspecs/features/uikit/default_post.prf b/mkspecs/features/uikit/default_post.prf new file mode 100644 index 0000000000..f21d1e6427 --- /dev/null +++ b/mkspecs/features/uikit/default_post.prf @@ -0,0 +1,101 @@ +equals(TEMPLATE, app):qt { + # If the application uses Qt, it needs to be an application bundle + # to be able to deploy and run on iOS. The only exception to this + # is if you're working with a jailbroken device and can run the + # resulting binary from the console/over SSH, but that's not a + # use-case we care about, so no need to complicate the logic. + CONFIG *= app_bundle + + # For Qt applications we want Xcode project files as the generated output, + # but since qmake doesn't handle the transition between makefiles and Xcode + # project files (which happens when using subdirs), we can't just override + # MAKEFILE_GENERATOR. Instead, we generate the Xcode project by spawning a + # child qmake process with -spec macx-xcode and let the top level qmake + # process generate a wrapper makefile that forwards everything to xcodebuild. + equals(MAKEFILE_GENERATOR, UNIX): \ + CONFIG = xcodebuild $$CONFIG +} + +load(default_post) + +macx-xcode { + device_family.name = TARGETED_DEVICE_FAMILY + device_family.value = $$QMAKE_IOS_TARGETED_DEVICE_FAMILY + QMAKE_MAC_XCODE_SETTINGS += device_family + + { + # If QMAKE_BUNDLE_DATA contains an asset catalog that includes an + # AppIcon.appiconset, we configure Xcode to use it for app icons. + for(bundle_data, QMAKE_BUNDLE_DATA) { + for(bundle_file, $${bundle_data}.files) { + !contains(bundle_file, .*\.xcassets$): next() + !exists($$absolute_path($$bundle_file/AppIcon.appiconset, $$_PRO_FILE_PWD_)): next() + + asset_catalog_appicon.name = "ASSETCATALOG_COMPILER_APPICON_NAME" + asset_catalog_appicon.value = "AppIcon" + QMAKE_MAC_XCODE_SETTINGS += asset_catalog_appicon + break() + } + !isEmpty(asset_catalog_appicon.name): break() + } + + # Set up default 4-inch iPhone/iPod launch image so that our apps + # support the full screen resolution of those devices. + qmake_launch_image = Default-568h@2x.png + qmake_copy_image.input = $$QMAKESPEC/$$qmake_launch_image + qmake_copy_image.output = $$OUT_PWD/$${TARGET}.xcodeproj/$$qmake_launch_image + qmake_copy_image.CONFIG = verbatim + QMAKE_SUBSTITUTES += qmake_copy_image + qmake_launch_images.files = $$qmake_copy_image.output + QMAKE_BUNDLE_DATA += qmake_launch_images + + lessThan(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+ + qmake_launch_screen = LaunchScreen.xib + qmake_copy_launch_screen.input = $$QMAKESPEC/$$qmake_launch_screen + qmake_copy_launch_screen.output = $$OUT_PWD/$${TARGET}.xcodeproj/$$qmake_launch_screen + QMAKE_SUBSTITUTES += qmake_copy_launch_screen + qmake_launch_screens.files = $$qmake_copy_launch_screen.output + QMAKE_BUNDLE_DATA += qmake_launch_screens + } + } +} + +macx-xcode { + arch_device.name = "ARCHS[sdk=$${device.sdk}*]" + arch_simulator.name = "ARCHS[sdk=$${simulator.sdk}*]" + { + 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 + } + + 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 { + # Be more specific about which architecture we're targeting + contains(QT_ARCH, arm.*) { + VALID_ARCHS = $$QMAKE_IOS_DEVICE_ARCHS + } 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)) + + 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 +} diff --git a/mkspecs/macx-ios-clang/features/default_pre.prf b/mkspecs/features/uikit/default_pre.prf index a857c49007..a857c49007 100644 --- a/mkspecs/macx-ios-clang/features/default_pre.prf +++ b/mkspecs/features/uikit/default_pre.prf diff --git a/mkspecs/macx-ios-clang/ios_destinations.sh b/mkspecs/features/uikit/device_destinations.sh index 04785ba6ca..978e1149b5 100755 --- a/mkspecs/macx-ios-clang/ios_destinations.sh +++ b/mkspecs/features/uikit/device_destinations.sh @@ -39,10 +39,10 @@ ## ############################################################################# -booted_simulator=$(xcrun simctl list devices | grep -E "iPhone|iPad" | grep -v unavailable | grep Booted | perl -lne 'print $1 if /\((.*?)\)/') -echo "IPHONESIMULATOR_DEVICES = $booted_simulator" +booted_simulator=$(xcrun simctl list devices | grep -E '$1' | grep -v unavailable | grep Booted | perl -lne 'print $2 if /\((.*?)\)/') +echo "SIMULATOR_DEVICES = $booted_simulator" -xcodebuild test -scheme $1 -destination 'id=0' -destination-timeout 1 2>&1| sed -n 's/{ \(platform:.*\) }/\1/p' | while read destination; do +xcodebuild test -scheme $2 -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') echo $destination | tr ',' '\n' | while read keyval; do key=$(echo $keyval | cut -d ':' -f 1 | tr '[:lower:]' '[:upper:]') @@ -51,9 +51,9 @@ xcodebuild test -scheme $1 -destination 'id=0' -destination-timeout 1 2>&1| sed if [ $key = 'PLATFORM' ]; then if [ "$val" = "iOS" ]; then - echo "IPHONEOS_DEVICES += $id" + echo "HARDWARE_DEVICES += $id" elif [ "$val" = "iOS Simulator" -a "$id" != "$booted_simulator" ]; then - echo "IPHONESIMULATOR_DEVICES += $id" + echo "SIMULATOR_DEVICES += $id" fi fi done diff --git a/mkspecs/macx-ios-clang/features/exclusive_builds_post.prf b/mkspecs/features/uikit/exclusive_builds_post.prf index 1fb0a55846..1fb0a55846 100644 --- a/mkspecs/macx-ios-clang/features/exclusive_builds_post.prf +++ b/mkspecs/features/uikit/exclusive_builds_post.prf diff --git a/mkspecs/macx-ios-clang/features/qt.prf b/mkspecs/features/uikit/qt.prf index 474a195e4b..7edec819d5 100644 --- a/mkspecs/macx-ios-clang/features/qt.prf +++ b/mkspecs/features/uikit/qt.prf @@ -7,16 +7,18 @@ equals(TEMPLATE, app):contains(qt_depends, gui(-private)?) { lib_path_and_base = $$[QT_INSTALL_PLUGINS/get]/platforms/lib$${lib_name}$$qtPlatformTargetSuffix() LIBS += -l$${lib_name}$$qtPlatformTargetSuffix() $$fromfile($${lib_path_and_base}.prl, QMAKE_PRL_LIBS) - # By marking qt_registerPlatformPlugin as undefined, we ensure that - # the plugin.o translation unit is considered for inclusion in - # the final binary, which in turn ensures that the plugin's - # static initializer is included and run. - QMAKE_LFLAGS += -u _qt_registerPlatformPlugin + { + # By marking qt_registerPlatformPlugin as undefined, we ensure that + # the plugin.o translation unit is considered for inclusion in + # the final binary, which in turn ensures that the plugin's + # static initializer is included and run. + QMAKE_LFLAGS += -u _qt_registerPlatformPlugin - # We do link and dependency resolution for the platform plugin - # manually, since we know we always need the plugin, so we don't - # need to generate an import for it. - QTPLUGIN.platforms = - + # We do link and dependency resolution for the platform plugin + # manually, since we know we always need the plugin, so we don't + # need to generate an import for it. + QTPLUGIN.platforms = - + } !no_main_wrapper { # The LC_MAIN load command available in iOS 6.0 and above allows dyld to diff --git a/mkspecs/macx-ios-clang/features/qt_config.prf b/mkspecs/features/uikit/qt_config.prf index d746cba9d9..00e2c0c258 100644 --- a/mkspecs/macx-ios-clang/features/qt_config.prf +++ b/mkspecs/features/uikit/qt_config.prf @@ -5,10 +5,11 @@ isEmpty(QT_ARCH) { # 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}.*): \ + contains(QMAKE_MAC_SDK, $${device.sdk}.*) { QT_ARCH = arm - else: \ # Simulator + } 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. diff --git a/mkspecs/macx-ios-clang/features/qt_parts.prf b/mkspecs/features/uikit/qt_parts.prf index 81814a62b0..81814a62b0 100644 --- a/mkspecs/macx-ios-clang/features/qt_parts.prf +++ b/mkspecs/features/uikit/qt_parts.prf diff --git a/mkspecs/macx-ios-clang/features/resolve_config.prf b/mkspecs/features/uikit/resolve_config.prf index 38d6c74ccb..38d6c74ccb 100644 --- a/mkspecs/macx-ios-clang/features/resolve_config.prf +++ b/mkspecs/features/uikit/resolve_config.prf diff --git a/mkspecs/macx-ios-clang/features/sdk.prf b/mkspecs/features/uikit/sdk.prf index 11d684687c..ce44ac79fd 100644 --- a/mkspecs/macx-ios-clang/features/sdk.prf +++ b/mkspecs/features/uikit/sdk.prf @@ -2,7 +2,7 @@ # 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") + error("Simulator is handled automatically for simulator_and_device") CONFIG += simulator $${simulator.sdk} } diff --git a/mkspecs/macx-ios-clang/features/testcase.prf b/mkspecs/features/uikit/testcase.prf index e16c163ffa..e16c163ffa 100644 --- a/mkspecs/macx-ios-clang/features/testcase.prf +++ b/mkspecs/features/uikit/testcase.prf diff --git a/mkspecs/macx-ios-clang/features/testcase_targets.prf b/mkspecs/features/uikit/testcase_targets.prf index e0a2922c3f..e0a2922c3f 100644 --- a/mkspecs/macx-ios-clang/features/testcase_targets.prf +++ b/mkspecs/features/uikit/testcase_targets.prf diff --git a/mkspecs/macx-ios-clang/xcodebuild.mk b/mkspecs/features/uikit/xcodebuild.mk index 4ff9c5a9c1..5cbad60804 100644 --- a/mkspecs/macx-ios-clang/xcodebuild.mk +++ b/mkspecs/features/uikit/xcodebuild.mk @@ -49,8 +49,8 @@ simulator-install: ACTION = build %-simulator-check: check-simulator ; # SDK -%-device: SDK = iphoneos -%-simulator: SDK = iphonesimulator +%-device: SDK = $(DEVICE_SDK) +%-simulator: SDK = $(SIMULATOR_SDK) # Configuration release-%: CONFIGURATION = Release @@ -61,19 +61,20 @@ ifneq ($(filter check%,$(MAKECMDGOALS)),) ifeq ($(DEVICES),) $(info Enumerating test destinations (you may override this by setting DEVICES explicitly), please wait...) SPECDIR := $(dir $(lastword $(MAKEFILE_LIST))) - DESTINATIONS_INCLUDE = /tmp/ios_destinations.mk - $(shell $(SPECDIR)/ios_destinations.sh $(TARGET) > $(DESTINATIONS_INCLUDE)) + DESTINATIONS_INCLUDE = /tmp/device_destinations.mk + $(shell $(SPECDIR)/../features/uikit/device_destinations.sh '$(EXPORT_DEVICE_FILTER)' $(TARGET) > $(DESTINATIONS_INCLUDE)) include $(DESTINATIONS_INCLUDE) endif endif -%-simulator: DEVICES = $(firstword $(IPHONESIMULATOR_DEVICES)) -%-device: DEVICES = $(IPHONEOS_DEVICES) +%-simulator: DEVICES = $(firstword $(SIMULATOR_DEVICES)) +%-device: DEVICES = $(HARDWARE_DEVICES) -IPHONEOS_GENERIC_DESTINATION := "generic/platform=iOS" -IPHONESIMULATOR_GENERIC_DESTINATION := "id=$(shell xcrun simctl list devices | grep -E 'iPhone|iPad' | grep -v unavailable | perl -lne 'print $$1 if /\((.*?)\)/' | tail -n 1)" +GENERIC_DEVICE_DESTINATION := $(EXPORT_GENERIC_DEVICE_DESTINATION) +GENERIC_SIMULATOR_DESTINATION := "id=$(shell xcrun simctl list devices | grep -E '$(EXPORT_DEVICE_FILTER)' | grep -v unavailable | perl -lne 'print $$1 if /\((.*?)\)/' | tail -n 1)" -DESTINATION = $(if $(DESTINATION_ID),"id=$(DESTINATION_ID)",$(value $(call toupper,$(call basesdk,$(SDK)))_GENERIC_DESTINATION)) +%-simulator: DESTINATION = $(if $(DESTINATION_ID),"id=$(DESTINATION_ID)",$(GENERIC_SIMULATOR_DESTINATION)) +%-device: DESTINATION = $(if $(DESTINATION_ID),"id=$(DESTINATION_ID)",$(GENERIC_DEVICE_DESTINATION)) # Xcodebuild diff --git a/mkspecs/macx-ios-clang/features/xcodebuild.prf b/mkspecs/features/uikit/xcodebuild.prf index b897432a43..c6f20a5109 100644 --- a/mkspecs/macx-ios-clang/features/xcodebuild.prf +++ b/mkspecs/features/uikit/xcodebuild.prf @@ -33,7 +33,13 @@ QMAKE_EXTRA_VARIABLES += SUBTARGETS CONFIG += no_default_goal_deps -QMAKE_EXTRA_INCLUDES += $$shell_quote($$QMAKESPEC/xcodebuild.mk) +DEVICE_SDK = $${device.sdk} +SIMULATOR_SDK = $${simulator.sdk} +DEVICE_FILTER = "iPhone|iPad" +GENERIC_DEVICE_DESTINATION = "generic/platform=iOS" +QMAKE_EXTRA_VARIABLES += DEVICE_SDK SIMULATOR_SDK DEVICE_FILTER GENERIC_DEVICE_DESTINATION + +QMAKE_EXTRA_INCLUDES += $$shell_quote($$PWD/xcodebuild.mk) # Distclean diff --git a/mkspecs/macx-ios-clang/features/default_post.prf b/mkspecs/macx-ios-clang/features/default_post.prf deleted file mode 100644 index e5c78a0ea4..0000000000 --- a/mkspecs/macx-ios-clang/features/default_post.prf +++ /dev/null @@ -1,97 +0,0 @@ - -equals(TEMPLATE, app):contains(CONFIG, qt) { - # If the application uses Qt, it needs to be an application bundle - # to be able to deploy and run on iOS. The only exception to this - # is if you're working with a jailbroken device and can run the - # resulting binary from the console/over SSH, but that's not a - # use-case we care about, so no need to complicate the logic. - CONFIG *= app_bundle - - # For Qt applications we want Xcode project files as the generated output, - # but since qmake doesn't handle the transition between makefiles and Xcode - # project files (which happens when using subdirs), we can't just override - # MAKEFILE_GENERATOR. Instead, we generate the Xcode project by spawning a - # child qmake process with -spec macx-xcode and let the top level qmake - # process generate a wrapper makefile that forwards everything to xcodebuild. - equals(MAKEFILE_GENERATOR, UNIX): \ - CONFIG = xcodebuild $$CONFIG -} - -load(default_post) - -macx-xcode { - ios_device_family.name = TARGETED_DEVICE_FAMILY - ios_device_family.value = $$QMAKE_IOS_TARGETED_DEVICE_FAMILY - QMAKE_MAC_XCODE_SETTINGS += ios_device_family - - # If QMAKE_BUNDLE_DATA contains an asset catalog that includes an - # AppIcon.appiconset, we configure Xcode to use it for app icons. - for(bundle_data, QMAKE_BUNDLE_DATA) { - for(bundle_file, $${bundle_data}.files) { - !contains(bundle_file, .*\.xcassets$): next() - !exists($$absolute_path($$bundle_file/AppIcon.appiconset, $$_PRO_FILE_PWD_)): next() - - asset_catalog_appicon.name = "ASSETCATALOG_COMPILER_APPICON_NAME" - asset_catalog_appicon.value = "AppIcon" - QMAKE_MAC_XCODE_SETTINGS += asset_catalog_appicon - break() - } - !isEmpty(asset_catalog_appicon.name): break() - } - - # Set up default 4-inch iPhone/iPod launch image so that our apps - # support the full screen resolution of those devices. - qmake_launch_image = Default-568h@2x.png - qmake_copy_image.input = $$QMAKESPEC/$$qmake_launch_image - qmake_copy_image.output = $$OUT_PWD/$${TARGET}.xcodeproj/$$qmake_launch_image - qmake_copy_image.CONFIG = verbatim - QMAKE_SUBSTITUTES += qmake_copy_image - qmake_launch_images.files = $$qmake_copy_image.output - QMAKE_BUNDLE_DATA += qmake_launch_images - - lessThan(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+ - qmake_launch_screen = LaunchScreen.xib - qmake_copy_launch_screen.input = $$QMAKESPEC/$$qmake_launch_screen - qmake_copy_launch_screen.output = $$OUT_PWD/$${TARGET}.xcodeproj/$$qmake_launch_screen - QMAKE_SUBSTITUTES += qmake_copy_launch_screen - qmake_launch_screens.files = $$qmake_copy_launch_screen.output - QMAKE_BUNDLE_DATA += qmake_launch_screens - } -} - -macx-xcode { - arch_device.name = "ARCHS[sdk=$${device.sdk}*]" - arch_device.value = $$QMAKE_IOS_DEVICE_ARCHS - arch_simulator.name = "ARCHS[sdk=$${simulator.sdk}*]" - arch_simulator.value = $$QMAKE_IOS_SIMULATOR_ARCHS - - QMAKE_MAC_XCODE_SETTINGS += arch_device arch_simulator - QMAKE_XCODE_ARCHS = $$QMAKE_IOS_DEVICE_ARCHS $$QMAKE_IOS_SIMULATOR_ARCHS - - 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 { - # Be more specific about which architecture we're targeting - contains(QT_ARCH, arm.*): \ - VALID_ARCHS = $$QMAKE_IOS_DEVICE_ARCHS - 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)) - - 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 -} |