Files
workinf_Blender_Wasm/tools/web/emscripten-env.sh
mes123456 c2c65d3a09
Some checks failed
M6 deployable RC / quick (push) Has been cancelled
M6 deployable RC / chromium (push) Has been cancelled
M6 deployable RC / release (push) Has been cancelled
Rebuild local Blender WASM environment and recovery evidence
2026-08-27 20:22:15 +08:00

41 lines
1.7 KiB
Bash
Executable File

#!/usr/bin/env bash
set -euo pipefail
WEB_EMSCRIPTEN_VERSION="3.1.69"
web_workspace_root="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"
# Prefer the repository-local SDK prepared by tools/web/prepare-build-env.sh.
if [[ -x "${web_workspace_root}/.emsdk/upstream/emscripten/emcc" ]]; then
export EMSDK="${web_workspace_root}/.emsdk"
export PATH="${EMSDK}/upstream/emscripten:${EMSDK}/node/24.19.0_64bit/bin:${EMSDK}:${PATH}"
# Override copied-host settings in .emscripten-web with this checkout's SDK.
export EM_LLVM_ROOT="${EM_LLVM_ROOT-${EMSDK}/upstream/bin}"
export EM_BINARYEN_ROOT="${EM_BINARYEN_ROOT-${EMSDK}/upstream}"
export EM_NODE_JS="${EM_NODE_JS-${EMSDK}/node/24.19.0_64bit/bin/node}"
export EM_LLVM_ADD_VERSION="${EM_LLVM_ADD_VERSION-}"
export EM_CLANG_ADD_VERSION="${EM_CLANG_ADD_VERSION-}"
fi
if command -v emcc >/dev/null 2>&1; then
detected_version="$(emcc --version | awk '{for (i = 1; i <= NF; i++) if ($i ~ /^[0-9]+\.[0-9]+\.[0-9]+$/) {print $i; exit}}')"
if [[ "${detected_version}" != "${WEB_EMSCRIPTEN_VERSION}" ]]; then
echo "Expected Emscripten ${WEB_EMSCRIPTEN_VERSION}, found ${detected_version}" >&2
exit 1
fi
else
echo "emcc was not found; install or activate emsdk ${WEB_EMSCRIPTEN_VERSION}" >&2
exit 1
fi
export WEB_EMSCRIPTEN_VERSION
export EM_CONFIG="${web_workspace_root}/.emscripten-web"
export EM_CACHE="${web_workspace_root}/.emcache"
export WEB_EMSCRIPTEN_CFLAGS="-sENVIRONMENT=web,worker -sMODULARIZE=1 -sEXPORT_ES6=1"
export WEB_EMSCRIPTEN_LDFLAGS="-sALLOW_MEMORY_GROWTH=1 -sFILESYSTEM=1"
if [[ "${BASH_SOURCE[0]}" == "${0}" ]]; then
emcc --version | head -3
node --version
cmake --version | head -1
fi