mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2025-12-23 10:11:54 +00:00
23 lines
940 B
Makefile
23 lines
940 B
Makefile
# https://just.systems
|
|
|
|
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 != "release" { "--debug" } else { "" } }} \
|
|
{{ if profile == "release" { "--no-demangle" } else { "" } }} \
|
|
{{ if profile == "profiling" { "--keep-debug" } else { "" } }}
|
|
|
|
# Apply optimisations (if necessary)
|
|
{{ if profile != 'debug' { "wasm-opt " + output + " -o " + output + " -Os -g" } else { "" } }}
|
|
|
|
|