From 13d013312ad7ce1c4e6ccfa4ea75b2312e6b4b64 Mon Sep 17 00:00:00 2001 From: Robbert van der Helm Date: Fri, 6 Mar 2020 18:37:35 +0100 Subject: [PATCH] Clean up the Boost/windows.h trickery I didn't know NOMINMAX was a thing, but that fixes a lot of compile errors. --- .../{native-includes.h => boost-fix.h} | 25 +++++++++---------- src/wine-host/plugin-bridge.h | 8 +++--- 2 files changed, 17 insertions(+), 16 deletions(-) rename src/wine-host/{native-includes.h => boost-fix.h} (56%) diff --git a/src/wine-host/native-includes.h b/src/wine-host/boost-fix.h similarity index 56% rename from src/wine-host/native-includes.h rename to src/wine-host/boost-fix.h index 8a2b1a27..ff24a8d1 100644 --- a/src/wine-host/native-includes.h +++ b/src/wine-host/boost-fix.h @@ -16,13 +16,12 @@ #pragma once -// Libraries like Boost and bitsery think we're compiling on Windows or using a -// MSVC toolchain. This will cause them to make assumptions about the way -// certain types are defined, which headers are available and which features to -// disable (i.e. POSIX specific features). The only way around this I could -// think of was to just temporarily undefine the macros these libraries use to -// detect it's running under a WIN32 environment. If anyone knows a better way -// to do this, please let me know! +// Libraries like Boost think we're compiling on Windows or using a MSVC +// toolchain. This will cause them to make incorrect assumptions which platform +// specific features are available. The only way around this I could think of +// was to just temporarily undefine the macros these libraries use to detect +// it's running under a WIN32 environment. If anyone knows a better way to do +// this, please let me know! #pragma push_macro("WIN32") #pragma push_macro("_WIN32") @@ -34,13 +33,13 @@ #undef __WIN32__ #undef _WIN64 -#include +// This would be the minimal include needed to get Bosot to work. The commented +// out include below is the actual header that would cause compile errors if not +// included here, but including headers from the detail directory directly +// didn't sound like a great idea. -#include -#include -#include -#include -#include +#include +// #include #pragma pop_macro("WIN32") #pragma pop_macro("_WIN32") diff --git a/src/wine-host/plugin-bridge.h b/src/wine-host/plugin-bridge.h index 91a94e1a..e009c6c3 100644 --- a/src/wine-host/plugin-bridge.h +++ b/src/wine-host/plugin-bridge.h @@ -16,10 +16,12 @@ #pragma once -#include "native-includes.h" +#include "boost-fix.h" -// `native-includes.h` has to be included before any other files as otherwise we -// might get the wrong version of certain libraries +#define NOMINMAX +#define NOSERVICE +#define NOMCX +#define NOIMM #define WIN32_LEAN_AND_MEAN #include #include