Enable wxUSE_GRAPHICS_CONTEXT for MinGW >= 4.8

It seems that MinGW-w32 started distributing GDI+ headers since this
version and MinGW-w64 might have supported them for even longer, but
it's difficult to test for the MinGW distribution used in this header,
as it is included before wx/msw/gccpriv.h which defines
__MINGW32_TOOLCHAIN__ and __MINGW64_TOOLCHAIN__ symbols and changing
this is tricky due to relative order of defining UNICODE and
wxUSE_UNICODE and including MinGW headers, which can only be included
once UNICODE is set properly.

But while the fully correct solution is difficult, just checking for the
compiler version should solve the problem in 99.99% of the cases in
practice as there should be vanishingly few people using MinGW-w64 with
gcc < 4.8 currently, so this simple solution is good enough.

Closes #17973.
This commit is contained in:
Vadim Zeitlin
2017-12-08 19:42:21 +01:00
parent 504c22a512
commit f4af243e5c
8 changed files with 65 additions and 64 deletions

View File

@@ -782,18 +782,18 @@
// Enable wxGraphicsContext and related classes for a modern 2D drawing API.
//
// Default is 1 except if you're using a non-Microsoft compiler under Windows
// as only MSVC is known to ship with at least gdiplus.h which is required to
// compile GDI+-based implementation of wxGraphicsContext (MSVC10 and later
// versions also include d2d1.h required for Direct2D-based implementation).
// For other compilers (e.g. mingw32) you may need to install the headers (and
// just the headers) yourself. If you do, change the setting below manually.
// Default is 1 except if you're using a compiler without support for GDI+
// under MSW, i.e. gdiplus.h and related headers (MSVC and MinGW >= 4.8 are
// known to have them). For other compilers (e.g. older mingw32) you may need
// to install the headers (and just the headers) yourself. If you do, change
// the setting below manually.
//
// Recommended setting: 1 if supported by the compilation environment
// notice that we can't use wxCHECK_VISUALC_VERSION() here as this file is
// included from wx/platform.h before wxCHECK_VISUALC_VERSION() is defined
#ifdef _MSC_VER
// Notice that we can't use wxCHECK_VISUALC_VERSION() nor wxCHECK_GCC_VERSION()
// here as this file is included from wx/platform.h before they're defined.
#if defined(_MSC_VER) || \
(defined(__MINGW32__) && (__GNUC__ > 4 || __GNUC_MINOR__ >= 8))
#define wxUSE_GRAPHICS_CONTEXT 1
#else
// Disable support for other Windows compilers, enable it if your compiler