diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 87fcd86..0cd6248 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -70,10 +70,8 @@ jobs: run: bash scripts/parity-check.sh - name: Build WASM - env: - # The script defaults to /usr/lib/emscripten/emcc; the runner gets - # emcc on PATH via setup-emsdk. Override. - EMCC: emcc + # setup-emsdk puts emcc on PATH; build-wasm.sh picks it up via + # `command -v emcc`. No EMCC override needed. run: bash scripts/build-wasm.sh - name: Parity check (native vs WASM) diff --git a/scripts/build-wasm.sh b/scripts/build-wasm.sh index 89e2239..65f2c0a 100755 --- a/scripts/build-wasm.sh +++ b/scripts/build-wasm.sh @@ -18,9 +18,16 @@ ROOT="$(cd "$(dirname "$0")/.." && pwd)" OUT="$ROOT/manifold/public" SRC="$ROOT/nisps/wasm/bindings.cpp" +# EMCC may be a bare command name on PATH (emsdk installs it that way) or an +# absolute path. Resolve the former before the existence check, which otherwise +# looks for a file of that name in the CWD and always fails. +if [[ "$EMCC" != */* ]]; then + EMCC="$(command -v "$EMCC" || echo "$EMCC")" +fi + if [[ ! -x "$EMCC" && ! -f "$EMCC" ]]; then echo "[build-wasm] emcc not found at $EMCC" >&2 - echo "[build-wasm] set EMCC=/path/to/emcc and retry." >&2 + echo "[build-wasm] set EMCC=/path/to/emcc (or put emcc on PATH) and retry." >&2 exit 2 fi