File tree Expand file tree Collapse file tree 3 files changed +16
-2
lines changed
tools/build-wasm-example/src Expand file tree Collapse file tree 3 files changed +16
-2
lines changed Original file line number Diff line number Diff line change @@ -269,6 +269,7 @@ Bevy has a helper to build its examples:
269
269
270
270
- Build for WebGL2: `cargo run -p build-wasm-example -- --api webgl2 load_gltf`
271
271
- Build for WebGPU: `cargo run -p build-wasm-example -- --api webgpu load_gltf`
272
+ - Debug: `cargo run -p build-wasm-example -- --debug --api webgl2 load_gltf`
272
273
273
274
This helper will log the command used to build the examples.
274
275
Original file line number Diff line number Diff line change @@ -782,6 +782,7 @@ Bevy has a helper to build its examples:
782
782
783
783
- Build for WebGL2: `cargo run -p build-wasm-example -- --api webgl2 load_gltf`
784
784
- Build for WebGPU: `cargo run -p build-wasm-example -- --api webgpu load_gltf`
785
+ - Debug: `cargo run -p build-wasm-example -- --debug --api webgl2 load_gltf`
785
786
786
787
This helper will log the command used to build the examples.
787
788
Original file line number Diff line number Diff line change @@ -39,6 +39,10 @@ struct Args {
39
39
#[ arg( long) ]
40
40
/// Additional features to enable
41
41
features : Vec < String > ,
42
+
43
+ #[ arg( long) ]
44
+ /// Build the example in debug mode instead of release
45
+ debug : bool ,
42
46
}
43
47
44
48
fn main ( ) {
@@ -73,15 +77,23 @@ fn main() {
73
77
parameters. push ( "--features" ) ;
74
78
parameters. push ( & features_string) ;
75
79
}
80
+
81
+ let profile = if cli. debug {
82
+ "debug"
83
+ } else {
84
+ parameters. push ( "--release" ) ;
85
+ "release"
86
+ } ;
87
+
76
88
let cmd = cmd ! (
77
89
sh,
78
- "cargo build {parameters...} --profile release -- target wasm32-unknown-unknown --example {example}"
90
+ "cargo build {parameters...} --target wasm32-unknown-unknown --example {example}"
79
91
) ;
80
92
cmd. run ( ) . expect ( "Error building example" ) ;
81
93
82
94
cmd ! (
83
95
sh,
84
- "wasm-bindgen --out-dir examples/wasm/target --out-name wasm_example --target web target/wasm32-unknown-unknown/release /examples/{example}.wasm"
96
+ "wasm-bindgen --out-dir examples/wasm/target --out-name wasm_example --target web target/wasm32-unknown-unknown/{profile} /examples/{example}.wasm"
85
97
)
86
98
. run ( )
87
99
. expect ( "Error creating wasm binding" ) ;
You can’t perform that action at this time.
0 commit comments