Add windows_with_undefs.h to fix conflicts with windows.h

windows.h adds macros such as `#define GetMessage GetMessageA` which
cause conflicts in naming when for example a class definition is before
windows.h and a use is after windows.h

Add a header that can be used both to include windows.h and remove
defines, and to only remove defines (when windows.h is included by)
external dependencies.
This commit is contained in:
Corentin Wallez
2018-07-17 11:27:58 +02:00
committed by Corentin Wallez
parent 6aaa10fa60
commit 629c11baad
6 changed files with 51 additions and 1 deletions

View File

@@ -25,4 +25,10 @@
using Microsoft::WRL::ComPtr;
// Remove windows.h macros after d3d12's include of windows.h
#include "common/Platform.h"
#if defined(NXT_PLATFORM_WINDOWS)
# include "common/windows_with_undefs.h"
#endif
#endif // BACKEND_D3D12_D3D12PLATFORM_H_

View File

@@ -19,9 +19,15 @@
#include "backend/Device.h"
#include "backend/opengl/Forward.h"
#include "common/Platform.h"
#include "glad/glad.h"
// Remove windows.h macros after glad's include of windows.h
#if defined(NXT_PLATFORM_WINDOWS)
# include "common/windows_with_undefs.h"
#endif
namespace backend { namespace opengl {
class Device : public DeviceBase {