Introduce Q_OS macros for watchOS and tvOS.

As a useful side effect, watchOS and tvOS won't be detected
as iOS, leading to another confusing Q_OS_MAC situation.

Change-Id: I00fc0c7088dbc091c4638b6937a7b378d7569cec
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@theqtcompany.com>
This commit is contained in:
Jake Petroules 2015-09-10 01:04:53 -07:00
parent 5081fd6887
commit 2d74c00a19
2 changed files with 34 additions and 10 deletions

View File

@ -1169,7 +1169,7 @@ bool qSharedBuild() Q_DECL_NOTHROW
\macro Q_OS_DARWIN \macro Q_OS_DARWIN
\relates <QtGlobal> \relates <QtGlobal>
Defined on Darwin-based operating systems such as OS X and iOS. Defined on Darwin-based operating systems such as OS X, iOS, watchOS, and tvOS.
*/ */
/*! /*!
@ -1186,6 +1186,20 @@ bool qSharedBuild() Q_DECL_NOTHROW
Defined on iOS. Defined on iOS.
*/ */
/*!
\macro Q_OS_WATCHOS
\relates <QtGlobal>
Defined on watchOS.
*/
/*!
\macro Q_OS_TVOS
\relates <QtGlobal>
Defined on tvOS.
*/
/*! /*!
\macro Q_OS_WIN \macro Q_OS_WIN
\relates <QtGlobal> \relates <QtGlobal>

View File

@ -41,9 +41,11 @@
/* /*
The operating system, must be one of: (Q_OS_x) The operating system, must be one of: (Q_OS_x)
DARWIN - Any Darwin system (OS X, iOS) DARWIN - Any Darwin system (OS X, iOS, watchOS, tvOS)
OSX - OS X OSX - OS X
IOS - iOS IOS - iOS
WATCHOS - watchOS
TVOS - tvOS
MSDOS - MS-DOS and Windows MSDOS - MS-DOS and Windows
OS2 - OS/2 OS2 - OS/2
OS2EMX - XFree86 on OS/2 (not PM) OS2EMX - XFree86 on OS/2 (not PM)
@ -88,15 +90,23 @@
#if defined(__APPLE__) && (defined(__GNUC__) || defined(__xlC__) || defined(__xlc__)) #if defined(__APPLE__) && (defined(__GNUC__) || defined(__xlC__) || defined(__xlc__))
# include <TargetConditionals.h> # include <TargetConditionals.h>
# if defined(TARGET_OS_MAC) && TARGET_OS_MAC # if defined(TARGET_OS_MAC) && TARGET_OS_MAC
# define Q_OS_DARWIN # define Q_OS_DARWIN
# define Q_OS_BSD4 # define Q_OS_BSD4
# ifdef __LP64__ # ifdef __LP64__
# define Q_OS_DARWIN64 # define Q_OS_DARWIN64
# else # else
# 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 Q_OS_IOS # if defined(TARGET_OS_TV) && TARGET_OS_TV
# define Q_OS_TVOS
# elif 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
# endif
# else # else
# // there is no "real" OS X define (rdar://22640089), # // there is no "real" OS X define (rdar://22640089),
# // assume any non iOS-based platform is OS X for now # // assume any non iOS-based platform is OS X for now