forked from binji/smoothnacl
/
build_emscripten.sh
executable file
·37 lines (31 loc) · 1.24 KB
/
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
#!/bin/bash
# Builds smooth.js and smooth.data which is embedded by smooth.html.
# After building, serve this directory and browse to <localhost>/smooth.html
# To build:
# 1) git clone git://github.com/kripken/emscripten.git (requires clang/LLVM)
# NOTE: You may need to modify tools/shared.py to point to the correct llvm
# binary names (e.g., llvm-link -> llvm-link-3.0).
# 2) cd emscripten
# 3) patch -p0 < <path/to/emscripten_float_luminance.patch>
# 4) ./emcc (one time setup)
# 5) EMSCRIPTEN_ROOT=<path/to/emscripten> ./build_emscripten.sh
set -e
if [[ ! ${EMSCRIPTEN_ROOT} || ! ${EMSCRIPTEN_ROOT-_} ]]; then
echo "Set EMSCRIPTEN_ROOT to the location of your emscripten install."
exit 1
fi
${EMSCRIPTEN_ROOT}/em++ hello_world.cc matrix.cc smoothlife.cc -o smooth.js \
-s EXPORTED_FUNCTIONS="['_main']" \
--preload-file 2D/copybuffercr.frag \
--preload-file 2D/copybuffercr.vert \
--preload-file 2D/draw.frag \
--preload-file 2D/draw.vert \
--preload-file 2D/fft.frag \
--preload-file 2D/fft.vert \
--preload-file 2D/kernelmul.frag \
--preload-file 2D/kernelmul.vert \
--preload-file 2D/snm.frag \
--preload-file 2D/snm.vert \
--preload-file 2D/copybufferrc.frag \
--preload-file 2D/copybufferrc.vert
echo "Success!"