forked from ZQuestClassic/ZQuestClassic
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild_emscripten.sh
45 lines (37 loc) · 982 Bytes
/
build_emscripten.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#!/bin/bash
# This currently only builds the allegro example project.
set -e
if ! command -v emcc &> /dev/null
then
echo "emcc could not be found. You must install emsdk"
echo "https://emscripten.org/docs/getting_started/downloads.html"
exit 1
fi
mkdir -p build_emscripten
cd build_emscripten
USE_FLAGS=(
-s USE_FREETYPE=1
-s USE_VORBIS=1
-s USE_OGG=1
-s USE_LIBJPEG=1
-s USE_SDL=2
-s USE_LIBPNG=1
-s FULL_ES2=1
-s ASYNCIFY
-O3
)
# Wish I knew how to remove this.
SDL2_INCLUDE_DIR=$(dirname $(which emcc))/cache/sysroot/include
emcmake cmake .. \
-D CMAKE_BUILD_TYPE=Release \
-D ALLEGRO_SDL=ON \
-D WANT_ALLOW_SSE=OFF \
-D WANT_OPENAL=OFF \
-D WANT_AUDIO=ON \
-D ALLEGRO_WAIT_EVENT_SLEEP=ON \
-D SDL2_INCLUDE_DIR="$SDL2_INCLUDE_DIR" \
-D CMAKE_C_FLAGS="${USE_FLAGS[*]}" \
-D CMAKE_CXX_FLAGS="${USE_FLAGS[*]}" \
-D CMAKE_EXE_LINKER_FLAGS="${USE_FLAGS[*]}" \
-D CMAKE_EXECUTABLE_SUFFIX_CXX=".html"
cmake --build . -t al5_example