Update for the newest Darwin-family operating systems.

- Adapt to the OS X => macOS rename in Q_OS_ macros/docs, qmake scopes,
file selectors, etc.
- Add new QSysInfo values and MAC_OS_X / __MAC_ / __IPHONE_ values for
macOS 10.12 and iOS 9.1 through 10.0.
- Update prettyProductName with new macOS "Sierra" codename.

Change-Id: Id976530beeafa01b648ebaa16f4a8f0613fcaf75
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
Jake Petroules 2016-06-10 21:13:35 -07:00
parent 712e437849
commit 3e2bde3578
7 changed files with 70 additions and 23 deletions

View File

@ -2,7 +2,7 @@
# qmake configuration for common OS X
#
QMAKE_PLATFORM += osx macx
QMAKE_PLATFORM += macos osx macx
QMAKE_MAC_SDK = macosx
include(mac.conf)

View File

@ -5,7 +5,7 @@
#
MAKEFILE_GENERATOR = UNIX
QMAKE_PLATFORM = osx macx mac darwin
QMAKE_PLATFORM = macos osx macx mac darwin
CONFIG += native_precompiled_headers
DEFINES += __USE_WS_X11__

View File

@ -26,16 +26,16 @@ isEmpty(QMAKE_PLATFORM) {
equals(TARGET_PLATFORM, unix): \
QMAKE_PLATFORM = unix
else:equals(TARGET_PLATFORM, macx): \
QMAKE_PLATFORM = osx macx mac darwin unix
QMAKE_PLATFORM = macos osx macx mac darwin unix
else:equals(TARGET_PLATFORM, win32): \
QMAKE_PLATFORM = win32
else: \
error("Qmake spec sets an invalid TARGET_PLATFORM.")
}
contains(QMAKE_PLATFORM, macx):!contains(QMAKE_PLATFORM, osx) {
warning("qmake spec specifies platform macx, but not osx.")
QMAKE_PLATFORM = osx $$QMAKE_PLATFORM
if(contains(QMAKE_PLATFORM, macx)|contains(QMAKE_PLATFORM, osx)):!contains(QMAKE_PLATFORM, macos) {
warning("qmake spec specifies platform macx or osx, but not macos.")
QMAKE_PLATFORM = macos $$QMAKE_PLATFORM
}
CONFIG += $$QMAKE_PLATFORM

View File

@ -1134,6 +1134,7 @@ bool qSharedBuild() Q_DECL_NOTHROW
\value MV_10_9 OS X 10.9
\value MV_10_10 OS X 10.10
\value MV_10_11 OS X 10.11
\value MV_10_12 macOS 10.12
\value MV_Unknown An unknown and currently unsupported platform
\value MV_CHEETAH Apple codename for MV_10_0
@ -1148,6 +1149,7 @@ bool qSharedBuild() Q_DECL_NOTHROW
\value MV_MAVERICKS Apple codename for MV_10_9
\value MV_YOSEMITE Apple codename for MV_10_10
\value MV_ELCAPITAN Apple codename for MV_10_11
\value MV_SIERRA Apple codename for MV_10_12
\value MV_IOS iOS (any)
\value MV_IOS_4_3 iOS 4.3
@ -1163,6 +1165,10 @@ bool qSharedBuild() Q_DECL_NOTHROW
\value MV_IOS_8_3 iOS 8.3
\value MV_IOS_8_4 iOS 8.4
\value MV_IOS_9_0 iOS 9.0
\value MV_IOS_9_1 iOS 9.1
\value MV_IOS_9_2 iOS 9.2
\value MV_IOS_9_3 iOS 9.3
\value MV_IOS_10_0 iOS 10.0
\value MV_None Not a Darwin operating system
@ -1173,23 +1179,28 @@ bool qSharedBuild() Q_DECL_NOTHROW
\macro Q_OS_DARWIN
\relates <QtGlobal>
Defined on Darwin-based operating systems such as OS X and iOS,
including any open source version(s) of Darwin.
Defined on Darwin-based operating systems such as OS X and iOS.
*/
/*!
\macro Q_OS_MAC
\relates <QtGlobal>
Defined on Darwin-based operating systems distributed by Apple, which
currently includes OS X and iOS, but not the open source versions of Darwin.
Deprecated synonym for \c Q_OS_DARWIN. Do not use.
*/
/*!
\macro Q_OS_OSX
\relates <QtGlobal>
Defined on OS X.
Deprecated synonym for \c Q_OS_MACOS. Do not use.
*/
/*!
\macro Q_OS_MACOS
\relates <QtGlobal>
Defined on macOS.
*/
/*!
@ -2573,10 +2584,12 @@ QString QSysInfo::kernelVersion()
running the BlackBerry userspace, but "qnx" for all other QNX-based
systems.
\b{Darwin, OS X and iOS note}: this function returns "osx" for OS X
\b{Darwin, OS X and iOS note}: this function returns "macos" for macOS
systems, "ios" for iOS 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{FreeBSD note}: this function returns "debian" for Debian/kFreeBSD and
"unknown" otherwise.
@ -2610,8 +2623,11 @@ QString QSysInfo::productType()
#elif defined(Q_OS_IOS)
return QStringLiteral("ios");
#elif defined(Q_OS_OSX)
return QStringLiteral("osx");
#elif defined(Q_OS_MACOS)
const QAppleOperatingSystemVersion version = qt_apple_os_version();
if (version.major == 10 && version.minor < 12)
return QStringLiteral("osx");
return QStringLiteral("macos");
#elif defined(Q_OS_DARWIN)
return QStringLiteral("darwin");
@ -2700,7 +2716,7 @@ QString QSysInfo::prettyProductName()
{
#if defined(Q_OS_IOS)
return QLatin1String("iOS ") + productVersion();
#elif defined(Q_OS_OSX)
#elif defined(Q_OS_MACOS)
// get the known codenames
const char *basename = 0;
switch (int(MacintoshVersion)) {
@ -2734,12 +2750,15 @@ QString QSysInfo::prettyProductName()
case MV_ELCAPITAN:
basename = "OS X El Capitan (";
break;
case MV_SIERRA:
basename = "macOS Sierra (";
break;
}
if (basename)
return QLatin1String(basename) + productVersion() + QLatin1Char(')');
// a future version of OS X
return QLatin1String("OS X ") + productVersion();
// a future version of macOS
return QLatin1String("macOS ") + productVersion();
#elif defined(Q_OS_WINPHONE)
return QLatin1String("Windows Phone ") + QLatin1String(winVer_helper());
#elif defined(Q_OS_WIN)

View File

@ -138,6 +138,7 @@ public:
MV_10_9 = Q_MV_OSX(10, 9),
MV_10_10 = Q_MV_OSX(10, 10),
MV_10_11 = Q_MV_OSX(10, 11),
MV_10_12 = Q_MV_OSX(10, 12),
/* codenames */
MV_CHEETAH = MV_10_0,
@ -152,6 +153,7 @@ public:
MV_MAVERICKS = MV_10_9,
MV_YOSEMITE = MV_10_10,
MV_ELCAPITAN = MV_10_11,
MV_SIERRA = MV_10_12,
/* iOS */
MV_IOS = 1 << 8,
@ -167,7 +169,11 @@ public:
MV_IOS_8_2 = Q_MV_IOS(8, 2),
MV_IOS_8_3 = Q_MV_IOS(8, 3),
MV_IOS_8_4 = Q_MV_IOS(8, 4),
MV_IOS_9_0 = Q_MV_IOS(9, 0)
MV_IOS_9_0 = Q_MV_IOS(9, 0),
MV_IOS_9_1 = Q_MV_IOS(9, 1),
MV_IOS_9_2 = Q_MV_IOS(9, 2),
MV_IOS_9_3 = Q_MV_IOS(9, 3),
MV_IOS_10_0 = Q_MV_IOS(10, 0)
};
#if defined(Q_OS_MAC)
static const MacVersion MacintoshVersion;

View File

@ -42,8 +42,7 @@
The operating system, must be one of: (Q_OS_x)
DARWIN - Any Darwin system
MAC - OS X and iOS
OSX - OS X
MACOS - macOS
IOS - iOS
MSDOS - MS-DOS and Windows
OS2 - OS/2
@ -199,7 +198,8 @@
# if defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE
# define Q_OS_IOS
# elif defined(TARGET_OS_MAC) && TARGET_OS_MAC
# define Q_OS_OSX
# define Q_OS_MACOS
# define Q_OS_OSX // compatibility synonym
# define Q_OS_MACX // compatibility synonym
# endif
#endif
@ -214,7 +214,7 @@
# include <Availability.h>
# include <AvailabilityMacros.h>
#
# ifdef Q_OS_OSX
# ifdef Q_OS_MACOS
# if !defined(__MAC_OS_X_VERSION_MIN_REQUIRED) || __MAC_OS_X_VERSION_MIN_REQUIRED < __MAC_10_6
# undef __MAC_OS_X_VERSION_MIN_REQUIRED
# define __MAC_OS_X_VERSION_MIN_REQUIRED __MAC_10_6
@ -243,6 +243,9 @@
# if !defined(__MAC_10_11)
# define __MAC_10_11 101100
# endif
# if !defined(__MAC_10_12)
# define __MAC_10_12 101200
# endif
# if !defined(MAC_OS_X_VERSION_10_7)
# define MAC_OS_X_VERSION_10_7 1070
# endif
@ -258,6 +261,9 @@
# if !defined(MAC_OS_X_VERSION_10_11)
# define MAC_OS_X_VERSION_10_11 101100
# endif
# if !defined(MAC_OS_X_VERSION_10_12)
# define MAC_OS_X_VERSION_10_12 101200
# endif
#
# if !defined(__IPHONE_4_3)
# define __IPHONE_4_3 40300
@ -298,6 +304,18 @@
# if !defined(__IPHONE_9_0)
# define __IPHONE_9_0 90000
# endif
# if !defined(__IPHONE_9_1)
# define __IPHONE_9_1 90100
# endif
# if !defined(__IPHONE_9_2)
# define __IPHONE_9_2 90200
# endif
# if !defined(__IPHONE_9_3)
# define __IPHONE_9_3 90300
# endif
# if !defined(__IPHONE_10_0)
# define __IPHONE_10_0 100000
# endif
#endif
#ifdef __LSB_VERSION__

View File

@ -383,8 +383,12 @@ QStringList QFileSelectorPrivate::platformSelectors()
# endif
# endif
QString productName = QSysInfo::productType();
# ifdef Q_OS_MACOS
if (productName != QStringLiteral("osx"))
ret << QStringLiteral("osx"); // compatibility
# endif
if (productName != QLatin1String("unknown"))
ret << productName; // "opensuse", "fedora", "osx", "ios", "blackberry", "android"
ret << productName; // "opensuse", "fedora", "macos", "ios", "blackberry", "android"
#endif
return ret;
}