From: Neal Gompa (ニール・ゴンパ) Date: Mon, 14 Nov 2016 23:06:22 +0000 (+0000) Subject: Merge branch 'fix-mingw32' into 'master' X-Git-Url: https://git.jsancho.org/?a=commitdiff_plain;h=efadab206c3103525a243756e388560260b4757c;hp=4be3d280fd943394a564e08aae694d2efad6088f;p=lugaru.git Merge branch 'fix-mingw32' into 'master' Fix a first batch of mingw32 (gcc 6) compilation issues Those fixes are mostly trial and error from someone with little experience with Windows compilers (especially getting things to work for both MinGW32 and MSVC), so there is likely room for improvement. Part of #6. Fixes #7. See merge request !2 --- 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/Dependencies/libjpeg/jconfig.h b/Dependencies/libjpeg/jconfig.h index 3700728..0dc5ad6 100644 --- a/Dependencies/libjpeg/jconfig.h +++ b/Dependencies/libjpeg/jconfig.h @@ -12,3 +12,5 @@ #define TARGA_SUPPORTED /* Targa image file format */ #endif /* JPEG_CJPEG_DJPEG */ +#define HAVE_UNSIGNED_CHAR +#define HAVE_UNSIGNED_SHORT diff --git a/Source/OpenGL_Windows.cpp b/Source/OpenGL_Windows.cpp index 2f92938..09081c4 100644 --- a/Source/OpenGL_Windows.cpp +++ b/Source/OpenGL_Windows.cpp @@ -163,10 +163,8 @@ int kContextHeight; Boolean gDone = false; -#ifndef __MINGW32__ static int _argc = 0; static char **_argv = NULL; -#endif bool cmdline(const char *cmd) { @@ -681,10 +679,8 @@ static inline void chdirToAppPath(const char *argv0) int main(int argc, char **argv) { -#ifndef __MINGW32__ _argc = argc; _argv = argv; -#endif // !!! FIXME: we could use a Win32 API for this. --ryan. #ifndef 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