1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2024-12-26 01:50:36 +00:00

Merge pull request #53 from Quuxplusone/travis-ci

Merge Makefiles. Add emscripten to Makefile. Test all platforms on TravisCI.
This commit is contained in:
Zeno Rogue 2018-07-11 12:38:26 +02:00 committed by GitHub
commit 69d7c4651a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 313 additions and 131 deletions

View File

@ -1,38 +1,147 @@
language: cpp
sudo: required
addons:
apt:
packages:
- libsdl-dev
- libsdl-mixer1.2-dev
- libsdl-gfx1.2-dev
- libsdl-ttf2.0-dev
- libglew-dev
os:
- linux
- osx
compiler:
- gcc
- clang
services:
- docker
matrix:
include:
- os: linux
compiler: gcc
env: >-
TRAVIS_OS_NAME=linux
TRAVIS_COMPILER_NAME=gcc
TRAVIS_BUILD_SYSTEM=autotools
HYPERROGUE_USE_GLEW=1
HYPERROGUE_USE_PNG=1
- os: osx
compiler: clang
env: >-
TRAVIS_OS_NAME=osx
TRAVIS_COMPILER_NAME=clang
TRAVIS_BUILD_SYSTEM=autotools
HYPERROGUE_USE_GLEW=1
HYPERROGUE_USE_PNG=1
- os: linux
compiler: gcc
env: >-
TRAVIS_OS_NAME=linux
TRAVIS_COMPILER_NAME=gcc
TRAVIS_BUILD_SYSTEM=Makefile
HYPERROGUE_USE_GLEW=1
HYPERROGUE_USE_PNG=1
HYPERROGUE_USE_ROGUEVIZ=1
- os: linux
compiler: clang
env: >-
TRAVIS_OS_NAME=linux
TRAVIS_COMPILER_NAME=clang
TRAVIS_BUILD_SYSTEM=Makefile
HYPERROGUE_USE_GLEW=1
HYPERROGUE_USE_PNG=1
HYPERROGUE_USE_ROGUEVIZ=1
- os: osx
compiler: gcc
env: >-
TRAVIS_OS_NAME=osx
TRAVIS_COMPILER_NAME=gcc
TRAVIS_BUILD_SYSTEM=Makefile
HYPERROGUE_USE_GLEW=1
HYPERROGUE_USE_PNG=1
HYPERROGUE_USE_ROGUEVIZ=1
- os: osx
compiler: clang
env: >-
TRAVIS_OS_NAME=osx
TRAVIS_COMPILER_NAME=clang
TRAVIS_BUILD_SYSTEM=Makefile
HYPERROGUE_USE_GLEW=1
HYPERROGUE_USE_PNG=1
HYPERROGUE_USE_ROGUEVIZ=1
- os: osx
compiler: clang
env: >-
TRAVIS_OS_NAME=osx
TRAVIS_COMPILER_NAME=clang
TRAVIS_BUILD_SYSTEM=Makefile
HYPERROGUE_USE_GLEW=0
HYPERROGUE_USE_PNG=0
HYPERROGUE_USE_ROGUEVIZ=0
- os: linux
env: >-
TRAVIS_OS_NAME=linux
TRAVIS_COMPILER_NAME=emscripten
TRAVIS_BUILD_SYSTEM=emscripten
before_install:
- |-
if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then
brew update && brew install sdl sdl_gfx sdl_mixer sdl_ttf
# work around https://stackoverflow.com/questions/51034399/ for now
(cd /usr/local/include && ln -sf SDL/SDL.h)
- |-
# Install SDL
if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then
sudo apt-get update -qq
sudo apt-get install -qq libsdl1.2-dev libsdl-gfx1.2-dev libsdl-mixer1.2-dev libsdl-ttf2.0-dev
elif [[ "$TRAVIS_OS_NAME" == "osx" ]]; then
brew update
brew install sdl sdl_gfx sdl_mixer sdl_ttf
# work around https://stackoverflow.com/questions/51034399/ for now
(cd /usr/local/include && ln -sf SDL/SDL.h)
else
exit 'Unsupported OS'
fi
- |-
# Install GLEW if asked for
if [[ "$HYPERROGUE_USE_GLEW" == "1" ]]; then
if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then
sudo apt-get install -qq libglew-dev
elif [[ "$TRAVIS_OS_NAME" == "osx" ]]; then
brew install glew
else
exit 'Unsupported OS'
fi
fi
- |-
# Install libpng if asked for
if [[ "$HYPERROGUE_USE_PNG" == "1" ]]; then
if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then
echo 'libpng is installed by default'
elif [[ "$TRAVIS_OS_NAME" == "osx" ]]; then
brew install libpng
else
exit 'Unsupported OS'
fi
fi
- |-
# Install autotools if asked for
if [[ "$TRAVIS_USE_AUTOTOOLS" == "1" ]]; then
if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then
echo 'autotools is installed by default'
elif [[ "$TRAVIS_OS_NAME" == "osx" ]]; then
brew install automake
else
exit 'Unsupported OS'
fi
fi
script:
- |-
# Build hyperrogue.
autoreconf -vi
./configure CXXFLAGS="-Wall -Werror -Wno-error=unused-result"
make
if [[ "$TRAVIS_BUILD_SYSTEM" == "autotools" ]]; then
autoreconf -vi
./configure CXXFLAGS="-Wall -Werror -Wno-error=unused-result"
make
elif [[ "$TRAVIS_BUILD_SYSTEM" == "Makefile" ]]; then
make -f Makefile.simple
elif [[ "$TRAVIS_BUILD_SYSTEM" == "emscripten" ]]; then
docker run --rm -v $(pwd):/src trzeci/emscripten make -f Makefile.simple emscripten
else
exit 'Unsupported build system'
fi
- |-
# Test hyperrogue.
./hyperrogue --help
if [[ "$TRAVIS_BUILD_SYSTEM" == "emscripten" ]]; then
ls -lAF hyper.html hyper.js hyper.wasm
else
./hyperrogue --help
fi
- |-
# Test "make dist". ("make distcheck" is expected to fail.)
make dist
if [[ "$TRAVIS_BUILD_SYSTEM" == "autotools" ]]; then make dist; fi
- |-
# Test "sudo make install".
sudo make install
if [[ "$TRAVIS_BUILD_SYSTEM" == "autotools" ]]; then sudo make install; fi

View File

@ -1,51 +0,0 @@
# This Makefile works for Mac OS X (El Capitan).
#
# Run "brew install sdl" to install SDL in /usr/local.
# Run "brew install sdl_gfx".
# Run "brew install sdl_mixer".
# Run "brew install sdl_ttf".
# Run "make -f Makefile.mac" to build HyperRogue as ./hyper.
CXXFLAGS += -std=c++11 -march=native -DMAC
CXXFLAGS += -W -Wall -Wextra -pedantic
CXXFLAGS += -Wno-format-pedantic -Wno-unused-parameter -Wno-missing-field-initializers
CXXFLAGS += -I/usr/local/include
CXXFLAGS += ${EXTRA_CXXFLAGS}
LDFLAGS += -L/usr/local/lib
OBJS = hyper.o
ifeq (a,b)
# Enable PNG screenshots. Requires "brew install libpng".
CXXFLAGS += -DCAP_PNG
LDFLAGS += -lpng
OBJS += savepng.o
else
CXXFLAGS += -DCAP_PNG=0
endif
ifeq (a,b)
# Enable RogueViz.
CXXFLAGS += -DCAP_ROGUEVIZ
endif
hyper: $(OBJS)
$(CXX) $(CXXFLAGS) $(OBJS) $(LDFLAGS) -lSDL -lSDLMain -lSDL_gfx -lSDL_mixer -lSDL_ttf -framework AppKit -framework OpenGL -o hyper
hyper.o: *.cpp language-data.cpp
$(CXX) $(CXXFLAGS) -O2 -c hyper.cpp
langen: langen.cpp language-??.cpp language-ptbr.cpp
$(CXX) $(CXXFLAGS) -O0 langen.cpp -o langen
language-data.cpp: langen
./langen > language-data.cpp
savepng.o: savepng.cpp
$(CXX) $(CXXFLAGS) -O2 -c savepng.cpp
.PHONY: clean
clean:
rm -f hyper hyper.o langen language-data.cpp savepng.o

View File

@ -1,49 +0,0 @@
# This Makefile works for MSYS2 and MinGW-w64.
#
# You might need to run commands such as "pacman -S mingw-w64-x86_64-SDL"
# to install SDL and other required libraries.
#
# Run "make -f Makefile.mgw" to build HyperRogue as ./hyper.exe.
CXXFLAGS += -std=c++11 -mwindows -DWINDOWS
CXXFLAGS += -D_A_VOLID=8
CXXFLAGS += ${EXTRA_CXXFLAGS}
OBJS = hyper.obj
ifeq (a,b)
# Enable PNG screenshots. Requires libpng.
CXXFLAGS += -DCAP_PNG
LDFLAGS += -lpng
OBJS += savepng.obj
else
CXXFLAGS += -DCAP_PNG=0
endif
ifeq (a,b)
# Enable RogueViz.
CXXFLAGS += -DCAP_ROGUEVIZ
endif
hyper.exe: $(OBJS) hyper.res
$(CXX) $(CXXFLAGS) $(OBJS) hyper.res -lSDL -lSDL_mixer -lopengl32 -lSDL_ttf -lSDL_gfx -lglew32 -o hyper.exe
hyper.obj: *.cpp language-data.cpp hyper.res
$(CXX) $(CXXFLAGS) -O2 -c hyper.cpp -o hyper.obj
hyper.res: hyper.rc hr-icon.ico
windres hyper.rc -O coff -o hyper.res
langen.exe: langen.cpp language-??.cpp language-ptbr.cpp
$(CXX) $(CXXFLAGS) -O0 langen.cpp -o langen
language-data.cpp: langen.exe
./langen.exe > language-data.cpp
savepng.obj: savepng.cpp
$(CXX) $(CXXFLAGS) -O2 -c savepng.cpp -o savepng.obj
.PHONY: clean
clean:
rm -f hyper.exe hyper.obj hyper.res langen.exe language-data.cpp savepng.obj

164
Makefile.simple Normal file
View File

@ -0,0 +1,164 @@
# This Makefile works for Mac OS X (El Capitan), MinGW, and Linux.
#
# For Mac OS X:
# Run "brew install sdl" to install SDL in /usr/local.
# Run "brew install sdl_gfx".
# Run "brew install sdl_mixer".
# Run "brew install sdl_ttf".
# Run "make -f Makefile.simple" to build HyperRogue as ./hyperrogue.
#
# For MSYS2 and MinGW-w64:
# You might need to run commands such as "pacman -S mingw-w64-x86_64-SDL"
# to install SDL and other required libraries.
# Run "make -f Makefile.simple" to build HyperRogue as ./hyperrogue.exe.
#
# For Ubuntu Linux:
# Run "sudo apt-get install libsdl-dev" to install SDL in /usr/local.
# Run "make -f Makefile.simple" to build HyperRogue as ./hyperrogue.
ifeq ($(OS),Windows_NT)
OS := mingw
TOOLCHAIN := mingw
else
UNAME_S := $(shell uname -s)
ifeq ($(UNAME_S),Linux)
OS := linux
else
ifeq ($(UNAME_S),Darwin)
OS := osx
endif
endif
TOOLCHAIN_VERSION_S := $(shell $(CXX) --version)
ifneq (,$(findstring clang,$(TOOLCHAIN_VERSION_S)))
TOOLCHAIN := clang
else
TOOLCHAIN := gcc
endif
endif
## We have now finished inspecting the environment via $(shell).
## Begin customization points for each OS and TOOLCHAIN we support.
ifeq (${OS},linux)
CXXFLAGS_EARLY += -DLINUX
EXE_EXTENSION :=
LDFLAGS_GL := -lGL
LDFLAGS_GLEW := -lGLEW
LDFLAGS_PNG := -lpng
LDFLAGS_SDL := -lSDL -lSDL_gfx -lSDL_mixer -lSDL_ttf
OBJ_EXTENSION := .o
hyper_RES :=
endif
ifeq (${OS},mingw)
CXXFLAGS_EARLY += -DWINDOWS -mwindows -D_A_VOLID=8
EXE_EXTENSION := .exe
LDFLAGS_GL := -lopengl32
LDFLAGS_GLEW := -lglew32
LDFLAGS_PNG := -lpng
LDFLAGS_SDL := -lSDL -lSDL_gfx -lSDL_mixer -lSDL_ttf
OBJ_EXTENSION := .o
hyper_RES := hyper.res
ifeq (${HYPERROGUE_USE_GLEW},)
HYPERROGUE_USE_GLEW := 1
endif
endif
ifeq (${OS},osx)
CXXFLAGS_EARLY += -DMAC -I/usr/local/include
EXE_EXTENSION :=
LDFLAGS_EARLY += -L/usr/local/lib
LDFLAGS_GL := -framework AppKit -framework OpenGL
LDFLAGS_GLEW := -lGLEW
LDFLAGS_PNG := -lpng
LDFLAGS_SDL := -lSDL -lSDLMain -lSDL_gfx -lSDL_mixer -lSDL_ttf
OBJ_EXTENSION := .o
hyper_RES :=
endif
ifeq (${TOOLCHAIN},clang)
CXXFLAGS_EARLY += -std=c++11 -march=native
CXXFLAGS_EARLY += -W -Wall -Wextra -Werror -pedantic
CXXFLAGS_EARLY += -Wno-format-pedantic -Wno-missing-field-initializers -Wno-unused-parameter
endif
ifeq (${TOOLCHAIN},gcc)
CXXFLAGS_EARLY += -std=c++11 -march=native
CXXFLAGS_EARLY += -W -Wall -Wextra -Werror
CXXFLAGS_EARLY += -Wno-empty-body -Wno-maybe-uninitialized -Wno-missing-field-initializers -Wno-unused-parameter -Wno-unused-result
endif
ifeq (${TOOLCHAIN},mingw)
CXXFLAGS_EARLY += -std=c++11 -march=native
CXXFLAGS_EARLY += -W -Wall -Wextra -Werror
endif
## We have now finished OS-specific and TOOLCHAIN-specific computations.
## Begin customization points for user-specifiable HYPERROGUE_USE_XXX macros.
hyper_OBJS = hyper$(OBJ_EXTENSION)
hyper_LDFLAGS = $(LDFLAGS_GL) $(LDFLAGS_SDL)
ifeq (${HYPERROGUE_USE_GLEW},1)
CXXFLAGS_EARLY += -DCAP_GLEW=1
hyper_LDFLAGS += $(LDFLAGS_GLEW)
else
CXXFLAGS_EARLY += -DCAP_GLEW=0
endif
ifeq (${HYPERROGUE_USE_PNG},1)
CXXFLAGS_EARLY += -DCAP_PNG=1
hyper_LDFLAGS += $(LDFLAGS_PNG)
hyper_OBJS += savepng$(OBJ_EXTENSION)
else
CXXFLAGS_EARLY += -DCAP_PNG=0
endif
ifeq (${HYPERROGUE_USE_ROGUEVIZ},1)
# Enable RogueViz.
CXXFLAGS_EARLY += -DCAP_ROGUEVIZ=1
endif
## We have now finished HYPERROGUE_USE_XXX-specific computations.
## Begin the Makefile proper.
override CXXFLAGS := $(CXXFLAGS_EARLY) $(CXXFLAGS) ${EXTRA_CXXFLAGS}
override LDFLAGS := $(LDFLAGS_EARLY) $(LDFLAGS) ${EXTRA_LDFLAGS}
hyperrogue$(EXE_EXTENSION): $(hyper_OBJS) $(hyper_RES)
$(CXX) $(CXXFLAGS) $(hyper_OBJS) $(hyper_RES) $(LDFLAGS) $(hyper_LDFLAGS) -o $@
hyper$(OBJ_EXTENSION): *.cpp language-data.cpp
$(CXX) -O2 $(CXXFLAGS) $(hyper_CXXFLAGS) -c hyper.cpp -o $@
hyper.res: hyper.rc hr-icon.ico
windres hyper.rc -O coff -o hyper.res
langen$(EXE_EXTENSION): langen.cpp language-??.cpp language-ptbr.cpp
$(CXX) -O0 $(CXXFLAGS) $(langen_CXXFLAGS) langen.cpp $(LDFLAGS) -o $@
language-data.cpp: langen$(EXE_EXTENSION)
./langen > language-data.cpp
savepng$(OBJ_EXTENSION): savepng.cpp
$(CXX) -O2 $(CXXFLAGS) -c savepng.cpp -o $@
emscripten: hyper.html
%.html %.js %.wasm: %.emscripten-sources
emcc -std=c++11 -O3 -s LEGACY_GL_EMULATION=1 -s TOTAL_MEMORY=128*1024*1024 hyperweb.cpp -o hyper.html
hyper.emscripten-sources: *.cpp
.PHONY: clean
clean:
rm -f hyperrogue$(EXE_EXTENSION) hyper$(OBJ_EXTENSION) $(hyper_RES) langen$(EXE_EXTENSION) language-data.cpp savepng$(OBJ_EXTENSION)
rm -f hyper.html hyper.js hyper.wasm

View File

@ -1,7 +1,9 @@
# HyperRogue
<p align="right">
<a href="https://travis-ci.org/zenorogue/hyperrogue/builds">
<img align="right" src="https://badges.herokuapp.com/travis/zenorogue/hyperrogue?branch=master&label=autotools" alt="TravisCI badge">
<img align="right" src="https://badges.herokuapp.com/travis/zenorogue/hyperrogue?branch=master&env=TRAVIS_BUILD_SYSTEM=autotools&label=autotools" alt="TravisCI badge">
<img align="right" src="https://badges.herokuapp.com/travis/zenorogue/hyperrogue?branch=master&env=TRAVIS_BUILD_SYSTEM=Makefile&label=make" alt="TravisCI badge">
<img align="right" src="https://badges.herokuapp.com/travis/zenorogue/hyperrogue?branch=master&env=TRAVIS_BUILD_SYSTEM=emscripten&label=web" alt="TravisCI badge">
</a>
</p>
<p align="left">
@ -48,10 +50,17 @@ You should be able to compile on Ubuntu (or similar) with something like this (y
```
sudo apt-get install gcc libsdl1.2-dev libsdl-ttf2.0-dev libsdl-gfx1.2-dev
git clone https://github.com/zenorogue/hyperrogue.git hyperrogue-git
cd hyperrogue-git
git clone https://github.com/zenorogue/hyperrogue.git hyperrogue
cd hyperrogue
autoreconf -vi
./configure
make
```
There are also makefiles for OSX `Makefile.mac` and Windows MinGW `Makefile.mgw` (note: I do not use these makefiles myself, so they might be a bit outdated).
There is also a standalone Makefile for Linux, OSX, and MinGW.
```
git clone https://github.com/zenorogue/hyperrogue.git
cd hyperrogue
make -f Makefile.simple
```

0
embuild.sh Normal file → Executable file
View File

View File

@ -1718,7 +1718,7 @@ void configure_edge_display() {
dialog::add_action([t,s3] {
static int i;
i = 1 / t->visible_from;
dialog::editNumber(i, 1, 1000000, .2, 500, s3, "");
dialog::editNumber(i, 1, 1000000, 1, 500, s3, "");
dialog::reaction = [t] () { t->visible_from = i ? 1. / i : 5; };
dialog::scaleLog();
});