Fix build on Windows

Use wrapper header over Windows.h to undefine far and near in a single place.
pull/3226/head
elsid 3 years ago
parent f99f818c0c
commit 0dcb1f5aac
No known key found for this signature in database
GPG Key ID: D27B8E8D10A2896B

@ -15,7 +15,7 @@
#include "model/world/data.hpp" #include "model/world/data.hpp"
#ifdef _WIN32 #ifdef _WIN32
#include <Windows.h> #include <components/windows.hpp>
#endif #endif
using namespace Fallback; using namespace Fallback;

@ -9,10 +9,7 @@
#include "options.hpp" #include "options.hpp"
#if defined(_WIN32) #if defined(_WIN32)
#ifndef WIN32_LEAN_AND_MEAN #include <components/windows.hpp>
#define WIN32_LEAN_AND_MEAN
#endif
#include <windows.h>
// makes __argc and __argv available on windows // makes __argc and __argv available on windows
#include <cstdlib> #include <cstdlib>
#endif #endif

@ -3,10 +3,7 @@
#include <string> #include <string>
#undef WIN32_LEAN_AND_MEAN #include <components/windows.hpp>
#define WIN32_LEAN_AND_MEAN
#include <Windows.h>
#include <components/crashcatcher/crashcatcher.hpp> #include <components/crashcatcher/crashcatcher.hpp>
namespace Crash namespace Crash

@ -1,8 +1,6 @@
#include "windows_crashmonitor.hpp" #include "windows_crashmonitor.hpp"
#undef WIN32_LEAN_AND_MEAN #include <components/windows.hpp>
#define WIN32_LEAN_AND_MEAN
#include <Windows.h>
#include <Psapi.h> #include <Psapi.h>
#include <DbgHelp.h> #include <DbgHelp.h>

@ -1,9 +1,7 @@
#ifndef WINDOWS_CRASHMONITOR_HPP #ifndef WINDOWS_CRASHMONITOR_HPP
#define WINDOWS_CRASHMONITOR_HPP #define WINDOWS_CRASHMONITOR_HPP
#undef WIN32_LEAN_AND_MEAN #include <components/windows.hpp>
#define WIN32_LEAN_AND_MEAN
#include <Windows.h>
#include <atomic> #include <atomic>
#include <unordered_map> #include <unordered_map>

@ -1,9 +1,7 @@
#ifndef WINDOWS_CRASHSHM_HPP #ifndef WINDOWS_CRASHSHM_HPP
#define WINDOWS_CRASHSHM_HPP #define WINDOWS_CRASHSHM_HPP
#undef WIN32_LEAN_AND_MEAN #include <components/windows.hpp>
#define WIN32_LEAN_AND_MEAN
#include <Windows.h>
namespace Crash namespace Crash
{ {

@ -7,10 +7,8 @@
#include <components/crashcatcher/crashcatcher.hpp> #include <components/crashcatcher/crashcatcher.hpp>
#ifdef _WIN32 #ifdef _WIN32
# include <components/crashcatcher/windows_crashcatcher.hpp> #include <components/crashcatcher/windows_crashcatcher.hpp>
# undef WIN32_LEAN_AND_MEAN #include <components/windows.hpp>
# define WIN32_LEAN_AND_MEAN
# include <windows.h>
#endif #endif
namespace Debug namespace Debug

@ -12,9 +12,7 @@
#include "debuglog.hpp" #include "debuglog.hpp"
#if defined _WIN32 && defined _DEBUG #if defined _WIN32 && defined _DEBUG
# undef WIN32_LEAN_AND_MEAN #include <components/windows.hpp>
# define WIN32_LEAN_AND_MEAN
# include <windows.h>
#endif #endif
namespace Debug namespace Debug

@ -19,7 +19,7 @@
#include <cstdio> #include <cstdio>
#elif FILE_API == FILE_API_POSIX #elif FILE_API == FILE_API_POSIX
#elif FILE_API == FILE_API_WIN32 #elif FILE_API == FILE_API_WIN32
#include <windows.h> #include <components/windows.hpp>
#else #else
#error Unsupported File API #error Unsupported File API
#endif #endif

@ -25,10 +25,7 @@ namespace Misc
#elif defined(WIN32) #elif defined(WIN32)
#undef WIN32_LEAN_AND_MEAN #include <components/windows.hpp>
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
namespace Misc namespace Misc
{ {

@ -0,0 +1,9 @@
#ifndef OPENMW_COMPONENTS_WINDOWS_H
#define OPENMW_COMPONENTS_WINDOWS_H
#include <Windows.h>
#undef far
#undef near
#endif
Loading…
Cancel
Save