Fix flags from cargo.toml

This commit is contained in:
hypercube
2025-07-24 20:32:51 +01:00
parent 25a8e86fb8
commit 0db70a5b0e
2 changed files with 9 additions and 26 deletions
+9 -2
View File
@@ -3,14 +3,21 @@
output := 'wasm'/'pkg'/'graphite_wasm_bg.wasm'
build profile='debug':
# Build the rust code into the target directory
cargo build -p graphite-wasm --lib --target wasm32-unknown-unknown --color=always {{ if profile != "debug" { "--release" } else { "" } }}
# Create a directory to store the package in
mkdir -p pkg
# Build the JS glue and patch wasm
wasm-bindgen \
{{ '..' / 'target' / 'wasm32-unknown-unknown' / if profile != "debug" { 'release' / 'graphite_wasm.wasm' } else { 'debug' / 'graphite_wasm.wasm' } }} \
--out-dir {{ 'wasm' / 'pkg' }} --typescript --target web {{ if profile == "debug" { "--debug" } else { "" } }}
--out-dir {{ 'wasm' / 'pkg' }} --typescript --target web \
{{ if profile != "release" { "--debug" } else { "" } }} \
{{ if profile == "release" { "--no-demangle" } else { "" } }} \
{{ if profile == "profiling" { "--keep-debug" } else { "" } }}
{{ if profile != 'debug' { "wasm-opt " + output + " -o " + output + " -O" } else { "" } }}
# Apply optimisations (if necessary)
{{ if profile != 'debug' { "wasm-opt " + output + " -o " + output + " -Os -g" } else { "" } }}