From f2191d9900cbb9930e2fbdefb4682ce59769e007 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Sat, 16 Feb 2013 17:31:58 +0100 Subject: Introduce macros for simplifying platform checks on Mac OS and iOS Change-Id: Ibab8486e1e6d7e4d8922fce96add055e60c6095c Reviewed-by: Thiago Macieira --- src/corelib/global/qglobal.h | 10 ++++++++++ src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm | 4 ++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/corelib/global/qglobal.h b/src/corelib/global/qglobal.h index 73e849cb3e..233743f3ce 100644 --- a/src/corelib/global/qglobal.h +++ b/src/corelib/global/qglobal.h @@ -512,6 +512,16 @@ template Q_DECL_CONSTEXPR inline const T &qBound(const T &min, const T &val, const T &max) { return qMax(min, qMin(max, val)); } +#ifdef Q_OS_DARWIN +# define QT_MAC_PLATFORM_SDK_EQUAL_OR_ABOVE(osx, ios) \ + (defined(__MAC_OS_X_VERSION_MAX_ALLOWED) && __MAC_OS_X_VERSION_MAX_ALLOWED >= osx) || \ + (defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && __IPHONE_OS_VERSION_MAX_ALLOWED >= ios) + +# define QT_MAC_DEPLOYMENT_TARGET_BELOW(osx, ios) \ + (defined(__MAC_OS_X_VERSION_MIN_REQUIRED) && osx != __MAC_NA && __MAC_OS_X_VERSION_MIN_REQUIRED < osx) || \ + (defined(__IPHONE_OS_VERSION_MIN_REQUIRED) && ios != __IPHONE_NA && __IPHONE_OS_VERSION_MIN_REQUIRED < ios) +#endif + /* Data stream functions are provided by many classes (defined in qdatastream.h) */ diff --git a/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm b/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm index aec32e1bca..7391cbf9df 100644 --- a/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm +++ b/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm @@ -361,9 +361,9 @@ QStringList QCoreTextFontDatabase::fallbacksForFamily(const QString &family, QFo static QHash fallbackLists; -#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 60000 +#if QT_MAC_PLATFORM_SDK_EQUAL_OR_ABOVE(__MAC_NA, __IPHONE_6_0) // CTFontCopyDefaultCascadeListForLanguages is available in the SDK - #if (defined(__IPHONE_OS_VERSION_MIN_REQUIRED) && __IPHONE_OS_VERSION_MIN_REQUIRED < 60000) + #if QT_MAC_DEPLOYMENT_TARGET_BELOW(__MAC_NA, __IPHONE_6_0) // But we have to feature check at runtime if (&CTFontCopyDefaultCascadeListForLanguages) #endif -- cgit v1.2.3