-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild-wasm-ballistic-solver.sh
More file actions
31 lines (24 loc) · 921 Bytes
/
Copy pathbuild-wasm-ballistic-solver.sh
File metadata and controls
31 lines (24 loc) · 921 Bytes
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
#!/usr/bin/env bash
# POSIX sibling of build-wasm-ballistic-solver.ps1. Build the tank
# ballistic-solver Rust crate to WASM and emit the bundle into
# src/systems/combat/projectiles/wasm/tank-ballistic-solver/.
#
# Requires:
# - rustup target add wasm32-unknown-unknown
# - cargo install wasm-pack
set -euo pipefail
REPO_ROOT="$(cd "$(dirname "$0")/.." && pwd)"
CRATE_DIR="$REPO_ROOT/rust/tank-ballistic-solver"
OUT_DIR="$REPO_ROOT/src/systems/combat/projectiles/wasm/tank-ballistic-solver"
echo "Building tank-ballistic-solver -> $OUT_DIR"
if ! command -v wasm-pack >/dev/null 2>&1; then
echo "wasm-pack not found in PATH. Install via: cargo install wasm-pack" >&2
exit 1
fi
cd "$CRATE_DIR"
wasm-pack build --target web --release --out-dir "$OUT_DIR"
# Drop wasm-pack's generated package.json + .gitignore.
rm -f "$OUT_DIR/package.json" "$OUT_DIR/.gitignore"
echo
echo "Artifacts:"
ls -lh "$OUT_DIR"