From d57a7c41712f8627a462d893329dc3f0dbb52d32 Mon Sep 17 00:00:00 2001 From: Orgad Shaneh Date: Thu, 28 Sep 2017 23:54:32 +0300 Subject: MinGW: Globally define WINVER and _WIN32_WINNT to enable Windows 7 API Change-Id: I637b33ba6d05f40486d8da927ae5cc5148299348 Reviewed-by: Oswald Buddenhagen --- mkspecs/features/qt_build_config.prf | 3 +++ src/corelib/corelib.pro | 2 -- src/corelib/global/qt_windows.h | 4 ++-- src/network/kernel/kernel.pri | 2 -- src/network/kernel/qnetworkinterface_win.cpp | 1 + src/plugins/bearer/generic/qgenericengine.cpp | 6 +++--- src/plugins/bearer/platformdefs_win.h | 1 + src/plugins/platforms/windows/qwindowsdialoghelpers.cpp | 4 +++- src/plugins/platforms/windows/qwindowsmousehandler.cpp | 4 ++-- src/plugins/platforms/windows/qwindowstheme.cpp | 4 ++-- src/widgets/kernel/win.pri | 2 -- tests/auto/network/kernel/qhostinfo/qhostinfo.pro | 3 --- 12 files changed, 17 insertions(+), 19 deletions(-) diff --git a/mkspecs/features/qt_build_config.prf b/mkspecs/features/qt_build_config.prf index 150d2b2cc3..76e1d15319 100644 --- a/mkspecs/features/qt_build_config.prf +++ b/mkspecs/features/qt_build_config.prf @@ -100,6 +100,9 @@ unix: CONFIG += explicitlib # By default we want tests on macOS to be built as standalone executables macos: CONFIG += testcase_no_bundle +# Override MinGW's definition in _mingw.h +mingw: DEFINES += WINVER=0x0601 _WIN32_WINNT=0x0601 + defineTest(qtBuildPart) { bp = $$eval($$upper($$section(_QMAKE_CONF_, /, -2, -2))_BUILD_PARTS) isEmpty(bp): bp = $$QT_BUILD_PARTS diff --git a/src/corelib/corelib.pro b/src/corelib/corelib.pro index 7f018bdb94..6dc11e1a4d 100644 --- a/src/corelib/corelib.pro +++ b/src/corelib/corelib.pro @@ -50,8 +50,6 @@ win32 { mingw { # otherwise mingw headers do not declare common functions like putenv CONFIG -= strict_c++ - # Override MinGW's definition in _mingw.h - DEFINES += WINVER=0x600 _WIN32_WINNT=0x0600 } LIBS_PRIVATE += -lws2_32 !winrt { diff --git a/src/corelib/global/qt_windows.h b/src/corelib/global/qt_windows.h index bc48104edc..67ba27f072 100644 --- a/src/corelib/global/qt_windows.h +++ b/src/corelib/global/qt_windows.h @@ -48,10 +48,10 @@ #if defined(Q_CC_MINGW) // mingw's windows.h does not set _WIN32_WINNT, resulting breaking compilation # ifndef WINVER -# define WINVER 0x600 +# define WINVER 0x601 # endif # ifndef _WIN32_WINNT -# define _WIN32_WINNT 0x600 +# define _WIN32_WINNT 0x601 # endif # ifndef NTDDI_VERSION # define NTDDI_VERSION 0x06000000 diff --git a/src/network/kernel/kernel.pri b/src/network/kernel/kernel.pri index 716f745bc9..54b61f3ad3 100644 --- a/src/network/kernel/kernel.pri +++ b/src/network/kernel/kernel.pri @@ -49,8 +49,6 @@ win32: { SOURCES += kernel/qdnslookup_win.cpp \ kernel/qnetworkinterface_win.cpp LIBS_PRIVATE += -ldnsapi -liphlpapi - DEFINES += WINVER=0x0600 _WIN32_WINNT=0x0600 - } else { SOURCES += kernel/qdnslookup_winrt.cpp \ kernel/qnetworkinterface_winrt.cpp diff --git a/src/network/kernel/qnetworkinterface_win.cpp b/src/network/kernel/qnetworkinterface_win.cpp index 8344fb04c2..64c3fa6f83 100644 --- a/src/network/kernel/qnetworkinterface_win.cpp +++ b/src/network/kernel/qnetworkinterface_win.cpp @@ -56,6 +56,7 @@ // (http://sourceforge.net/p/mingw-w64/mailman/message/32935366/) #include #include +#include #include #include diff --git a/src/plugins/bearer/generic/qgenericengine.cpp b/src/plugins/bearer/generic/qgenericengine.cpp index cd3b202001..7b0aa52831 100644 --- a/src/plugins/bearer/generic/qgenericengine.cpp +++ b/src/plugins/bearer/generic/qgenericengine.cpp @@ -55,10 +55,10 @@ #if defined(Q_OS_WIN32) // PMIB_TCPTABLE2 is only available since Vista -#if _WIN32_WINNT < 0x0600 +#if _WIN32_WINNT < 0x0601 # undef _WIN32_WINNT -# define _WIN32_WINNT 0x0600 -#endif // _WIN32_WINNT < 0x0600 +# define _WIN32_WINNT 0x0601 +#endif // _WIN32_WINNT < 0x0601 #include "../platformdefs_win.h" #include #endif diff --git a/src/plugins/bearer/platformdefs_win.h b/src/plugins/bearer/platformdefs_win.h index 5a8487d868..0477dc45c3 100644 --- a/src/plugins/bearer/platformdefs_win.h +++ b/src/plugins/bearer/platformdefs_win.h @@ -45,6 +45,7 @@ #include #include #undef interface +#include #include QT_BEGIN_NAMESPACE diff --git a/src/plugins/platforms/windows/qwindowsdialoghelpers.cpp b/src/plugins/platforms/windows/qwindowsdialoghelpers.cpp index c4aeb15bd1..26779f0c01 100644 --- a/src/plugins/platforms/windows/qwindowsdialoghelpers.cpp +++ b/src/plugins/platforms/windows/qwindowsdialoghelpers.cpp @@ -39,7 +39,9 @@ #define QT_NO_URL_CAST_FROM_STRING 1 -#define _WIN32_WINNT 0x0600 +#ifndef _WIN32_WINNT +#define _WIN32_WINNT 0x0601 +#endif #include "qwindowscombase.h" #include "qwindowsdialoghelpers.h" diff --git a/src/plugins/platforms/windows/qwindowsmousehandler.cpp b/src/plugins/platforms/windows/qwindowsmousehandler.cpp index 2b14edc804..9544fb81f7 100644 --- a/src/plugins/platforms/windows/qwindowsmousehandler.cpp +++ b/src/plugins/platforms/windows/qwindowsmousehandler.cpp @@ -60,7 +60,7 @@ * are present in the Windows SDK's, but not in older MSVC Express * versions. */ -#if defined(Q_CC_MINGW) || !defined(TOUCHEVENTF_MOVE) +#if !defined(TOUCHEVENTF_MOVE) typedef struct tagTOUCHINPUT { LONG x; @@ -85,7 +85,7 @@ typedef TOUCHINPUT const * PCTOUCHINPUT; # define TOUCHEVENTF_PALM 0x0080 # define TOUCHINPUTMASKF_CONTACTAREA 0x0004 # define TOUCHINPUTMASKF_EXTRAINFO 0x0002 -#endif // if defined(Q_CC_MINGW) || !defined(TOUCHEVENTF_MOVE) +#endif // if !defined(TOUCHEVENTF_MOVE) QT_BEGIN_NAMESPACE diff --git a/src/plugins/platforms/windows/qwindowstheme.cpp b/src/plugins/platforms/windows/qwindowstheme.cpp index a1ccf1f83c..651c661d6b 100644 --- a/src/plugins/platforms/windows/qwindowstheme.cpp +++ b/src/plugins/platforms/windows/qwindowstheme.cpp @@ -38,9 +38,9 @@ ****************************************************************************/ // SHSTOCKICONINFO is only available since Vista -#if _WIN32_WINNT < 0x0600 +#if _WIN32_WINNT < 0x0601 # undef _WIN32_WINNT -# define _WIN32_WINNT 0x0600 +# define _WIN32_WINNT 0x0601 #endif #include "qwindowstheme.h" diff --git a/src/widgets/kernel/win.pri b/src/widgets/kernel/win.pri index 7cef2d14a8..f6877b02db 100644 --- a/src/widgets/kernel/win.pri +++ b/src/widgets/kernel/win.pri @@ -3,5 +3,3 @@ INCLUDEPATH += ../3rdparty/wintab !winrt: LIBS_PRIVATE *= -lshell32 -luxtheme -ldwmapi -# Override MinGW's definition in _mingw.h -mingw: DEFINES += WINVER=0x600 _WIN32_WINNT=0x0600 diff --git a/tests/auto/network/kernel/qhostinfo/qhostinfo.pro b/tests/auto/network/kernel/qhostinfo/qhostinfo.pro index 67a37faeb5..3d8457dd46 100644 --- a/tests/auto/network/kernel/qhostinfo/qhostinfo.pro +++ b/tests/auto/network/kernel/qhostinfo/qhostinfo.pro @@ -8,7 +8,4 @@ QT = core-private network-private testlib win32:LIBS += -lws2_32 -# needed for getaddrinfo with official MinGW -mingw:DEFINES += _WIN32_WINNT=0x0501 - winrt: WINRT_MANIFEST.capabilities += internetClientServer -- cgit v1.2.3