Add support for Apple watchOS

Change-Id: I3f9e00569458a463af2eaa5a3a16a6afd1e9c1ea
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@theqtcompany.com>
This commit is contained in:
Jake Petroules 2016-05-19 23:01:59 -07:00
parent 2f108fafe9
commit 57378a108c
41 changed files with 266 additions and 67 deletions

13
configure vendored
View File

@ -279,6 +279,12 @@ macSDKify()
appletvsimulator*) appletvsimulator*)
version_min_flag="-mtvos-simulator-version-min=$(getSingleQMakeVariable QMAKE_TVOS_DEPLOYMENT_TARGET "$1")" version_min_flag="-mtvos-simulator-version-min=$(getSingleQMakeVariable QMAKE_TVOS_DEPLOYMENT_TARGET "$1")"
;; ;;
watchos*)
version_min_flag="-mwatchos-version-min=$(getSingleQMakeVariable QMAKE_WATCHOS_DEPLOYMENT_TARGET "$1")"
;;
watchsimulator*)
version_min_flag="-mwatchos-simulator-version-min=$(getSingleQMakeVariable QMAKE_WATCHOS_DEPLOYMENT_TARGET "$1")"
;;
*) *)
;; ;;
esac esac
@ -459,9 +465,10 @@ CFG_RELEASE_TOOLS=no
CFG_ANDROID_STYLE_ASSETS=yes CFG_ANDROID_STYLE_ASSETS=yes
XPLATFORM= # This seems to be the QMAKESPEC, like "linux-g++" XPLATFORM= # This seems to be the QMAKESPEC, like "linux-g++"
XPLATFORM_MAC=no # Whether target platform is OS X, iOS or tvOS XPLATFORM_MAC=no # Whether target platform is macOS, iOS, tvOS, or watchOS
XPLATFORM_IOS=no # Whether target platform is iOS XPLATFORM_IOS=no # Whether target platform is iOS
XPLATFORM_TVOS=no # Whether target platform is tvOS XPLATFORM_TVOS=no # Whether target platform is tvOS
XPLATFORM_WATCHOS=no # Whether target platform is watchOS
XPLATFORM_ANDROID=no XPLATFORM_ANDROID=no
XPLATFORM_MINGW=no # Whether target platform is MinGW (win32-g++*) XPLATFORM_MINGW=no # Whether target platform is MinGW (win32-g++*)
PLATFORM=$QMAKESPEC PLATFORM=$QMAKESPEC
@ -995,6 +1002,10 @@ case "$XPLATFORM" in
XPLATFORM_MAC=yes XPLATFORM_MAC=yes
XPLATFORM_TVOS=yes XPLATFORM_TVOS=yes
;; ;;
*watchos*)
XPLATFORM_MAC=yes
XPLATFORM_WATCHOS=yes
;;
*macx*) *macx*)
XPLATFORM_MAC=yes XPLATFORM_MAC=yes
;; ;;

View File

@ -2314,7 +2314,7 @@
"description": "OpenGL ES 2.0", "description": "OpenGL ES 2.0",
"enable": "input.opengl == 'es2'", "enable": "input.opengl == 'es2'",
"disable": "input.opengl == 'desktop' || input.opengl == 'dynamic' || input.opengl == 'no'", "disable": "input.opengl == 'desktop' || input.opengl == 'dynamic' || input.opengl == 'no'",
"condition": "config.win32 || (!features.opengl-desktop && libs.opengl_es2)", "condition": "config.win32 || (!config.watchos && !features.opengl-desktop && libs.opengl_es2)",
"output": [ "output": [
"publicFeature", "publicFeature",
"publicQtConfig", "publicQtConfig",
@ -2343,7 +2343,7 @@
"enable": "input.opengl == 'desktop'", "enable": "input.opengl == 'desktop'",
"disable": "input.opengl == 'es2' || input.opengl == 'dynamic' || input.opengl == 'no'", "disable": "input.opengl == 'es2' || input.opengl == 'dynamic' || input.opengl == 'no'",
"condition": "(config.win32 && !config.winrt && !features.opengles2 && (config.msvc || libs.opengl)) "condition": "(config.win32 && !config.winrt && !features.opengles2 && (config.msvc || libs.opengl))
|| (!config.win32 && libs.opengl)" || (!config.watchos && !config.win32 && libs.opengl)"
}, },
"opengl-dynamic": { "opengl-dynamic": {
"description": "Dynamic OpenGL", "description": "Dynamic OpenGL",
@ -2647,7 +2647,7 @@ Specify -opengl desktop to use regular OpenGL."
}, },
{ {
"type": "error", "type": "error",
"condition": "features.gui && input.opengl != 'no' && !features.opengl-desktop && !features.opengles2 && !features.opengl-dynamic", "condition": "features.gui && !config.watchos && input.opengl != 'no' && !features.opengl-desktop && !features.opengles2 && !features.opengl-dynamic",
"message": "The OpenGL functionality tests failed! "message": "The OpenGL functionality tests failed!
You might need to modify the include and library search paths by editing QMAKE_INCDIR_OPENGL[_ES2], You might need to modify the include and library search paths by editing QMAKE_INCDIR_OPENGL[_ES2],
QMAKE_LIBDIR_OPENGL[_ES2] and QMAKE_LIBS_OPENGL[_ES2] in the mkspec for your platform." QMAKE_LIBDIR_OPENGL[_ES2] and QMAKE_LIBS_OPENGL[_ES2] in the mkspec for your platform."

View File

@ -204,9 +204,9 @@ defineTest(qtConfTest_neon) {
defineTest(qtConfTest_skipModules) { defineTest(qtConfTest_skipModules) {
skip = skip =
ios|tvos { uikit {
skip += qtdoc qtmacextras qtserialport qtwebkit qtwebkit-examples skip += qtdoc qtmacextras qtserialport qtwebkit qtwebkit-examples
tvos: skip += qtscript !ios: skip += qtscript
} }
for (m, config.input.skip) { for (m, config.input.skip) {

View File

@ -21,7 +21,7 @@ qtHaveModule(widgets) {
load(qfeatures) load(qfeatures)
!contains(QT_DISABLED_FEATURES, bearermanagement) { !contains(QT_DISABLED_FEATURES, bearermanagement) {
# no QProcess # no QProcess
!vxworks:!qnx:!winrt:!integrity: SUBDIRS += network-chat !vxworks:!qnx:!winrt:!integrity:!uikit: SUBDIRS += network-chat
SUBDIRS += \ SUBDIRS += \
bearermonitor \ bearermonitor \

View File

@ -13,11 +13,16 @@ SOURCES = main.cpp \
paintarea.cpp \ paintarea.cpp \
plugindialog.cpp plugindialog.cpp
LIBS = -L../plugins -lpnp_basictools LIBS = -L../plugins
if(!debug_and_release|build_pass):CONFIG(debug, debug|release) { macx-xcode:qtConfig(simulator_and_device) {
LIBS += -lpnp_basictools$($${QMAKE_XCODE_LIBRARY_PLATFORM_SUFFIX_SETTING})$($${QMAKE_XCODE_LIBRARY_SUFFIX_SETTING})
} else {
LIBS += -lpnp_basictools
if(!debug_and_release|build_pass):CONFIG(debug, debug|release) {
mac:LIBS = $$member(LIBS, 0) $$member(LIBS, 1)_debug mac:LIBS = $$member(LIBS, 0) $$member(LIBS, 1)_debug
win32:LIBS = $$member(LIBS, 0) $$member(LIBS, 1)d win32:LIBS = $$member(LIBS, 0) $$member(LIBS, 1)d
}
} }
#! [0] #! [0]

View File

@ -14,3 +14,4 @@ target.path = $$[QT_INSTALL_EXAMPLES]/widgets/tools/plugandpaint/plugins
INSTALLS += target INSTALLS += target
CONFIG += install_ok # Do not cargo-cult this! CONFIG += install_ok # Do not cargo-cult this!
uikit: CONFIG += debug_and_release simulator_and_device

View File

@ -14,3 +14,4 @@ target.path = $$[QT_INSTALL_EXAMPLES]/widgets/tools/plugandpaint/plugins
INSTALLS += target INSTALLS += target
CONFIG += install_ok # Do not cargo-cult this! CONFIG += install_ok # Do not cargo-cult this!
uikit: CONFIG += debug_and_release simulator_and_device

View File

@ -0,0 +1,21 @@
#
# qmake common configuration for watchOS
#
QMAKE_PLATFORM += watchos
QMAKE_MAC_SDK = watchos
CONFIG += bitcode
simulator.sdk = watchsimulator
simulator.target = simulator
simulator.dir_affix = $${simulator.sdk}
simulator.CONFIG = apple$${simulator.sdk}
simulator.deployment_identifier = watchos-simulator
device.sdk = watchos
device.target = device
device.dir_affix = $${device.sdk}
device.CONFIG = apple$${device.sdk}
device.deployment_identifier = $${device.sdk}
include(uikit.conf)

View File

@ -62,6 +62,7 @@ for(tool, $$list(QMAKE_CC QMAKE_CXX QMAKE_FIX_RPATH QMAKE_AR QMAKE_RANLIB QMAKE_
version_identifier = $$device.deployment_identifier version_identifier = $$device.deployment_identifier
ios: deployment_target = $$QMAKE_IOS_DEPLOYMENT_TARGET ios: deployment_target = $$QMAKE_IOS_DEPLOYMENT_TARGET
tvos: deployment_target = $$QMAKE_TVOS_DEPLOYMENT_TARGET tvos: deployment_target = $$QMAKE_TVOS_DEPLOYMENT_TARGET
watchos: deployment_target = $$QMAKE_WATCHOS_DEPLOYMENT_TARGET
} else: osx { } else: osx {
version_identifier = macosx version_identifier = macosx
deployment_target = $$QMAKE_MACOSX_DEPLOYMENT_TARGET deployment_target = $$QMAKE_MACOSX_DEPLOYMENT_TARGET

View File

@ -22,6 +22,7 @@ macx-xcode {
device_family.name = TARGETED_DEVICE_FAMILY device_family.name = TARGETED_DEVICE_FAMILY
ios: 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 tvos: device_family.value = $$QMAKE_TVOS_TARGETED_DEVICE_FAMILY
watchos: device_family.value = $$QMAKE_WATCHOS_TARGETED_DEVICE_FAMILY
QMAKE_MAC_XCODE_SETTINGS += device_family QMAKE_MAC_XCODE_SETTINGS += device_family
ios { ios {
@ -77,6 +78,11 @@ macx-xcode {
arch_simulator.value = $$QMAKE_TVOS_SIMULATOR_ARCHS arch_simulator.value = $$QMAKE_TVOS_SIMULATOR_ARCHS
QMAKE_XCODE_ARCHS = $$QMAKE_TVOS_DEVICE_ARCHS $$QMAKE_TVOS_SIMULATOR_ARCHS QMAKE_XCODE_ARCHS = $$QMAKE_TVOS_DEVICE_ARCHS $$QMAKE_TVOS_SIMULATOR_ARCHS
} }
watchos {
arch_device.value = $$QMAKE_WATCHOS_DEVICE_ARCHS
arch_simulator.value = $$QMAKE_WATCHOS_SIMULATOR_ARCHS
QMAKE_XCODE_ARCHS = $$QMAKE_WATCHOS_DEVICE_ARCHS $$QMAKE_WATCHOS_SIMULATOR_ARCHS
}
QMAKE_MAC_XCODE_SETTINGS += arch_device arch_simulator QMAKE_MAC_XCODE_SETTINGS += arch_device arch_simulator
@ -89,9 +95,11 @@ macx-xcode {
contains(QT_ARCH, arm.*) { contains(QT_ARCH, arm.*) {
ios: VALID_ARCHS = $$QMAKE_IOS_DEVICE_ARCHS ios: VALID_ARCHS = $$QMAKE_IOS_DEVICE_ARCHS
tvos: VALID_ARCHS = $$QMAKE_TVOS_DEVICE_ARCHS tvos: VALID_ARCHS = $$QMAKE_TVOS_DEVICE_ARCHS
watchos: VALID_ARCHS = $$QMAKE_WATCHOS_DEVICE_ARCHS
} else { } else {
ios: VALID_ARCHS = $$QMAKE_IOS_SIMULATOR_ARCHS ios: VALID_ARCHS = $$QMAKE_IOS_SIMULATOR_ARCHS
tvos: VALID_ARCHS = $$QMAKE_TVOS_SIMULATOR_ARCHS tvos: VALID_ARCHS = $$QMAKE_TVOS_SIMULATOR_ARCHS
watchos: VALID_ARCHS = $$QMAKE_WATCHOS_SIMULATOR_ARCHS
} }
single_arch: VALID_ARCHS = $$first(VALID_ARCHS) single_arch: VALID_ARCHS = $$first(VALID_ARCHS)

View File

@ -11,7 +11,7 @@ lessThan(QMAKE_XCODE_VERSION, "4.3"): \
build_pass:simulator { build_pass:simulator {
# For a simulator_and_device build all the config tests # For a simulator_and_device build all the config tests
# are based on the iPhoneOS ARM SDK, but we know that the simulator # are based on the iPhoneOS/WatchOS ARM SDK, but we know that the simulator
# is i386 and that we support SSE/SSE2. # is i386 and that we support SSE/SSE2.
QT_ARCH = i386 QT_ARCH = i386
QT_CPU_FEATURES.i386 = sse sse2 QT_CPU_FEATURES.i386 = sse sse2

View File

@ -60,6 +60,10 @@ xcodebuild test -scheme $2 -destination 'id=0' -destination-timeout 1 2>&1| sed
echo "HARDWARE_DEVICES += $id" echo "HARDWARE_DEVICES += $id"
elif [ "$val" = "tvOS Simulator" -a "$id" != "$booted_simulator" ]; then elif [ "$val" = "tvOS Simulator" -a "$id" != "$booted_simulator" ]; then
echo "SIMULATOR_DEVICES += $id" echo "SIMULATOR_DEVICES += $id"
elif [ "$val" = "watchOS" ]; then
echo "HARDWARE_DEVICES += $id"
elif [ "$val" = "watchOS Simulator" -a "$id" != "$booted_simulator" ]; then
echo "SIMULATOR_DEVICES += $id"
fi fi
fi fi
done done

View File

@ -1,6 +1,6 @@
qt_depends = $$resolve_depends(QT, "QT.") qt_depends = $$resolve_depends(QT, "QT.")
equals(TEMPLATE, app):contains(qt_depends, gui(-private)?) { !watchos:equals(TEMPLATE, app):contains(qt_depends, gui(-private)?) {
LIBS *= -L$$[QT_INSTALL_PLUGINS/get]/platforms LIBS *= -L$$[QT_INSTALL_PLUGINS/get]/platforms
lib_name = qios lib_name = qios

View File

@ -10,6 +10,7 @@ isEmpty(QT_ARCH) {
} else { # Simulator } else { # Simulator
ios: QT_ARCH = i386 ios: QT_ARCH = i386
tvos: QT_ARCH = x64 tvos: QT_ARCH = x64
watchos: QT_ARCH = i386
} }
# Prevent the arch/config tests from building as multi-arch binaries, # Prevent the arch/config tests from building as multi-arch binaries,

View File

@ -43,6 +43,10 @@ tvos {
DEVICE_FILTER = "Apple TV" DEVICE_FILTER = "Apple TV"
GENERIC_DEVICE_DESTINATION = "generic/platform=tvOS" GENERIC_DEVICE_DESTINATION = "generic/platform=tvOS"
} }
watchos {
DEVICE_FILTER = "Apple Watch"
GENERIC_DEVICE_DESTINATION = "generic/platform=watchOS"
}
QMAKE_EXTRA_VARIABLES += DEVICE_SDK SIMULATOR_SDK DEVICE_FILTER GENERIC_DEVICE_DESTINATION QMAKE_EXTRA_VARIABLES += DEVICE_SDK SIMULATOR_SDK DEVICE_FILTER GENERIC_DEVICE_DESTINATION
QMAKE_EXTRA_INCLUDES += $$shell_quote($$PWD/xcodebuild.mk) QMAKE_EXTRA_INCLUDES += $$shell_quote($$PWD/xcodebuild.mk)

View File

@ -0,0 +1,35 @@
<?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>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationPortraitUpsideDown</string>
</array>
<key>WKWatchKitApp</key>
<true/>
<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-watchos-clang
#
QMAKE_WATCHOS_DEPLOYMENT_TARGET = 2.2
INCLUDEPATH += $$PWD/watchos
QMAKE_WATCHOS_TARGETED_DEVICE_FAMILY = 4
QMAKE_WATCHOS_DEVICE_ARCHS = armv7k
QMAKE_WATCHOS_SIMULATOR_ARCHS = i386
include(../common/watchos.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) 2016 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 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. variables that only take effect on the platforms where they are relevant.
\section1 \macos, iOS and tvOS \section1 \macos, iOS, tvOS, and watchOS
Features specific to these platforms include support for creating universal Features specific to these platforms include support for creating universal
binaries, frameworks and bundles. binaries, frameworks and bundles.
@ -1439,7 +1439,7 @@
\target QMAKE_BUNDLE_DATA \target QMAKE_BUNDLE_DATA
\section1 QMAKE_BUNDLE_DATA \section1 QMAKE_BUNDLE_DATA
\note This variable is used on \macos, iOS and tvOS only. \note This variable is used on \macos, iOS, tvOS, and watchOS only.
Specifies the data that will be installed with a library Specifies the data that will be installed with a library
bundle, and is often used to specify a collection of header files. bundle, and is often used to specify a collection of header files.
@ -1461,7 +1461,7 @@
\section1 QMAKE_BUNDLE_EXTENSION \section1 QMAKE_BUNDLE_EXTENSION
\note This variable is used on \macos, iOS and tvOS only. \note This variable is used on \macos, iOS, tvOS, and watchOS only.
Specifies the extension to be used for library bundles. Specifies the extension to be used for library bundles.
This allows frameworks to be created with custom extensions instead of the This allows frameworks to be created with custom extensions instead of the
@ -1695,7 +1695,7 @@
\section1 QMAKE_FRAMEWORK_BUNDLE_NAME \section1 QMAKE_FRAMEWORK_BUNDLE_NAME
\note This variable is used on \macos, iOS and tvOS only. \note This variable is used on \macos, iOS, tvOS, and watchOS only.
In a framework project, this variable contains the name to be used for the In a framework project, this variable contains the name to be used for the
framework that is built. framework that is built.
@ -1709,9 +1709,9 @@
\target QMAKE_FRAMEWORK_VERSION \target QMAKE_FRAMEWORK_VERSION
\section1 QMAKE_FRAMEWORK_VERSION \section1 QMAKE_FRAMEWORK_VERSION
\note This variable is used on \macos, iOS and tvOS only. \note This variable is used on \macos, iOS, tvOS, and watchOS only.
For projects where the build target is an \macos, iOS or tvOS framework, this For projects where the build target is an \macos, iOS, tvOS, or watchOS framework, this
variable is used to specify the version number that will be applied to the variable is used to specify the version number that will be applied to the
framework that is built. framework that is built.
@ -1804,10 +1804,10 @@
\target QMAKE_INFO_PLIST \target QMAKE_INFO_PLIST
\section1 QMAKE_INFO_PLIST \section1 QMAKE_INFO_PLIST
\note This variable is used on \macos, iOS and tvOS platforms only. \note This variable is used on \macos, iOS, tvOS, and watchOS platforms only.
Specifies the name of the property list file, \c{.plist}, you Specifies the name of the property list file, \c{.plist}, you
would like to include in your \macos, iOS and tvOS application bundle. would like to include in your \macos, iOS, tvOS, and watchOS application bundle.
In the \c{.plist} file, you can define some variables, e.g., @EXECUTABLE@, In the \c{.plist} file, you can define some variables, e.g., @EXECUTABLE@,
which qmake will replace with the actual executable name. Other variables which qmake will replace with the actual executable name. Other variables
@ -2164,8 +2164,8 @@
If defined, the value of this variable is used as a path to be prepended to If defined, the value of this variable is used as a path to be prepended to
the built shared library's \c SONAME identifier. The \c SONAME is the 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. 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 In general this reference may be a library name or full library path. On \macos,
X, iOS and tvOS, the path may be specified relatively using the following iOS, tvOS, and watchOS, the path may be specified relatively using the following
placeholders: placeholders:
\table \table
@ -4428,7 +4428,7 @@
\li nmake \li nmake
\li Visual Studio projects (VS 2008 and later) \li Visual Studio projects (VS 2008 and later)
\endlist \endlist
\li \macos, iOS and tvOS \li \macos, iOS, tvOS, and watchOS
\list \list
\li Makefile \li Makefile
\li Xcode \li Xcode

View File

@ -1537,6 +1537,8 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t)
t << "\t\t\t\t" << writeSettings("IPHONEOS_DEPLOYMENT_TARGET", project->first("QMAKE_IOS_DEPLOYMENT_TARGET")) << ";\n"; t << "\t\t\t\t" << writeSettings("IPHONEOS_DEPLOYMENT_TARGET", project->first("QMAKE_IOS_DEPLOYMENT_TARGET")) << ";\n";
if (!project->isEmpty("QMAKE_TVOS_DEPLOYMENT_TARGET")) if (!project->isEmpty("QMAKE_TVOS_DEPLOYMENT_TARGET"))
t << "\t\t\t\t" << writeSettings("APPLETVOS_DEPLOYMENT_TARGET", project->first("QMAKE_TVOS_DEPLOYMENT_TARGET")) << ";\n"; t << "\t\t\t\t" << writeSettings("APPLETVOS_DEPLOYMENT_TARGET", project->first("QMAKE_TVOS_DEPLOYMENT_TARGET")) << ";\n";
if (!project->isEmpty("QMAKE_WATCHOS_DEPLOYMENT_TARGET"))
t << "\t\t\t\t" << writeSettings("WATCHOS_DEPLOYMENT_TARGET", project->first("QMAKE_WATCHOS_DEPLOYMENT_TARGET")) << ";\n";
if (!project->isEmpty("QMAKE_XCODE_CODE_SIGN_IDENTITY")) 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"; t << "\t\t\t\t" << writeSettings("CODE_SIGN_IDENTITY", project->first("QMAKE_XCODE_CODE_SIGN_IDENTITY")) << ";\n";

View File

@ -9,7 +9,9 @@ load(qt_helper_lib)
# built-in shapers list configuration: # built-in shapers list configuration:
SHAPERS += opentype # HB's main shaper; enabling it should be enough most of the time SHAPERS += opentype # HB's main shaper; enabling it should be enough most of the time
mac: SHAPERS += coretext # native shaper on OSX/iOS; could be used alone to handle both OT and AAT fonts
# native shaper on Apple platforms; could be used alone to handle both OT and AAT fonts
darwin:!if(watchos:CONFIG(simulator, simulator|device)): SHAPERS += coretext
DEFINES += HAVE_CONFIG_H DEFINES += HAVE_CONFIG_H
DEFINES += HB_NO_UNICODE_FUNCS HB_DISABLE_DEPRECATED DEFINES += HB_NO_UNICODE_FUNCS HB_DISABLE_DEPRECATED
@ -147,7 +149,7 @@ contains(SHAPERS, coretext) {
$$PWD/src/hb-coretext.h $$PWD/src/hb-coretext.h
uikit: \ uikit: \
# On iOS/tvOS CoreText and CoreGraphics are stand-alone frameworks # On iOS/tvOS/watchOS CoreText and CoreGraphics are stand-alone frameworks
LIBS_PRIVATE += -framework CoreText -framework CoreGraphics LIBS_PRIVATE += -framework CoreText -framework CoreGraphics
else: \ else: \
# On Mac OS they are part of the ApplicationServices umbrella framework, # On Mac OS they are part of the ApplicationServices umbrella framework,

View File

@ -1946,6 +1946,8 @@ QSysInfo::MacVersion QSysInfo::macVersion()
return QSysInfo::MacVersion(Q_MV_IOS(version.major, version.minor)); return QSysInfo::MacVersion(Q_MV_IOS(version.major, version.minor));
#elif defined(Q_OS_TVOS) #elif defined(Q_OS_TVOS)
return QSysInfo::MacVersion(Q_MV_TVOS(version.major, version.minor)); return QSysInfo::MacVersion(Q_MV_TVOS(version.major, version.minor));
#elif defined(Q_OS_WATCHOS)
return QSysInfo::MacVersion(Q_MV_WATCHOS(version.major, version.minor));
#else #else
return QSysInfo::MV_Unknown; return QSysInfo::MV_Unknown;
#endif #endif
@ -2631,9 +2633,10 @@ QString QSysInfo::kernelVersion()
to determine the distribution name and returns that. If determining the to determine the distribution name and returns that. If determining the
distribution name failed, it returns "unknown". distribution name failed, it returns "unknown".
\b{Darwin, \macOS, iOS and tvOS note}: this function returns "macos" for macOS \b{Darwin, \macos, iOS, tvOS, and watchOS note}: this function returns
systems, "ios" for iOS systems, "tvos" for tvOS systems and "darwin" in case "macos" for \macos systems, "ios" for iOS systems, "tvos" for tvOS systems,
the system could not be determined. "watchos" for watchOS systems, and "darwin" in case the system could not
be determined.
\b{OS X note}: this function returns "osx" for versions of \macos prior to 10.12. \b{OS X note}: this function returns "osx" for versions of \macos prior to 10.12.
@ -2667,6 +2670,8 @@ QString QSysInfo::productType()
return QStringLiteral("ios"); return QStringLiteral("ios");
#elif defined(Q_OS_TVOS) #elif defined(Q_OS_TVOS)
return QStringLiteral("tvos"); return QStringLiteral("tvos");
#elif defined(Q_OS_WATCHOS)
return QStringLiteral("watchos");
#elif defined(Q_OS_MACOS) #elif defined(Q_OS_MACOS)
const QAppleOperatingSystemVersion version = qt_apple_os_version(); const QAppleOperatingSystemVersion version = qt_apple_os_version();
if (version.major == 10 && version.minor < 12) if (version.major == 10 && version.minor < 12)
@ -2754,6 +2759,8 @@ QString QSysInfo::prettyProductName()
return QLatin1String("iOS ") + productVersion(); return QLatin1String("iOS ") + productVersion();
#elif defined(Q_OS_TVOS) #elif defined(Q_OS_TVOS)
return QLatin1String("tvOS ") + productVersion(); return QLatin1String("tvOS ") + productVersion();
#elif defined(Q_OS_WATCHOS)
return QLatin1String("watchOS ") + productVersion();
#elif defined(Q_OS_MACOS) #elif defined(Q_OS_MACOS)
const QAppleOperatingSystemVersion version = qt_apple_os_version(); const QAppleOperatingSystemVersion version = qt_apple_os_version();
const char *name = osxVer_helper(version); const char *name = osxVer_helper(version);

View File

@ -122,6 +122,7 @@ public:
#define Q_MV_OSX(major, minor) (major == 10 ? minor + 2 : (major == 9 ? 1 : 0)) #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_IOS(major, minor) (QSysInfo::MV_IOS | major << 4 | minor)
#define Q_MV_TVOS(major, minor) (QSysInfo::MV_TVOS | major << 4 | minor) #define Q_MV_TVOS(major, minor) (QSysInfo::MV_TVOS | major << 4 | minor)
#define Q_MV_WATCHOS(major, minor) (QSysInfo::MV_WATCHOS | major << 4 | minor)
enum MacVersion { enum MacVersion {
MV_None = 0xffff, MV_None = 0xffff,
MV_Unknown = 0x0000, MV_Unknown = 0x0000,
@ -182,7 +183,14 @@ public:
MV_TVOS_9_0 = Q_MV_TVOS(9, 0), MV_TVOS_9_0 = Q_MV_TVOS(9, 0),
MV_TVOS_9_1 = Q_MV_TVOS(9, 1), MV_TVOS_9_1 = Q_MV_TVOS(9, 1),
MV_TVOS_9_2 = Q_MV_TVOS(9, 2), MV_TVOS_9_2 = Q_MV_TVOS(9, 2),
MV_TVOS_10_0 = Q_MV_TVOS(10, 0) MV_TVOS_10_0 = Q_MV_TVOS(10, 0),
/* watchOS */
MV_WATCHOS = 1 << 10,
MV_WATCHOS_2_0 = Q_MV_WATCHOS(2, 0),
MV_WATCHOS_2_1 = Q_MV_WATCHOS(2, 1),
MV_WATCHOS_2_2 = Q_MV_WATCHOS(2, 2),
MV_WATCHOS_3_0 = Q_MV_WATCHOS(3, 0)
}; };
#if defined(Q_OS_MAC) #if defined(Q_OS_MAC)
static const MacVersion MacintoshVersion; static const MacVersion MacintoshVersion;

View File

@ -102,18 +102,16 @@
# define Q_OS_DARWIN32 # define Q_OS_DARWIN32
# endif # endif
# if defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE # if defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE
# define QT_PLATFORM_UIKIT
# if defined(TARGET_OS_WATCH) && TARGET_OS_WATCH # if defined(TARGET_OS_WATCH) && TARGET_OS_WATCH
# define Q_OS_WATCHOS # define Q_OS_WATCHOS
# else # elif defined(TARGET_OS_TV) && TARGET_OS_TV
# define QT_PLATFORM_UIKIT
# if defined(TARGET_OS_TV) && TARGET_OS_TV
# define Q_OS_TVOS # define Q_OS_TVOS
# else # else
# // TARGET_OS_IOS is only available in newer SDKs, # // TARGET_OS_IOS is only available in newer SDKs,
# // so assume any other iOS-based platform is iOS for now # // so assume any other iOS-based platform is iOS for now
# define Q_OS_IOS # define Q_OS_IOS
# endif # endif
# endif
# else # else
# // TARGET_OS_OSX is only available in newer SDKs, # // TARGET_OS_OSX is only available in newer SDKs,
# // so assume any non iOS-based platform is macOS for now # // so assume any non iOS-based platform is macOS for now

View File

@ -135,7 +135,7 @@ win32 {
io/qprocess_unix.cpp \ io/qprocess_unix.cpp \
io/qfilesystemiterator_unix.cpp io/qfilesystemiterator_unix.cpp
!integrity:!tvos { !integrity:!uikit {
SOURCES += io/forkfd_qt.cpp SOURCES += io/forkfd_qt.cpp
HEADERS += \ HEADERS += \
../3rdparty/forkfd/forkfd.h ../3rdparty/forkfd/forkfd.h

View File

@ -123,6 +123,11 @@ mac {
# We need UIKit for UIDevice # We need UIKit for UIDevice
LIBS_PRIVATE += -framework UIKit LIBS_PRIVATE += -framework UIKit
} }
watchos {
# We need WatchKit for WKExtension in qeventdispatcher_cf.mm
LIBS_PRIVATE += -framework WatchKit
}
} }
nacl { nacl {

View File

@ -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 qt_apple_os_version()
{ {
QAppleOperatingSystemVersion v = {0, 0, 0}; QAppleOperatingSystemVersion v = {0, 0, 0};
#if QT_MAC_PLATFORM_SDK_EQUAL_OR_ABOVE(__MAC_10_10, __IPHONE_8_0) || defined(Q_OS_TVOS) #if QT_MAC_PLATFORM_SDK_EQUAL_OR_ABOVE(__MAC_10_10, __IPHONE_8_0) || defined(Q_OS_TVOS) || defined(Q_OS_WATCHOS)
if ([NSProcessInfo instancesRespondToSelector:@selector(operatingSystemVersion)]) { if ([NSProcessInfo instancesRespondToSelector:@selector(operatingSystemVersion)]) {
NSOperatingSystemVersion osv = NSProcessInfo.processInfo.operatingSystemVersion; NSOperatingSystemVersion osv = NSProcessInfo.processInfo.operatingSystemVersion;
v.major = osv.majorVersion; v.major = osv.majorVersion;

View File

@ -299,7 +299,7 @@ static inline int qt_safe_close(int fd)
#undef QT_CLOSE #undef QT_CLOSE
#define QT_CLOSE qt_safe_close #define QT_CLOSE qt_safe_close
// - VxWorks & iOS/tvOS don't have processes // - VxWorks & iOS/tvOS/watchOS don't have processes
#if !defined(Q_OS_VXWORKS) && !defined(QT_NO_PROCESS) #if !defined(Q_OS_VXWORKS) && !defined(QT_NO_PROCESS)
static inline int qt_safe_execve(const char *filename, char *const argv[], static inline int qt_safe_execve(const char *filename, char *const argv[],
char *const envp[]) char *const envp[])

View File

@ -72,7 +72,7 @@
#ifndef QT_NO_QOBJECT #ifndef QT_NO_QOBJECT
#if defined(Q_OS_UNIX) #if defined(Q_OS_UNIX)
# if defined(Q_OS_OSX) # if defined(Q_OS_DARWIN)
# include "qeventdispatcher_cf_p.h" # include "qeventdispatcher_cf_p.h"
# else # else
# if !defined(QT_NO_GLIB) # if !defined(QT_NO_GLIB)
@ -483,7 +483,7 @@ void QCoreApplicationPrivate::createEventDispatcher()
{ {
Q_Q(QCoreApplication); Q_Q(QCoreApplication);
#if defined(Q_OS_UNIX) #if defined(Q_OS_UNIX)
# if defined(Q_OS_OSX) # if defined(Q_OS_DARWIN)
bool ok = false; bool ok = false;
int value = qEnvironmentVariableIntValue("QT_EVENT_DISPATCHER_CORE_FOUNDATION", &ok); int value = qEnvironmentVariableIntValue("QT_EVENT_DISPATCHER_CORE_FOUNDATION", &ok);
if (ok && value > 0) if (ok && value > 0)

View File

@ -51,6 +51,8 @@
#ifdef Q_OS_OSX #ifdef Q_OS_OSX
# include <AppKit/NSApplication.h> # include <AppKit/NSApplication.h>
#elif defined(Q_OS_WATCHOS)
# include <WatchKit/WatchKit.h>
#else #else
# include <UIKit/UIApplication.h> # include <UIKit/UIApplication.h>
#endif #endif
@ -75,6 +77,8 @@ QT_USE_NAMESPACE
name:nil name:nil
#ifdef Q_OS_OSX #ifdef Q_OS_OSX
object:[NSApplication sharedApplication]]; object:[NSApplication sharedApplication]];
#elif defined(Q_OS_WATCHOS)
object:[WKExtension sharedExtension]];
#else #else
object:[UIApplication sharedApplication]]; object:[UIApplication sharedApplication]];
#endif #endif

View File

@ -45,7 +45,7 @@
#include <private/qcoreapplication_p.h> #include <private/qcoreapplication_p.h>
#include <private/qcore_unix_p.h> #include <private/qcore_unix_p.h>
#if defined(Q_OS_OSX) #if defined(Q_OS_DARWIN)
# include <private/qeventdispatcher_cf_p.h> # include <private/qeventdispatcher_cf_p.h>
#else #else
# if !defined(QT_NO_GLIB) # if !defined(QT_NO_GLIB)
@ -279,7 +279,7 @@ typedef void*(*QtThreadCallback)(void*);
void QThreadPrivate::createEventDispatcher(QThreadData *data) void QThreadPrivate::createEventDispatcher(QThreadData *data)
{ {
#if defined(Q_OS_OSX) #if defined(Q_OS_DARWIN)
bool ok = false; bool ok = false;
int value = qEnvironmentVariableIntValue("QT_EVENT_DISPATCHER_CORE_FOUNDATION", &ok); int value = qEnvironmentVariableIntValue("QT_EVENT_DISPATCHER_CORE_FOUNDATION", &ok);
if (ok && value > 0) if (ok && value > 0)

View File

@ -56,8 +56,9 @@ win32: {
} }
mac { mac {
LIBS_PRIVATE += -framework SystemConfiguration -framework CoreFoundation LIBS_PRIVATE += -framework CoreFoundation
!uikit: LIBS_PRIVATE += -framework CoreServices !uikit: LIBS_PRIVATE += -framework CoreServices
!if(watchos:CONFIG(device, simulator|device)): LIBS_PRIVATE += -framework SystemConfiguration
} }
osx:SOURCES += kernel/qnetworkproxy_mac.cpp osx:SOURCES += kernel/qnetworkproxy_mac.cpp

View File

@ -204,7 +204,7 @@ bool QSslSocketPrivate::s_loadedCiphersAndCerts = false;
bool QSslSocketPrivate::s_loadRootCertsOnDemand = false; bool QSslSocketPrivate::s_loadRootCertsOnDemand = false;
#if !defined(QT_PLATFORM_UIKIT) // dhparam is not used on iOS or tvOS. (see the SSLSetDiffieHellmanParams call below) #if !defined(QT_PLATFORM_UIKIT) // dhparam is only used on macOS. (see the SSLSetDiffieHellmanParams call below)
static const uint8_t dhparam[] = static const uint8_t dhparam[] =
"\x30\x82\x01\x08\x02\x82\x01\x01\x00\x97\xea\xd0\x46\xf7\xae\xa7\x76\x80" "\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" "\x9c\x74\x56\x98\xd8\x56\x97\x2b\x20\x6c\x77\xe2\x82\xbb\xc8\x84\xbe\xe7"
@ -223,7 +223,7 @@ static const uint8_t dhparam[] =
"\x90\x0b\x35\x64\xff\xd9\xe3\xac\xf2\xf2\xeb\x3a\x63\x02\x01\x02"; "\x90\x0b\x35\x64\xff\xd9\xe3\xac\xf2\xf2\xeb\x3a\x63\x02\x01\x02";
#endif #endif
// No ioErr on iOS/tvOS. (defined in MacErrors.h on OS X) // No ioErr on iOS/tvOS/watchOS. (defined in MacErrors.h on macOS)
#if defined(QT_PLATFORM_UIKIT) #if defined(QT_PLATFORM_UIKIT)
# define ioErr -36 # define ioErr -36
#endif #endif

View File

@ -1,16 +1,15 @@
!win32|qtConfig(freetype):!darwin { darwin:!if(watchos:CONFIG(simulator, simulator|device)) {
include($$PWD/mac/coretext.pri)
} else {
!win32|qtConfig(freetype) {
include($$PWD/basic/basic.pri) include($$PWD/basic/basic.pri)
} }
unix:!mac { unix {
CONFIG += qpa/genericunixfontdatabase CONFIG += qpa/genericunixfontdatabase
include($$PWD/genericunix/genericunix.pri) include($$PWD/genericunix/genericunix.pri)
qtConfig(fontconfig) { contains(QT_CONFIG,fontconfig) {
include($$PWD/fontconfig/fontconfig.pri) include($$PWD/fontconfig/fontconfig.pri)
} }
}
} }
mac {
include($$PWD/mac/coretext.pri)
}

View File

@ -8,7 +8,7 @@ qtConfig(freetype) {
} }
uikit: \ uikit: \
# On iOS/tvOS CoreText and CoreGraphics are stand-alone frameworks # On iOS/tvOS/watchOS CoreText and CoreGraphics are stand-alone frameworks
LIBS_PRIVATE += -framework CoreText -framework CoreGraphics LIBS_PRIVATE += -framework CoreText -framework CoreGraphics
else: \ else: \
# On Mac OS they are part of the ApplicationServices umbrella framework, # On Mac OS they are part of the ApplicationServices umbrella framework,

View File

@ -811,7 +811,7 @@ static CTFontDescriptorRef fontDescriptorFromTheme(QPlatformTheme::Font f)
UIFontDescriptor *desc = [UIFontDescriptor preferredFontDescriptorWithTextStyle:textStyle]; UIFontDescriptor *desc = [UIFontDescriptor preferredFontDescriptorWithTextStyle:textStyle];
return static_cast<CTFontDescriptorRef>(CFBridgingRetain(desc)); return static_cast<CTFontDescriptorRef>(CFBridgingRetain(desc));
} }
#endif // Q_OS_IOS, Q_OS_TVOS #endif // Q_OS_IOS, Q_OS_TVOS, Q_OS_WATCHOS
// OSX default case and iOS fallback case // OSX default case and iOS fallback case
CTFontUIFontType fontType = fontTypeFromTheme(f); CTFontUIFontType fontType = fontTypeFromTheme(f);

View File

@ -10,7 +10,7 @@ qtConfig(xcb) {
SUBDIRS += xcb SUBDIRS += xcb
} }
uikit: SUBDIRS += ios uikit:!watchos: SUBDIRS += ios
osx: SUBDIRS += cocoa osx: SUBDIRS += cocoa
win32:!winrt: SUBDIRS += windows win32:!winrt: SUBDIRS += windows

View File

@ -106,6 +106,9 @@ static QSet<QByteArray> keywords()
#ifdef Q_OS_TVOS #ifdef Q_OS_TVOS
<< "tvos" << "tvos"
#endif #endif
#ifdef Q_OS_WATCHOS
<< "watchos"
#endif
#ifdef Q_OS_ANDROID #ifdef Q_OS_ANDROID
<< "android" << "android"
#endif #endif

View File

@ -1388,7 +1388,7 @@ FatalSignalHandler::FatalSignalHandler()
// tvOS/watchOS both define SA_ONSTACK (in sys/signal.h) but mark sigaltstack() as // tvOS/watchOS both define SA_ONSTACK (in sys/signal.h) but mark sigaltstack() as
// unavailable (__WATCHOS_PROHIBITED __TVOS_PROHIBITED in signal.h) // unavailable (__WATCHOS_PROHIBITED __TVOS_PROHIBITED in signal.h)
#if defined(SA_ONSTACK) && !defined(Q_OS_TVOS) #if defined(SA_ONSTACK) && !defined(Q_OS_TVOS) && !defined(Q_OS_WATCHOS)
// Let the signal handlers use an alternate stack // Let the signal handlers use an alternate stack
// This is necessary if SIGSEGV is to catch a stack overflow // This is necessary if SIGSEGV is to catch a stack overflow
# if defined(Q_CC_GNU) && defined(Q_OF_ELF) # if defined(Q_CC_GNU) && defined(Q_OF_ELF)

View File

@ -332,8 +332,9 @@ void tst_QWidget_window::tst_showWithoutActivating()
else if (platformName != QStringLiteral("xcb") else if (platformName != QStringLiteral("xcb")
&& platformName != QStringLiteral("windows") && platformName != QStringLiteral("windows")
&& platformName != QStringLiteral("ios") && platformName != QStringLiteral("ios")
&& platformName != QStringLiteral("tvos")) && platformName != QStringLiteral("tvos")
QSKIP("Qt::WA_ShowWithoutActivating is currently supported only on xcb, windows, and ios/tvos platforms."); && platformName != QStringLiteral("watchos"))
QSKIP("Qt::WA_ShowWithoutActivating is currently supported only on xcb, windows, and ios/tvos/watchos platforms.");
QWidget w1; QWidget w1;
w1.setAttribute(Qt::WA_ShowWithoutActivating); w1.setAttribute(Qt::WA_ShowWithoutActivating);