-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sh
executable file
·40 lines (30 loc) · 1.51 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
#!/bin/sh
rm -r build
mkdir -p build
SOURCE="src/main.cpp"
NAME="boids.html"
VERSION="00"
CONFIG=""
# CONFIG="${CONFIG} -DNO_CONTROL_PANEL"
# files
SET_FRONTEND_TEMPLATE="--shell-file site/index.html"
FILES="${FILES} --preload-file src/view/shaders/boids.vertex.glsl"
FILES="${FILES} --preload-file src/view/shaders/boids.fragment.glsl"
FILES="${FILES} --preload-file src/view/shaders/CTU.vertex.glsl"
FILES="${FILES} --preload-file src/view/shaders/CTU.fragment.glsl"
FILES="${FILES} --preload-file res/texture.jpeg"
# includes and libs
INCS="-I libs/glad -I libs/imgui -I libs/base -I libs/stb"
LIBS="-L ./libs/archives -lm -lGL -lpthread -lglfw -limgui -lstb"
# flags
EMFLAGS="-s USE_GLFW=3 -s FULL_ES3=1 -s USE_WEBGL2=1 -DPLATFORM_WEB -s MAXIMUM_MEMORY=1GB -s ALLOW_MEMORY_GROWTH -s STACK_SIZE=90MB -s INITIAL_MEMORY=100MB"
CPPFLAGS="${CPPFLAGS} -D_DEFAULT_SOURCE -D_BSD_SOURCE -D_POSIX_C_SOURCE=2 -DVERSION=\"${VERSION}\""
# CFLAGS="${CFLAGS} -g -Wall -Wno-deprecated-declarations -Wno-write-strings -Wno-writable-strings -Wno-unused-function -O3 ${INCS} ${CPPFLAGS}"
CFLAGS="${CFLAGS} -g -fsanitize=address -Wall -Wno-deprecated-declarations -Wno-write-strings -Wno-writable-strings -Wno-unused-function ${INCS} ${CPPFLAGS}"
# compiler
CC="em++"
# building
echo "[build.sh]# building $NAME"
echo ${CC} $CFLAGS ${EMFLAGS} ${FILES} ${CONFIG} -o "build/$NAME" $SOURCE $LIBS $SET_FRONTEND_TEMPLATE
${CC} $CFLAGS ${EMFLAGS} ${FILES} ${CONFIG} -o "build/$NAME" $SOURCE $LIBS $SET_FRONTEND_TEMPLATE
echo "[build.sh]# finished building"