mirror of
https://github.com/thorvg/thorvg.git
synced 2025-06-07 21:23:32 +00:00
wasm/infra: Add build scripts for WebGPU
New build script for WASM with WebGPU. Run `wasm_webgpu_build.sh` to have WebGPU WASM binary
This commit is contained in:
parent
0787e46635
commit
32954f962d
3 changed files with 36 additions and 1 deletions
21
cross/wasm_webgpu.txt
Normal file
21
cross/wasm_webgpu.txt
Normal file
|
@ -0,0 +1,21 @@
|
|||
[binaries]
|
||||
cpp = 'EMSDK:upstream/emscripten/em++.py'
|
||||
ar = 'EMSDK:upstream/emscripten/emar.py'
|
||||
strip = '-strip'
|
||||
|
||||
[properties]
|
||||
root = 'EMSDK:upstream/emscripten/system'
|
||||
shared_lib_suffix = 'js'
|
||||
static_lib_suffix = 'js'
|
||||
shared_module_suffix = 'js'
|
||||
exe_suffix = 'js'
|
||||
|
||||
[built-in options]
|
||||
cpp_args = ['-Wshift-negative-value', '-flto', '-Os', '-fno-exceptions']
|
||||
cpp_link_args = ['-lembind', '-sMODULARIZE=1', '-sUSE_WEBGPU=1', '-sASYNCIFY=1', '-sFORCE_FILESYSTEM=1', '-sALLOW_MEMORY_GROWTH=1', '-sEXPORT_ES6=1', '-sSINGLE_FILE=1']
|
||||
|
||||
[host_machine]
|
||||
system = 'emscripten'
|
||||
cpu_family = 'wasm32'
|
||||
cpu = 'wasm32'
|
||||
endian = 'little'
|
|
@ -21,7 +21,10 @@ source_file = [
|
|||
'tvgWgShaderTypes.cpp'
|
||||
]
|
||||
|
||||
wgpu_dep = dependency('wgpu_native')
|
||||
wgpu_dep = []
|
||||
if not get_option('bindings').contains('wasm_beta')
|
||||
wgpu_dep = dependency('wgpu_native')
|
||||
endif
|
||||
|
||||
engine_dep += [declare_dependency(
|
||||
dependencies : wgpu_dep,
|
||||
|
|
11
wasm_webgpu_build.sh
Executable file
11
wasm_webgpu_build.sh
Executable file
|
@ -0,0 +1,11 @@
|
|||
#!/bin/bash
|
||||
|
||||
#https://github.com/thorvg/thorvg/wiki/WebGPU-Raster-Engine-Development
|
||||
|
||||
if [ ! -d "./build_wasm" ]; then
|
||||
sed "s|EMSDK:|$1|g" ./cross/wasm_webgpu.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_wasm
|
||||
fi
|
||||
|
||||
ninja -C build_wasm/
|
||||
ls -lrt build_wasm/src/bindings/wasm/thorvg-wasm.*
|
Loading…
Add table
Reference in a new issue