From 2d74c00a19a9e4909ff9f15248b9240dbddc2d22 Mon Sep 17 00:00:00 2001 From: Jake Petroules Date: Thu, 10 Sep 2015 01:04:53 -0700 Subject: [PATCH] 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 --- src/corelib/global/qglobal.cpp | 16 ++++++++++++++- src/corelib/global/qsystemdetection.h | 28 ++++++++++++++++++--------- 2 files changed, 34 insertions(+), 10 deletions(-) diff --git a/src/corelib/global/qglobal.cpp b/src/corelib/global/qglobal.cpp index 3ede935b4b..775f62d2ae 100644 --- a/src/corelib/global/qglobal.cpp +++ b/src/corelib/global/qglobal.cpp @@ -1169,7 +1169,7 @@ bool qSharedBuild() Q_DECL_NOTHROW \macro Q_OS_DARWIN \relates - 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. */ +/*! + \macro Q_OS_WATCHOS + \relates + + Defined on watchOS. + */ + +/*! + \macro Q_OS_TVOS + \relates + + Defined on tvOS. + */ + /*! \macro Q_OS_WIN \relates diff --git a/src/corelib/global/qsystemdetection.h b/src/corelib/global/qsystemdetection.h index 6d942a7217..8711678f34 100644 --- a/src/corelib/global/qsystemdetection.h +++ b/src/corelib/global/qsystemdetection.h @@ -41,9 +41,11 @@ /* 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 IOS - iOS + WATCHOS - watchOS + TVOS - tvOS MSDOS - MS-DOS and Windows OS2 - OS/2 OS2EMX - XFree86 on OS/2 (not PM) @@ -88,15 +90,23 @@ #if defined(__APPLE__) && (defined(__GNUC__) || defined(__xlC__) || defined(__xlc__)) # include # if defined(TARGET_OS_MAC) && TARGET_OS_MAC -# define Q_OS_DARWIN -# define Q_OS_BSD4 -# ifdef __LP64__ -# define Q_OS_DARWIN64 -# else -# define Q_OS_DARWIN32 -# endif +# define Q_OS_DARWIN +# define Q_OS_BSD4 +# ifdef __LP64__ +# define Q_OS_DARWIN64 +# else +# define Q_OS_DARWIN32 +# endif # 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 # // there is no "real" OS X define (rdar://22640089), # // assume any non iOS-based platform is OS X for now