2024-10-23 06:13:33 -05:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
2024-11-14 05:02:22 -05:00
|
|
|
if [ "$NODE_ENV" = "production" ]; then
|
|
|
|
export _BUILD_MODE="release";
|
|
|
|
else
|
|
|
|
export _BUILD_MODE=${1:-debug};
|
|
|
|
fi
|
2024-10-23 06:13:33 -05:00
|
|
|
|
|
|
|
export EMCC_CFLAGS="--no-entry -s ERROR_ON_UNDEFINED_SYMBOLS=0 -s MAX_WEBGL_VERSION=2 -s MODULARIZE=1 -s EXPORT_NAME=createRustSkiaModule -s EXPORTED_RUNTIME_METHODS=GL -s ENVIRONMENT=web -s EXPORT_ES6=1 -sMODULARIZE"
|
|
|
|
|
2024-11-14 12:18:22 -05:00
|
|
|
EMSDK_QUIET=1 . /usr/local/emsdk/emsdk_env.sh;
|
|
|
|
. /usr/local/cargo/env
|
2024-11-14 08:29:19 -05:00
|
|
|
|
|
|
|
export EM_CACHE="/tmp/emsdk_cache";
|
2024-10-23 06:13:33 -05:00
|
|
|
|
|
|
|
set -x
|
|
|
|
|
|
|
|
_SCRIPT_DIR=$(dirname $0);
|
|
|
|
_CARGO_PARAMS="--target=wasm32-unknown-emscripten";
|
|
|
|
|
|
|
|
if [ "$_BUILD_MODE" = "release" ]; then
|
|
|
|
_CARGO_PARAMS="--release $_CARGO_PARAMS"
|
|
|
|
fi
|
|
|
|
|
|
|
|
pushd $_SCRIPT_DIR;
|
|
|
|
cargo build $_CARGO_PARAMS
|
|
|
|
|
|
|
|
cp target/wasm32-unknown-emscripten/$_BUILD_MODE/render_wasm.js ../frontend/resources/public/js/
|
|
|
|
cp target/wasm32-unknown-emscripten/$_BUILD_MODE/render_wasm.wasm ../frontend/resources/public/js/
|
|
|
|
|
2024-11-14 12:14:43 -05:00
|
|
|
sed -i "s/render_wasm.wasm/render_wasm.wasm?version=develop/g" ../frontend/resources/public/js/render_wasm.js;
|
|
|
|
|
2024-10-23 06:13:33 -05:00
|
|
|
popd
|