mirror of
https://github.com/projectM-visualizer/projectm.git
synced 2026-02-05 15:35:45 +00:00
Avoid relying on max() from windows.h
Unfortunately, windows.h breaks the standard library because it defines max() as a macro by default. To fix this, add NOMINMAX (and WIN32_LEAN_AND_MEAN for good measure) to the compile options. Ideally, this would be set on a per-target basis, but with so many OBJECT targets, that is really tedious. Luckily, add_compile_definitions() is scoped to the current directory and sub- directories only.
This commit is contained in:
committed by
Kai Blaschke
parent
91a0b0be23
commit
6edb9d01dd
@ -20,6 +20,8 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
|
||||
|
||||
# Additional preprocessor definitions for Windows builds
|
||||
add_compile_definitions(
|
||||
NOMINMAX
|
||||
WIN32_LEAN_AND_MEAN
|
||||
USE_FTGL
|
||||
USE_NATIVE_GLEW
|
||||
STBI_NO_DDS
|
||||
|
||||
@ -74,7 +74,6 @@
|
||||
|
||||
#if defined( __WIN32__ ) || defined( _WIN32 ) || defined( WIN32 )
|
||||
#define SOIL_PLATFORM_WIN32
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#include <windows.h>
|
||||
#include <wingdi.h>
|
||||
#include <GL/gl.h>
|
||||
|
||||
@ -51,13 +51,8 @@ TextureManager::TextureManager(std::vector<std::string>& textureSearchPaths, int
|
||||
// blur5 = 64 <- user sees this as "blur3"
|
||||
if (!(i&1) || (i<2))
|
||||
{
|
||||
#if defined WIN32 && defined max
|
||||
w = max(16, w / 2);
|
||||
h = max(16, h / 2);
|
||||
#else
|
||||
w = std::max(16, w / 2);
|
||||
h = std::max(16, h / 2);
|
||||
#endif /** WIN32 */
|
||||
}
|
||||
int w2 = ((w+3)/16)*16;
|
||||
int h2 = ((h+3)/4)*4;
|
||||
|
||||
Reference in New Issue
Block a user