From: RĂ©mi Verschelde Date: Mon, 14 Nov 2016 21:45:53 +0000 (+0100) Subject: mingw32: Fix issues with WIN32 not being defined X-Git-Url: https://git.jsancho.org/?p=lugaru.git;a=commitdiff_plain;h=c37122c24359588ba80e02599ac98eddc44b6a34 mingw32: Fix issues with WIN32 not being defined Not sure if that is the proper fix, but it does the trick for my toolchain. An alternative might be to do s/WIN32/_WIN32/g, but I lack experience here. Also fixed abs() redefinitions that conflicted with mingw's cmath. --- diff --git a/CMakeLists.txt b/CMakeLists.txt index a082391..ff20152 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -510,6 +510,9 @@ target_link_libraries(lugaru ${LUGARU_LIBS}) if(WIN32) add_definitions(-DUSE_OPENAL=1 -DUSE_SDL=1 -DBinIO_STDINT_HEADER=) + if(MINGW) + add_definitions(-DWIN32) + endif(MINGW) else(WIN32) add_definitions(-DPLATFORM_LINUX=1 -DPLATFORM_UNIX=1 -DUSE_OPENAL=1 -DUSE_SDL=1 -DBinIO_STDINT_HEADER=) endif(WIN32) diff --git a/Source/WinDefs.h b/Source/WinDefs.h index 31dd352..2609273 100644 --- a/Source/WinDefs.h +++ b/Source/WinDefs.h @@ -99,6 +99,7 @@ char* ConvertFileName( const char* orgfilename, const char* junk); #define fopen(a, b) fopen(ConvertFileName(a), b); +#ifndef __MINGW32__ inline float abs(float f) { if (f < 0) @@ -112,6 +113,7 @@ inline double abs(double f) return -f; return f; } +#endif // __MINGW32__ #endif