diff options
author | Mike Krus <[email protected]> | 2016-02-16 14:29:59 +0000 |
---|---|---|
committer | Jake Petroules <[email protected]> | 2016-05-17 16:11:23 +0000 |
commit | 03e9c6f4a62582837fc9f5961ecbccd0a3d1b5d6 (patch) | |
tree | c52961c92f5968a7355941fa224dfc74268ce150 | |
parent | 26d44fce3dfb9dbd3b5be2a031fff8c1bb903960 (diff) |
Add support for Apple tvOS
Pass -xplatform macx-tvos-clang to configure to build.
Builds device and simulator by default.
Added ‘uikit’ platform with the common setup.
Also added QT_PLATFORM_UIKIT define (undocumented).
qmake config defines tvos (but not ios).
tvOS is 64bits only (QT_ARCH is arm64) and requires bitcode to be
embedded in the binary. A new ‘bitcode’ configuration was added.
For ReleaseDevice builds (which get archived and push to the store),
bitcode is actually embedded (-fembed-bitcode passed to clang). For all
other configurations, only using bitcode markers to keep file size
down (-fembed-bitcode-marker).
Build disables Widgets in qtbase, and qtscript (unsupported,
would require fixes to JavaScriptCore source code).
Qpa same as on iOS but disables device orientation, status bar, clipboard,
menus, dialogs which are not supported on tvOS.
Change-Id: I645804fd933be0befddeeb43095a74d2c178b2ba
Reviewed-by: Tor Arne Vestbø <[email protected]>
87 files changed, 463 insertions, 144 deletions
diff --git a/configure b/configure index ae8ca41a92c..008216a17d2 100755 --- a/configure +++ b/configure @@ -301,6 +301,12 @@ macSDKify() iphonesimulator*) version_min_flag="-mios-simulator-version-min=$(getSingleQMakeVariable QMAKE_IOS_DEPLOYMENT_TARGET "$1")" ;; + appletvos*) + version_min_flag="-mappletvos-version-min=$(getSingleQMakeVariable QMAKE_TVOS_DEPLOYMENT_TARGET "$1")" + ;; + appletvsimulator*) + version_min_flag="-mtvos-simulator-version-min=$(getSingleQMakeVariable QMAKE_TVOS_DEPLOYMENT_TARGET "$1")" + ;; *) ;; esac @@ -741,8 +747,9 @@ RPATH_FLAGS= W_FLAGS= QCONFIG_FLAGS= XPLATFORM= # This seems to be the QMAKESPEC, like "linux-g++" -XPLATFORM_MAC=no # Whether target platform is OS X or iOS +XPLATFORM_MAC=no # Whether target platform is OS X, iOS or tvOS XPLATFORM_IOS=no # Whether target platform is iOS +XPLATFORM_TVOS=no # Whether target platform is tvOS XPLATFORM_ANDROID=no XPLATFORM_MINGW=no # Whether target platform is MinGW (win32-g++*) XPLATFORM_QNX=no @@ -2342,6 +2349,10 @@ case "$XPLATFORM" in XPLATFORM_MAC=yes XPLATFORM_IOS=yes ;; + *tvos*) + XPLATFORM_MAC=yes + XPLATFORM_TVOS=yes + ;; *macx*) XPLATFORM_MAC=yes ;; @@ -2714,12 +2725,16 @@ if [ "$XPLATFORM_MAC" = "yes" ]; then [ "$CFG_PKGCONFIG" = "auto" ] && CFG_PKGCONFIG="no" fi -if [ "$XPLATFORM_IOS" = "yes" ]; then +if [ "$XPLATFORM_IOS" = "yes" ] || [ "$XPLATFORM_TVOS" = "yes" ]; then CFG_RPATH="no" CFG_NOBUILD_PARTS="$CFG_NOBUILD_PARTS examples" CFG_SHARED="no" # iOS builds should be static to be able to submit to the App Store CFG_SKIP_MODULES="$CFG_SKIP_MODULES qtdoc qtmacextras qtserialport qtwebkit qtwebkit-examples" CFG_PRECOMPILE="no" # Precompiled headers not supported with multiple -arch arguments + if [ "$XPLATFORM_TVOS" = "yes" ]; then + CFG_SKIP_MODULES="$CFG_SKIP_MODULES qtscript" + CFG_WIDGETS="no" + fi # If the user passes -sdk on the command line we build a SDK-specific Qt build. # Otherwise we build a joined simulator and device build, which is the default. @@ -6379,7 +6394,7 @@ if [ "$CFG_ARCH" = "i386" -o "$CFG_ARCH" = "x86_64" ]; then echo " SSE .................. ${CFG_SSE_LIST:-<none>}" echo " AVX .................. ${CFG_AVX_LIST:-<none>}" echo " AVX512 ............... ${CFG_AVX512_UPPER:-<none>}" -elif [ "$CFG_ARCH" = "arm" ]; then +elif [ "$CFG_ARCH" = "arm" -o "$CFG_ARCH" = "arm64" ]; then echo " Neon ................. ${CFG_NEON}" elif [ "$CFG_ARCH" = "mips" ]; then echo " DSP/DSPr2 ............ ${CFG_MIPS_DSP}/${CFG_MIPS_DSPR2}" diff --git a/mkspecs/common/ios.conf b/mkspecs/common/ios.conf index dea9a25efd3..dd9b29f9e23 100644 --- a/mkspecs/common/ios.conf +++ b/mkspecs/common/ios.conf @@ -2,7 +2,7 @@ # qmake common configuration for iOS # -QMAKE_PLATFORM += ios uikit +QMAKE_PLATFORM += ios QMAKE_MAC_SDK = iphoneos simulator.sdk = iphonesimulator @@ -17,4 +17,4 @@ device.dir_affix = $${device.sdk} device.CONFIG = $${device.sdk} device.deployment_identifier = $${device.sdk} -include(mac.conf) +include(uikit.conf) diff --git a/mkspecs/common/tvos.conf b/mkspecs/common/tvos.conf new file mode 100644 index 00000000000..2db616f51e8 --- /dev/null +++ b/mkspecs/common/tvos.conf @@ -0,0 +1,21 @@ +# +# qmake common configuration for tvOS +# + +QMAKE_PLATFORM += tvos +QMAKE_MAC_SDK = appletvos +CONFIG += bitcode + +simulator.sdk = appletvsimulator +simulator.target = simulator +simulator.dir_affix = $${simulator.sdk} +simulator.CONFIG = $${simulator.sdk} +simulator.deployment_identifier = tvos-simulator + +device.sdk = appletvos +device.target = device +device.dir_affix = $${device.sdk} +device.CONFIG = $${device.sdk} +device.deployment_identifier = $${device.sdk} + +include(uikit.conf) diff --git a/mkspecs/common/uikit.conf b/mkspecs/common/uikit.conf new file mode 100644 index 00000000000..d975ed98af4 --- /dev/null +++ b/mkspecs/common/uikit.conf @@ -0,0 +1,11 @@ +# +# qmake configuration for shared by UIKIT platforms +# + +QMAKE_PLATFORM += uikit +CONFIG += reduce_exports + +INCLUDEPATH += $$PWD/uikit +DEFINES += DARWIN_NO_CARBON QT_NO_PRINTER QT_NO_PRINTDIALOG + +include(mac.conf) diff --git a/mkspecs/common/ios/GLES2/gl2.h b/mkspecs/common/uikit/GLES2/gl2.h index 0974509a350..0974509a350 100644 --- a/mkspecs/common/ios/GLES2/gl2.h +++ b/mkspecs/common/uikit/GLES2/gl2.h diff --git a/mkspecs/features/mac/sdk.prf b/mkspecs/features/mac/sdk.prf index ab37b1740f8..c4d4c90f095 100644 --- a/mkspecs/features/mac/sdk.prf +++ b/mkspecs/features/mac/sdk.prf @@ -55,12 +55,13 @@ for(tool, $$list(QMAKE_CC QMAKE_CXX QMAKE_FIX_RPATH QMAKE_AR QMAKE_RANLIB QMAKE_ } !equals(MAKEFILE_GENERATOR, XCODE) { - ios:!host_build { + uikit:!host_build { simulator: \ version_identifier = $$simulator.deployment_identifier else: \ version_identifier = $$device.deployment_identifier - deployment_target = $$QMAKE_IOS_DEPLOYMENT_TARGET + ios: deployment_target = $$QMAKE_IOS_DEPLOYMENT_TARGET + tvos: deployment_target = $$QMAKE_TVOS_DEPLOYMENT_TARGET } else: osx { version_identifier = macosx deployment_target = $$QMAKE_MACOSX_DEPLOYMENT_TARGET diff --git a/mkspecs/features/qt_build_config.prf b/mkspecs/features/qt_build_config.prf index 2d437e7f910..ab183bf23b0 100644 --- a/mkspecs/features/qt_build_config.prf +++ b/mkspecs/features/qt_build_config.prf @@ -64,7 +64,7 @@ CONFIG = qt_build_extra $$CONFIG cross_compile: \ CONFIG += force_bootstrap -android|ios|winrt: \ +android|uikit|winrt: \ CONFIG += builtin_testdata CONFIG += \ diff --git a/mkspecs/features/qt_common.prf b/mkspecs/features/qt_common.prf index b060ff604e9..4b110768bf9 100644 --- a/mkspecs/features/qt_common.prf +++ b/mkspecs/features/qt_common.prf @@ -67,7 +67,7 @@ warnings_are_errors:warning_clean { # If the module declares that it has does its clean-up of warnings, enable -Werror. # This setting is compiler-dependent anyway because it depends on the version of the # compiler. - clang:!ios { + clang:!uikit { # Apple clang 4.0-4.2,5.0-5.1,6.0-6.4 # Regular clang 3.3-3.8 apple_ver = $${QT_APPLE_CLANG_MAJOR_VERSION}.$${QT_APPLE_CLANG_MINOR_VERSION} diff --git a/mkspecs/features/qt_functions.prf b/mkspecs/features/qt_functions.prf index cfac583ba85..2ed1cd51de0 100644 --- a/mkspecs/features/qt_functions.prf +++ b/mkspecs/features/qt_functions.prf @@ -1,6 +1,6 @@ defineReplace(qtPlatformTargetSuffix) { - ios:CONFIG(simulator, simulator|device): \ + uikit:CONFIG(simulator, simulator|device): \ suffix = _$${simulator.sdk} else: \ suffix = diff --git a/mkspecs/features/qt_parts.prf b/mkspecs/features/qt_parts.prf index 877bd60321a..fa62f40e35a 100644 --- a/mkspecs/features/qt_parts.prf +++ b/mkspecs/features/qt_parts.prf @@ -60,7 +60,7 @@ exists($$_PRO_FILE_PWD_/tests/tests.pro) { sub_tests.CONFIG = no_default_install !contains(QT_BUILD_PARTS, tests) { sub_tests.CONFIG += no_default_target - } else: !ios { + } else: !uikit { # Make sure these are there in case we need them sub_tools.CONFIG -= no_default_target sub_examples.CONFIG -= no_default_target diff --git a/mkspecs/features/uikit/bitcode.prf b/mkspecs/features/uikit/bitcode.prf new file mode 100644 index 00000000000..ecc6542b3ce --- /dev/null +++ b/mkspecs/features/uikit/bitcode.prf @@ -0,0 +1,13 @@ +lessThan(QMAKE_XCODE_VERSION, "7.0") { + warning("You need to update Xcode to version 7 or newer to support bitcode") +} else { + release:device { + QMAKE_CFLAGS += -fembed-bitcode + QMAKE_CXXFLAGS += -fembed-bitcode + QMAKE_OBJECTIVE_CFLAGS += -fembed-bitcode + } else { + QMAKE_CFLAGS += -fembed-bitcode-marker + QMAKE_CXXFLAGS += -fembed-bitcode-marker + QMAKE_OBJECTIVE_CFLAGS += -fembed-bitcode-marker + } +} diff --git a/mkspecs/features/uikit/default_post.prf b/mkspecs/features/uikit/default_post.prf index f21d1e6427b..7c92a245561 100644 --- a/mkspecs/features/uikit/default_post.prf +++ b/mkspecs/features/uikit/default_post.prf @@ -20,10 +20,11 @@ load(default_post) macx-xcode { device_family.name = TARGETED_DEVICE_FAMILY - device_family.value = $$QMAKE_IOS_TARGETED_DEVICE_FAMILY + ios: device_family.value = $$QMAKE_IOS_TARGETED_DEVICE_FAMILY + tvos: device_family.value = $$QMAKE_TVOS_TARGETED_DEVICE_FAMILY QMAKE_MAC_XCODE_SETTINGS += device_family - { + ios { # 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) { @@ -66,11 +67,16 @@ 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 + } QMAKE_MAC_XCODE_SETTINGS += arch_device arch_simulator @@ -81,9 +87,11 @@ macx-xcode { } else { # Be more specific about which architecture we're targeting contains(QT_ARCH, arm.*) { - VALID_ARCHS = $$QMAKE_IOS_DEVICE_ARCHS + ios: VALID_ARCHS = $$QMAKE_IOS_DEVICE_ARCHS + tvos: VALID_ARCHS = $$QMAKE_TVOS_DEVICE_ARCHS } else { - VALID_ARCHS = $$QMAKE_IOS_SIMULATOR_ARCHS + ios: VALID_ARCHS = $$QMAKE_IOS_SIMULATOR_ARCHS + tvos: VALID_ARCHS = $$QMAKE_TVOS_SIMULATOR_ARCHS } single_arch: VALID_ARCHS = $$first(VALID_ARCHS) diff --git a/mkspecs/features/uikit/default_pre.prf b/mkspecs/features/uikit/default_pre.prf index a857c49007a..cba5490b6e1 100644 --- a/mkspecs/features/uikit/default_pre.prf +++ b/mkspecs/features/uikit/default_pre.prf @@ -19,3 +19,13 @@ simulator_and_device:iphonesimulator { CONFIG -= neon CONFIG += sse sse2 } +simulator_and_device:appletvsimulator { + # For a simulator_and_device build all the config tests + # are based on the AppleTVOS ARM SDK, but we know that the simulator + # is x64 and that we support SSE/SSE2. + QT_ARCH = x64 + QT_CPU_FEATURES.x64 = sse sse2 + DEFINES += QT_COMPILER_SUPPORTS_SSE2 + CONFIG -= neon + CONFIG += sse sse2 +} diff --git a/mkspecs/features/uikit/device_destinations.sh b/mkspecs/features/uikit/device_destinations.sh index 978e1149b5c..af7cb91e859 100755 --- a/mkspecs/features/uikit/device_destinations.sh +++ b/mkspecs/features/uikit/device_destinations.sh @@ -54,6 +54,10 @@ xcodebuild test -scheme $2 -destination 'id=0' -destination-timeout 1 2>&1| sed echo "HARDWARE_DEVICES += $id" elif [ "$val" = "iOS Simulator" -a "$id" != "$booted_simulator" ]; then echo "SIMULATOR_DEVICES += $id" + elif [ "$val" = "tvOS" ]; then + echo "HARDWARE_DEVICES += $id" + elif [ "$val" = "tvOS Simulator" -a "$id" != "$booted_simulator" ]; then + echo "SIMULATOR_DEVICES += $id" fi fi done diff --git a/mkspecs/features/uikit/qt.prf b/mkspecs/features/uikit/qt.prf index 7edec819d54..af047be466b 100644 --- a/mkspecs/features/uikit/qt.prf +++ b/mkspecs/features/uikit/qt.prf @@ -7,7 +7,7 @@ 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) - { + !bitcode { # 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 diff --git a/mkspecs/features/uikit/qt_config.prf b/mkspecs/features/uikit/qt_config.prf index 00e2c0c258b..71e0982f7eb 100644 --- a/mkspecs/features/uikit/qt_config.prf +++ b/mkspecs/features/uikit/qt_config.prf @@ -8,7 +8,8 @@ isEmpty(QT_ARCH) { contains(QMAKE_MAC_SDK, $${device.sdk}.*) { QT_ARCH = arm } else { # Simulator - QT_ARCH = i386 + ios: QT_ARCH = i386 + tvos: QT_ARCH = x64 } # Prevent the arch/config tests from building as multi-arch binaries, diff --git a/mkspecs/features/uikit/xcodebuild.prf b/mkspecs/features/uikit/xcodebuild.prf index c6f20a51099..6e50bbcf500 100644 --- a/mkspecs/features/uikit/xcodebuild.prf +++ b/mkspecs/features/uikit/xcodebuild.prf @@ -35,8 +35,14 @@ CONFIG += no_default_goal_deps DEVICE_SDK = $${device.sdk} SIMULATOR_SDK = $${simulator.sdk} -DEVICE_FILTER = "iPhone|iPad" -GENERIC_DEVICE_DESTINATION = "generic/platform=iOS" +ios { + DEVICE_FILTER = "iPhone|iPad" + GENERIC_DEVICE_DESTINATION = "generic/platform=iOS" +} +tvos { + DEVICE_FILTER = "Apple TV" + GENERIC_DEVICE_DESTINATION = "generic/platform=tvOS" +} QMAKE_EXTRA_VARIABLES += DEVICE_SDK SIMULATOR_SDK DEVICE_FILTER GENERIC_DEVICE_DESTINATION QMAKE_EXTRA_INCLUDES += $$shell_quote($$PWD/xcodebuild.mk) diff --git a/mkspecs/macx-ios-clang/qmake.conf b/mkspecs/macx-ios-clang/qmake.conf index 595b11e7c1d..94eff0d2377 100644 --- a/mkspecs/macx-ios-clang/qmake.conf +++ b/mkspecs/macx-ios-clang/qmake.conf @@ -2,12 +2,8 @@ # qmake configuration for macx-ios-clang # -QMAKE_MACOSX_DEPLOYMENT_TARGET = QMAKE_IOS_DEPLOYMENT_TARGET = 7.0 -INCLUDEPATH += $$PWD/ios -DEFINES += DARWIN_NO_CARBON QT_NO_PRINTER QT_NO_PRINTDIALOG - # Universal target (iPhone and iPad) QMAKE_IOS_TARGETED_DEVICE_FAMILY = 1,2 diff --git a/mkspecs/macx-tvos-clang/Info.plist.app b/mkspecs/macx-tvos-clang/Info.plist.app new file mode 100644 index 00000000000..618989d63d9 --- /dev/null +++ b/mkspecs/macx-tvos-clang/Info.plist.app @@ -0,0 +1,41 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<plist version="1.0"> +<dict> + <key>CFBundleDevelopmentRegion</key> + <string>en</string> + <key>CFBundlePackageType</key> + <string>APPL</string> + <key>CFBundleGetInfoString</key> + <string>Created by Qt/QMake</string> + <key>CFBundleSignature</key> + <string>@TYPEINFO@</string> + <key>CFBundleExecutable</key> + <string>@EXECUTABLE@</string> + <key>CFBundleIdentifier</key> + <string>@BUNDLEIDENTIFIER@</string> + <key>CFBundleDisplayName</key> + <string>${PRODUCT_NAME}</string> + <key>CFBundleName</key> + <string>${PRODUCT_NAME}</string> + <key>CFBundleShortVersionString</key> + <string>1.0</string> + <key>CFBundleVersion</key> + <string>1.0</string> + <key>CFBundleIcons</key> + <dict> + <key>CFBundlePrimaryIcon</key> + <string>App Icon - Small</string> + </dict> + <key>CFBundleSupportedPlatforms</key> + <array> + <string>AppleTVOS</string> + </array> + <key>LSRequiresIPhoneOS</key> + <true/> + <key>MinimumOSVersion</key> + <string>9.1</string> + <key>NOTE</key> + <string>This file was generated by Qt/QMake.</string> +</dict> +</plist> diff --git a/mkspecs/macx-tvos-clang/Info.plist.lib b/mkspecs/macx-tvos-clang/Info.plist.lib new file mode 100644 index 00000000000..7cbdb9af129 --- /dev/null +++ b/mkspecs/macx-tvos-clang/Info.plist.lib @@ -0,0 +1,22 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<plist version="1.0"> +<dict> + <key>CFBundlePackageType</key> + <string>FMWK</string> + <key>CFBundleShortVersionString</key> + <string>@SHORT_VERSION@</string> + <key>CFBundleVersion</key> + <string>@FULL_VERSION@</string> + <key>CFBundleGetInfoString</key> + <string>Created by Qt/QMake</string> + <key>CFBundleSignature</key> + <string>@TYPEINFO@</string> + <key>CFBundleExecutable</key> + <string>@LIBRARY@</string> + <key>CFBundleIdentifier</key> + <string>@BUNDLEIDENTIFIER@</string> + <key>NOTE</key> + <string>Please, do NOT change this file -- It was generated by Qt/QMake.</string> +</dict> +</plist> diff --git a/mkspecs/macx-tvos-clang/qmake.conf b/mkspecs/macx-tvos-clang/qmake.conf new file mode 100644 index 00000000000..f3893824506 --- /dev/null +++ b/mkspecs/macx-tvos-clang/qmake.conf @@ -0,0 +1,21 @@ +# +# qmake configuration for macx-tvos-clang +# + +QMAKE_TVOS_DEPLOYMENT_TARGET = 9.1 + +INCLUDEPATH += $$PWD/tvos + +QMAKE_TVOS_TARGETED_DEVICE_FAMILY = 3 + +QMAKE_TVOS_DEVICE_ARCHS = arm64 +QMAKE_TVOS_SIMULATOR_ARCHS = x86_64 + +include(../common/tvos.conf) +include(../common/gcc-base-mac.conf) +include(../common/clang.conf) +include(../common/clang-mac.conf) +include(../common/ios/clang.conf) +include(../common/ios/qmake.conf) + +load(qt_config) diff --git a/mkspecs/macx-tvos-clang/qplatformdefs.h b/mkspecs/macx-tvos-clang/qplatformdefs.h new file mode 100644 index 00000000000..68020de6d59 --- /dev/null +++ b/mkspecs/macx-tvos-clang/qplatformdefs.h @@ -0,0 +1,34 @@ +/**************************************************************************** +** +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the qmake spec of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL21$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "../common/mac/qplatformdefs.h" diff --git a/qmake/doc/src/qmake-manual.qdoc b/qmake/doc/src/qmake-manual.qdoc index 77026bb4796..5c6afcf191c 100644 --- a/qmake/doc/src/qmake-manual.qdoc +++ b/qmake/doc/src/qmake-manual.qdoc @@ -657,7 +657,7 @@ qmake knows about many of these features, which can be accessed via specific variables that only take effect on the platforms where they are relevant. - \section1 OS X and iOS + \section1 OS X, iOS and tvOS Features specific to these platforms include support for creating universal binaries, frameworks and bundles. @@ -1439,7 +1439,7 @@ \target QMAKE_BUNDLE_DATA \section1 QMAKE_BUNDLE_DATA - \note This variable is used on OS X and iOS only. + \note This variable is used on OS X, iOS and tvOS only. Specifies the data that will be installed with a library bundle, and is often used to specify a collection of header files. @@ -1461,7 +1461,7 @@ \section1 QMAKE_BUNDLE_EXTENSION - \note This variable is used on OS X and iOS only. + \note This variable is used on OS X, iOS and tvOS only. Specifies the extension to be used for library bundles. This allows frameworks to be created with custom extensions instead of the @@ -1688,7 +1688,7 @@ \section1 QMAKE_FRAMEWORK_BUNDLE_NAME - \note This variable is used on OS X and iOS only. + \note This variable is used on OS X, iOS and tvOS only. In a framework project, this variable contains the name to be used for the framework that is built. @@ -1702,11 +1702,11 @@ \target QMAKE_FRAMEWORK_VERSION \section1 QMAKE_FRAMEWORK_VERSION - \note This variable is used on OS X and iOS only. + \note This variable is used on OS X, iOS and tvOS only. - For projects where the build target is an OS X or iOS framework, this variable - is used to specify the version number that will be applied to the framework - that is built. + For projects where the build target is an OS X, iOS or tvOS framework, this + variable is used to specify the version number that will be applied to the + framework that is built. By default, this variable contains the same value as the \l{#VERSION}{VERSION} variable. @@ -1797,10 +1797,10 @@ \target QMAKE_INFO_PLIST \section1 QMAKE_INFO_PLIST - \note This variable is used on OS X and iOS platforms only. + \note This variable is used on OS X, iOS and tvOS platforms only. Specifies the name of the property list file, \c{.plist}, you - would like to include in your OS X and iOS application bundle. + would like to include in your OS X, iOS and tvOS application bundle. In the \c{.plist} file, you can define some variables, e.g., @EXECUTABLE@, which qmake will replace with the actual executable name. Other variables @@ -2158,7 +2158,7 @@ the built shared library's \c SONAME identifier. The \c SONAME is the identifier that the dynamic linker will later use to reference the library. In general this reference may be a library name or full library path. On OS - X and iOS, the path may be specified relatively using the following + X, iOS and tvOS, the path may be specified relatively using the following placeholders: \table @@ -4301,7 +4301,7 @@ \li nmake \li Visual Studio projects (VS 2008 and later) \endlist - \li OS X and iOS + \li OS X, iOS and tvOS \list \li Makefile \li Xcode diff --git a/qmake/generators/mac/pbuilder_pbx.cpp b/qmake/generators/mac/pbuilder_pbx.cpp index 147c03a92d7..47c7826154f 100644 --- a/qmake/generators/mac/pbuilder_pbx.cpp +++ b/qmake/generators/mac/pbuilder_pbx.cpp @@ -1089,7 +1089,7 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t) // Copy Bundle Data if (!project->isEmpty("QMAKE_BUNDLE_DATA")) { ProStringList bundle_file_refs; - bool ios = project->isActiveConfig("ios"); + bool osx = project->isActiveConfig("osx"); //all bundle data const ProStringList &bundle_data = project->values("QMAKE_BUNDLE_DATA"); @@ -1117,8 +1117,8 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t) << "\t\t};\n"; } - if (copyBundleResources && ((ios && path.isEmpty()) - || (!ios && path == QLatin1String("Contents/Resources")))) { + if (copyBundleResources && ((!osx && path.isEmpty()) + || (osx && path == QLatin1String("Contents/Resources")))) { for (const ProString &s : qAsConst(bundle_files)) bundle_resources_files << s; } else { @@ -1336,7 +1336,7 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t) ProString targetName = project->first("QMAKE_ORIG_TARGET"); ProString testHost = "$(BUILT_PRODUCTS_DIR)/" + targetName + ".app/"; - if (!project->isActiveConfig("ios")) + if (project->isActiveConfig("osx")) testHost.append("Contents/MacOS/"); testHost.append(targetName); @@ -1404,10 +1404,8 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t) QMap<QString, QString> settings; settings.insert("COPY_PHASE_STRIP", (as_release ? "YES" : "NO")); - // Bitcode is only supported with a deployment target >= iOS 6.0. - // Disable it for now, and consider switching it on when later - // bumping the deployment target. - settings.insert("ENABLE_BITCODE", "NO"); + // required for tvOS (and watchos), optional on iOS (deployment target >= iOS 6.0) + settings.insert("ENABLE_BITCODE", project->isActiveConfig("bitcode") ? "YES" : "NO"); settings.insert("GCC_GENERATE_DEBUGGING_SYMBOLS", as_release ? "NO" : "YES"); if(!as_release) settings.insert("GCC_OPTIMIZATION_LEVEL", "0"); @@ -1537,6 +1535,8 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t) t << "\t\t\t\t" << writeSettings("MACOSX_DEPLOYMENT_TARGET", project->first("QMAKE_MACOSX_DEPLOYMENT_TARGET")) << ";\n"; if (!project->isEmpty("QMAKE_IOS_DEPLOYMENT_TARGET")) t << "\t\t\t\t" << writeSettings("IPHONEOS_DEPLOYMENT_TARGET", project->first("QMAKE_IOS_DEPLOYMENT_TARGET")) << ";\n"; + if (!project->isEmpty("QMAKE_TVOS_DEPLOYMENT_TARGET")) + t << "\t\t\t\t" << writeSettings("APPLETVOS_DEPLOYMENT_TARGET", project->first("QMAKE_TVOS_DEPLOYMENT_TARGET")) << ";\n"; if (!project->isEmpty("QMAKE_XCODE_CODE_SIGN_IDENTITY")) t << "\t\t\t\t" << writeSettings("CODE_SIGN_IDENTITY", project->first("QMAKE_XCODE_CODE_SIGN_IDENTITY")) << ";\n"; diff --git a/src/3rdparty/harfbuzz-ng/harfbuzz-ng.pro b/src/3rdparty/harfbuzz-ng/harfbuzz-ng.pro index 163842e8fc3..99c32ea6723 100644 --- a/src/3rdparty/harfbuzz-ng/harfbuzz-ng.pro +++ b/src/3rdparty/harfbuzz-ng/harfbuzz-ng.pro @@ -143,8 +143,8 @@ contains(SHAPERS, coretext) { HEADERS += \ $$PWD/src/hb-coretext.h - ios: \ - # On iOS CoreText and CoreGraphics are stand-alone frameworks + uikit: \ + # On iOS/tvOS CoreText and CoreGraphics are stand-alone frameworks LIBS_PRIVATE += -framework CoreText -framework CoreGraphics else: \ # On Mac OS they are part of the ApplicationServices umbrella framework, diff --git a/src/3rdparty/pcre/pcre.pro b/src/3rdparty/pcre/pcre.pro index 53405e0e468..fad82b80b17 100644 --- a/src/3rdparty/pcre/pcre.pro +++ b/src/3rdparty/pcre/pcre.pro @@ -11,7 +11,7 @@ DEFINES += HAVE_CONFIG_H # platform/compiler specific definitions win32: DEFINES += PCRE_STATIC -ios|qnx|winrt: DEFINES += PCRE_DISABLE_JIT +uikit|qnx|winrt: DEFINES += PCRE_DISABLE_JIT SOURCES += \ $$PWD/pcre16_byte_order.c \ diff --git a/src/corelib/codecs/codecs.pri b/src/corelib/codecs/codecs.pri index b87d5f4e5d8..fdaec33c5a5 100644 --- a/src/corelib/codecs/codecs.pri +++ b/src/corelib/codecs/codecs.pri @@ -40,7 +40,7 @@ contains(QT_CONFIG,icu) { codecs/qeuckrcodec.cpp \ codecs/qbig5codec.cpp - unix:!qnx:!mac:!ios:!linux-android-* { + unix:!qnx:!darwin:!linux-android-* { contains(QT_CONFIG, iconv) { HEADERS += codecs/qiconvcodec_p.h SOURCES += codecs/qiconvcodec.cpp diff --git a/src/corelib/corelib.pro b/src/corelib/corelib.pro index 46887b71883..aea3f54bb55 100644 --- a/src/corelib/corelib.pro +++ b/src/corelib/corelib.pro @@ -58,8 +58,8 @@ win32 { !winrt: LIBS_PRIVATE += -lwinmm } -mac|darwin { - !ios { +darwin { + osx { LIBS_PRIVATE += -framework ApplicationServices LIBS_PRIVATE += -framework CoreServices } diff --git a/src/corelib/global/qglobal.cpp b/src/corelib/global/qglobal.cpp index dd357e4b158..dc7f492bb11 100644 --- a/src/corelib/global/qglobal.cpp +++ b/src/corelib/global/qglobal.cpp @@ -1918,6 +1918,8 @@ QSysInfo::MacVersion QSysInfo::macVersion() return QSysInfo::MacVersion(Q_MV_OSX(version.major, version.minor)); #elif defined(Q_OS_IOS) return QSysInfo::MacVersion(Q_MV_IOS(version.major, version.minor)); +#elif defined(Q_OS_TVOS) + return QSysInfo::MacVersion(Q_MV_TVOS(version.major, version.minor)); #else return QSysInfo::MV_Unknown; #endif @@ -2620,9 +2622,9 @@ QString QSysInfo::kernelVersion() to determine the distribution name and returns that. If determining the distribution name failed, it returns "unknown". - \b{Darwin, OS X and iOS note}: this function returns "osx" for OS X - systems, "ios" for iOS systems and "darwin" in case the system could not be - determined. + \b{Darwin, OS X, iOS and tvOS note}: this function returns "osx" for OS X + systems, "ios" for iOS systems, "tvos" for tvOS systems and "darwin" in case + the system could not be determined. \b{FreeBSD note}: this function returns "debian" for Debian/kFreeBSD and "unknown" otherwise. @@ -2652,6 +2654,8 @@ QString QSysInfo::productType() #elif defined(Q_OS_IOS) return QStringLiteral("ios"); +#elif defined(Q_OS_TVOS) + return QStringLiteral("tvos"); #elif defined(Q_OS_OSX) return QStringLiteral("osx"); #elif defined(Q_OS_DARWIN) @@ -2735,6 +2739,8 @@ QString QSysInfo::prettyProductName() { #if defined(Q_OS_IOS) return QLatin1String("iOS ") + productVersion(); +#elif defined(Q_OS_TVOS) + return QLatin1String("tvOS ") + productVersion(); #elif defined(Q_OS_OSX) // get the known codenames const char *basename = 0; diff --git a/src/corelib/global/qglobal.h b/src/corelib/global/qglobal.h index 808f4332782..38ced26ea4f 100644 --- a/src/corelib/global/qglobal.h +++ b/src/corelib/global/qglobal.h @@ -607,7 +607,7 @@ class QDataStream; # define QT_NO_SOCKS5 #endif -#if defined(Q_OS_IOS) +#if defined(QT_PLATFORM_UIKIT) # define QT_NO_PROCESS #endif diff --git a/src/corelib/global/qsysinfo.h b/src/corelib/global/qsysinfo.h index 141d45e0dbe..143e00a4c34 100644 --- a/src/corelib/global/qsysinfo.h +++ b/src/corelib/global/qsysinfo.h @@ -121,6 +121,7 @@ public: #define Q_MV_OSX(major, minor) (major == 10 ? minor + 2 : (major == 9 ? 1 : 0)) #define Q_MV_IOS(major, minor) (QSysInfo::MV_IOS | major << 4 | minor) +#define Q_MV_TVOS(major, minor) (QSysInfo::MV_TVOS | major << 4 | minor) enum MacVersion { MV_None = 0xffff, MV_Unknown = 0x0000, @@ -168,7 +169,12 @@ public: MV_IOS_8_2 = Q_MV_IOS(8, 2), MV_IOS_8_3 = Q_MV_IOS(8, 3), MV_IOS_8_4 = Q_MV_IOS(8, 4), - MV_IOS_9_0 = Q_MV_IOS(9, 0) + MV_IOS_9_0 = Q_MV_IOS(9, 0), + + /* tvOS */ + MV_TVOS = 1 << 9, + MV_TVOS_9_0 = Q_MV_TVOS(9, 0), + MV_TVOS_9_1 = Q_MV_TVOS(9, 1) }; #if defined(Q_OS_MAC) static const MacVersion MacintoshVersion; diff --git a/src/corelib/global/qsystemdetection.h b/src/corelib/global/qsystemdetection.h index ee4b88cdbb0..10f9068d0ab 100644 --- a/src/corelib/global/qsystemdetection.h +++ b/src/corelib/global/qsystemdetection.h @@ -101,14 +101,17 @@ # define Q_OS_DARWIN32 # endif # if defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE -# if defined(TARGET_OS_TV) && TARGET_OS_TV -# define Q_OS_TVOS -# elif defined(TARGET_OS_WATCH) && TARGET_OS_WATCH +# if defined(TARGET_OS_WATCH) && TARGET_OS_WATCH # define Q_OS_WATCHOS # else -# // TARGET_OS_IOS is only available in newer SDKs, -# // so assume any other iOS-based platform is iOS for now -# define Q_OS_IOS +# define QT_PLATFORM_UIKIT +# if defined(TARGET_OS_TV) && TARGET_OS_TV +# define Q_OS_TVOS +# else +# // TARGET_OS_IOS is only available in newer SDKs, +# // so assume any other iOS-based platform is iOS for now +# define Q_OS_IOS +# endif # endif # else # // there is no "real" OS X define (rdar://22640089), diff --git a/src/corelib/io/io.pri b/src/corelib/io/io.pri index 052dc8408b4..0b3a28944ca 100644 --- a/src/corelib/io/io.pri +++ b/src/corelib/io/io.pri @@ -135,7 +135,7 @@ win32 { io/qprocess_unix.cpp \ io/qfilesystemiterator_unix.cpp - !integrity { + !integrity:!tvos { SOURCES += io/forkfd_qt.cpp HEADERS += \ ../3rdparty/forkfd/forkfd.h @@ -153,7 +153,7 @@ win32 { OBJECTIVE_SOURCES += io/qfilesystemwatcher_fsevents.mm HEADERS += io/qfilesystemwatcher_fsevents_p.h LIBS += -framework DiskArbitration -framework IOKit - } else:ios { + } else { LIBS += -framework MobileCoreServices } } else:android { diff --git a/src/corelib/io/qfilesystemengine_unix.cpp b/src/corelib/io/qfilesystemengine_unix.cpp index 75797e58da5..eebe5f1f94f 100644 --- a/src/corelib/io/qfilesystemengine_unix.cpp +++ b/src/corelib/io/qfilesystemengine_unix.cpp @@ -61,7 +61,7 @@ #include <CoreServices/CoreServices.h> #endif -#ifdef Q_OS_IOS +#if defined(QT_PLATFORM_UIKIT) #include <MobileCoreServices/MobileCoreServices.h> #endif diff --git a/src/corelib/io/qfilesystemwatcher.cpp b/src/corelib/io/qfilesystemwatcher.cpp index 8b11830fbe9..1e222522176 100644 --- a/src/corelib/io/qfilesystemwatcher.cpp +++ b/src/corelib/io/qfilesystemwatcher.cpp @@ -58,7 +58,7 @@ # include "qfilesystemwatcher_win_p.h" #elif defined(USE_INOTIFY) # include "qfilesystemwatcher_inotify_p.h" -#elif defined(Q_OS_FREEBSD) || defined(Q_OS_NETBSD) || defined(Q_OS_IOS) +#elif defined(Q_OS_FREEBSD) || defined(Q_OS_NETBSD) || defined(QT_PLATFORM_UIKIT) # include "qfilesystemwatcher_kqueue_p.h" #elif defined(Q_OS_OSX) # include "qfilesystemwatcher_fsevents_p.h" @@ -74,7 +74,7 @@ QFileSystemWatcherEngine *QFileSystemWatcherPrivate::createNativeEngine(QObject // there is a chance that inotify may fail on Linux pre-2.6.13 (August // 2005), so we can't just new inotify directly. return QInotifyFileSystemWatcherEngine::create(parent); -#elif defined(Q_OS_FREEBSD) || defined(Q_OS_NETBSD) || defined(Q_OS_IOS) +#elif defined(Q_OS_FREEBSD) || defined(Q_OS_NETBSD) || defined(QT_PLATFORM_UIKIT) return QKqueueFileSystemWatcherEngine::create(parent); #elif defined(Q_OS_OSX) return QFseventsFileSystemWatcherEngine::create(parent); diff --git a/src/corelib/io/qlockfile_unix.cpp b/src/corelib/io/qlockfile_unix.cpp index 03dc5fc6601..ba59ea83415 100644 --- a/src/corelib/io/qlockfile_unix.cpp +++ b/src/corelib/io/qlockfile_unix.cpp @@ -70,7 +70,7 @@ # include <cstdio> #elif defined(Q_OS_HAIKU) # include <kernel/OS.h> -#elif defined(Q_OS_BSD4) && !defined(Q_OS_IOS) +#elif defined(Q_OS_BSD4) && !defined(QT_PLATFORM_UIKIT) # include <sys/user.h> # if defined(__GLIBC__) && defined(__FreeBSD_kernel__) # include <sys/cdefs.h> @@ -285,7 +285,7 @@ QString QLockFilePrivate::processNameByPid(qint64 pid) if (get_thread_info(pid, &info) != B_OK) return QString(); return QFile::decodeName(info.name); -#elif defined(Q_OS_BSD4) && !defined(Q_OS_IOS) +#elif defined(Q_OS_BSD4) && !defined(QT_PLATFORM_UIKIT) # if defined(__GLIBC__) && defined(__FreeBSD_kernel__) int mib[4] = { CTL_KERN, KERN_PROC, KERN_PROC_PID, pid }; size_t len = 0; diff --git a/src/corelib/io/qprocess.cpp b/src/corelib/io/qprocess.cpp index fea5a4c967f..227241b2086 100644 --- a/src/corelib/io/qprocess.cpp +++ b/src/corelib/io/qprocess.cpp @@ -2531,7 +2531,7 @@ QT_BEGIN_INCLUDE_NAMESPACE #if defined(Q_OS_MACX) # include <crt_externs.h> # define environ (*_NSGetEnviron()) -#elif defined(Q_OS_IOS) +#elif defined(QT_PLATFORM_UIKIT) static char *qt_empty_environ[] = { 0 }; #define environ qt_empty_environ #elif !defined(Q_OS_WIN) diff --git a/src/corelib/io/qprocess_unix.cpp b/src/corelib/io/qprocess_unix.cpp index 8c5589538d5..1d425653a3d 100644 --- a/src/corelib/io/qprocess_unix.cpp +++ b/src/corelib/io/qprocess_unix.cpp @@ -322,7 +322,7 @@ QT_END_INCLUDE_NAMESPACE QProcessEnvironment QProcessEnvironment::systemEnvironment() { QProcessEnvironment env; -#if !defined(Q_OS_IOS) +#if !defined(QT_PLATFORM_UIKIT) const char *entry; for (int count = 0; (entry = environ[count]); ++count) { const char *equal = strchr(entry, '='); diff --git a/src/corelib/io/qsettings.cpp b/src/corelib/io/qsettings.cpp index 831658befce..ed3273eb2e2 100644 --- a/src/corelib/io/qsettings.cpp +++ b/src/corelib/io/qsettings.cpp @@ -109,7 +109,7 @@ using namespace ABI::Windows::Storage; #define Q_XDG_PLATFORM #endif -#if !defined(QT_NO_STANDARDPATHS) && (defined(Q_XDG_PLATFORM) || defined(Q_OS_IOS)) +#if !defined(QT_NO_STANDARDPATHS) && (defined(Q_XDG_PLATFORM) || defined(QT_PLATFORM_UIKIT)) #define QSETTINGS_USE_QSTANDARDPATHS #endif diff --git a/src/corelib/io/qstandardpaths_mac.mm b/src/corelib/io/qstandardpaths_mac.mm index f08a6dac53f..dc3d7737b63 100644 --- a/src/corelib/io/qstandardpaths_mac.mm +++ b/src/corelib/io/qstandardpaths_mac.mm @@ -117,7 +117,7 @@ static QString baseWritableLocation(QStandardPaths::StandardLocation type, case QStandardPaths::TempLocation: path = QDir::tempPath(); break; -#ifdef Q_OS_IOS +#if defined(QT_PLATFORM_UIKIT) // These locations point to non-existing write-protected paths. Use sensible fallbacks. case QStandardPaths::MusicLocation: path = pathForDirectory(NSDocumentDirectory, mask) + QLatin1String("/Music"); @@ -204,7 +204,7 @@ QStringList QStandardPaths::standardLocations(StandardLocation type) { QStringList dirs; -#ifdef Q_OS_IOS +#if defined(QT_PLATFORM_UIKIT) if (type == PicturesLocation) dirs << writableLocation(PicturesLocation) << QLatin1String("assets-library://"); #endif diff --git a/src/corelib/kernel/kernel.pri b/src/corelib/kernel/kernel.pri index aa60e1686cd..60252a51ed5 100644 --- a/src/corelib/kernel/kernel.pri +++ b/src/corelib/kernel/kernel.pri @@ -111,7 +111,7 @@ mac { osx: LIBS_PRIVATE += -framework CoreServices -framework AppKit - ios { + uikit { # We need UIKit for UIDevice LIBS_PRIVATE += -framework UIKit } diff --git a/src/corelib/kernel/qcore_mac_objc.mm b/src/corelib/kernel/qcore_mac_objc.mm index de491dd43da..068b6b04404 100644 --- a/src/corelib/kernel/qcore_mac_objc.mm +++ b/src/corelib/kernel/qcore_mac_objc.mm @@ -47,7 +47,7 @@ #include <qdebug.h> -#ifdef Q_OS_IOS +#if defined(Q_OS_IOS) #import <UIKit/UIKit.h> #endif @@ -101,7 +101,7 @@ QT_FOR_EACH_MUTABLE_CORE_GRAPHICS_TYPE(QT_DECLARE_WEAK_QDEBUG_OPERATOR_FOR_CF_TY QAppleOperatingSystemVersion qt_apple_os_version() { QAppleOperatingSystemVersion v = {0, 0, 0}; -#if QT_MAC_PLATFORM_SDK_EQUAL_OR_ABOVE(__MAC_10_10, __IPHONE_8_0) +#if QT_MAC_PLATFORM_SDK_EQUAL_OR_ABOVE(__MAC_10_10, __IPHONE_8_0) || defined(Q_OS_TVOS) if ([NSProcessInfo instancesRespondToSelector:@selector(operatingSystemVersion)]) { NSOperatingSystemVersion osv = NSProcessInfo.processInfo.operatingSystemVersion; v.major = osv.majorVersion; diff --git a/src/corelib/kernel/qcore_unix_p.h b/src/corelib/kernel/qcore_unix_p.h index 319914a99d9..b08571223f9 100644 --- a/src/corelib/kernel/qcore_unix_p.h +++ b/src/corelib/kernel/qcore_unix_p.h @@ -284,8 +284,8 @@ static inline int qt_safe_close(int fd) #undef QT_CLOSE #define QT_CLOSE qt_safe_close -// - VxWorks doesn't have processes -#if !defined(Q_OS_VXWORKS) +// - VxWorks & iOS/tvOS don't have processes +#if !defined(Q_OS_VXWORKS) && !defined(QT_NO_PROCESS) static inline int qt_safe_execve(const char *filename, char *const argv[], char *const envp[]) { diff --git a/src/gui/kernel/qclipboard.cpp b/src/gui/kernel/qclipboard.cpp index e5e268ace3c..7932b9a2dc4 100644 --- a/src/gui/kernel/qclipboard.cpp +++ b/src/gui/kernel/qclipboard.cpp @@ -553,7 +553,7 @@ bool QClipboard::ownsFindBuffer() const bool QClipboard::supportsMode(Mode mode) const { QPlatformClipboard *clipboard = QGuiApplicationPrivate::platformIntegration()->clipboard(); - return clipboard->supportsMode(mode); + return clipboard && clipboard->supportsMode(mode); } /*! @@ -565,7 +565,7 @@ bool QClipboard::supportsMode(Mode mode) const bool QClipboard::ownsMode(Mode mode) const { QPlatformClipboard *clipboard = QGuiApplicationPrivate::platformIntegration()->clipboard(); - return clipboard->ownsMode(mode); + return clipboard && clipboard->ownsMode(mode); } /*! diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp index 239c5e135b5..a125b39d67e 100644 --- a/src/gui/kernel/qguiapplication.cpp +++ b/src/gui/kernel/qguiapplication.cpp @@ -1054,7 +1054,7 @@ QWindow *QGuiApplication::topLevelAt(const QPoint &pos) \li \c eglfs is a platform plugin for running Qt5 applications on top of EGL and OpenGL ES 2.0 without an actual windowing system (like X11 or Wayland). For more information, see \l{EGLFS}. - \li \c ios + \li \c ios (also used for tvOS) \li \c kms is an experimental platform plugin using kernel modesetting and \l{http://dri.freedesktop.org/wiki/DRM}{DRM} (Direct Rendering Manager). diff --git a/src/gui/painting/painting.pri b/src/gui/painting/painting.pri index 283b6643b9d..2f927aeddb0 100644 --- a/src/gui/painting/painting.pri +++ b/src/gui/painting/painting.pri @@ -104,8 +104,8 @@ AVX2_SOURCES += painting/qdrawhelper_avx2.cpp NEON_SOURCES += painting/qdrawhelper_neon.cpp painting/qimagescale_neon.cpp NEON_HEADERS += painting/qdrawhelper_neon_p.h NEON_ASM += ../3rdparty/pixman/pixman-arm-neon-asm.S painting/qdrawhelper_neon_asm.S -!ios:contains(QT_ARCH, "arm"): CONFIG+=no_clang_integrated_as -!ios:!contains(QT_ARCH, "arm64"): DEFINES += ENABLE_PIXMAN_DRAWHELPERS +!uikit:contains(QT_ARCH, "arm"): CONFIG += no_clang_integrated_as +!uikit:!contains(QT_ARCH, "arm64"): DEFINES += ENABLE_PIXMAN_DRAWHELPERS MIPS_DSP_SOURCES += painting/qdrawhelper_mips_dsp.cpp MIPS_DSP_HEADERS += painting/qdrawhelper_mips_dsp_p.h painting/qt_mips_asm_dsp_p.h diff --git a/src/network/access/access.pri b/src/network/access/access.pri index 17897ca8691..94f8b7cbc04 100644 --- a/src/network/access/access.pri +++ b/src/network/access/access.pri @@ -74,7 +74,7 @@ SOURCES += \ mac: LIBS_PRIVATE += -framework Security -ios { +uikit { HEADERS += \ access/qnetworkreplynsurlconnectionimpl_p.h diff --git a/src/network/access/qnetworkaccessmanager.cpp b/src/network/access/qnetworkaccessmanager.cpp index ed586c1de52..0abc48a99c8 100644 --- a/src/network/access/qnetworkaccessmanager.cpp +++ b/src/network/access/qnetworkaccessmanager.cpp @@ -56,7 +56,7 @@ #include "qnetworkreplydataimpl_p.h" #include "qnetworkreplyfileimpl_p.h" -#if defined(Q_OS_IOS) && defined(QT_NO_SSL) +#if defined(QT_PLATFORM_UIKIT) && defined(QT_NO_SSL) #include "qnetworkreplynsurlconnectionimpl_p.h" #endif @@ -1205,7 +1205,7 @@ QNetworkReply *QNetworkAccessManager::createRequest(QNetworkAccessManager::Opera } // Use NSURLConnection for https on iOS when OpenSSL is disabled. -#if defined(Q_OS_IOS) && defined(QT_NO_SSL) +#if defined(QT_PLATFORM_UIKIT) && defined(QT_NO_SSL) if (scheme == QLatin1String("https")) return new QNetworkReplyNSURLConnectionImpl(this, request, op, outgoingData); #endif diff --git a/src/network/kernel/kernel.pri b/src/network/kernel/kernel.pri index 811d8b6f0df..b50ca0d1c42 100644 --- a/src/network/kernel/kernel.pri +++ b/src/network/kernel/kernel.pri @@ -53,10 +53,10 @@ win32: { mac { LIBS_PRIVATE += -framework SystemConfiguration -framework CoreFoundation - !ios: LIBS_PRIVATE += -framework CoreServices + !uikit: LIBS_PRIVATE += -framework CoreServices } -mac:!ios:SOURCES += kernel/qnetworkproxy_mac.cpp +osx:SOURCES += kernel/qnetworkproxy_mac.cpp else:win32:SOURCES += kernel/qnetworkproxy_win.cpp else:contains(QT_CONFIG, libproxy) { SOURCES += kernel/qnetworkproxy_libproxy.cpp diff --git a/src/network/ssl/qsslsocket_mac.cpp b/src/network/ssl/qsslsocket_mac.cpp index c1643421668..96a3bfb571e 100644 --- a/src/network/ssl/qsslsocket_mac.cpp +++ b/src/network/ssl/qsslsocket_mac.cpp @@ -351,7 +351,7 @@ bool QSslSocketPrivate::s_loadedCiphersAndCerts = false; bool QSslSocketPrivate::s_loadRootCertsOnDemand = false; -#ifndef Q_OS_IOS // dhparam is not used on iOS. (see the SSLSetDiffieHellmanParams call below) +#if !defined(QT_PLATFORM_UIKIT) // dhparam is not used on iOS or tvOS. (see the SSLSetDiffieHellmanParams call below) static const uint8_t dhparam[] = "\x30\x82\x01\x08\x02\x82\x01\x01\x00\x97\xea\xd0\x46\xf7\xae\xa7\x76\x80" "\x9c\x74\x56\x98\xd8\x56\x97\x2b\x20\x6c\x77\xe2\x82\xbb\xc8\x84\xbe\xe7" @@ -370,8 +370,8 @@ static const uint8_t dhparam[] = "\x90\x0b\x35\x64\xff\xd9\xe3\xac\xf2\xf2\xeb\x3a\x63\x02\x01\x02"; #endif -// No ioErr on iOS. (defined in MacErrors.h on OS X) -#ifdef Q_OS_IOS +// No ioErr on iOS/tvOS. (defined in MacErrors.h on OS X) +#if defined(QT_PLATFORM_UIKIT) # define ioErr -36 #endif @@ -1011,7 +1011,7 @@ bool QSslSocketBackendPrivate::initSslContext() return false; } } -#ifndef Q_OS_IOS +#if !defined(QT_PLATFORM_UIKIT) // No SSLSetDiffieHellmanParams on iOS; calling it is optional according to docs. SSLSetDiffieHellmanParams(context, dhparam, sizeof(dhparam)); #endif diff --git a/src/platformsupport/clipboard/qmacmime.mm b/src/platformsupport/clipboard/qmacmime.mm index 2ad734b8b9e..d8e46bdbc62 100644 --- a/src/platformsupport/clipboard/qmacmime.mm +++ b/src/platformsupport/clipboard/qmacmime.mm @@ -43,7 +43,7 @@ #import <AppKit/AppKit.h> #endif -#if defined(Q_OS_IOS) +#if defined(QT_PLATFORM_UIKIT) #import <UIKit/UIKit.h> #endif diff --git a/src/platformsupport/fontdatabases/mac/coretext.pri b/src/platformsupport/fontdatabases/mac/coretext.pri index d9ffb85f96a..272e7591ba8 100644 --- a/src/platformsupport/fontdatabases/mac/coretext.pri +++ b/src/platformsupport/fontdatabases/mac/coretext.pri @@ -7,8 +7,8 @@ contains(QT_CONFIG, freetype) { SOURCES += $$QT_SOURCE_TREE/src/gui/text/qfontengine_ft.cpp } -ios: \ - # On iOS CoreText and CoreGraphics are stand-alone frameworks +uikit: \ + # On iOS/tvOS CoreText and CoreGraphics are stand-alone frameworks LIBS_PRIVATE += -framework CoreText -framework CoreGraphics else: \ # On Mac OS they are part of the ApplicationServices umbrella framework, diff --git a/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm b/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm index df39dcf6bee..bea32950be0 100644 --- a/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm +++ b/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm @@ -44,7 +44,7 @@ #if defined(Q_OS_OSX) #import <AppKit/AppKit.h> #import <IOKit/graphics/IOGraphicsLib.h> -#elif defined(Q_OS_IOS) +#elif defined(QT_PLATFORM_UIKIT) #import <UIKit/UIFont.h> #endif @@ -191,7 +191,7 @@ static CFArrayRef availableFamilyNames() { #if defined(Q_OS_OSX) return CTFontManagerCopyAvailableFontFamilyNames(); -#elif defined(Q_OS_IOS) +#elif defined(QT_PLATFORM_UIKIT) return (CFArrayRef) [[UIFont familyNames] retain]; #endif } @@ -847,7 +847,7 @@ static CTFontUIFontType fontTypeFromTheme(QPlatformTheme::Font f) static CTFontDescriptorRef fontDescriptorFromTheme(QPlatformTheme::Font f) { -#ifdef Q_OS_IOS +#if defined(QT_PLATFORM_UIKIT) if (QSysInfo::MacintoshVersion >= QSysInfo::MV_IOS_7_0) { // Use Dynamic Type to resolve theme fonts if possible, to get // correct font sizes and style based on user configuration. @@ -881,7 +881,7 @@ static CTFontDescriptorRef fontDescriptorFromTheme(QPlatformTheme::Font f) return static_cast<CTFontDescriptorRef>(CFBridgingRetain(desc)); } } -#endif // Q_OS_IOS +#endif // Q_OS_IOS, Q_OS_TVOS // OSX default case and iOS fallback case CTFontUIFontType fontType = fontTypeFromTheme(f); diff --git a/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase_p.h b/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase_p.h index 2cc6b09a152..d3f891fd4d8 100644 --- a/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase_p.h +++ b/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase_p.h @@ -59,7 +59,7 @@ #include <qpa/qplatformtheme.h> #include <private/qcore_mac_p.h> -#ifndef Q_OS_IOS +#ifdef Q_OS_OSX #include <ApplicationServices/ApplicationServices.h> #else #include <CoreText/CoreText.h> diff --git a/src/platformsupport/fontdatabases/mac/qfontengine_coretext.mm b/src/platformsupport/fontdatabases/mac/qfontengine_coretext.mm index bbc5cf0c8f1..88d80d19ae4 100644 --- a/src/platformsupport/fontdatabases/mac/qfontengine_coretext.mm +++ b/src/platformsupport/fontdatabases/mac/qfontengine_coretext.mm @@ -181,7 +181,7 @@ void QCoreTextFontEngine::init() synthesisFlags = 0; CTFontSymbolicTraits traits = CTFontGetSymbolicTraits(ctfont); -#if defined(Q_OS_IOS) || MAC_OS_X_VERSION_MAX_ALLOWED >= 1070 +#if defined(QT_PLATFORM_UIKIT) || MAC_OS_X_VERSION_MAX_ALLOWED >= 1070 if (supportsColorGlyphs() && (traits & kCTFontColorGlyphsTrait)) glyphFormat = QFontEngine::Format_ARGB; else @@ -568,7 +568,7 @@ QImage QCoreTextFontEngine::imageForGlyph(glyph_t glyph, QFixed subPixelPosition if (!im.width() || !im.height()) return im; -#ifndef Q_OS_IOS +#ifdef Q_OS_OSX CGColorSpaceRef colorspace = CGColorSpaceCreateWithName(kCGColorSpaceGenericRGB); #else CGColorSpaceRef colorspace = CGColorSpaceCreateDeviceRGB(); @@ -617,7 +617,7 @@ QImage QCoreTextFontEngine::imageForGlyph(glyph_t glyph, QFixed subPixelPosition CGContextShowGlyphsWithAdvances(ctx, &cgGlyph, &CGSizeZero, 1); } } -#if defined(Q_OS_IOS) || MAC_OS_X_VERSION_MAX_ALLOWED >= 1070 +#if defined(QT_PLATFORM_UIKIT) || MAC_OS_X_VERSION_MAX_ALLOWED >= 1070 else if (supportsColorGlyphs()) { // CGContextSetTextMatrix does not work with color glyphs, so we use // the CTM instead. This means we must translate the CTM as well, to diff --git a/src/platformsupport/fontdatabases/mac/qfontengine_coretext_p.h b/src/platformsupport/fontdatabases/mac/qfontengine_coretext_p.h index 8a487f0ff00..27289239c67 100644 --- a/src/platformsupport/fontdatabases/mac/qfontengine_coretext_p.h +++ b/src/platformsupport/fontdatabases/mac/qfontengine_coretext_p.h @@ -54,7 +54,7 @@ #include <private/qfontengine_p.h> #include <private/qcore_mac_p.h> -#ifndef Q_OS_IOS +#ifdef Q_OS_OSX #include <ApplicationServices/ApplicationServices.h> #else #include <CoreText/CoreText.h> @@ -118,7 +118,7 @@ public: static bool supportsColorGlyphs() { -#if defined(Q_OS_IOS) +#if defined(QT_PLATFORM_UIKIT) return true; #elif MAC_OS_X_VERSION_MAX_ALLOWED >= 1070 #if MAC_OS_X_VERSION_MIN_REQUIRED < 1070 diff --git a/src/platformsupport/platformsupport.pro b/src/platformsupport/platformsupport.pro index 81c7faa3891..8fb05be3fab 100644 --- a/src/platformsupport/platformsupport.pro +++ b/src/platformsupport/platformsupport.pro @@ -25,6 +25,6 @@ contains(QT_CONFIG, dbus) { include(dbusmenu/dbusmenu.pri) include(dbustray/dbustray.pri) } -ios: include(graphics/graphics.pri) +uikit: include(graphics/graphics.pri) load(qt_module) diff --git a/src/plugins/platforms/ios/ios.pro b/src/plugins/platforms/ios/ios.pro index 7b0a573ffae..2c85a68f0b8 100644 --- a/src/plugins/platforms/ios/ios.pro +++ b/src/plugins/platforms/ios/ios.pro @@ -1,7 +1,7 @@ TARGET = qios QT += core-private gui-private platformsupport-private -LIBS += -framework Foundation -framework UIKit -framework QuartzCore -framework AssetsLibrary -framework AudioToolbox +LIBS += -framework Foundation -framework UIKit -framework QuartzCore -framework AudioToolbox OBJECTIVE_SOURCES = \ plugin.mm \ @@ -19,15 +19,9 @@ OBJECTIVE_SOURCES = \ qiosglobal.mm \ qiosservices.mm \ quiview.mm \ - qiosclipboard.mm \ quiaccessibilityelement.mm \ qiosplatformaccessibility.mm \ - qiostextresponder.mm \ - qiosmenu.mm \ - qiosfileengineassetslibrary.mm \ - qiosfiledialog.mm \ - qiosmessagedialog.mm \ - qiostextinputoverlay.mm + qiostextresponder.mm HEADERS = \ qiosintegration.h \ @@ -44,16 +38,28 @@ HEADERS = \ qiosglobal.h \ qiosservices.h \ quiview.h \ - qiosclipboard.h \ quiaccessibilityelement.h \ qiosplatformaccessibility.h \ qiostextresponder.h \ - qiosmenu.h \ - qiosfileenginefactory.h \ - qiosfileengineassetslibrary.h \ - qiosfiledialog.h \ - qiosmessagedialog.h \ - qiostextinputoverlay.h + qiosfileenginefactory.h + +!tvos { + LIBS += -framework AssetsLibrary + OBJECTIVE_SOURCES += \ + qiosclipboard.mm \ + qiosmenu.mm \ + qiosfileengineassetslibrary.mm \ + qiosfiledialog.mm \ + qiosmessagedialog.mm \ + qiostextinputoverlay.mm + HEADERS += \ + qiosclipboard.h \ + qiosmenu.h \ + qiosfileengineassetslibrary.h \ + qiosfiledialog.h \ + qiosmessagedialog.h \ + qiostextinputoverlay.h +} OTHER_FILES = \ quiview_textinput.mm \ diff --git a/src/plugins/platforms/ios/plugin.mm b/src/plugins/platforms/ios/plugin.mm index b854dfdaa00..83760f2f39a 100644 --- a/src/plugins/platforms/ios/plugin.mm +++ b/src/plugins/platforms/ios/plugin.mm @@ -54,8 +54,10 @@ class QIOSIntegrationPlugin : public QPlatformIntegrationPlugin QPlatformIntegration * QIOSIntegrationPlugin::create(const QString& system, const QStringList& paramList) { Q_UNUSED(paramList); - if (!system.compare(QLatin1String("ios"), Qt::CaseInsensitive)) + if (!system.compare(QLatin1String("ios"), Qt::CaseInsensitive) + || !system.compare(QLatin1String("tvos"), Qt::CaseInsensitive)) { return new QIOSIntegration; + } return 0; } diff --git a/src/plugins/platforms/ios/qiosfileenginefactory.h b/src/plugins/platforms/ios/qiosfileenginefactory.h index b71fa64460c..87665ac6035 100644 --- a/src/plugins/platforms/ios/qiosfileenginefactory.h +++ b/src/plugins/platforms/ios/qiosfileenginefactory.h @@ -51,8 +51,12 @@ public: { static QLatin1String assetsScheme("assets-library:"); +#ifndef Q_OS_TVOS if (fileName.toLower().startsWith(assetsScheme)) return new QIOSFileEngineAssetsLibrary(fileName); +#else + Q_UNUSED(fileName); +#endif return 0; } diff --git a/src/plugins/platforms/ios/qiosglobal.h b/src/plugins/platforms/ios/qiosglobal.h index 0fe81ceb91e..c374dcfc6bf 100644 --- a/src/plugins/platforms/ios/qiosglobal.h +++ b/src/plugins/platforms/ios/qiosglobal.h @@ -66,8 +66,10 @@ QRectF fromCGRect(const CGRect &rect); CGPoint toCGPoint(const QPointF &point); QPointF fromCGPoint(const CGPoint &point); +#ifndef Q_OS_TVOS Qt::ScreenOrientation toQtScreenOrientation(UIDeviceOrientation uiDeviceOrientation); UIDeviceOrientation fromQtScreenOrientation(Qt::ScreenOrientation qtOrientation); +#endif int infoPlistValue(NSString* key, int defaultValue); diff --git a/src/plugins/platforms/ios/qiosglobal.mm b/src/plugins/platforms/ios/qiosglobal.mm index c2f3d6b9e17..57e86538ed1 100644 --- a/src/plugins/platforms/ios/qiosglobal.mm +++ b/src/plugins/platforms/ios/qiosglobal.mm @@ -78,6 +78,7 @@ QPointF fromCGPoint(const CGPoint &point) return QPointF(point.x, point.y); } +#ifndef Q_OS_TVOS Qt::ScreenOrientation toQtScreenOrientation(UIDeviceOrientation uiDeviceOrientation) { Qt::ScreenOrientation qtOrientation; @@ -124,6 +125,7 @@ UIDeviceOrientation fromQtScreenOrientation(Qt::ScreenOrientation qtOrientation) } return uiOrientation; } +#endif int infoPlistValue(NSString* key, int defaultValue) { diff --git a/src/plugins/platforms/ios/qiosinputcontext.mm b/src/plugins/platforms/ios/qiosinputcontext.mm index d553d16698b..20d1670681f 100644 --- a/src/plugins/platforms/ios/qiosinputcontext.mm +++ b/src/plugins/platforms/ios/qiosinputcontext.mm @@ -84,6 +84,7 @@ static QUIView *focusView() self.cancelsTouchesInView = NO; self.delaysTouchesEnded = NO; +#ifndef Q_OS_TVOS NSNotificationCenter *notificationCenter = [NSNotificationCenter defaultCenter]; [notificationCenter addObserver:self @@ -101,6 +102,7 @@ static QUIView *focusView() [notificationCenter addObserver:self selector:@selector(keyboardDidChangeFrame:) name:UIKeyboardDidChangeFrameNotification object:nil]; +#endif } return self; @@ -342,6 +344,9 @@ void QIOSInputContext::clearCurrentFocusObject() void QIOSInputContext::updateKeyboardState(NSNotification *notification) { +#ifdef Q_OS_TVOS + Q_UNUSED(notification); +#else static CGRect currentKeyboardRect = CGRectZero; KeyboardState previousState = m_keyboardState; @@ -395,6 +400,7 @@ void QIOSInputContext::updateKeyboardState(NSNotification *notification) emitAnimatingChanged(); if (m_keyboardState.keyboardRect != previousState.keyboardRect) emitKeyboardRectChanged(); +#endif } bool QIOSInputContext::isInputPanelVisible() const @@ -514,7 +520,11 @@ void QIOSInputContext::scroll(int y) if (keyboardScrollIsActive && !originalWindowLevels.contains(window)) originalWindowLevels.insert(window, window.windowLevel); +#ifndef Q_OS_TVOS UIWindowLevel windowLevelAdjustment = keyboardScrollIsActive ? UIWindowLevelStatusBar : 0; +#else + UIWindowLevel windowLevelAdjustment = 0; +#endif window.windowLevel = originalWindowLevels.value(window) + windowLevelAdjustment; if (!keyboardScrollIsActive) diff --git a/src/plugins/platforms/ios/qiosintegration.h b/src/plugins/platforms/ios/qiosintegration.h index a50d9aa5717..8009a37edb4 100644 --- a/src/plugins/platforms/ios/qiosintegration.h +++ b/src/plugins/platforms/ios/qiosintegration.h @@ -102,7 +102,9 @@ public: private: QPlatformFontDatabase *m_fontDatabase; +#ifndef Q_OS_TVOS QPlatformClipboard *m_clipboard; +#endif QPlatformInputContext *m_inputContext; QTouchDevice *m_touchDevice; QIOSApplicationState m_applicationState; diff --git a/src/plugins/platforms/ios/qiosintegration.mm b/src/plugins/platforms/ios/qiosintegration.mm index fa12d54b288..297b549ec25 100644 --- a/src/plugins/platforms/ios/qiosintegration.mm +++ b/src/plugins/platforms/ios/qiosintegration.mm @@ -45,7 +45,9 @@ #include "qiosscreen.h" #include "qiosplatformaccessibility.h" #include "qioscontext.h" +#ifndef Q_OS_TVOS #include "qiosclipboard.h" +#endif #include "qiosinputcontext.h" #include "qiostheme.h" #include "qiosservices.h" @@ -72,7 +74,9 @@ QIOSIntegration *QIOSIntegration::instance() QIOSIntegration::QIOSIntegration() : m_fontDatabase(new QCoreTextFontDatabase) +#ifndef Q_OS_TVOS , m_clipboard(new QIOSClipboard) +#endif , m_inputContext(0) , m_platformServices(new QIOSServices) , m_accessibility(0) @@ -127,8 +131,10 @@ QIOSIntegration::~QIOSIntegration() delete m_fontDatabase; m_fontDatabase = 0; +#ifndef Q_OS_TVOS delete m_clipboard; m_clipboard = 0; +#endif QMacInternalPasteboardMime::destroyMimeTypes(); delete m_inputContext; @@ -217,7 +223,11 @@ QPlatformFontDatabase * QIOSIntegration::fontDatabase() const QPlatformClipboard *QIOSIntegration::clipboard() const { +#ifndef Q_OS_TVOS return m_clipboard; +#else + return 0; +#endif } QPlatformInputContext *QIOSIntegration::inputContext() const diff --git a/src/plugins/platforms/ios/qiosscreen.mm b/src/plugins/platforms/ios/qiosscreen.mm index bfd22abaa43..285b90bcd1e 100644 --- a/src/plugins/platforms/ios/qiosscreen.mm +++ b/src/plugins/platforms/ios/qiosscreen.mm @@ -120,21 +120,25 @@ static QIOSScreen* qtPlatformScreenFor(UIScreen *uiScreen) self = [super init]; if (self) { m_screen = screen; +#ifndef Q_OS_TVOS [[UIDevice currentDevice] beginGeneratingDeviceOrientationNotifications]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(orientationChanged:) name:@"UIDeviceOrientationDidChangeNotification" object:nil]; +#endif } return self; } - (void)dealloc { +#ifndef Q_OS_TVOS [[UIDevice currentDevice] endGeneratingDeviceOrientationNotifications]; [[NSNotificationCenter defaultCenter] removeObserver:self name:@"UIDeviceOrientationDidChangeNotification" object:nil]; +#endif [super dealloc]; } @@ -228,8 +232,13 @@ void QIOSScreen::updateProperties() QRect previousAvailableGeometry = m_availableGeometry; m_geometry = fromCGRect(m_uiScreen.bounds).toRect(); +#ifndef Q_OS_TVOS m_availableGeometry = fromCGRect(m_uiScreen.applicationFrame).toRect(); +#else + m_availableGeometry = fromCGRect(m_uiScreen.bounds).toRect(); +#endif +#ifndef Q_OS_TVOS if (m_uiScreen == [UIScreen mainScreen]) { Qt::ScreenOrientation statusBarOrientation = toQtScreenOrientation(UIDeviceOrientation([UIApplication sharedApplication].statusBarOrientation)); @@ -257,6 +266,7 @@ void QIOSScreen::updateProperties() m_availableGeometry = transform.mapRect(m_availableGeometry); } } +#endif if (m_geometry != previousGeometry) { QRectF physicalGeometry; @@ -335,7 +345,7 @@ qreal QIOSScreen::devicePixelRatio() const Qt::ScreenOrientation QIOSScreen::nativeOrientation() const { CGRect nativeBounds = -#if QT_IOS_PLATFORM_SDK_EQUAL_OR_ABOVE(__IPHONE_8_0) +#if !defined(Q_OS_TVOS) && QT_IOS_PLATFORM_SDK_EQUAL_OR_ABOVE(__IPHONE_8_0) QSysInfo::MacintoshVersion >= QSysInfo::MV_IOS_8_0 ? m_uiScreen.nativeBounds : #endif m_uiScreen.bounds; @@ -348,6 +358,9 @@ Qt::ScreenOrientation QIOSScreen::nativeOrientation() const Qt::ScreenOrientation QIOSScreen::orientation() const { +#ifdef Q_OS_TVOS + return Qt::PrimaryOrientation; +#else // Auxiliary screens are always the same orientation as their primary orientation if (m_uiScreen != [UIScreen mainScreen]) return Qt::PrimaryOrientation; @@ -372,6 +385,7 @@ Qt::ScreenOrientation QIOSScreen::orientation() const } return toQtScreenOrientation(deviceOrientation); +#endif } void QIOSScreen::setOrientationUpdateMask(Qt::ScreenOrientations mask) diff --git a/src/plugins/platforms/ios/qiostextresponder.mm b/src/plugins/platforms/ios/qiostextresponder.mm index eb12739e987..ecc8d1ab1c6 100644 --- a/src/plugins/platforms/ios/qiostextresponder.mm +++ b/src/plugins/platforms/ios/qiostextresponder.mm @@ -896,6 +896,7 @@ // text instead of just guessing... } +#ifndef Q_OS_TVOS - (NSDictionary *)textStylingAtPosition:(UITextPosition *)position inDirection:(UITextStorageDirection)direction { Q_UNUSED(position); @@ -915,6 +916,7 @@ return [NSDictionary dictionary]; return [NSDictionary dictionaryWithObject:uifont forKey:UITextInputTextFontKey]; } +#endif - (NSDictionary *)markedTextStyle { diff --git a/src/plugins/platforms/ios/qiostheme.mm b/src/plugins/platforms/ios/qiostheme.mm index 486c146af9b..83a8176478e 100644 --- a/src/plugins/platforms/ios/qiostheme.mm +++ b/src/plugins/platforms/ios/qiostheme.mm @@ -51,9 +51,11 @@ #include <UIKit/UIFont.h> #include <UIKit/UIInterface.h> +#ifndef Q_OS_TVOS #include "qiosmenu.h" #include "qiosfiledialog.h" #include "qiosmessagedialog.h" +#endif QT_BEGIN_NAMESPACE @@ -80,12 +82,20 @@ const QPalette *QIOSTheme::palette(QPlatformTheme::Palette type) const QPlatformMenuItem* QIOSTheme::createPlatformMenuItem() const { +#ifdef Q_OS_TVOS + return 0; +#else return new QIOSMenuItem(); +#endif } QPlatformMenu* QIOSTheme::createPlatformMenu() const { +#ifdef Q_OS_TVOS + return 0; +#else return new QIOSMenu(); +#endif } bool QIOSTheme::usePlatformNativeDialog(QPlatformTheme::DialogType type) const @@ -102,12 +112,14 @@ bool QIOSTheme::usePlatformNativeDialog(QPlatformTheme::DialogType type) const QPlatformDialogHelper *QIOSTheme::createPlatformDialogHelper(QPlatformTheme::DialogType type) const { switch (type) { +#ifndef Q_OS_TVOS case FileDialog: return new QIOSFileDialog(); break; case MessageDialog: return new QIOSMessageDialog(); break; +#endif default: return 0; } diff --git a/src/plugins/platforms/ios/qiosviewcontroller.h b/src/plugins/platforms/ios/qiosviewcontroller.h index e97aeb32ed3..92c4e59d1af 100644 --- a/src/plugins/platforms/ios/qiosviewcontroller.h +++ b/src/plugins/platforms/ios/qiosviewcontroller.h @@ -46,12 +46,16 @@ class QIOSScreen; - (id)initWithQIOSScreen:(QIOSScreen *)screen; - (void)updateProperties; +#ifndef Q_OS_TVOS @property (nonatomic, assign) UIInterfaceOrientation lockedOrientation; +#endif // UIViewController @property (nonatomic, assign) BOOL prefersStatusBarHidden; +#ifndef Q_OS_TVOS @property (nonatomic, assign) UIStatusBarAnimation preferredStatusBarUpdateAnimation; @property (nonatomic, assign) UIStatusBarStyle preferredStatusBarStyle; +#endif @end diff --git a/src/plugins/platforms/ios/qiosviewcontroller.mm b/src/plugins/platforms/ios/qiosviewcontroller.mm index e975793d9c9..77b0716cabd 100644 --- a/src/plugins/platforms/ios/qiosviewcontroller.mm +++ b/src/plugins/platforms/ios/qiosviewcontroller.mm @@ -37,6 +37,7 @@ ** ****************************************************************************/ +#include "qiosglobal.h" #import "qiosviewcontroller.h" #include <QtCore/qscopedvaluerollback.h> @@ -253,13 +254,15 @@ [[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleBlackTranslucent]; #endif - self.lockedOrientation = UIInterfaceOrientationUnknown; self.changingOrientation = NO; +#ifndef Q_OS_TVOS + self.lockedOrientation = UIInterfaceOrientationUnknown; // Status bar may be initially hidden at startup through Info.plist self.prefersStatusBarHidden = infoPlistValue(@"UIStatusBarHidden", false); self.preferredStatusBarUpdateAnimation = UIStatusBarAnimationNone; self.preferredStatusBarStyle = UIStatusBarStyle(infoPlistValue(@"UIStatusBarStyle", UIStatusBarStyleDefault)); +#endif m_focusWindowChangeConnection = QObject::connect(qApp, &QGuiApplication::focusWindowChanged, [self]() { [self updateProperties]; @@ -284,6 +287,7 @@ { [super viewDidLoad]; +#ifndef Q_OS_TVOS NSNotificationCenter *center = [NSNotificationCenter defaultCenter]; [center addObserver:self selector:@selector(willChangeStatusBarFrame:) name:UIApplicationWillChangeStatusBarFrameNotification @@ -292,6 +296,7 @@ [center addObserver:self selector:@selector(didChangeStatusBarOrientation:) name:UIApplicationDidChangeStatusBarOrientationNotification object:[UIApplication sharedApplication]]; +#endif } - (void)viewDidUnload @@ -304,7 +309,11 @@ - (BOOL)shouldAutorotate { +#ifndef Q_OS_TVOS return m_screen && m_screen->uiScreen() == [UIScreen mainScreen] && !self.lockedOrientation; +#else + return NO; +#endif } #if QT_IOS_PLATFORM_SDK_EQUAL_OR_ABOVE(__IPHONE_6_0) @@ -436,6 +445,7 @@ // All decisions are based on the the top level window focusWindow = qt_window_private(focusWindow)->topLevelWindow(); +#ifndef Q_OS_TVOS UIApplication *uiApplication = [UIApplication sharedApplication]; // -------------- Status bar style and visbility --------------- @@ -513,6 +523,7 @@ [UIViewController attemptRotationToDeviceOrientation]; } } +#endif } @end diff --git a/src/plugins/platforms/ios/quiview.mm b/src/plugins/platforms/ios/quiview.mm index e38be683439..b199f281496 100644 --- a/src/plugins/platforms/ios/quiview.mm +++ b/src/plugins/platforms/ios/quiview.mm @@ -44,7 +44,9 @@ #include "qiosviewcontroller.h" #include "qiostextresponder.h" #include "qioswindow.h" +#ifndef Q_OS_TVOS #include "qiosmenu.h" +#endif #include <QtGui/private/qguiapplication_p.h> #include <QtGui/private/qwindow_p.h> @@ -78,7 +80,9 @@ if (isQtApplication()) self.hidden = YES; +#ifndef Q_OS_TVOS self.multipleTouchEnabled = YES; +#endif if (QIOSIntegration::instance()->debugWindowManagement()) { static CGFloat hue = 0.0; @@ -324,6 +328,7 @@ // Touch positions are expected to be in QScreen global coordinates, and // as we already have the QWindow positioned at the right place, we can // just map from the local view position to global coordinates. + // tvOS: all touches start at the center of the screen and move from there. QPoint localViewPosition = fromCGPoint([uiTouch locationInView:self]).toPoint(); QPoint globalScreenPosition = m_qioswindow->mapToGlobal(localViewPosition); @@ -439,14 +444,24 @@ - (BOOL)canPerformAction:(SEL)action withSender:(id)sender { +#ifndef Q_OS_TVOS // Check first if QIOSMenu should handle the action before continuing up the responder chain return [QIOSMenu::menuActionTarget() targetForAction:action withSender:sender] != 0; +#else + Q_UNUSED(action) + Q_UNUSED(sender) + return false; +#endif } - (id)forwardingTargetForSelector:(SEL)selector { Q_UNUSED(selector) +#ifndef Q_OS_TVOS return QIOSMenu::menuActionTarget(); +#else + return nil; +#endif } @end diff --git a/src/plugins/platforms/platforms.pro b/src/plugins/platforms/platforms.pro index cb3764f5df2..a63fc28a660 100644 --- a/src/plugins/platforms/platforms.pro +++ b/src/plugins/platforms/platforms.pro @@ -10,10 +10,8 @@ contains(QT_CONFIG, xcb) { SUBDIRS += xcb } -mac { - ios: SUBDIRS += ios - else: SUBDIRS += cocoa -} +uikit: SUBDIRS += ios +osx: SUBDIRS += cocoa win32:!winrt: SUBDIRS += windows winrt: SUBDIRS += winrt diff --git a/src/printsupport/kernel/qprint_p.h b/src/printsupport/kernel/qprint_p.h index ed9e8e272b6..199d8aef630 100644 --- a/src/printsupport/kernel/qprint_p.h +++ b/src/printsupport/kernel/qprint_p.h @@ -56,7 +56,7 @@ #include <QtCore/qstring.h> #include <QtCore/qlist.h> -#if (defined Q_OS_MAC && !defined Q_OS_IOS) || (defined Q_OS_UNIX && !defined QT_NO_CUPS) +#if (defined Q_OS_OSX) || (defined Q_OS_UNIX && !defined QT_NO_CUPS) #include <cups/ppd.h> // Use for type defs only, don't want to actually link in main module #endif @@ -244,7 +244,7 @@ public: return QByteArray(); } -#if (defined Q_OS_MAC && !defined Q_OS_IOS) || (defined Q_OS_UNIX && !defined QT_NO_CUPS) +#if (defined Q_OS_OSX) || (defined Q_OS_UNIX && !defined QT_NO_CUPS) // PPD utilities shared by CUPS and Mac plugins requiring CUPS headers // May turn into a proper internal QPpd class if enough shared between Mac and CUPS, diff --git a/src/testlib/qtestblacklist.cpp b/src/testlib/qtestblacklist.cpp index e891150330c..4435b509be7 100644 --- a/src/testlib/qtestblacklist.cpp +++ b/src/testlib/qtestblacklist.cpp @@ -86,6 +86,9 @@ static QSet<QByteArray> keywords() #ifdef Q_OS_IOS << "ios" #endif +#ifdef Q_OS_TVOS + << "tvos" +#endif #ifdef Q_OS_ANDROID << "android" #endif diff --git a/src/testlib/qtestcase.cpp b/src/testlib/qtestcase.cpp index 04f51cbb039..bf44049a0e3 100644 --- a/src/testlib/qtestcase.cpp +++ b/src/testlib/qtestcase.cpp @@ -1378,7 +1378,9 @@ FatalSignalHandler::FatalSignalHandler() act.sa_flags = SA_RESETHAND; #endif -#ifdef SA_ONSTACK +// tvOS/watchOS both define SA_ONSTACK (in sys/signal.h) but mark sigaltstack() as +// unavailable (__WATCHOS_PROHIBITED __TVOS_PROHIBITED in signal.h) +#if defined(SA_ONSTACK) && !defined(Q_OS_TVOS) // Let the signal handlers use an alternate stack // This is necessary if SIGSEGV is to catch a stack overflow # if defined(Q_CC_GNU) && defined(Q_OF_ELF) diff --git a/src/testlib/qxctestlogger.mm b/src/testlib/qxctestlogger.mm index c50b50eb065..ffabe88db21 100644 --- a/src/testlib/qxctestlogger.mm +++ b/src/testlib/qxctestlogger.mm @@ -191,7 +191,7 @@ private: name:[NSString stringWithFormat:@"%@DidFinishLaunchingNotification", #if defined(Q_OS_OSX) @"NSApplication" - #elif defined(Q_OS_IOS) + #else @"UIApplication" #endif ] diff --git a/src/tools/bootstrap/bootstrap.pro b/src/tools/bootstrap/bootstrap.pro index 47aa8865683..1bf7a47efbc 100644 --- a/src/tools/bootstrap/bootstrap.pro +++ b/src/tools/bootstrap/bootstrap.pro @@ -118,7 +118,7 @@ mac { LIBS += -framework Foundation osx: LIBS_PRIVATE += -framework CoreServices - ios: LIBS_PRIVATE += -framework UIKit + uikit: LIBS_PRIVATE += -framework UIKit } macx { diff --git a/src/widgets/kernel/qwidget.cpp b/src/widgets/kernel/qwidget.cpp index 217a075b075..495af34c605 100644 --- a/src/widgets/kernel/qwidget.cpp +++ b/src/widgets/kernel/qwidget.cpp @@ -9525,7 +9525,7 @@ void QWidget::focusOutEvent(QFocusEvent *) if (focusPolicy() != Qt::NoFocus || !isWindow()) update(); -#ifndef Q_OS_IOS +#if !defined(QT_PLATFORM_UIKIT) // FIXME: revisit autoSIP logic, QTBUG-42906 if (qApp->autoSipEnabled() && testAttribute(Qt::WA_InputMethodEnabled)) QGuiApplication::inputMethod()->hide(); diff --git a/src/widgets/styles/qfusionstyle.cpp b/src/widgets/styles/qfusionstyle.cpp index 8a768443d13..1ac28f548b4 100644 --- a/src/widgets/styles/qfusionstyle.cpp +++ b/src/widgets/styles/qfusionstyle.cpp @@ -3624,7 +3624,7 @@ int QFusionStyle::styleHint(StyleHint hint, const QStyleOption *option, const QW case SH_Menu_SupportsSections: return 1; -#if defined(Q_OS_IOS) +#if defined(QT_PLATFORM_UIKIT) case SH_ComboBox_UseNativePopup: return 1; #endif diff --git a/tests/auto/auto.pro b/tests/auto/auto.pro index c40e3d11405..8a3c39e9b1f 100644 --- a/tests/auto/auto.pro +++ b/tests/auto/auto.pro @@ -19,7 +19,7 @@ SUBDIRS += \ installed_cmake.depends = cmake -ios: SUBDIRS = corelib gui +uikit: SUBDIRS = corelib gui wince: SUBDIRS -= printsupport cross_compile: SUBDIRS -= tools cmake installed_cmake diff --git a/tests/auto/corelib/corelib.pro b/tests/auto/corelib/corelib.pro index 4d88b04828e..169579bd6b9 100644 --- a/tests/auto/corelib/corelib.pro +++ b/tests/auto/corelib/corelib.pro @@ -3,7 +3,7 @@ TEMPLATE=subdirs SUBDIRS = \ kernel -!ios: SUBDIRS += \ +!uikit: SUBDIRS += \ animation \ codecs \ global \ diff --git a/tests/auto/corelib/io/qlockfile/tst_qlockfile.cpp b/tests/auto/corelib/io/qlockfile/tst_qlockfile.cpp index afa3620b1a9..b21701f3414 100644 --- a/tests/auto/corelib/io/qlockfile/tst_qlockfile.cpp +++ b/tests/auto/corelib/io/qlockfile/tst_qlockfile.cpp @@ -281,7 +281,7 @@ void tst_QLockFile::staleLockFromCrashedProcessReusedPid() { #if defined(QT_NO_PROCESS) QSKIP("This test requires QProcess support"); -#elif defined(Q_OS_WINRT) || defined(Q_OS_IOS) +#elif defined(Q_OS_WINRT) || defined(QT_PLATFORM_UIKIT) QSKIP("We cannot retrieve information about other processes on this platform."); #else const QString fileName = dir.path() + "/staleLockFromCrashedProcessReusedPid"; diff --git a/tests/auto/corelib/kernel/kernel.pro b/tests/auto/corelib/kernel/kernel.pro index f85c39e9e67..397d281c570 100644 --- a/tests/auto/corelib/kernel/kernel.pro +++ b/tests/auto/corelib/kernel/kernel.pro @@ -38,4 +38,4 @@ SUBDIRS=\ # This test is only applicable on Windows !win32*|winrt: SUBDIRS -= qwineventnotifier -android|ios: SUBDIRS -= qsharedmemory qsystemsemaphore +android|uikit: SUBDIRS -= qsharedmemory qsystemsemaphore diff --git a/tests/auto/gui/gui.pro b/tests/auto/gui/gui.pro index d3393663ed9..d6aa5e01ae8 100644 --- a/tests/auto/gui/gui.pro +++ b/tests/auto/gui/gui.pro @@ -3,7 +3,7 @@ TEMPLATE=subdirs SUBDIRS = \ kernel -!ios: SUBDIRS += \ +!uikit: SUBDIRS += \ image \ math3d \ painting \ diff --git a/tests/auto/widgets/kernel/qwidget_window/tst_qwidget_window.cpp b/tests/auto/widgets/kernel/qwidget_window/tst_qwidget_window.cpp index 200c8a6ced4..301ddf441e0 100644 --- a/tests/auto/widgets/kernel/qwidget_window/tst_qwidget_window.cpp +++ b/tests/auto/widgets/kernel/qwidget_window/tst_qwidget_window.cpp @@ -330,8 +330,9 @@ void tst_QWidget_window::tst_showWithoutActivating() QSKIP("Cocoa: This fails. Figure out why."); else if (platformName != QStringLiteral("xcb") && platformName != QStringLiteral("windows") - && platformName != QStringLiteral("ios")) - QSKIP("Qt::WA_ShowWithoutActivating is currently supported only on xcb, windows, and ios platforms."); + && platformName != QStringLiteral("ios") + && platformName != QStringLiteral("tvos")) + QSKIP("Qt::WA_ShowWithoutActivating is currently supported only on xcb, windows, and ios/tvos platforms."); QWidget w1; w1.setAttribute(Qt::WA_ShowWithoutActivating); diff --git a/tests/auto/widgets/styles/styles.pro b/tests/auto/widgets/styles/styles.pro index b679b705377..952a659eaa6 100644 --- a/tests/auto/widgets/styles/styles.pro +++ b/tests/auto/widgets/styles/styles.pro @@ -12,5 +12,5 @@ SUBDIRS=\ !mac:SUBDIRS -= \ qmacstyle \ -ios|android|qnx: SUBDIRS -= \ +uikit|android|qnx: SUBDIRS -= \ qstylesheetstyle \ diff --git a/tests/tests.pro b/tests/tests.pro index 79bee02b651..22f606bbc6f 100644 --- a/tests/tests.pro +++ b/tests/tests.pro @@ -4,4 +4,4 @@ SUBDIRS = auto # benchmarks in debug mode is rarely sensible # benchmarks are not sensible for code coverage (here with tool testcocoon) -!ios:!testcocoon:contains(QT_CONFIG,release):SUBDIRS += benchmarks +!uikit:!testcocoon:contains(QT_CONFIG,release):SUBDIRS += benchmarks |