forked from repalash/xatlas.js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild_web.sh
executable file
·52 lines (45 loc) · 1.17 KB
/
build_web.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
46
47
48
49
50
51
52
#!/bin/bash
set -e
export OPTIMIZE="-Os"
export LDFLAGS="${OPTIMIZE}"
export CFLAGS="${OPTIMIZE}"
export CPPFLAGS="${OPTIMIZE}"
echo "============================================="
echo "Compiling wasm bindings"
echo "============================================="
(
mkdir -p source/web/build
# Compile C/C++ code
emcc \
-std=c++1y \
-DXA_MULTITHREADED=0 \
${OPTIMIZE} \
--bind \
--no-entry \
-s ERROR_ON_UNDEFINED_SYMBOLS=0 \
-s ALLOW_MEMORY_GROWTH=1 \
-s MALLOC=emmalloc \
-s MODULARIZE=1 \
-s ENVIRONMENT='worker' \
-s EXPORT_NAME="createXAtlasModule" \
-o ./source/web/build/xatlas.js \
--js-library ./source/web/jslib.js \
source/web/*.cpp \
source/xatlas/xatlas.cpp \
\
-s ASSERTIONS=1 \
-DNDEBUG \
# -s TOTAL_MEMORY=278mb \
# -D SANITIZE_ADDRESS_CHECK \
# -fsanitize=address \
# -g3
# Uncomment above line for leak checking
# Move artifacts
rm -rf dist
mkdir -p dist
mv source/web/build/xatlas.wasm dist
# mv source/web/build/xatlas.wasm.map dist
)
echo "============================================="
echo "Compiling wasm bindings done"
echo "============================================="