make qconfig.pri export QT_<compiler>_VERSION variables again

... and rename those determined by toolchain.prf to QMAKE_* (this was
already the case for the newly introduced msvc and icc variables).

this restores the ability for user projects to query the toolchain qt
itself was built with, which is necessary for compatibility checks.
in fact, we may do such validation in toolchain.prf itself at a later
point.

Change-Id: I35f4c393c5e4e0fe987c0844714b7a8f8687c24e
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
This commit is contained in:
Oswald Buddenhagen 2017-06-08 14:30:33 +02:00
parent b598cd0483
commit 1216f596bd
3 changed files with 51 additions and 28 deletions

View File

@ -1064,6 +1064,37 @@ defineReplace(qtConfOutputPostProcess_publicPro) {
!isEmpty(config.input.qt_libinfix): output += "QT_LIBINFIX = $$config.input.qt_libinfix"
!isEmpty(config.input.qt_namespace): output += "QT_NAMESPACE = $$config.input.qt_namespace"
!isEmpty(QMAKE_GCC_MAJOR_VERSION) {
output += \
"QT_GCC_MAJOR_VERSION = $$QMAKE_GCC_MAJOR_VERSION" \
"QT_GCC_MINOR_VERSION = $$QMAKE_GCC_MINOR_VERSION" \
"QT_GCC_PATCH_VERSION = $$QMAKE_GCC_PATCH_VERSION"
}
!isEmpty(QMAKE_CLANG_MAJOR_VERSION) {
output += \
"QT_CLANG_MAJOR_VERSION = $$QMAKE_CLANG_MAJOR_VERSION" \
"QT_CLANG_MINOR_VERSION = $$QMAKE_CLANG_MINOR_VERSION" \
"QT_CLANG_PATCH_VERSION = $$QMAKE_CLANG_PATCH_VERSION"
}
!isEmpty(QMAKE_APPLE_CLANG_MAJOR_VERSION) {
output += \
"QT_APPLE_CLANG_MAJOR_VERSION = $$QMAKE_APPLE_CLANG_MAJOR_VERSION" \
"QT_APPLE_CLANG_MINOR_VERSION = $$QMAKE_APPLE_CLANG_MINOR_VERSION" \
"QT_APPLE_CLANG_PATCH_VERSION = $$QMAKE_APPLE_CLANG_PATCH_VERSION"
}
!isEmpty(QMAKE_MSC_VER) {
output += \
"QT_MSVC_MAJOR_VERSION = $$replace(QMAKE_MSC_FULL_VER, "(..)(..)(.*)", "\\1")" \
"QT_MSVC_MINOR_VERSION = $$format_number($$replace(QMAKE_MSC_FULL_VER, "(..)(..)(.*)", "\\2"))" \
"QT_MSVC_PATCH_VERSION = $$replace(QMAKE_MSC_FULL_VER, "(..)(..)(.*)", "\\3")"
}
!isEmpty(QMAKE_ICC_VER) {
output += \
"QT_ICC_MAJOR_VERSION = $$replace(QMAKE_ICC_VER, "(..)(..)", "\\1")" \
"QT_ICC_MINOR_VERSION = $$format_number($$replace(QMAKE_ICC_VER, "(..)(..)", "\\2"))" \
"QT_ICC_PATCH_VERSION = $$QMAKE_ICC_UPDATE_VER"
}
output += "QT_EDITION = $$config.input.qt_edition"
!contains(config.input.qt_edition, "(OpenSource|Preview)") {
output += \

View File

@ -13,17 +13,17 @@ QMAKE_APPLE_CC = __APPLE_CC__
#endif
#ifdef __clang__
#ifdef __APPLE_CC__
QT_APPLE_CLANG_MAJOR_VERSION = __clang_major__
QT_APPLE_CLANG_MINOR_VERSION = __clang_minor__
QT_APPLE_CLANG_PATCH_VERSION = __clang_patchlevel__
QMAKE_APPLE_CLANG_MAJOR_VERSION = __clang_major__
QMAKE_APPLE_CLANG_MINOR_VERSION = __clang_minor__
QMAKE_APPLE_CLANG_PATCH_VERSION = __clang_patchlevel__
#else
QT_CLANG_MAJOR_VERSION = __clang_major__
QT_CLANG_MINOR_VERSION = __clang_minor__
QT_CLANG_PATCH_VERSION = __clang_patchlevel__
QMAKE_CLANG_MAJOR_VERSION = __clang_major__
QMAKE_CLANG_MINOR_VERSION = __clang_minor__
QMAKE_CLANG_PATCH_VERSION = __clang_patchlevel__
#endif
#endif
#ifdef __GNUC__
QT_GCC_MAJOR_VERSION = __GNUC__
QT_GCC_MINOR_VERSION = __GNUC_MINOR__
QT_GCC_PATCH_VERSION = __GNUC_PATCHLEVEL__
QMAKE_GCC_MAJOR_VERSION = __GNUC__
QMAKE_GCC_MINOR_VERSION = __GNUC_MINOR__
QMAKE_GCC_PATCH_VERSION = __GNUC_PATCHLEVEL__
#endif

View File

@ -155,35 +155,27 @@ unset(target_prefix)
# Populate QMAKE_COMPILER_DEFINES and some compatibility variables.
# The $$format_number() calls strip leading zeros to avoid misinterpretation as octal.
QMAKE_COMPILER_DEFINES += __cplusplus=$$QT_COMPILER_STDCXX
!isEmpty(QMAKE_MSC_VER) {
!isEmpty(QMAKE_MSC_VER): \
QMAKE_COMPILER_DEFINES += _MSC_VER=$$QMAKE_MSC_VER _MSC_FULL_VER=$$QMAKE_MSC_FULL_VER
QT_MSVC_MAJOR_VERSION = $$replace(QMAKE_MSC_FULL_VER, "(..)(..)(.*)", "\\1")
QT_MSVC_MINOR_VERSION = $$format_number($$replace(QMAKE_MSC_FULL_VER, "(..)(..)(.*)", "\\2"))
QT_MSVC_PATCH_VERSION = $$replace(QMAKE_MSC_FULL_VER, "(..)(..)(.*)", "\\3"))
}
!isEmpty(QMAKE_ICC_VER) {
!isEmpty(QMAKE_ICC_VER): \
QMAKE_COMPILER_DEFINES += __INTEL_COMPILER=$$QMAKE_ICC_VER __INTEL_COMPILER_UPDATE=$$QMAKE_ICC_UPDATE_VER
QT_ICC_MAJOR_VERSION = $$replace(QMAKE_ICC_VER, "(..)(..)", "\\1")
QT_ICC_MINOR_VERSION = $$format_number($$replace(QMAKE_ICC_VER, "(..)(..)", "\\2"))
QT_ICC_PATCH_VERSION = $$QMAKE_ICC_UPDATE_VER
}
!isEmpty(QMAKE_APPLE_CC): \
QMAKE_COMPILER_DEFINES += __APPLE_CC__=$$QMAKE_APPLE_CC
!isEmpty(QT_APPLE_CLANG_MAJOR_VERSION): \
QMAKE_COMPILER_DEFINES += __clang__ \
__clang_major__=$$QT_APPLE_CLANG_MAJOR_VERSION \
__clang_minor__=$$QT_APPLE_CLANG_MINOR_VERSION \
__clang_patchlevel__=$$QT_APPLE_CLANG_PATCH_VERSION
__clang_major__=$$QMAKE_APPLE_CLANG_MAJOR_VERSION \
__clang_minor__=$$QMAKE_APPLE_CLANG_MINOR_VERSION \
__clang_patchlevel__=$$QMAKE_APPLE_CLANG_PATCH_VERSION
!isEmpty(QT_CLANG_MAJOR_VERSION): \
QMAKE_COMPILER_DEFINES += __clang__ \
__clang_major__=$$QT_CLANG_MAJOR_VERSION \
__clang_minor__=$$QT_CLANG_MINOR_VERSION \
__clang_patchlevel__=$$QT_CLANG_PATCH_VERSION
__clang_major__=$$QMAKE_CLANG_MAJOR_VERSION \
__clang_minor__=$$QMAKE_CLANG_MINOR_VERSION \
__clang_patchlevel__=$$QMAKE_CLANG_PATCH_VERSION
!isEmpty(QT_GCC_MAJOR_VERSION): \
QMAKE_COMPILER_DEFINES += \
__GNUC__=$$QT_GCC_MAJOR_VERSION \
__GNUC_MINOR__=$$QT_GCC_MINOR_VERSION \
__GNUC_PATCHLEVEL__=$$QT_GCC_PATCH_VERSION
__GNUC__=$$QMAKE_GCC_MAJOR_VERSION \
__GNUC_MINOR__=$$QMAKE_GCC_MINOR_VERSION \
__GNUC_PATCHLEVEL__=$$QMAKE_GCC_PATCH_VERSION
QMAKE_CFLAGS += $$QMAKE_CFLAGS_MSVC_COMPAT
QMAKE_CXXFLAGS += $$QMAKE_CFLAGS_MSVC_COMPAT