Add a WASM build configuration
The config.toml lets me run `cargo run --target wasm32-unknown-unknown` and host a dev server. I've adjusted the Cargo.toml to use the kdtree_rayon feature by default, but disable the Rayon feature for WASM builds (because it doesn't work).
This commit is contained in:
2
.cargo/config.toml
Normal file
2
.cargo/config.toml
Normal file
@@ -0,0 +1,2 @@
|
||||
[target.wasm32-unknown-unknown]
|
||||
runner = "wasm-server-runner"
|
||||
11
Cargo.toml
11
Cargo.toml
@@ -5,7 +5,6 @@ edition = "2024"
|
||||
|
||||
[dependencies]
|
||||
bevy = "0.16.0"
|
||||
bevy_spatial = "0.11.0"
|
||||
|
||||
# Grand-dependency pins
|
||||
ab_glyph = "0.2.16"
|
||||
@@ -17,6 +16,16 @@ miniz-sys = "0.1.10"
|
||||
nonmax = "0.5.1"
|
||||
rand = "0.8.0"
|
||||
|
||||
# Use regular bevy_spatial on non-WASM builds
|
||||
[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
|
||||
bevy_spatial = "0.11.0"
|
||||
|
||||
# Use bevy_spatial *without* the kdtree_rayon feature when building for WASM.
|
||||
[target.'cfg(target_arch = "wasm32")'.dependencies.bevy_spatial]
|
||||
version = "0.11.0"
|
||||
default-features = false
|
||||
features = ["kdtree"]
|
||||
|
||||
[profile.dev]
|
||||
opt-level = 1
|
||||
|
||||
|
||||
Reference in New Issue
Block a user