MinGW: Globally define WINVER and _WIN32_WINNT to enable Windows 7 API

Change-Id: I637b33ba6d05f40486d8da927ae5cc5148299348
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
This commit is contained in:
Orgad Shaneh 2017-09-28 23:54:32 +03:00 committed by Orgad Shaneh
parent a1c985c10b
commit d57a7c4171
12 changed files with 17 additions and 19 deletions

View File

@ -100,6 +100,9 @@ unix: CONFIG += explicitlib
# By default we want tests on macOS to be built as standalone executables # By default we want tests on macOS to be built as standalone executables
macos: CONFIG += testcase_no_bundle macos: CONFIG += testcase_no_bundle
# Override MinGW's definition in _mingw.h
mingw: DEFINES += WINVER=0x0601 _WIN32_WINNT=0x0601
defineTest(qtBuildPart) { defineTest(qtBuildPart) {
bp = $$eval($$upper($$section(_QMAKE_CONF_, /, -2, -2))_BUILD_PARTS) bp = $$eval($$upper($$section(_QMAKE_CONF_, /, -2, -2))_BUILD_PARTS)
isEmpty(bp): bp = $$QT_BUILD_PARTS isEmpty(bp): bp = $$QT_BUILD_PARTS

View File

@ -50,8 +50,6 @@ win32 {
mingw { mingw {
# otherwise mingw headers do not declare common functions like putenv # otherwise mingw headers do not declare common functions like putenv
CONFIG -= strict_c++ CONFIG -= strict_c++
# Override MinGW's definition in _mingw.h
DEFINES += WINVER=0x600 _WIN32_WINNT=0x0600
} }
LIBS_PRIVATE += -lws2_32 LIBS_PRIVATE += -lws2_32
!winrt { !winrt {

View File

@ -48,10 +48,10 @@
#if defined(Q_CC_MINGW) #if defined(Q_CC_MINGW)
// mingw's windows.h does not set _WIN32_WINNT, resulting breaking compilation // mingw's windows.h does not set _WIN32_WINNT, resulting breaking compilation
# ifndef WINVER # ifndef WINVER
# define WINVER 0x600 # define WINVER 0x601
# endif # endif
# ifndef _WIN32_WINNT # ifndef _WIN32_WINNT
# define _WIN32_WINNT 0x600 # define _WIN32_WINNT 0x601
# endif # endif
# ifndef NTDDI_VERSION # ifndef NTDDI_VERSION
# define NTDDI_VERSION 0x06000000 # define NTDDI_VERSION 0x06000000

View File

@ -49,8 +49,6 @@ win32: {
SOURCES += kernel/qdnslookup_win.cpp \ SOURCES += kernel/qdnslookup_win.cpp \
kernel/qnetworkinterface_win.cpp kernel/qnetworkinterface_win.cpp
LIBS_PRIVATE += -ldnsapi -liphlpapi LIBS_PRIVATE += -ldnsapi -liphlpapi
DEFINES += WINVER=0x0600 _WIN32_WINNT=0x0600
} else { } else {
SOURCES += kernel/qdnslookup_winrt.cpp \ SOURCES += kernel/qdnslookup_winrt.cpp \
kernel/qnetworkinterface_winrt.cpp kernel/qnetworkinterface_winrt.cpp

View File

@ -56,6 +56,7 @@
// (http://sourceforge.net/p/mingw-w64/mailman/message/32935366/) // (http://sourceforge.net/p/mingw-w64/mailman/message/32935366/)
#include <winsock2.h> #include <winsock2.h>
#include <ws2ipdef.h> #include <ws2ipdef.h>
#include <wincrypt.h>
#include <iphlpapi.h> #include <iphlpapi.h>
#include <ws2tcpip.h> #include <ws2tcpip.h>

View File

@ -55,10 +55,10 @@
#if defined(Q_OS_WIN32) #if defined(Q_OS_WIN32)
// PMIB_TCPTABLE2 is only available since Vista // PMIB_TCPTABLE2 is only available since Vista
#if _WIN32_WINNT < 0x0600 #if _WIN32_WINNT < 0x0601
# undef _WIN32_WINNT # undef _WIN32_WINNT
# define _WIN32_WINNT 0x0600 # define _WIN32_WINNT 0x0601
#endif // _WIN32_WINNT < 0x0600 #endif // _WIN32_WINNT < 0x0601
#include "../platformdefs_win.h" #include "../platformdefs_win.h"
#include <iphlpapi.h> #include <iphlpapi.h>
#endif #endif

View File

@ -45,6 +45,7 @@
#include <winsock2.h> #include <winsock2.h>
#include <mswsock.h> #include <mswsock.h>
#undef interface #undef interface
#include <wincrypt.h>
#include <winioctl.h> #include <winioctl.h>
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE

View File

@ -39,7 +39,9 @@
#define QT_NO_URL_CAST_FROM_STRING 1 #define QT_NO_URL_CAST_FROM_STRING 1
#define _WIN32_WINNT 0x0600 #ifndef _WIN32_WINNT
#define _WIN32_WINNT 0x0601
#endif
#include "qwindowscombase.h" #include "qwindowscombase.h"
#include "qwindowsdialoghelpers.h" #include "qwindowsdialoghelpers.h"

View File

@ -60,7 +60,7 @@
* are present in the Windows SDK's, but not in older MSVC Express * are present in the Windows SDK's, but not in older MSVC Express
* versions. */ * versions. */
#if defined(Q_CC_MINGW) || !defined(TOUCHEVENTF_MOVE) #if !defined(TOUCHEVENTF_MOVE)
typedef struct tagTOUCHINPUT { typedef struct tagTOUCHINPUT {
LONG x; LONG x;
@ -85,7 +85,7 @@ typedef TOUCHINPUT const * PCTOUCHINPUT;
# define TOUCHEVENTF_PALM 0x0080 # define TOUCHEVENTF_PALM 0x0080
# define TOUCHINPUTMASKF_CONTACTAREA 0x0004 # define TOUCHINPUTMASKF_CONTACTAREA 0x0004
# define TOUCHINPUTMASKF_EXTRAINFO 0x0002 # define TOUCHINPUTMASKF_EXTRAINFO 0x0002
#endif // if defined(Q_CC_MINGW) || !defined(TOUCHEVENTF_MOVE) #endif // if !defined(TOUCHEVENTF_MOVE)
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE

View File

@ -38,9 +38,9 @@
****************************************************************************/ ****************************************************************************/
// SHSTOCKICONINFO is only available since Vista // SHSTOCKICONINFO is only available since Vista
#if _WIN32_WINNT < 0x0600 #if _WIN32_WINNT < 0x0601
# undef _WIN32_WINNT # undef _WIN32_WINNT
# define _WIN32_WINNT 0x0600 # define _WIN32_WINNT 0x0601
#endif #endif
#include "qwindowstheme.h" #include "qwindowstheme.h"

View File

@ -3,5 +3,3 @@
INCLUDEPATH += ../3rdparty/wintab INCLUDEPATH += ../3rdparty/wintab
!winrt: LIBS_PRIVATE *= -lshell32 -luxtheme -ldwmapi !winrt: LIBS_PRIVATE *= -lshell32 -luxtheme -ldwmapi
# Override MinGW's definition in _mingw.h
mingw: DEFINES += WINVER=0x600 _WIN32_WINNT=0x0600

View File

@ -8,7 +8,4 @@ QT = core-private network-private testlib
win32:LIBS += -lws2_32 win32:LIBS += -lws2_32
# needed for getaddrinfo with official MinGW
mingw:DEFINES += _WIN32_WINNT=0x0501
winrt: WINRT_MANIFEST.capabilities += internetClientServer winrt: WINRT_MANIFEST.capabilities += internetClientServer