-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.sh
executable file
·37 lines (33 loc) · 875 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
36
37
#!/bin/bash
set -e
export OPTIMIZE="-Os"
export LDFLAGS="${OPTIMIZE}"
export CFLAGS="${OPTIMIZE}"
export CXXFLAGS="${OPTIMIZE}"
echo "============================================="
echo "Compiling wasm bindings"
echo "============================================="
mkdir -p build/wasm
(
# Compile C/C++ code
emcc \
${OPTIMIZE} \
--bind \
-s "EXTRA_EXPORTED_RUNTIME_METHODS=['addOnPostRun', 'ccall']" \
-s ALLOW_MEMORY_GROWTH=1 \
-s ASSERTIONS=1 \
-s MALLOC=emmalloc \
-s STRICT=1 \
-s WASM_ASYNC_COMPILATION=0 \
-o ./native.js \
--no-entry \
src/cpp/arithmetic.cpp
# Create output folder
mkdir -p wasm
# Move artifacts
cp native.wasm build/wasm
mv native.{js,wasm} wasm
)
echo "============================================="
echo "Compiling wasm bindings done"
echo "============================================="