summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorTor Arne Vestbø <torarnv@gmail.com>2013-02-16 17:31:58 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-02-18 00:32:49 +0100
commitf2191d9900cbb9930e2fbdefb4682ce59769e007 (patch)
tree859023dc61bc10c181ab88eeeeb40f92830acb35 /src
parent4e78ce288aa67caddea65cd070663e95dc4f7183 (diff)
Introduce macros for simplifying platform checks on Mac OS and iOS
Change-Id: Ibab8486e1e6d7e4d8922fce96add055e60c6095c Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src')
-rw-r--r--src/corelib/global/qglobal.h10
-rw-r--r--src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm4
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 <typename T>
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<QString, QStringList> 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