summaryrefslogtreecommitdiff
path: root/build.sh
diff options
context:
space:
mode:
Diffstat (limited to 'build.sh')
-rwxr-xr-xbuild.sh22
1 files changed, 22 insertions, 0 deletions
diff --git a/build.sh b/build.sh
new file mode 100755
index 0000000..4b597bb
--- /dev/null
+++ b/build.sh
@@ -0,0 +1,22 @@
+#!/bin/sh
+
+cd ${0%/*} # go to project root
+
+FLAGS="-Wall -Wextra -g -pedantic"
+RAYLIB_FLAGS="-lraylib -lm -lpthread -lGL -ldl -lrt -lX11"
+RAYLIB_SRC="/usr/local/src/raylib/src"
+
+set -xe
+
+if ! [[ $1 == "web" ]] &> /dev/null; then
+ gcc -o bin/main src/main.c $FLAGS $RAYLIB_FLAGS
+else
+ source emsdk_env.sh
+
+ emcc -o bin/proc-gen.html src/main.c \
+ $FLAGS -DPLATFORM_WEB -DRAYLIB_SRC="\"$RAYLIB_SRC/raylib.h\"" \
+ $RAYLIB_SRC/libraylib.a \
+ -I$RAYLIB_SRC/raylib.h \
+ -s USE_GLFW=3 -s ASYNCIFY \
+ --shell-file src/shell.html
+fi