From f1dab56bab3909b3fd4d0aede4e9fc8432dcd3da Mon Sep 17 00:00:00 2001 From: still-flow <46608177+still-flow@users.noreply.github.com> Date: Tue, 22 Sep 2020 02:39:04 +0300 Subject: [PATCH 1/3] try supporting MinGW64 in mymake --- mymake.cpp | 29 +++++++++++++++++------------ 1 file changed, 17 insertions(+), 12 deletions(-) diff --git a/mymake.cpp b/mymake.cpp index 4dbcdb97..183d4b04 100644 --- a/mymake.cpp +++ b/mymake.cpp @@ -32,6 +32,7 @@ string linker; string libs; int batch_size = thread::hardware_concurrency() + 1; +bool mingw64 = false; void set_linux() { preprocessor = "g++ -E"; @@ -49,14 +50,14 @@ void set_mac() { libs = " savepng.o -L/usr/local/lib -framework AppKit -framework OpenGL -lSDL -lSDLMain -lSDL_gfx -lSDL_mixer -lSDL_ttf -lpng -lpthread -lz"; } -void set_win() { +void set_mingw64() { + mingw64 = true; preprocessor = "g++ -E"; - compiler = "runbat bwin-g.bat -c"; - linker = "runbat bwin-linker.bat"; - opts = "-DFHS -DLINUX -I/usr/include/SDL"; - libs = ""; - - standard = ""; + compiler = "g++ -mwindows -march=native -W -Wall -Wextra -Werror -Wno-unused-parameter -Wno-implicit-fallthrough -Wno-maybe-uninitialized -c"; + linker = "g++ -o hyper"; + opts = "-DWINDOWS -DCAP_GLEW=1 -DCAP_PNG=1"; + libs = " savepng.o hyper.res -lopengl32 -lSDL -lSDL_gfx -lSDL_mixer -lSDL_ttf -lpthread -lz -lglew32 -lpng"; + setvbuf(stdout, NULL, _IONBF, 0); // MinGW is quirky with output buffering } vector modules; @@ -73,6 +74,8 @@ string obj_dir = "mymake_files"; string setdir = "../"; int system(string cmdline) { + if (mingw64) + cmdline = "sh -c '" + cmdline + "'"; // because system(arg) passes arg to cmd.exe on MinGW return system(cmdline.c_str()); } @@ -84,7 +87,7 @@ int main(int argc, char **argv) { #if defined(MAC) set_mac(); #elif defined(WINDOWS) - set_win(); + set_mingw64(); #else set_linux(); #endif @@ -103,9 +106,9 @@ int main(int argc, char **argv) { if(!isalnum(c)) obj_dir += "_"; else obj_dir += c; } - else if(s == "-win") { - set_win(); - obj_dir += "/win"; + else if(s == "-mingw64") { + set_mingw64(); + obj_dir += "/mingw64"; setdir += "../"; } else if(s == "-mac") { @@ -267,7 +270,9 @@ int main(int argc, char **argv) { } else if (tasks_done == tasks_amt) { finished = true; break; } } this_thread::sleep_for(quantum); } - + + if (mingw64) (void)system("windres hyper.rc -O coff -o hyper.res"); + printf("linking...\n"); system(linker + allobj + libs); return 0; From 253061a4fda32d19ecceb3f6359e9a66cd134e49 Mon Sep 17 00:00:00 2001 From: still-flow <46608177+still-flow@users.noreply.github.com> Date: Thu, 24 Sep 2020 21:36:47 +0300 Subject: [PATCH 2/3] stop ignoring return values of some calls --- mymake.cpp | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/mymake.cpp b/mymake.cpp index 183d4b04..e3a72988 100644 --- a/mymake.cpp +++ b/mymake.cpp @@ -91,9 +91,11 @@ int main(int argc, char **argv) { #else set_linux(); #endif + int retval = 0; // for storing return values of some function calls for(string fname: {"Makefile.loc", "Makefile.simple", "Makefile"}) if(file_exists(fname)) { - system("make -f " + fname + " language-data.cpp autohdr.h savepng.o"); + retval = system("make -f " + fname + " language-data.cpp autohdr.h savepng.o"); + if (retval) { printf("error during preparation!\n"); exit(retval); } break; } for(int i=1; i Date: Fri, 25 Sep 2020 04:05:12 +0300 Subject: [PATCH 3/3] make gdb backtraces explicit mark them as red checks for convenience --- .github/workflows/test_simple.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/test_simple.sh b/.github/workflows/test_simple.sh index c10070f0..5cbff0dd 100755 --- a/.github/workflows/test_simple.sh +++ b/.github/workflows/test_simple.sh @@ -6,6 +6,7 @@ if [[ "$GH_OS" == "windows-latest" && "$GH_BUILDSYS" == "mymake" ]]; then cat << ENDOFCMDS > .github/workflows/gdb_cmds.txt run --version backtrace + exit 1 ENDOFCMDS gdb --batch -x .github/workflows/gdb_cmds.txt ./hyperrogue