Skip to content

Commit

Permalink
Add support for Apple watchOS
Browse files Browse the repository at this point in the history
Change-Id: I3f9e00569458a463af2eaa5a3a16a6afd1e9c1ea
Reviewed-by: Tor Arne Vestbø <[email protected]>
  • Loading branch information
jakepetroules committed Aug 19, 2016
1 parent 2f108fa commit 57378a1
Show file tree
Hide file tree
Showing 41 changed files with 266 additions and 67 deletions.
13 changes: 12 additions & 1 deletion configure
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -995,6 +1002,10 @@ case "$XPLATFORM" in
XPLATFORM_MAC=yes
XPLATFORM_TVOS=yes
;;
*watchos*)
XPLATFORM_MAC=yes
XPLATFORM_WATCHOS=yes
;;
*macx*)
XPLATFORM_MAC=yes
;;
Expand Down
6 changes: 3 additions & 3 deletions configure.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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."
Expand Down
4 changes: 2 additions & 2 deletions configure.pri
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion examples/network/network.pro
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand Down
13 changes: 9 additions & 4 deletions examples/widgets/tools/plugandpaint/app/app.pro
Original file line number Diff line number Diff line change
Expand Up @@ -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]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -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
21 changes: 21 additions & 0 deletions mkspecs/common/watchos.conf
Original file line number Diff line number Diff line change
@@ -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)
1 change: 1 addition & 0 deletions mkspecs/features/mac/sdk.prf
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 8 additions & 0 deletions mkspecs/features/uikit/default_post.prf
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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

Expand All @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion mkspecs/features/uikit/default_pre.prf
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions mkspecs/features/uikit/device_destinations.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion mkspecs/features/uikit/qt.prf
Original file line number Diff line number Diff line change
@@ -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
Expand Down
1 change: 1 addition & 0 deletions mkspecs/features/uikit/qt_config.prf
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
4 changes: 4 additions & 0 deletions mkspecs/features/uikit/xcodebuild.prf
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
35 changes: 35 additions & 0 deletions mkspecs/macx-watchos-clang/Info.plist.app
Original file line number Diff line number Diff line change
@@ -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>
22 changes: 22 additions & 0 deletions mkspecs/macx-watchos-clang/Info.plist.lib
Original file line number Diff line number Diff line change
@@ -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>
21 changes: 21 additions & 0 deletions mkspecs/macx-watchos-clang/qmake.conf
Original file line number Diff line number Diff line change
@@ -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)
34 changes: 34 additions & 0 deletions mkspecs/macx-watchos-clang/qplatformdefs.h
Original file line number Diff line number Diff line change
@@ -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"
Loading

0 comments on commit 57378a1

Please sign in to comment.