forked from repalash/xatlas.js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.sh
51 lines (44 loc) · 1.11 KB
/
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#!/bin/bash
set -e
export OPTIMIZE="-O3"
export LDFLAGS="${OPTIMIZE}"
export CFLAGS="${OPTIMIZE}"
export CPPFLAGS="${OPTIMIZE}"
echo "============================================="
echo "Compiling wasm bindings"
echo "============================================="
(
mkdir -p source/esm/build
# Compile C/C++ code
emcc \
-std=c++1y \
-DXA_MULTITHREADED=0 \
${OPTIMIZE} \
--bind \
--no-entry \
-s ALLOW_MEMORY_GROWTH=1 \
-s EXPORT_ES6=1 \
-s MODULARIZE=1 \
-s EXPORT_NAME="createXAtlasModule" \
--closure 1 \
-o ./source/esm/build/xatlas.js \
--js-library ./source/esm/jslib.js \
source/esm/*.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
cp source/esm/build/xatlas.{js,wasm} dist
cp source/esm/index.js dist
)
echo "============================================="
echo "Compiling wasm bindings done"
echo "============================================="