diff --git a/cmake/CommonModules/TinyCommon.cmake b/cmake/CommonModules/TinyCommon.cmake index a705e731a..2cf96ccb5 100644 --- a/cmake/CommonModules/TinyCommon.cmake +++ b/cmake/CommonModules/TinyCommon.cmake @@ -51,29 +51,49 @@ ${TINY_UNPARSED_ARGUMENTS}") # Platform specific configurations # --- + # WinApi + # For orientation in these versions, see: + # https://developer.microsoft.com/en-us/windows/downloads/sdk-archive/ + # https://microsoft.fandom.com/wiki/List_of_Windows_codenames + # https://en.wikipedia.org/wiki/Windows_11_version_history + # https://en.wikipedia.org/wiki/Microsoft_Windows_SDK + + # The ideal case would be not to define these and rely on what is defined + # in but Qt uses too old values for these, eg. MSYS2 patches these and + # uses the latest versions, so we have to define these manually because the original + # Qt code doesn't maintain these correctly. + # All have to be defined because of checks at the beginning of (fixed) + # WINVER, _WIN32_WINNT, NTDDI_VERSION if(CMAKE_SYSTEM_NAME STREQUAL "Windows") - # All have to be defined because of checks at the beginning of - # WINVER, _WIN32_WINNT, NTDDI_VERSION - # MSYS2 Qt 6 already defines these macros in the Qt6Targets.cmake Qt6::Platform + # which is included in Package Config file. These C macros comes + # from the QtBaseConfigureTests.cmake#qt_internal_ensure_latest_win_nt_api(), + # this functions is doing compile test using the check_cxx_source_compiles(), + # it includes the and checks whether these C macros are defined and + # if they are not then it appends them to the QT_PLATFORM_DEFINITIONS, then + # the QT_PLATFORM_DEFINITIONS is set for the Qt6::Platform interface library. + # So these C macros are set on MSVC (in is advanced guess logic) + # and are not set on mingw-w64/MSYS2 in the file. + # What means we can't set them on MSYS2 because it throws [-Wmacro-redefined]. # Flipped expression of : if(MINGW AND QT_VERSION_MAJOR GREATER_EQUAL 6) if(NOT MINGW OR NOT QT_VERSION_MAJOR GREATER_EQUAL 6) target_compile_definitions(${target} INTERFACE - # Windows 10 1903 "19H1" - 0x0A000007 + # Windows 11 "22H2" - 0x0A00000C WINVER=_WIN32_WINNT_WIN10 _WIN32_WINNT=_WIN32_WINNT_WIN10 ) endif() target_compile_definitions(${target} INTERFACE - # Windows 10 1903 "19H1" - 0x0A000007 - NTDDI_VERSION=NTDDI_WIN10_19H1 + # Windows 11 "22H2" - 0x0A00000C + NTDDI_VERSION=NTDDI_WIN10_NI # Internet Explorer 11 _WIN32_IE=_WIN32_IE_IE110 - UNICODE _UNICODE # Exclude unneeded header files WIN32_LEAN_AND_MEAN NOMINMAX + # Others + UNICODE _UNICODE ) endif() diff --git a/qmake/common/winconf.pri b/qmake/common/winconf.pri index acd1c0bde..61d6e3da0 100644 --- a/qmake/common/winconf.pri +++ b/qmake/common/winconf.pri @@ -1,10 +1,19 @@ # WinApi # --- - -# All have to be defined because of checks at the beginning of the qt_windows.h -# Windows 10 1903 "19H1" - 0x0A000007 +# For orientation in these versions, see: +# https://developer.microsoft.com/en-us/windows/downloads/sdk-archive/ +# https://microsoft.fandom.com/wiki/List_of_Windows_codenames +# https://en.wikipedia.org/wiki/Windows_11_version_history +# https://en.wikipedia.org/wiki/Microsoft_Windows_SDK + +# The ideal case would be not to define these and rely on what is defined +# in but Qt uses too old values for these, eg. MSYS2 patches these and +# uses the latest versions, so we have to define these manually because the original +# Qt code doesn't maintain these correctly. +# All have to be defined because of checks at the beginning of (fixed) +# Windows 11 "22H2" - 0x0A00000C DEFINES *= WINVER=_WIN32_WINNT_WIN10 -DEFINES *= NTDDI_VERSION=NTDDI_WIN10_19H1 +DEFINES *= NTDDI_VERSION=NTDDI_WIN10_NI DEFINES *= _WIN32_WINNT=_WIN32_WINNT_WIN10 # Internet Explorer 11 DEFINES *= _WIN32_IE=_WIN32_IE_IE110