TravisCI and Makefile integration for the emscripten build!

For testing the emscripten build in TravisCI, it looks like some
arcane combination of node + Browserify + the wasmify plugin + maybe
some other stuff *might* work, but I have no real idea yet.

For grabbing the build artifacts from Travis, you can temporarily
insert lines into the .travis.yml such as

    curl --upload-file ./hyper.html https://transfer.sh/hyper.html
    curl --upload-file ./hyper.js https://transfer.sh/hyper.js
    curl --upload-file ./hyper.wasm https://transfer.sh/hyper.wasm

However, "hyper.wasm" is about 2.8 megabytes in size, so this hack
definitely should never become part of the *master* `.travis.yml`.
This commit is contained in:
Arthur O'Dwyer 2018-06-26 18:55:19 -07:00
parent 5142901772
commit ef562d0d43
4 changed files with 25 additions and 3 deletions

View File

@ -1,4 +1,6 @@
language: cpp
services:
- docker
matrix:
include:
- os: linux
@ -62,6 +64,11 @@ matrix:
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:
- |-
@ -120,12 +127,18 @@ script:
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.)
if [[ "$TRAVIS_BUILD_SYSTEM" == "autotools" ]]; then make dist; fi

View File

@ -136,7 +136,7 @@ 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
$(CXX) -O2 $(CXXFLAGS) $(hyper_CXXFLAGS) -c hyper.cpp -o $@
hyper.res: hyper.rc hr-icon.ico
windres hyper.rc -O coff -o hyper.res
@ -148,9 +148,17 @@ language-data.cpp: langen$(EXE_EXTENSION)
./langen > language-data.cpp
savepng$(OBJ_EXTENSION): savepng.cpp
$(CXX) $(CXXFLAGS) -O2 -c savepng.cpp -o $@
$(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

@ -3,6 +3,7 @@
<a href="https://travis-ci.org/zenorogue/hyperrogue/builds">
<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">

0
embuild.sh Normal file → Executable file
View File