mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2025-04-11 21:33:16 +00:00
Merge branch 'master' of https://github.com/zenorogue/hyperrogue
This commit is contained in:
commit
76462aa1e7
6
.github/workflows/build.sh
vendored
6
.github/workflows/build.sh
vendored
@ -1,5 +1,4 @@
|
||||
set -e o pipefail
|
||||
source .github/workflows/gh_ci_envvars.sh
|
||||
set -x -e o pipefail
|
||||
|
||||
|
||||
GH_MYMAKE_ARGS="-fPIC"
|
||||
@ -32,5 +31,6 @@ elif [[ "$GH_BUILDSYS" == "mymake" ]]; then
|
||||
./mymake $GH_MYMAKE_ARGS
|
||||
mv hyper hyperrogue
|
||||
else
|
||||
exit 'unknown build system'
|
||||
echo 'unknown build system'
|
||||
exit 1
|
||||
fi
|
||||
|
57
.github/workflows/github_ci.yml
vendored
57
.github/workflows/github_ci.yml
vendored
@ -8,6 +8,7 @@ on:
|
||||
|
||||
jobs:
|
||||
main_matrix:
|
||||
name: Unix
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
fail-fast: false
|
||||
@ -18,36 +19,40 @@ jobs:
|
||||
hyper_use_rviz: [rviz_1, rviz_0]
|
||||
hyper_use_png: [png_1]
|
||||
hyper_use_glew: [glew_1]
|
||||
env:
|
||||
GH_OS: ${{ matrix.os }}
|
||||
GH_COMPILER: ${{ matrix.compiler }}
|
||||
GH_BUILDSYS: ${{ matrix.build_system }}
|
||||
GH_HYP_RVIZ: ${{ matrix.hyper_use_rviz }}
|
||||
GH_HYP_PNG: ${{ matrix.hyper_use_png }}
|
||||
GH_HYP_GLEW: ${{ matrix.hyper_use_glew }}
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: envvars_setup
|
||||
run: |
|
||||
cat << ENDOFVARS > .github/workflows/gh_ci_envvars.sh
|
||||
GH_OS=${{ matrix.os }}
|
||||
GH_COMPILER=${{ matrix.compiler }}
|
||||
GH_BUILDSYS=${{ matrix.build_system }}
|
||||
GH_HYP_RVIZ=${{ matrix.hyper_use_rviz }}
|
||||
GH_HYP_PNG=${{ matrix.hyper_use_png }}
|
||||
GH_HYP_GLEW=${{ matrix.hyper_use_glew }}
|
||||
ENDOFVARS
|
||||
- name: install_deps
|
||||
- name: Install build dependencies
|
||||
run: .github/workflows/install_deps.sh
|
||||
- name: build
|
||||
- name: Build
|
||||
run: .github/workflows/build.sh
|
||||
- name: test_simple
|
||||
- name: Do a simple test
|
||||
run: .github/workflows/test_simple.sh
|
||||
|
||||
windows:
|
||||
runs-on: ${{ matrix.os }}
|
||||
name: Windows
|
||||
runs-on: windows-latest
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
os: [windows-latest]
|
||||
compiler: [gcc]
|
||||
build_system: [makefile, autotools]
|
||||
build_system: [makefile, autotools, mymake]
|
||||
hyper_use_rviz: [rviz_1, rviz_0]
|
||||
hyper_use_png: [png_1]
|
||||
hyper_use_glew: [glew_1]
|
||||
env:
|
||||
GH_OS: windows-latest
|
||||
GH_COMPILER: ${{ matrix.compiler }}
|
||||
GH_BUILDSYS: ${{ matrix.build_system }}
|
||||
GH_HYP_RVIZ: ${{ matrix.hyper_use_rviz }}
|
||||
GH_HYP_PNG: ${{ matrix.hyper_use_png }}
|
||||
GH_HYP_GLEW: ${{ matrix.hyper_use_glew }}
|
||||
defaults:
|
||||
run:
|
||||
shell: msys2 {0}
|
||||
@ -57,32 +62,22 @@ jobs:
|
||||
update: true
|
||||
install: 'pactoys'
|
||||
- uses: actions/checkout@v2
|
||||
- name: envvars_setup
|
||||
run: |
|
||||
cat << ENDOFVARS > .github/workflows/gh_ci_envvars.sh
|
||||
GH_OS=${{ matrix.os }}
|
||||
GH_COMPILER=${{ matrix.compiler }}
|
||||
GH_BUILDSYS=${{ matrix.build_system }}
|
||||
GH_HYP_RVIZ=${{ matrix.hyper_use_rviz }}
|
||||
GH_HYP_PNG=${{ matrix.hyper_use_png }}
|
||||
GH_HYP_GLEW=${{ matrix.hyper_use_glew }}
|
||||
ENDOFVARS
|
||||
- name: install_deps
|
||||
- name: Install build dependencies
|
||||
env:
|
||||
MSYSTEM: MSYS
|
||||
run: .github/workflows/install_deps.sh
|
||||
- name: build
|
||||
- name: Build
|
||||
run: .github/workflows/build.sh
|
||||
- name: test_simple
|
||||
- name: Do a simple test
|
||||
run: .github/workflows/test_simple.sh
|
||||
|
||||
emscripten:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: build
|
||||
- name: Build
|
||||
run: |
|
||||
docker run --rm -v $(pwd):/src trzeci/emscripten make -f Makefile.simple emscripten
|
||||
- name: test_simple
|
||||
- name: Do a simple test
|
||||
run: |
|
||||
ls -lAF hyper.html hyper.js hyper.wasm
|
||||
|
8
.github/workflows/install_deps.sh
vendored
8
.github/workflows/install_deps.sh
vendored
@ -1,10 +1,9 @@
|
||||
set -e o pipefail
|
||||
source .github/workflows/gh_ci_envvars.sh
|
||||
set -x -e o pipefail
|
||||
|
||||
|
||||
GH_DEPS_UBUNTU="$GH_COMPILER libsdl1.2-dev libsdl-ttf2.0-dev libsdl-gfx1.2-dev libsdl-mixer1.2-dev"
|
||||
GH_DEPS_MACOS="sdl sdl_gfx sdl_mixer sdl_ttf"
|
||||
GH_DEPS_MINGW64="$GH_COMPILER:x SDL:x SDL_ttf:x SDL_gfx:x SDL_mixer:x make"
|
||||
GH_DEPS_MINGW64="$GH_COMPILER:x SDL:x SDL_ttf:x SDL_gfx:x SDL_mixer:x make gdb:x"
|
||||
|
||||
if [[ "$GH_HYP_GLEW" == "glew_1" ]]; then
|
||||
GH_DEPS_UBUNTU+=" libglew-dev"
|
||||
@ -36,5 +35,6 @@ elif [[ "$GH_OS" == "windows-latest" ]]; then
|
||||
pacboy -Sy --noconfirm --needed $GH_DEPS_MINGW64
|
||||
sed -i'.orig' 's/<SDL.h>/"SDL.h"/' /mingw64/include/SDL/SDL_gfxPrimitives.h
|
||||
else
|
||||
exit 'unknown OS'
|
||||
echo 'unknown OS'
|
||||
exit 1
|
||||
fi
|
||||
|
16
.github/workflows/test_simple.sh
vendored
16
.github/workflows/test_simple.sh
vendored
@ -1,5 +1,15 @@
|
||||
set -e o pipefail
|
||||
source .github/workflows/gh_ci_envvars.sh
|
||||
set -x -e o pipefail
|
||||
|
||||
|
||||
./hyperrogue --version
|
||||
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
|
||||
else
|
||||
./hyperrogue --version
|
||||
fi
|
||||
|
42
mymake.cpp
42
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
|
||||
}
|
||||
|
||||
void set_web() {
|
||||
@ -86,6 +87,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());
|
||||
}
|
||||
|
||||
@ -97,13 +100,15 @@ int main(int argc, char **argv) {
|
||||
#if defined(MAC)
|
||||
set_mac();
|
||||
#elif defined(WINDOWS)
|
||||
set_win();
|
||||
set_mingw64();
|
||||
#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<argc; i++) {
|
||||
@ -116,9 +121,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") {
|
||||
@ -189,7 +194,8 @@ int main(int argc, char **argv) {
|
||||
compiler += " " + standard;
|
||||
ifstream fs("hyper.cpp");
|
||||
|
||||
system("mkdir -p " + obj_dir);
|
||||
retval = system("mkdir -p " + obj_dir);
|
||||
if (retval) { printf("unable to create output directory!\n"); exit(retval); }
|
||||
|
||||
ofstream fsm(obj_dir + "/hyper.cpp");
|
||||
fsm << "#if REM\n#define INCLUDE(x)\n#endif\n";
|
||||
@ -286,8 +292,14 @@ int main(int argc, char **argv) {
|
||||
}
|
||||
else if (tasks_done == tasks_amt) { finished = true; break; }
|
||||
} this_thread::sleep_for(quantum); }
|
||||
|
||||
|
||||
if (mingw64) {
|
||||
retval = system("windres hyper.rc -O coff -o hyper.res");
|
||||
if (retval) { printf("windres error!\n"); exit(retval); }
|
||||
}
|
||||
|
||||
printf("linking...\n");
|
||||
system(linker + allobj + libs);
|
||||
retval = system(linker + allobj + libs);
|
||||
if (retval) { printf("linking error!\n"); exit(retval); }
|
||||
return 0;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user