]> git.jsancho.org Git - lugaru.git/commitdiff
Merge branch 'fix-mingw32' into 'master'
authorNeal Gompa (ニール・ゴンパ) <ngompa13@gmail.com>
Mon, 14 Nov 2016 23:06:22 +0000 (23:06 +0000)
committerNeal Gompa (ニール・ゴンパ) <ngompa13@gmail.com>
Mon, 14 Nov 2016 23:06:22 +0000 (23:06 +0000)
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

CMakeLists.txt
Dependencies/libjpeg/jconfig.h
Source/OpenGL_Windows.cpp
Source/WinDefs.h

index a082391123dafb920fa7caa745e88181f6a6fcc9..ff201528a71b3242f5c47477a1cbedd7b6cbfe76 100644 (file)
@@ -510,6 +510,9 @@ target_link_libraries(lugaru ${LUGARU_LIBS})
 
 if(WIN32)
        add_definitions(-DUSE_OPENAL=1 -DUSE_SDL=1 -DBinIO_STDINT_HEADER=<stdint.h>)
+       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=<stdint.h>)
 endif(WIN32)
index 3700728843f7294e054fcc763803c59022e17fac..0dc5ad632eaad61b9af1cc6b16d7f9eda3eaaa61 100644 (file)
@@ -12,3 +12,5 @@
 #define TARGA_SUPPORTED                /* Targa image file format */
 #endif /* JPEG_CJPEG_DJPEG */
 
+#define HAVE_UNSIGNED_CHAR
+#define HAVE_UNSIGNED_SHORT
index 2f92938789c3df346b2195183bbbf06eac6f6c80..09081c497ba0d8b07db0e463fbd521cd65423351 100644 (file)
@@ -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
index 31dd352d12598aa1fc7239c0668fb692001ec6bb..2609273cd873fa9486ba1e99b52393e0bdf271f4 100644 (file)
@@ -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