macOS: Warn the user when using incompatible or untested platform SDKs

Task-number: QTBUG-70263
Change-Id: Ic946d1efc69ebb8ba65bbba956ed55ab7183957e
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
This commit is contained in:
Tor Arne Vestbø 2018-08-31 12:33:08 +02:00
parent 3ed306772e
commit 4e4057460a
3 changed files with 40 additions and 4 deletions

View File

@ -1115,6 +1115,8 @@ defineReplace(qtConfOutputPostProcess_publicPro) {
"QT_GCC_MINOR_VERSION = $$QMAKE_GCC_MINOR_VERSION" \
"QT_GCC_PATCH_VERSION = $$QMAKE_GCC_PATCH_VERSION"
}
!isEmpty(QMAKE_MAC_SDK_VERSION): \
output += "QT_MAC_SDK_VERSION = $$QMAKE_MAC_SDK_VERSION"
!isEmpty(QMAKE_CLANG_MAJOR_VERSION) {
output += \
"QT_CLANG_MAJOR_VERSION = $$QMAKE_CLANG_MAJOR_VERSION" \

View File

@ -5,6 +5,8 @@
QMAKE_PLATFORM += macos osx macx
QMAKE_MAC_SDK = macosx
QT_MAC_SDK_VERSION_TESTED_WITH = 10.13
device.sdk = macosx
device.target = device
device.dir_affix = $${device.sdk}

View File

@ -1,9 +1,41 @@
load(default_post)
# Detect changes to the platform SDK. Apps only for now
contains(TEMPLATE, .*app):!macx-xcode {
QMAKE_EXTRA_VARIABLES += QMAKE_MAC_SDK QMAKE_MAC_SDK_VERSION
QMAKE_EXTRA_INCLUDES += $$shell_quote($$PWD/sdk.mk)
contains(TEMPLATE, .*app) {
!macx-xcode {
# Detect changes to the platform SDK
QMAKE_EXTRA_VARIABLES += QMAKE_MAC_SDK QMAKE_MAC_SDK_VERSION
QMAKE_EXTRA_INCLUDES += $$shell_quote($$PWD/sdk.mk)
}
# Detect incompatible SDK versions
!versionAtLeast(QMAKE_MAC_SDK_VERSION, $$QT_MAC_SDK_VERSION): \
warning("Qt requires at least version $$QT_MAC_SDK_VERSION of the platform SDK," \
"you're using $${QMAKE_MAC_SDK_VERSION}. Please upgrade.")
!isEmpty(QT_MAC_SDK_VERSION_TESTED_WITH) {
# For Qt developers only
!isEmpty($$list($$(QT_MAC_SDK_NO_VERSION_CHECK))): \
CONFIG += sdk_no_version_check
!sdk_no_version_check:!versionAtMost(QMAKE_MAC_SDK_VERSION, $$QT_MAC_SDK_VERSION_TESTED_WITH) {
warning("Qt has only been tested with version $$QT_MAC_SDK_VERSION_TESTED_WITH"\
"of the platform SDK, you're using $${QMAKE_MAC_SDK_VERSION}.")
warning("This is an unsupported configuration. You may experience build issues," \
"and by using")
warning("the $$QMAKE_MAC_SDK_VERSION SDK you are opting in to new features" \
"that Qt has not been prepared for.")
isEqual(QMAKE_MAC_SDK_VERSION, 10.14): \
warning("E.g., 10.14 enables dark mode and layer-backed views," \
"which Qt $${QT_MAJOR_VERSION}.$${QT_MINOR_VERSION} does not support.")
warning("Please downgrade the SDK you use to build your app to version" \
"$$QT_MAC_SDK_VERSION_TESTED_WITH, or configure")
warning("with CONFIG+=sdk_no_version_check when running qmake" \
"to silence this warning.")
}
}
}
!no_objective_c:CONFIG += objective_c