-
Notifications
You must be signed in to change notification settings - Fork 5
/
build.sh
executable file
·35 lines (31 loc) · 892 Bytes
/
build.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
#!/usr/bin/env bash
set -e
OUTPUT_FILENAME="yoga.js"
# clean up build folder
rm -rf build && mkdir -p build
build() {
if [[ -n "$EMSCRIPTEN_SDK_ENV" ]]; then
source $EMSCRIPTEN_SDK_ENV
emcc "$@"
else
docker run --rm -v $(pwd):$(pwd) -w $(pwd) -u emscripten -t trzeci/emscripten:sdk-incoming-64bit emcc "$@"
fi
}
# compile to wasm
build \
yoga/*.cpp bindings/*.cc \
--bind -Os --memory-init-file 0 --closure 1 --llvm-lto 1 \
-fno-exceptions \
-s BINARYEN=1 \
-s "BINARYEN_METHOD='native-wasm'" \
-s EXPORTED_RUNTIME_METHODS=[] \
-s DISABLE_EXCEPTION_CATCHING=1 \
-s AGGRESSIVE_VARIABLE_ELIMINATION=1 \
-s NO_EXIT_RUNTIME=1 \
-s ASSERTIONS=0 \
-s SINGLE_FILE=1 \
-s NO_FILESYSTEM=1 \
-s ALLOW_MEMORY_GROWTH=1 \
-s MODULARIZE=1 \
-s "DEFAULT_LIBRARY_FUNCS_TO_INCLUDE=['memcpy','memset','malloc','free','strlen']" \
-o build/$OUTPUT_FILENAME