DEADSOFTWARE

windows: fix build with mingw
authorDeaDDooMER <deaddoomer@deadsoftware.ru>
Tue, 10 Nov 2020 11:53:46 +0000 (14:53 +0300)
committerDeaDDooMER <deaddoomer@deadsoftware.ru>
Tue, 10 Nov 2020 12:46:00 +0000 (15:46 +0300)
src/cmake/i686-w64-mingw32.cmake [new file with mode: 0755]
src/cmake/x86_64-w64-mingw32.cmake [new file with mode: 0755]
src/gl/render.c
src/save.c

diff --git a/src/cmake/i686-w64-mingw32.cmake b/src/cmake/i686-w64-mingw32.cmake
new file mode 100755 (executable)
index 0000000..9ffcf73
--- /dev/null
@@ -0,0 +1,20 @@
+# Usage:
+#   cmake -DCMAKE_TOOLCHAIN_FILE=path/to/i686-w64-mingw32.cmake ..
+
+set(CMAKE_SYSTEM_NAME Windows)
+set(TOOLCHAIN_PREFIX i686-w64-mingw32)
+
+# cross compilers to use for C, C++ and Fortran
+set(CMAKE_C_COMPILER ${TOOLCHAIN_PREFIX}-gcc)
+set(CMAKE_CXX_COMPILER ${TOOLCHAIN_PREFIX}-g++)
+set(CMAKE_Fortran_COMPILER ${TOOLCHAIN_PREFIX}-gfortran)
+set(CMAKE_RC_COMPILER ${TOOLCHAIN_PREFIX}-windres)
+
+# target environment on the build host system
+set(CMAKE_FIND_ROOT_PATH /usr/${TOOLCHAIN_PREFIX}/sys-root/mingw)
+
+# modify default behavior of FIND_XXX() commands
+set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
+set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
+set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
+set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)
\ No newline at end of file
diff --git a/src/cmake/x86_64-w64-mingw32.cmake b/src/cmake/x86_64-w64-mingw32.cmake
new file mode 100755 (executable)
index 0000000..37c484d
--- /dev/null
@@ -0,0 +1,20 @@
+# Usage:
+#   cmake -DCMAKE_TOOLCHAIN_FILE=path/to/x86_64-w64-mingw32.cmake ..
+
+set(CMAKE_SYSTEM_NAME Windows)
+set(TOOLCHAIN_PREFIX x86_64-w64-mingw32)
+
+# cross compilers to use for C, C++ and Fortran
+set(CMAKE_C_COMPILER ${TOOLCHAIN_PREFIX}-gcc)
+set(CMAKE_CXX_COMPILER ${TOOLCHAIN_PREFIX}-g++)
+set(CMAKE_Fortran_COMPILER ${TOOLCHAIN_PREFIX}-gfortran)
+set(CMAKE_RC_COMPILER ${TOOLCHAIN_PREFIX}-windres)
+
+# target environment on the build host system
+set(CMAKE_FIND_ROOT_PATH /usr/${TOOLCHAIN_PREFIX}/sys-root/mingw)
+
+# modify default behavior of FIND_XXX() commands
+set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
+set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
+set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
+set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)
\ No newline at end of file
index d6f021de16a267021e347dfc8cda8b4c3b6eb76f..b7b5c248c67c68ccc7cb9c0a40862ef7ded56596 100644 (file)
@@ -1141,7 +1141,7 @@ static int wpnspr (player_t *p) {
 }
 
 static void R_draw_player (player_t *p) {
-  enum {STAND, GO, DIE, SLOP, DEAD, MESS, OUT, FALL}; // copypasted from player.c!
+  enum {STAND, GO, DIE, SLOP, DEAD, MESS, OUT_, FALL}; // copypasted from player.c!
   static const int wytab[] = {-1, -2, -1, 0};
   int s = 'A';
   int w = 0;
@@ -1187,7 +1187,7 @@ static void R_draw_player (player_t *p) {
     case SLOP:
       s = plr_slopanim[p->s];
       break;
-    case OUT:
+    case OUT_:
       s = 0;
       break;
   }
index fe52cc4982c6f3985774ed8da7d7aeb2c76e1381..27534214bf681a495663bd351bb60061bcf3c056 100644 (file)
@@ -538,9 +538,9 @@ static void WP_loadgame (FILE *h) {
 
 static char *getsavfpname (int n, int ro) {
   static char fn[] = "savgame0.dat";
+  static char p[100];
   fn[7] = n + '0';
 #ifndef WIN32
-  static char p[100];
   char *e = getenv("HOME");
   strncpy(p, e, 60);
   strcat(p, "/.flatwaifu");