Skip to content

Commit 0db70a5

Browse files
committed
Fix flags from cargo.toml
1 parent 25a8e86 commit 0db70a5

2 files changed

Lines changed: 9 additions & 26 deletions

File tree

frontend/justfile

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,21 @@
33
output := 'wasm'/'pkg'/'graphite_wasm_bg.wasm'
44

55
build profile='debug':
6+
# Build the rust code into the target directory
67
cargo build -p graphite-wasm --lib --target wasm32-unknown-unknown --color=always {{ if profile != "debug" { "--release" } else { "" } }}
78

9+
# Create a directory to store the package in
810
mkdir -p pkg
911

12+
# Build the JS glue and patch wasm
1013
wasm-bindgen \
1114
{{ '..' / 'target' / 'wasm32-unknown-unknown' / if profile != "debug" { 'release' / 'graphite_wasm.wasm' } else { 'debug' / 'graphite_wasm.wasm' } }} \
12-
--out-dir {{ 'wasm' / 'pkg' }} --typescript --target web {{ if profile == "debug" { "--debug" } else { "" } }}
15+
--out-dir {{ 'wasm' / 'pkg' }} --typescript --target web \
16+
{{ if profile != "release" { "--debug" } else { "" } }} \
17+
{{ if profile == "release" { "--no-demangle" } else { "" } }} \
18+
{{ if profile == "profiling" { "--keep-debug" } else { "" } }}
1319

14-
{{ if profile != 'debug' { "wasm-opt " + output + " -o " + output + " -O" } else { "" } }}
20+
# Apply optimisations (if necessary)
21+
{{ if profile != 'debug' { "wasm-opt " + output + " -o " + output + " -Os -g" } else { "" } }}
1522

1623

frontend/wasm/Cargo.toml

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -39,30 +39,6 @@ math-parser = { workspace = true }
3939
wgpu = { workspace = true }
4040
web-sys = { workspace = true }
4141

42-
[package.metadata.wasm-pack.profile.dev]
43-
wasm-opt = false
44-
45-
[package.metadata.wasm-pack.profile.dev.wasm-bindgen]
46-
debug-js-glue = true
47-
demangle-name-section = true
48-
dwarf-debug-info = false
49-
50-
[package.metadata.wasm-pack.profile.release]
51-
wasm-opt = ["-Os", "-g"]
52-
53-
[package.metadata.wasm-pack.profile.release.wasm-bindgen]
54-
debug-js-glue = false
55-
demangle-name-section = false
56-
dwarf-debug-info = false
57-
58-
[package.metadata.wasm-pack.profile.profiling]
59-
wasm-opt = ["-Os", "-g"]
60-
61-
[package.metadata.wasm-pack.profile.profiling.wasm-bindgen]
62-
debug-js-glue = true
63-
demangle-name-section = true
64-
dwarf-debug-info = true
65-
6642
[lints.rust]
6743
unexpected_cfgs = { level = "warn", check-cfg = [
6844
'cfg(wasm_bindgen_unstable_test_coverage)',

0 commit comments

Comments
 (0)