mirror of
https://github.com/thorvg/thorvg.git
synced 2025-06-08 13:43:43 +00:00

Updated WASM binding to bring WebGPU on the web player. binding will generate a WASM binary, which can render animation through both SW and WG raster engine. A raster engine will be chosen by parameter `engine`, when initializing.
27 lines
1.2 KiB
Bash
Executable file
27 lines
1.2 KiB
Bash
Executable file
#!/bin/bash
|
|
|
|
#https://github.com/thorvg/thorvg/wiki/ThorVG-Viewer-Development-Guide
|
|
|
|
BACKEND="$1"
|
|
EMSDK="$2"
|
|
|
|
if [ -z "$2" ]; then
|
|
BACKEND="all"
|
|
EMSDK="$1"
|
|
fi
|
|
|
|
if [ ! -d "./build_wasm32_$BACKEND" ]; then
|
|
if [[ "$BACKEND" == "wg" ]]; then
|
|
sed "s|EMSDK:|$EMSDK|g" ./cross/wasm32_wg.txt > /tmp/.wasm_cross.txt
|
|
meson -Db_lto=true -Ddefault_library=static -Dstatic=true -Dloaders="all" -Dsavers="all" -Dthreads=false -Dbindings="wasm_beta" -Dengines="wg_beta" --cross-file /tmp/.wasm_cross.txt build_wasm32_wg
|
|
elif [[ "$BACKEND" == "sw" ]]; then
|
|
sed "s|EMSDK:|$EMSDK|g" ./cross/wasm32_sw.txt > /tmp/.wasm_cross.txt
|
|
meson -Db_lto=true -Ddefault_library=static -Dstatic=true -Dloaders="all" -Dsavers="all" -Dthreads=false -Dbindings="wasm_beta" --cross-file /tmp/.wasm_cross.txt build_wasm32_sw
|
|
else
|
|
sed "s|EMSDK:|$EMSDK|g" ./cross/wasm32_wg.txt > /tmp/.wasm_cross.txt
|
|
meson -Db_lto=true -Ddefault_library=static -Dstatic=true -Dloaders="all" -Dsavers="all" -Dthreads=false -Dbindings="wasm_beta" -Dengines="wg_beta, sw" --cross-file /tmp/.wasm_cross.txt build_wasm32_all
|
|
fi
|
|
fi
|
|
|
|
ninja -C build_wasm32_$BACKEND/
|
|
ls -lrt build_wasm32_$BACKEND/src/bindings/wasm/*.{js,wasm}
|