From: DeaDDooMER Date: Tue, 10 Nov 2020 11:53:46 +0000 (+0300) Subject: windows: fix build with mingw X-Git-Url: http://deadsoftware.ru/gitweb?a=commitdiff_plain;h=0962b688f0f7c5767cd3c3ae247c92fea0b7c7e0;p=flatwaifu.git windows: fix build with mingw --- diff --git a/src/cmake/i686-w64-mingw32.cmake b/src/cmake/i686-w64-mingw32.cmake new file mode 100755 index 0000000..9ffcf73 --- /dev/null +++ b/src/cmake/i686-w64-mingw32.cmake @@ -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 index 0000000..37c484d --- /dev/null +++ b/src/cmake/x86_64-w64-mingw32.cmake @@ -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 diff --git a/src/gl/render.c b/src/gl/render.c index d6f021d..b7b5c24 100644 --- a/src/gl/render.c +++ b/src/gl/render.c @@ -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; } diff --git a/src/save.c b/src/save.c index fe52cc4..2753421 100644 --- a/src/save.c +++ b/src/save.c @@ -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");