From 57378a108ca488cbf5cfaa32590fc762dcbf3315 Mon Sep 17 00:00:00 2001 From: Jake Petroules Date: Thu, 19 May 2016 23:01:59 -0700 Subject: Add support for Apple watchOS MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I3f9e00569458a463af2eaa5a3a16a6afd1e9c1ea Reviewed-by: Tor Arne Vestbø --- configure | 13 +++++++- configure.json | 6 ++-- configure.pri | 4 +-- examples/network/network.pro | 2 +- examples/widgets/tools/plugandpaint/app/app.pro | 13 +++++--- .../plugandpaint/plugins/basictools/basictools.pro | 1 + .../plugins/extrafilters/extrafilters.pro | 1 + mkspecs/common/watchos.conf | 21 +++++++++++++ mkspecs/features/mac/sdk.prf | 1 + mkspecs/features/uikit/default_post.prf | 8 +++++ mkspecs/features/uikit/default_pre.prf | 2 +- mkspecs/features/uikit/device_destinations.sh | 4 +++ mkspecs/features/uikit/qt.prf | 2 +- mkspecs/features/uikit/qt_config.prf | 1 + mkspecs/features/uikit/xcodebuild.prf | 4 +++ mkspecs/macx-watchos-clang/Info.plist.app | 35 ++++++++++++++++++++++ mkspecs/macx-watchos-clang/Info.plist.lib | 22 ++++++++++++++ mkspecs/macx-watchos-clang/qmake.conf | 21 +++++++++++++ mkspecs/macx-watchos-clang/qplatformdefs.h | 34 +++++++++++++++++++++ qmake/doc/src/qmake-manual.qdoc | 22 +++++++------- qmake/generators/mac/pbuilder_pbx.cpp | 2 ++ src/3rdparty/harfbuzz-ng/harfbuzz-ng.pro | 6 ++-- src/corelib/global/qglobal.cpp | 13 ++++++-- src/corelib/global/qsysinfo.h | 10 ++++++- src/corelib/global/qsystemdetection.h | 14 ++++----- src/corelib/io/io.pri | 2 +- src/corelib/kernel/kernel.pri | 5 ++++ src/corelib/kernel/qcore_mac_objc.mm | 2 +- src/corelib/kernel/qcore_unix_p.h | 2 +- src/corelib/kernel/qcoreapplication.cpp | 4 +-- src/corelib/kernel/qeventdispatcher_cf.mm | 4 +++ src/corelib/thread/qthread_unix.cpp | 4 +-- src/network/kernel/kernel.pri | 3 +- src/network/ssl/qsslsocket_mac.cpp | 4 +-- .../fontdatabases/fontdatabases.pri | 25 ++++++++-------- src/platformsupport/fontdatabases/mac/coretext.pri | 2 +- .../fontdatabases/mac/qcoretextfontdatabase.mm | 2 +- src/plugins/platforms/platforms.pro | 2 +- src/testlib/qtestblacklist.cpp | 3 ++ src/testlib/qtestcase.cpp | 2 +- .../kernel/qwidget_window/tst_qwidget_window.cpp | 5 ++-- 41 files changed, 266 insertions(+), 67 deletions(-) create mode 100644 mkspecs/common/watchos.conf create mode 100644 mkspecs/macx-watchos-clang/Info.plist.app create mode 100644 mkspecs/macx-watchos-clang/Info.plist.lib create mode 100644 mkspecs/macx-watchos-clang/qmake.conf create mode 100644 mkspecs/macx-watchos-clang/qplatformdefs.h diff --git a/configure b/configure index b031aae2f9..ac68f3ce4b 100755 --- a/configure +++ b/configure @@ -279,6 +279,12 @@ macSDKify() appletvsimulator*) 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 @@ -459,9 +465,10 @@ CFG_RELEASE_TOOLS=no CFG_ANDROID_STYLE_ASSETS=yes 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_TVOS=no # Whether target platform is tvOS +XPLATFORM_WATCHOS=no # Whether target platform is watchOS XPLATFORM_ANDROID=no XPLATFORM_MINGW=no # Whether target platform is MinGW (win32-g++*) PLATFORM=$QMAKESPEC @@ -995,6 +1002,10 @@ case "$XPLATFORM" in XPLATFORM_MAC=yes XPLATFORM_TVOS=yes ;; + *watchos*) + XPLATFORM_MAC=yes + XPLATFORM_WATCHOS=yes + ;; *macx*) XPLATFORM_MAC=yes ;; diff --git a/configure.json b/configure.json index 7723437e03..a079572c0a 100644 --- a/configure.json +++ b/configure.json @@ -2314,7 +2314,7 @@ "description": "OpenGL ES 2.0", "enable": "input.opengl == 'es2'", "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": [ "publicFeature", "publicQtConfig", @@ -2343,7 +2343,7 @@ "enable": "input.opengl == 'desktop'", "disable": "input.opengl == 'es2' || input.opengl == 'dynamic' || input.opengl == 'no'", "condition": "(config.win32 && !config.winrt && !features.opengles2 && (config.msvc || libs.opengl)) - || (!config.win32 && libs.opengl)" + || (!config.watchos && !config.win32 && libs.opengl)" }, "opengl-dynamic": { "description": "Dynamic OpenGL", @@ -2647,7 +2647,7 @@ Specify -opengl desktop to use regular OpenGL." }, { "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! 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." diff --git a/configure.pri b/configure.pri index f42994d606..0a25d46b00 100644 --- a/configure.pri +++ b/configure.pri @@ -204,9 +204,9 @@ defineTest(qtConfTest_neon) { defineTest(qtConfTest_skipModules) { skip = - ios|tvos { + uikit { skip += qtdoc qtmacextras qtserialport qtwebkit qtwebkit-examples - tvos: skip += qtscript + !ios: skip += qtscript } for (m, config.input.skip) { diff --git a/examples/network/network.pro b/examples/network/network.pro index 68200efb18..a6a6f3ef52 100644 --- a/examples/network/network.pro +++ b/examples/network/network.pro @@ -21,7 +21,7 @@ qtHaveModule(widgets) { load(qfeatures) !contains(QT_DISABLED_FEATURES, bearermanagement) { # no QProcess - !vxworks:!qnx:!winrt:!integrity: SUBDIRS += network-chat + !vxworks:!qnx:!winrt:!integrity:!uikit: SUBDIRS += network-chat SUBDIRS += \ bearermonitor \ diff --git a/examples/widgets/tools/plugandpaint/app/app.pro b/examples/widgets/tools/plugandpaint/app/app.pro index 8139cd53ad..e35203edf2 100644 --- a/examples/widgets/tools/plugandpaint/app/app.pro +++ b/examples/widgets/tools/plugandpaint/app/app.pro @@ -13,11 +13,16 @@ SOURCES = main.cpp \ paintarea.cpp \ plugindialog.cpp -LIBS = -L../plugins -lpnp_basictools +LIBS = -L../plugins -if(!debug_and_release|build_pass):CONFIG(debug, debug|release) { - mac:LIBS = $$member(LIBS, 0) $$member(LIBS, 1)_debug - win32:LIBS = $$member(LIBS, 0) $$member(LIBS, 1)d +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 + win32:LIBS = $$member(LIBS, 0) $$member(LIBS, 1)d + } } #! [0] diff --git a/examples/widgets/tools/plugandpaint/plugins/basictools/basictools.pro b/examples/widgets/tools/plugandpaint/plugins/basictools/basictools.pro index f28be96b03..8317019c10 100644 --- a/examples/widgets/tools/plugandpaint/plugins/basictools/basictools.pro +++ b/examples/widgets/tools/plugandpaint/plugins/basictools/basictools.pro @@ -14,3 +14,4 @@ target.path = $$[QT_INSTALL_EXAMPLES]/widgets/tools/plugandpaint/plugins INSTALLS += target CONFIG += install_ok # Do not cargo-cult this! +uikit: CONFIG += debug_and_release simulator_and_device diff --git a/examples/widgets/tools/plugandpaint/plugins/extrafilters/extrafilters.pro b/examples/widgets/tools/plugandpaint/plugins/extrafilters/extrafilters.pro index deb3c5e70e..4716665d34 100644 --- a/examples/widgets/tools/plugandpaint/plugins/extrafilters/extrafilters.pro +++ b/examples/widgets/tools/plugandpaint/plugins/extrafilters/extrafilters.pro @@ -14,3 +14,4 @@ target.path = $$[QT_INSTALL_EXAMPLES]/widgets/tools/plugandpaint/plugins INSTALLS += target CONFIG += install_ok # Do not cargo-cult this! +uikit: CONFIG += debug_and_release simulator_and_device diff --git a/mkspecs/common/watchos.conf b/mkspecs/common/watchos.conf new file mode 100644 index 0000000000..21a408c6b2 --- /dev/null +++ b/mkspecs/common/watchos.conf @@ -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) diff --git a/mkspecs/features/mac/sdk.prf b/mkspecs/features/mac/sdk.prf index c4d4c90f09..5abc741b90 100644 --- a/mkspecs/features/mac/sdk.prf +++ b/mkspecs/features/mac/sdk.prf @@ -62,6 +62,7 @@ for(tool, $$list(QMAKE_CC QMAKE_CXX QMAKE_FIX_RPATH QMAKE_AR QMAKE_RANLIB QMAKE_ version_identifier = $$device.deployment_identifier ios: deployment_target = $$QMAKE_IOS_DEPLOYMENT_TARGET tvos: deployment_target = $$QMAKE_TVOS_DEPLOYMENT_TARGET + watchos: deployment_target = $$QMAKE_WATCHOS_DEPLOYMENT_TARGET } else: osx { version_identifier = macosx deployment_target = $$QMAKE_MACOSX_DEPLOYMENT_TARGET diff --git a/mkspecs/features/uikit/default_post.prf b/mkspecs/features/uikit/default_post.prf index 7c92a24556..52c9b1e8c8 100644 --- a/mkspecs/features/uikit/default_post.prf +++ b/mkspecs/features/uikit/default_post.prf @@ -22,6 +22,7 @@ macx-xcode { device_family.name = TARGETED_DEVICE_FAMILY ios: device_family.value = $$QMAKE_IOS_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 ios { @@ -77,6 +78,11 @@ macx-xcode { arch_simulator.value = $$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 @@ -89,9 +95,11 @@ macx-xcode { contains(QT_ARCH, arm.*) { ios: VALID_ARCHS = $$QMAKE_IOS_DEVICE_ARCHS tvos: VALID_ARCHS = $$QMAKE_TVOS_DEVICE_ARCHS + watchos: VALID_ARCHS = $$QMAKE_WATCHOS_DEVICE_ARCHS } else { ios: VALID_ARCHS = $$QMAKE_IOS_SIMULATOR_ARCHS tvos: VALID_ARCHS = $$QMAKE_TVOS_SIMULATOR_ARCHS + watchos: VALID_ARCHS = $$QMAKE_WATCHOS_SIMULATOR_ARCHS } single_arch: VALID_ARCHS = $$first(VALID_ARCHS) diff --git a/mkspecs/features/uikit/default_pre.prf b/mkspecs/features/uikit/default_pre.prf index 9b2ebc19bd..e719ab0848 100644 --- a/mkspecs/features/uikit/default_pre.prf +++ b/mkspecs/features/uikit/default_pre.prf @@ -11,7 +11,7 @@ lessThan(QMAKE_XCODE_VERSION, "4.3"): \ build_pass:simulator { # 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. QT_ARCH = i386 QT_CPU_FEATURES.i386 = sse sse2 diff --git a/mkspecs/features/uikit/device_destinations.sh b/mkspecs/features/uikit/device_destinations.sh index b378d67500..2c117d0ad4 100755 --- a/mkspecs/features/uikit/device_destinations.sh +++ b/mkspecs/features/uikit/device_destinations.sh @@ -60,6 +60,10 @@ xcodebuild test -scheme $2 -destination 'id=0' -destination-timeout 1 2>&1| sed echo "HARDWARE_DEVICES += $id" elif [ "$val" = "tvOS Simulator" -a "$id" != "$booted_simulator" ]; then 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 done diff --git a/mkspecs/features/uikit/qt.prf b/mkspecs/features/uikit/qt.prf index af047be466..4475c137dc 100644 --- a/mkspecs/features/uikit/qt.prf +++ b/mkspecs/features/uikit/qt.prf @@ -1,6 +1,6 @@ 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 lib_name = qios diff --git a/mkspecs/features/uikit/qt_config.prf b/mkspecs/features/uikit/qt_config.prf index 71e0982f7e..5fa5a536f8 100644 --- a/mkspecs/features/uikit/qt_config.prf +++ b/mkspecs/features/uikit/qt_config.prf @@ -10,6 +10,7 @@ isEmpty(QT_ARCH) { } else { # Simulator ios: QT_ARCH = i386 tvos: QT_ARCH = x64 + watchos: QT_ARCH = i386 } # Prevent the arch/config tests from building as multi-arch binaries, diff --git a/mkspecs/features/uikit/xcodebuild.prf b/mkspecs/features/uikit/xcodebuild.prf index 6e50bbcf50..82bcd9a315 100644 --- a/mkspecs/features/uikit/xcodebuild.prf +++ b/mkspecs/features/uikit/xcodebuild.prf @@ -43,6 +43,10 @@ tvos { DEVICE_FILTER = "Apple TV" 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_INCLUDES += $$shell_quote($$PWD/xcodebuild.mk) diff --git a/mkspecs/macx-watchos-clang/Info.plist.app b/mkspecs/macx-watchos-clang/Info.plist.app new file mode 100644 index 0000000000..cceb9c5b5a --- /dev/null +++ b/mkspecs/macx-watchos-clang/Info.plist.app @@ -0,0 +1,35 @@ + + + + + CFBundleDevelopmentRegion + en + CFBundlePackageType + APPL + CFBundleGetInfoString + Created by Qt/QMake + CFBundleSignature + @TYPEINFO@ + CFBundleExecutable + @EXECUTABLE@ + CFBundleIdentifier + @BUNDLEIDENTIFIER@ + CFBundleDisplayName + ${PRODUCT_NAME} + CFBundleName + ${PRODUCT_NAME} + CFBundleShortVersionString + 1.0 + CFBundleVersion + 1.0 + UISupportedInterfaceOrientations + + UIInterfaceOrientationPortrait + UIInterfaceOrientationPortraitUpsideDown + + WKWatchKitApp + + NOTE + This file was generated by Qt/QMake. + + diff --git a/mkspecs/macx-watchos-clang/Info.plist.lib b/mkspecs/macx-watchos-clang/Info.plist.lib new file mode 100644 index 0000000000..7cbdb9af12 --- /dev/null +++ b/mkspecs/macx-watchos-clang/Info.plist.lib @@ -0,0 +1,22 @@ + + + + + CFBundlePackageType + FMWK + CFBundleShortVersionString + @SHORT_VERSION@ + CFBundleVersion + @FULL_VERSION@ + CFBundleGetInfoString + Created by Qt/QMake + CFBundleSignature + @TYPEINFO@ + CFBundleExecutable + @LIBRARY@ + CFBundleIdentifier + @BUNDLEIDENTIFIER@ + NOTE + Please, do NOT change this file -- It was generated by Qt/QMake. + + diff --git a/mkspecs/macx-watchos-clang/qmake.conf b/mkspecs/macx-watchos-clang/qmake.conf new file mode 100644 index 0000000000..bb9ab703b7 --- /dev/null +++ b/mkspecs/macx-watchos-clang/qmake.conf @@ -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) diff --git a/mkspecs/macx-watchos-clang/qplatformdefs.h b/mkspecs/macx-watchos-clang/qplatformdefs.h new file mode 100644 index 0000000000..965eb5e97b --- /dev/null +++ b/mkspecs/macx-watchos-clang/qplatformdefs.h @@ -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" diff --git a/qmake/doc/src/qmake-manual.qdoc b/qmake/doc/src/qmake-manual.qdoc index b84e847fcb..509dc3efa1 100644 --- a/qmake/doc/src/qmake-manual.qdoc +++ b/qmake/doc/src/qmake-manual.qdoc @@ -657,7 +657,7 @@ qmake knows about many of these features, which can be accessed via specific variables that only take effect on the platforms where they are relevant. - \section1 \macos, iOS and tvOS + \section1 \macos, iOS, tvOS, and watchOS 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 \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 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 \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. This allows frameworks to be created with custom extensions instead of the @@ -1695,7 +1695,7 @@ \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 framework that is built. @@ -1709,9 +1709,9 @@ \target 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 framework that is built. @@ -1804,10 +1804,10 @@ \target 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 - 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@, 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 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, iOS and tvOS, the path may be specified relatively using the following + In general this reference may be a library name or full library path. On \macos, + iOS, tvOS, and watchOS, the path may be specified relatively using the following placeholders: \table @@ -4428,7 +4428,7 @@ \li nmake \li Visual Studio projects (VS 2008 and later) \endlist - \li \macos, iOS and tvOS + \li \macos, iOS, tvOS, and watchOS \list \li Makefile \li Xcode diff --git a/qmake/generators/mac/pbuilder_pbx.cpp b/qmake/generators/mac/pbuilder_pbx.cpp index 47c7826154..bf2e774678 100644 --- a/qmake/generators/mac/pbuilder_pbx.cpp +++ b/qmake/generators/mac/pbuilder_pbx.cpp @@ -1537,6 +1537,8 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t) 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_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")) t << "\t\t\t\t" << writeSettings("CODE_SIGN_IDENTITY", project->first("QMAKE_XCODE_CODE_SIGN_IDENTITY")) << ";\n"; diff --git a/src/3rdparty/harfbuzz-ng/harfbuzz-ng.pro b/src/3rdparty/harfbuzz-ng/harfbuzz-ng.pro index 4fd0823332..1bfeabb8c4 100644 --- a/src/3rdparty/harfbuzz-ng/harfbuzz-ng.pro +++ b/src/3rdparty/harfbuzz-ng/harfbuzz-ng.pro @@ -9,7 +9,9 @@ load(qt_helper_lib) # built-in shapers list configuration: 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 += HB_NO_UNICODE_FUNCS HB_DISABLE_DEPRECATED @@ -147,7 +149,7 @@ contains(SHAPERS, coretext) { $$PWD/src/hb-coretext.h 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 else: \ # On Mac OS they are part of the ApplicationServices umbrella framework, diff --git a/src/corelib/global/qglobal.cpp b/src/corelib/global/qglobal.cpp index e05b7874e5..71cf1da20a 100644 --- a/src/corelib/global/qglobal.cpp +++ b/src/corelib/global/qglobal.cpp @@ -1946,6 +1946,8 @@ QSysInfo::MacVersion QSysInfo::macVersion() 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)); +#elif defined(Q_OS_WATCHOS) + return QSysInfo::MacVersion(Q_MV_WATCHOS(version.major, version.minor)); #else return QSysInfo::MV_Unknown; #endif @@ -2631,9 +2633,10 @@ QString QSysInfo::kernelVersion() to determine the distribution name and returns that. If determining the distribution name failed, it returns "unknown". - \b{Darwin, \macOS, iOS and tvOS note}: this function returns "macos" for macOS - systems, "ios" for iOS systems, "tvos" for tvOS systems and "darwin" in case - the system could not be determined. + \b{Darwin, \macos, iOS, tvOS, and watchOS note}: this function returns + "macos" for \macos systems, "ios" for iOS systems, "tvos" for tvOS systems, + "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. @@ -2667,6 +2670,8 @@ QString QSysInfo::productType() return QStringLiteral("ios"); #elif defined(Q_OS_TVOS) return QStringLiteral("tvos"); +#elif defined(Q_OS_WATCHOS) + return QStringLiteral("watchos"); #elif defined(Q_OS_MACOS) const QAppleOperatingSystemVersion version = qt_apple_os_version(); if (version.major == 10 && version.minor < 12) @@ -2754,6 +2759,8 @@ QString QSysInfo::prettyProductName() return QLatin1String("iOS ") + productVersion(); #elif defined(Q_OS_TVOS) return QLatin1String("tvOS ") + productVersion(); +#elif defined(Q_OS_WATCHOS) + return QLatin1String("watchOS ") + productVersion(); #elif defined(Q_OS_MACOS) const QAppleOperatingSystemVersion version = qt_apple_os_version(); const char *name = osxVer_helper(version); diff --git a/src/corelib/global/qsysinfo.h b/src/corelib/global/qsysinfo.h index 31d78bca50..f01b45cbf9 100644 --- a/src/corelib/global/qsysinfo.h +++ b/src/corelib/global/qsysinfo.h @@ -122,6 +122,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) +#define Q_MV_WATCHOS(major, minor) (QSysInfo::MV_WATCHOS | major << 4 | minor) enum MacVersion { MV_None = 0xffff, MV_Unknown = 0x0000, @@ -182,7 +183,14 @@ public: MV_TVOS_9_0 = Q_MV_TVOS(9, 0), MV_TVOS_9_1 = Q_MV_TVOS(9, 1), 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) static const MacVersion MacintoshVersion; diff --git a/src/corelib/global/qsystemdetection.h b/src/corelib/global/qsystemdetection.h index 90954b1eca..3b486b8f6f 100644 --- a/src/corelib/global/qsystemdetection.h +++ b/src/corelib/global/qsystemdetection.h @@ -102,17 +102,15 @@ # define Q_OS_DARWIN32 # endif # if defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE +# define QT_PLATFORM_UIKIT # if defined(TARGET_OS_WATCH) && TARGET_OS_WATCH # define Q_OS_WATCHOS +# elif defined(TARGET_OS_TV) && TARGET_OS_TV +# define Q_OS_TVOS # else -# 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 +# // 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 # else # // TARGET_OS_OSX is only available in newer SDKs, diff --git a/src/corelib/io/io.pri b/src/corelib/io/io.pri index cc658afa94..0414ae966a 100644 --- a/src/corelib/io/io.pri +++ b/src/corelib/io/io.pri @@ -135,7 +135,7 @@ win32 { io/qprocess_unix.cpp \ io/qfilesystemiterator_unix.cpp - !integrity:!tvos { + !integrity:!uikit { SOURCES += io/forkfd_qt.cpp HEADERS += \ ../3rdparty/forkfd/forkfd.h diff --git a/src/corelib/kernel/kernel.pri b/src/corelib/kernel/kernel.pri index 2388bbe9be..a78397e46c 100644 --- a/src/corelib/kernel/kernel.pri +++ b/src/corelib/kernel/kernel.pri @@ -123,6 +123,11 @@ mac { # We need UIKit for UIDevice LIBS_PRIVATE += -framework UIKit } + + watchos { + # We need WatchKit for WKExtension in qeventdispatcher_cf.mm + LIBS_PRIVATE += -framework WatchKit + } } nacl { diff --git a/src/corelib/kernel/qcore_mac_objc.mm b/src/corelib/kernel/qcore_mac_objc.mm index 068b6b0440..ee1a290386 100644 --- a/src/corelib/kernel/qcore_mac_objc.mm +++ b/src/corelib/kernel/qcore_mac_objc.mm @@ -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) || 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)]) { NSOperatingSystemVersion osv = NSProcessInfo.processInfo.operatingSystemVersion; v.major = osv.majorVersion; diff --git a/src/corelib/kernel/qcore_unix_p.h b/src/corelib/kernel/qcore_unix_p.h index c393609188..b5756af994 100644 --- a/src/corelib/kernel/qcore_unix_p.h +++ b/src/corelib/kernel/qcore_unix_p.h @@ -299,7 +299,7 @@ static inline int qt_safe_close(int fd) #undef QT_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) static inline int qt_safe_execve(const char *filename, char *const argv[], char *const envp[]) diff --git a/src/corelib/kernel/qcoreapplication.cpp b/src/corelib/kernel/qcoreapplication.cpp index c1f2dfded4..0413e06665 100644 --- a/src/corelib/kernel/qcoreapplication.cpp +++ b/src/corelib/kernel/qcoreapplication.cpp @@ -72,7 +72,7 @@ #ifndef QT_NO_QOBJECT #if defined(Q_OS_UNIX) -# if defined(Q_OS_OSX) +# if defined(Q_OS_DARWIN) # include "qeventdispatcher_cf_p.h" # else # if !defined(QT_NO_GLIB) @@ -483,7 +483,7 @@ void QCoreApplicationPrivate::createEventDispatcher() { Q_Q(QCoreApplication); #if defined(Q_OS_UNIX) -# if defined(Q_OS_OSX) +# if defined(Q_OS_DARWIN) bool ok = false; int value = qEnvironmentVariableIntValue("QT_EVENT_DISPATCHER_CORE_FOUNDATION", &ok); if (ok && value > 0) diff --git a/src/corelib/kernel/qeventdispatcher_cf.mm b/src/corelib/kernel/qeventdispatcher_cf.mm index 437e4062ad..eecc72fd94 100644 --- a/src/corelib/kernel/qeventdispatcher_cf.mm +++ b/src/corelib/kernel/qeventdispatcher_cf.mm @@ -51,6 +51,8 @@ #ifdef Q_OS_OSX # include +#elif defined(Q_OS_WATCHOS) +# include #else # include #endif @@ -75,6 +77,8 @@ QT_USE_NAMESPACE name:nil #ifdef Q_OS_OSX object:[NSApplication sharedApplication]]; +#elif defined(Q_OS_WATCHOS) + object:[WKExtension sharedExtension]]; #else object:[UIApplication sharedApplication]]; #endif diff --git a/src/corelib/thread/qthread_unix.cpp b/src/corelib/thread/qthread_unix.cpp index deedd61c17..ba5f2dca95 100644 --- a/src/corelib/thread/qthread_unix.cpp +++ b/src/corelib/thread/qthread_unix.cpp @@ -45,7 +45,7 @@ #include #include -#if defined(Q_OS_OSX) +#if defined(Q_OS_DARWIN) # include #else # if !defined(QT_NO_GLIB) @@ -279,7 +279,7 @@ typedef void*(*QtThreadCallback)(void*); void QThreadPrivate::createEventDispatcher(QThreadData *data) { -#if defined(Q_OS_OSX) +#if defined(Q_OS_DARWIN) bool ok = false; int value = qEnvironmentVariableIntValue("QT_EVENT_DISPATCHER_CORE_FOUNDATION", &ok); if (ok && value > 0) diff --git a/src/network/kernel/kernel.pri b/src/network/kernel/kernel.pri index e1eb4f7a93..8f37e28669 100644 --- a/src/network/kernel/kernel.pri +++ b/src/network/kernel/kernel.pri @@ -56,8 +56,9 @@ win32: { } mac { - LIBS_PRIVATE += -framework SystemConfiguration -framework CoreFoundation + LIBS_PRIVATE += -framework CoreFoundation !uikit: LIBS_PRIVATE += -framework CoreServices + !if(watchos:CONFIG(device, simulator|device)): LIBS_PRIVATE += -framework SystemConfiguration } osx:SOURCES += kernel/qnetworkproxy_mac.cpp diff --git a/src/network/ssl/qsslsocket_mac.cpp b/src/network/ssl/qsslsocket_mac.cpp index 438ea9a38e..4c06404415 100644 --- a/src/network/ssl/qsslsocket_mac.cpp +++ b/src/network/ssl/qsslsocket_mac.cpp @@ -204,7 +204,7 @@ bool QSslSocketPrivate::s_loadedCiphersAndCerts = 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[] = "\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" @@ -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"; #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) # define ioErr -36 #endif diff --git a/src/platformsupport/fontdatabases/fontdatabases.pri b/src/platformsupport/fontdatabases/fontdatabases.pri index 0ef46d0a1c..f8e51f2a6d 100644 --- a/src/platformsupport/fontdatabases/fontdatabases.pri +++ b/src/platformsupport/fontdatabases/fontdatabases.pri @@ -1,16 +1,15 @@ -!win32|qtConfig(freetype):!darwin { - include($$PWD/basic/basic.pri) -} - -unix:!mac { - CONFIG += qpa/genericunixfontdatabase - include($$PWD/genericunix/genericunix.pri) - qtConfig(fontconfig) { - include($$PWD/fontconfig/fontconfig.pri) +darwin:!if(watchos:CONFIG(simulator, simulator|device)) { + include($$PWD/mac/coretext.pri) +} else { + !win32|qtConfig(freetype) { + include($$PWD/basic/basic.pri) } -} -mac { - include($$PWD/mac/coretext.pri) + unix { + CONFIG += qpa/genericunixfontdatabase + include($$PWD/genericunix/genericunix.pri) + contains(QT_CONFIG,fontconfig) { + include($$PWD/fontconfig/fontconfig.pri) + } + } } - diff --git a/src/platformsupport/fontdatabases/mac/coretext.pri b/src/platformsupport/fontdatabases/mac/coretext.pri index 4140b64b22..4d19a59226 100644 --- a/src/platformsupport/fontdatabases/mac/coretext.pri +++ b/src/platformsupport/fontdatabases/mac/coretext.pri @@ -8,7 +8,7 @@ qtConfig(freetype) { } 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 else: \ # On Mac OS they are part of the ApplicationServices umbrella framework, diff --git a/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm b/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm index 5fec53d1ed..6b73134c8b 100644 --- a/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm +++ b/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm @@ -811,7 +811,7 @@ static CTFontDescriptorRef fontDescriptorFromTheme(QPlatformTheme::Font f) UIFontDescriptor *desc = [UIFontDescriptor preferredFontDescriptorWithTextStyle:textStyle]; return static_cast(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 CTFontUIFontType fontType = fontTypeFromTheme(f); diff --git a/src/plugins/platforms/platforms.pro b/src/plugins/platforms/platforms.pro index 8324520725..fcfebf6e94 100644 --- a/src/plugins/platforms/platforms.pro +++ b/src/plugins/platforms/platforms.pro @@ -10,7 +10,7 @@ qtConfig(xcb) { SUBDIRS += xcb } -uikit: SUBDIRS += ios +uikit:!watchos: SUBDIRS += ios osx: SUBDIRS += cocoa win32:!winrt: SUBDIRS += windows diff --git a/src/testlib/qtestblacklist.cpp b/src/testlib/qtestblacklist.cpp index 1fa76a692a..3fec0ad98a 100644 --- a/src/testlib/qtestblacklist.cpp +++ b/src/testlib/qtestblacklist.cpp @@ -106,6 +106,9 @@ static QSet keywords() #ifdef Q_OS_TVOS << "tvos" #endif +#ifdef Q_OS_WATCHOS + << "watchos" +#endif #ifdef Q_OS_ANDROID << "android" #endif diff --git a/src/testlib/qtestcase.cpp b/src/testlib/qtestcase.cpp index e5dd0d694a..1fc5a36d66 100644 --- a/src/testlib/qtestcase.cpp +++ b/src/testlib/qtestcase.cpp @@ -1388,7 +1388,7 @@ FatalSignalHandler::FatalSignalHandler() // 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) +#if defined(SA_ONSTACK) && !defined(Q_OS_TVOS) && !defined(Q_OS_WATCHOS) // Let the signal handlers use an alternate stack // This is necessary if SIGSEGV is to catch a stack overflow # if defined(Q_CC_GNU) && defined(Q_OF_ELF) diff --git a/tests/auto/widgets/kernel/qwidget_window/tst_qwidget_window.cpp b/tests/auto/widgets/kernel/qwidget_window/tst_qwidget_window.cpp index a59dd8c80e..6aaac6d135 100644 --- a/tests/auto/widgets/kernel/qwidget_window/tst_qwidget_window.cpp +++ b/tests/auto/widgets/kernel/qwidget_window/tst_qwidget_window.cpp @@ -332,8 +332,9 @@ void tst_QWidget_window::tst_showWithoutActivating() else if (platformName != QStringLiteral("xcb") && platformName != QStringLiteral("windows") && platformName != QStringLiteral("ios") - && platformName != QStringLiteral("tvos")) - QSKIP("Qt::WA_ShowWithoutActivating is currently supported only on xcb, windows, and ios/tvos platforms."); + && platformName != QStringLiteral("tvos") + && platformName != QStringLiteral("watchos")) + QSKIP("Qt::WA_ShowWithoutActivating is currently supported only on xcb, windows, and ios/tvos/watchos platforms."); QWidget w1; w1.setAttribute(Qt::WA_ShowWithoutActivating); -- cgit v1.2.3