0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-01-08 07:50:43 -05:00
penpot/render-wasm/build

25 lines
760 B
Bash
Executable file

#!/usr/bin/env bash
export _BUILD_MODE=${1:-debug};
export EMSDK_QUIET=1
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"
source /usr/local/emsdk/emsdk_env.sh;
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/
popd