summaryrefslogtreecommitdiff
path: root/2026/submissions/threecoff/clennis/scripts
diff options
context:
space:
mode:
Diffstat (limited to '2026/submissions/threecoff/clennis/scripts')
-rwxr-xr-x2026/submissions/threecoff/clennis/scripts/build-native.sh12
-rwxr-xr-x2026/submissions/threecoff/clennis/scripts/build-web.sh29
-rw-r--r--2026/submissions/threecoff/clennis/scripts/setup-emsdk.sh20
3 files changed, 61 insertions, 0 deletions
diff --git a/2026/submissions/threecoff/clennis/scripts/build-native.sh b/2026/submissions/threecoff/clennis/scripts/build-native.sh
new file mode 100755
index 0000000..8a0b297
--- /dev/null
+++ b/2026/submissions/threecoff/clennis/scripts/build-native.sh
@@ -0,0 +1,12 @@
+#!/usr/bin/env bash
+# Configure + build the native desktop binary at ./build-native/tennis
+set -euo pipefail
+
+ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
+cd "$ROOT"
+
+cmake -B build-native -DCMAKE_BUILD_TYPE=Debug
+cmake --build build-native -j"$(nproc)"
+
+echo
+echo ">> Built build-native/tennis — run it with: ./build-native/tennis"
diff --git a/2026/submissions/threecoff/clennis/scripts/build-web.sh b/2026/submissions/threecoff/clennis/scripts/build-web.sh
new file mode 100755
index 0000000..12ca74b
--- /dev/null
+++ b/2026/submissions/threecoff/clennis/scripts/build-web.sh
@@ -0,0 +1,29 @@
+#!/usr/bin/env bash
+# Configure + build the WebAssembly version into ./build-web (tennis.html/.js/.wasm)
+set -euo pipefail
+
+ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
+cd "$ROOT"
+
+# Activate the project-local Emscripten SDK if the caller hasn't already.
+if ! command -v emcc >/dev/null 2>&1; then
+ if [ -f "$ROOT/vendor/emsdk/emsdk_env.sh" ]; then
+ # shellcheck disable=SC1091
+ source "$ROOT/vendor/emsdk/emsdk_env.sh"
+ else
+ echo "error: emcc not found and vendor/emsdk missing. Run scripts/setup-emsdk.sh first." >&2
+ exit 1
+ fi
+fi
+
+# CMake/emscripten intermediates live in build/web; only the runtime files
+# (index/tennis.html, tennis.js, tennis.wasm, tennis.data) land in build-web.
+emcmake cmake -B build/web -DPLATFORM=Web -DCMAKE_BUILD_TYPE=Release
+cmake --build build/web -j"$(nproc)"
+cmake --install build/web --prefix build-web --component web >/dev/null
+
+echo
+echo ">> Built build-web/tennis.html (+ index.html copy) — serve it"
+echo " (COOP/COEP not required; ports below 1024 need root) with e.g.:"
+echo " python -m http.server -d build-web 8000"
+echo " then open http://localhost:8000/"
diff --git a/2026/submissions/threecoff/clennis/scripts/setup-emsdk.sh b/2026/submissions/threecoff/clennis/scripts/setup-emsdk.sh
new file mode 100644
index 0000000..b711b7f
--- /dev/null
+++ b/2026/submissions/threecoff/clennis/scripts/setup-emsdk.sh
@@ -0,0 +1,20 @@
+#!/usr/bin/env bash
+# Install the Emscripten SDK into ./vendor/emsdk (needed only for the web build).
+set -euo pipefail
+
+ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
+EMSDK_DIR="$ROOT/vendor/emsdk"
+
+if [ ! -d "$EMSDK_DIR" ]; then
+ echo ">> Cloning emsdk into $EMSDK_DIR"
+ git clone --depth 1 https://github.com/emscripten-core/emsdk.git "$EMSDK_DIR"
+fi
+
+cd "$EMSDK_DIR"
+echo ">> Installing latest Emscripten toolchain (large download)..."
+./emsdk install latest
+./emsdk activate latest
+
+echo
+echo ">> Done. Activate it in your shell with:"
+echo " source $EMSDK_DIR/emsdk_env.sh"