2023-04-12 14:21:03 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
2023-06-24 01:38:19 +00:00
|
|
|
set -euo pipefail
|
|
|
|
|
|
|
|
if [[ -x /usr/local/opt/llvm/bin/clang ]]; then
|
|
|
|
CLANG=/usr/local/opt/llvm/bin/clang
|
|
|
|
elif [[ -x /opt/homebrew/opt/llvm/bin/clang ]]; then
|
|
|
|
CLANG=/opt/homebrew/opt/llvm/bin/clang
|
|
|
|
else
|
|
|
|
echo "Could not find Homebrew clang; this script will probably not work."
|
|
|
|
CLANG=clang
|
|
|
|
fi
|
|
|
|
|
2023-06-30 22:14:10 +00:00
|
|
|
STDLIB_DIR=../../cstdlib
|
|
|
|
ORCA_SDK_DIR=../../sdk
|
|
|
|
MILEPOST_DIR=../../milepost
|
|
|
|
|
2023-04-12 14:21:03 +00:00
|
|
|
wasmFlags="--target=wasm32 \
|
2023-06-30 22:14:10 +00:00
|
|
|
--no-standard-libraries \
|
|
|
|
-fno-builtin \
|
|
|
|
-Wl,--no-entry \
|
|
|
|
-Wl,--export-dynamic \
|
|
|
|
-g \
|
|
|
|
-O2 \
|
|
|
|
-mbulk-memory \
|
|
|
|
-D__ORCA__ \
|
|
|
|
-I $STDLIB_DIR/include \
|
|
|
|
-I $ORCA_SDK_DIR \
|
2023-07-15 07:15:07 +00:00
|
|
|
-I $MILEPOST_DIR/ext -I $MILEPOST_DIR -I $MILEPOST_DIR/src"
|
2023-04-12 14:21:03 +00:00
|
|
|
|
2023-06-25 13:36:27 +00:00
|
|
|
$CLANG $wasmFlags -o ./module.wasm ../../sdk/orca.c ../../cstdlib/src/*.c src/main.c
|
2023-04-12 14:21:03 +00:00
|
|
|
|
2023-07-27 02:28:39 +00:00
|
|
|
../../scripts/orca.py bundle --orca-dir ../.. --name Pong --icon icon.png --resource-dir data module.wasm
|