From daa9a42e463c2088936199592acafc404bedba69 Mon Sep 17 00:00:00 2001 From: Pietro Gagliardi Date: Tue, 9 Jun 2015 12:16:59 -0400 Subject: [PATCH] Added more robust compiler version verification to the Windows code, including a minimum version of MSVC for logging utilities. --- redo/windows/GNUmakeinc.mk | 1 + redo/windows/compilerver.h | 30 ++++++++++++++++++++++++++++++ redo/windows/uipriv_windows.h | 9 +-------- 3 files changed, 32 insertions(+), 8 deletions(-) create mode 100644 redo/windows/compilerver.h diff --git a/redo/windows/GNUmakeinc.mk b/redo/windows/GNUmakeinc.mk index 7dfcd8d0..790a795e 100644 --- a/redo/windows/GNUmakeinc.mk +++ b/redo/windows/GNUmakeinc.mk @@ -33,6 +33,7 @@ osCFILES = \ windows/window.c osHFILES = \ + windows/compilerver.h \ windows/resources.h \ windows/uipriv_windows.h \ windows/winapi.h diff --git a/redo/windows/compilerver.h b/redo/windows/compilerver.h new file mode 100644 index 00000000..e5539919 --- /dev/null +++ b/redo/windows/compilerver.h @@ -0,0 +1,30 @@ +// 9 june 2015 + +// Visual Studio (Microsoft's compilers) +// VS2013 is needed for va_copy(). +#ifdef _MSC_VER +#if _MSC_VER < 1800 +#error Visual Studio 2013 or higher is required to build libui. +#endif +#endif + +// MinGW +// Only MinGW-w64 is supported due to supporting APIs introduced after 2001. +// 4.0.0 is required due to its improved Vista support. +#ifdef __MINGW32__ +#ifndef __MINGW64_VERSION_MAJOR +#error At present, only MinGW-w64 (>= 4.0.0) is supported. Other toolchains will be supported in the future (but other variants of MinGW will not). +#endif +#if __MINGW64_VERSION_MAJOR > 4 +#define ui_good_mingw +#elif (__MINGW64_VERSION_MAJOR == 4) && (__MINGW64_VERSION_MINOR > 0) +#define ui_good_mingw +#endif +#ifndef ui_good_mingw +#error MinGW-w64 version 4.0.0 or newer is required. +#endif +// TODO exact version once my changes get pushed +#undef ui_good_mingw +#endif + +// other compilers can be added here as necessary diff --git a/redo/windows/uipriv_windows.h b/redo/windows/uipriv_windows.h index 90abfb17..cf992c2c 100644 --- a/redo/windows/uipriv_windows.h +++ b/redo/windows/uipriv_windows.h @@ -4,14 +4,7 @@ #include "../ui_windows.h" #include "../uipriv.h" #include "resources.h" - -#ifndef __MINGW64_VERSION_MAJOR -#error At present, only MinGW-w64 (>= 4.0.0) is supported. Other toolchains will be supported in the future (but other variants of MinGW will not). -#endif -#if __MINGW64_VERSION_MAJOR < 4 -#error MinGW-w64 version 4.0.0 or newer is required. -#endif -// TODO exact version once my changes get pushed +#include "compilerver.h" // ui internal window messages enum {