From c37122c24359588ba80e02599ac98eddc44b6a34 Mon Sep 17 00:00:00 2001 From: =?utf8?q?R=C3=A9mi=20Verschelde?= Date: Mon, 14 Nov 2016 22:45:53 +0100 Subject: [PATCH] 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. --- CMakeLists.txt | 3 +++ Source/WinDefs.h | 2 ++ 2 files changed, 5 insertions(+) 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 -- 2.39.5