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ø <tor.arne.vestbo@theqtcompany.com>
This commit is contained in:
Mike Krus 2016-02-16 14:29:59 +00:00 committed by Jake Petroules
parent 26d44fce3d
commit 03e9c6f4a6
87 changed files with 463 additions and 144 deletions

21
configure vendored
View File

@ -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}"

View File

@ -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)

21
mkspecs/common/tvos.conf Normal file
View File

@ -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)

11
mkspecs/common/uikit.conf Normal file
View File

@ -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)

View File

@ -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

View File

@ -64,7 +64,7 @@ CONFIG = qt_build_extra $$CONFIG
cross_compile: \
CONFIG += force_bootstrap
android|ios|winrt: \
android|uikit|winrt: \
CONFIG += builtin_testdata
CONFIG += \

View File

@ -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}

View File

@ -1,6 +1,6 @@
defineReplace(qtPlatformTargetSuffix) {
ios:CONFIG(simulator, simulator|device): \
uikit:CONFIG(simulator, simulator|device): \
suffix = _$${simulator.sdk}
else: \
suffix =

View File

@ -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

View File

@ -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
}
}

View File

@ -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)

View File

@ -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
}

View File

@ -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

View File

@ -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

View File

@ -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,

View File

@ -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)

View File

@ -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

View File

@ -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>

View File

@ -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>

View File

@ -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)

View File

@ -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"

View File

@ -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

View File

@ -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";

View File

@ -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,

View File

@ -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 \

View File

@ -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

View File

@ -58,8 +58,8 @@ win32 {
!winrt: LIBS_PRIVATE += -lwinmm
}
mac|darwin {
!ios {
darwin {
osx {
LIBS_PRIVATE += -framework ApplicationServices
LIBS_PRIVATE += -framework CoreServices
}

View File

@ -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;

View File

@ -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

View File

@ -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;

View File

@ -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),

View File

@ -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 {

View File

@ -61,7 +61,7 @@
#include <CoreServices/CoreServices.h>
#endif
#ifdef Q_OS_IOS
#if defined(QT_PLATFORM_UIKIT)
#include <MobileCoreServices/MobileCoreServices.h>
#endif

View File

@ -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);

View File

@ -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;

View File

@ -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)

View File

@ -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, '=');

View File

@ -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

View File

@ -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

View File

@ -111,7 +111,7 @@ mac {
osx: LIBS_PRIVATE += -framework CoreServices -framework AppKit
ios {
uikit {
# We need UIKit for UIDevice
LIBS_PRIVATE += -framework UIKit
}

View File

@ -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;

View File

@ -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[])
{

View File

@ -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);
}
/*!

View File

@ -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).

View File

@ -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

View File

@ -74,7 +74,7 @@ SOURCES += \
mac: LIBS_PRIVATE += -framework Security
ios {
uikit {
HEADERS += \
access/qnetworkreplynsurlconnectionimpl_p.h

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -43,7 +43,7 @@
#import <AppKit/AppKit.h>
#endif
#if defined(Q_OS_IOS)
#if defined(QT_PLATFORM_UIKIT)
#import <UIKit/UIKit.h>
#endif

View File

@ -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,

View File

@ -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);

View File

@ -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>

View File

@ -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

View File

@ -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

View File

@ -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)

View File

@ -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 \

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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);

View File

@ -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)
{

View File

@ -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)

View File

@ -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;

View File

@ -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

View File

@ -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)

View File

@ -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
{

View File

@ -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;
}

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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,

View File

@ -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

View File

@ -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)

View File

@ -191,7 +191,7 @@ private:
name:[NSString stringWithFormat:@"%@DidFinishLaunchingNotification",
#if defined(Q_OS_OSX)
@"NSApplication"
#elif defined(Q_OS_IOS)
#else
@"UIApplication"
#endif
]

View File

@ -118,7 +118,7 @@ mac {
LIBS += -framework Foundation
osx: LIBS_PRIVATE += -framework CoreServices
ios: LIBS_PRIVATE += -framework UIKit
uikit: LIBS_PRIVATE += -framework UIKit
}
macx {

View File

@ -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();

View File

@ -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

View File

@ -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

View File

@ -3,7 +3,7 @@ TEMPLATE=subdirs
SUBDIRS = \
kernel
!ios: SUBDIRS += \
!uikit: SUBDIRS += \
animation \
codecs \
global \

View File

@ -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";

View File

@ -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

View File

@ -3,7 +3,7 @@ TEMPLATE=subdirs
SUBDIRS = \
kernel
!ios: SUBDIRS += \
!uikit: SUBDIRS += \
image \
math3d \
painting \

View File

@ -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);

View File

@ -12,5 +12,5 @@ SUBDIRS=\
!mac:SUBDIRS -= \
qmacstyle \
ios|android|qnx: SUBDIRS -= \
uikit|android|qnx: SUBDIRS -= \
qstylesheetstyle \

View File

@ -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