Browse Source

Define WIN32_LEAN_AND_MEAN if it's not defined when including windows.h.

Branimir Karadžić 4 years ago
parent
commit
46384208ad
4 changed files with 16 additions and 5 deletions
  1. 5 0
      src/bgfx.cpp
  2. 0 2
      src/bgfx_p.h
  3. 4 0
      src/debug_renderdoc.cpp
  4. 7 3
      src/renderer_gl.h

+ 5 - 0
src/bgfx.cpp

@@ -14,6 +14,11 @@
 
 #if BX_PLATFORM_OSX || BX_PLATFORM_IOS
 #	include <objc/message.h>
+#elif BX_PLATFORM_WINDOWS
+#	ifndef WIN32_LEAN_AND_MEAN
+#		define WIN32_LEAN_AND_MEAN
+#	endif // WIN32_LEAN_AND_MEAN
+#	include <windows.h>
 #endif // BX_PLATFORM_OSX
 
 BX_ERROR_RESULT(BGFX_ERROR_TEXTURE_VALIDATION,      BX_MAKEFOURCC('b', 'g', 0, 1) );

+ 0 - 2
src/bgfx_p.h

@@ -226,8 +226,6 @@ namespace stl = std;
 
 #if BX_PLATFORM_ANDROID
 #	include <android/native_window.h>
-#elif BX_PLATFORM_WINDOWS
-#	include <windows.h>
 #endif // BX_PLATFORM_*
 
 #define BGFX_MAX_COMPUTE_BINDINGS BGFX_CONFIG_MAX_TEXTURE_SAMPLERS

+ 4 - 0
src/debug_renderdoc.cpp

@@ -7,6 +7,10 @@
 
 #if BX_PLATFORM_WINDOWS || BX_PLATFORM_LINUX
 #	if BX_PLATFORM_WINDOWS
+#		ifndef WIN32_LEAN_AND_MEAN
+#			define WIN32_LEAN_AND_MEAN
+#		endif // WIN32_LEAN_AND_MEAN
+#		include <windows.h>
 #		include <psapi.h>
 #	endif // BX_PLATFORM_WINDOWS
 #	include <renderdoc/renderdoc_app.h>

+ 7 - 3
src/renderer_gl.h

@@ -87,6 +87,12 @@
 #			undef GL_VERSION_1_4
 #			undef GL_VERSION_1_5
 #			undef GL_VERSION_2_0
+#		elif BX_PLATFORM_WINDOWS
+#			ifndef WIN32_LEAN_AND_MEAN
+#				define WIN32_LEAN_AND_MEAN
+#			endif // WIN32_LEAN_AND_MEAN
+#			include <windows.h>
+#			include <GL/gl.h>
 #		else
 #			include <GL/gl.h>
 #		endif // BX_PLATFORM_
@@ -1084,9 +1090,7 @@ typedef uint64_t GLuint64;
 #	define GL_TEXTURE_LOD_BIAS 0x8501
 #endif // GL_TEXTURE_LOD_BIAS
 
-#if BX_PLATFORM_WINDOWS
-#	include <windows.h>
-#elif BX_PLATFORM_LINUX || BX_PLATFORM_BSD
+#if BX_PLATFORM_LINUX || BX_PLATFORM_BSD
 #	include "glcontext_glx.h"
 #elif BX_PLATFORM_OSX
 #	include "glcontext_nsgl.h"