From 6e763d277639fd967aea7756071761920df2c568 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C3=A1vid=20Bodor?= Date: Tue, 25 Feb 2020 13:51:43 +0100 Subject: [PATCH] only include windows.h when it's unavoidable --- include/spdlog/common.h | 12 ------------ include/spdlog/sinks/msvc_sink.h | 9 +++++++++ include/spdlog/sinks/win_eventlog_sink.h | 9 +++++++++ include/spdlog/sinks/wincolor_sink.h | 10 ++++++++++ 4 files changed, 28 insertions(+), 12 deletions(-) diff --git a/include/spdlog/common.h b/include/spdlog/common.h index e1108a0a..cb6355cf 100644 --- a/include/spdlog/common.h +++ b/include/spdlog/common.h @@ -15,18 +15,6 @@ #include #include -#ifdef _WIN32 -#ifndef NOMINMAX -#define NOMINMAX // prevent windows redefining min/max -#endif - -#ifndef WIN32_LEAN_AND_MEAN -#define WIN32_LEAN_AND_MEAN -#endif - -#include -#endif //_WIN32 - #ifdef SPDLOG_COMPILED_LIB #undef SPDLOG_HEADER_ONLY #define SPDLOG_INLINE diff --git a/include/spdlog/sinks/msvc_sink.h b/include/spdlog/sinks/msvc_sink.h index 6db10bc9..b3887ac7 100644 --- a/include/spdlog/sinks/msvc_sink.h +++ b/include/spdlog/sinks/msvc_sink.h @@ -8,6 +8,15 @@ #include #include +#ifndef NOMINMAX +#define NOMINMAX // prevent windows redefining min/max +#endif + +#ifndef WIN32_LEAN_AND_MEAN +#define WIN32_LEAN_AND_MEAN +#endif + +#include #include #include diff --git a/include/spdlog/sinks/win_eventlog_sink.h b/include/spdlog/sinks/win_eventlog_sink.h index 83835743..e3d4e3a6 100644 --- a/include/spdlog/sinks/win_eventlog_sink.h +++ b/include/spdlog/sinks/win_eventlog_sink.h @@ -30,6 +30,15 @@ Windows Registry Editor Version 5.00 #pragma once +#ifndef NOMINMAX +#define NOMINMAX // prevent windows redefining min/max +#endif + +#ifndef WIN32_LEAN_AND_MEAN +#define WIN32_LEAN_AND_MEAN +#endif + +#include #include #include diff --git a/include/spdlog/sinks/wincolor_sink.h b/include/spdlog/sinks/wincolor_sink.h index a051a1df..9feab90d 100644 --- a/include/spdlog/sinks/wincolor_sink.h +++ b/include/spdlog/sinks/wincolor_sink.h @@ -12,6 +12,16 @@ #include #include #include + +#ifndef NOMINMAX +#define NOMINMAX // prevent windows redefining min/max +#endif + +#ifndef WIN32_LEAN_AND_MEAN +#define WIN32_LEAN_AND_MEAN +#endif + +#include #include namespace spdlog {