Skip to content

Commit 24b2489

Browse files
committed
WIN: Only define _WIN32_WINNT if not new enough
This warns with MinGW, since it already defines `_WIN32_WINNT` to 0x0a00.
1 parent db47898 commit 24b2489

File tree

2 files changed

+16
-2
lines changed

2 files changed

+16
-2
lines changed

src/_c_internal_utils.cpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,14 @@
77
#define WIN32_LEAN_AND_MEAN
88
// Windows 10, for latest HiDPI API support.
99
#define WINVER 0x0A00
10-
#define _WIN32_WINNT 0x0A00
10+
#if defined(_WIN32_WINNT)
11+
#if _WIN32_WINNT < WINVER
12+
#undef _WIN32_WINNT
13+
#define _WIN32_WINNT WINVER
14+
#endif
15+
#else
16+
#define _WIN32_WINNT WINVER
17+
#endif
1118
#endif
1219
#include <pybind11/pybind11.h>
1320
#ifdef __linux__

src/_tkagg.cpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,14 @@
1919
#define WIN32_LEAN_AND_MEAN
2020
// Windows 8.1
2121
#define WINVER 0x0603
22-
#define _WIN32_WINNT 0x0603
22+
#if defined(_WIN32_WINNT)
23+
#if _WIN32_WINNT < WINVER
24+
#undef _WIN32_WINNT
25+
#define _WIN32_WINNT WINVER
26+
#endif
27+
#else
28+
#define _WIN32_WINNT WINVER
29+
#endif
2330
#endif
2431

2532
#include <pybind11/pybind11.h>

0 commit comments

Comments
 (0)