rand 0.8 depends on getrandom 0.2, which refuses to compile on wasm32-unknown-unknown without its "js" feature (it needs to call into the Web Crypto API via wasm-bindgen). Bevy's own rand usage sits on getrandom 0.3+, which enables this by default, so the web build only broke once we added a direct rand 0.8 dep in 76be513. Force-enabling getrandom/js in the wasm32 target deps section unblocks `trunk build`. Desktop is unaffected (the cfg gates it to wasm only). Caught by the Task 8 wasm cargo-check gate.
53 lines
2.0 KiB
TOML
53 lines
2.0 KiB
TOML
[package]
|
|
name = "singularity-rs"
|
|
version = "0.1.0"
|
|
edition = "2024"
|
|
|
|
[lib]
|
|
name = "singularity_rs"
|
|
path = "src/lib.rs"
|
|
|
|
[dependencies]
|
|
bevy = "0.19"
|
|
bevy_egui = "0.41"
|
|
# Deterministic PRNG for planet seeding (ChaCha8Rng). `rand` is a transitive
|
|
# dep via bevy_math but not declared directly; `rand_chacha` ships ChaCha8Rng.
|
|
# Pinned to 0.8/0.3 (LTS, API-compatible with the Bevy 0.19 ecosystem).
|
|
rand = "0.8"
|
|
rand_chacha = "0.3"
|
|
|
|
# Web-only deps for WebGPU detection + fallback message.
|
|
[target.'cfg(target_arch = "wasm32")'.dependencies]
|
|
web-sys = { version = "0.3", features = ["Gpu", "Navigator", "Window", "Document", "HtmlElement", "Element"] }
|
|
wasm-bindgen = "0.2"
|
|
js-sys = "0.3"
|
|
# rand 0.8 pulls getrandom 0.2, which on wasm32-unknown-unknown refuses to
|
|
# compile unless its "js" feature is explicitly enabled (it calls into the
|
|
# Web Crypto API via wasm-bindgen). Bevy's own rand usage is on getrandom
|
|
# 0.3+, which enables this by default; our direct rand 0.8 dep does not.
|
|
# Force-enabling it here unblocks the web build. See getrandom docs:
|
|
# https://docs.rs/getrandom/#webassembly-support
|
|
getrandom = { version = "0.2", features = ["js"] }
|
|
|
|
# Desktop release tuning. This renderer is GPU-bound, but Bevy's CPU path
|
|
# (resource management, system scheduling, egui, wgpu command submission)
|
|
# still benefits measurably from cross-crate LTO and a single codegen unit:
|
|
# - lto = "fat": cross-crate inlining, removes trampolines through Bevy/wgpu.
|
|
# - codegen-units = 1: best optimization, at the cost of slower compiles.
|
|
# - panic = "abort": smaller binary, no unwind tables in the hot path.
|
|
# - strip: drop debug symbols from the shipped binary.
|
|
# `wasm-release` inherits release, so web picks these up too (then overrides
|
|
# opt-level to "z" for binary size).
|
|
[profile.release]
|
|
lto = "fat"
|
|
codegen-units = 1
|
|
panic = "abort"
|
|
strip = "symbols"
|
|
|
|
# Smaller wasm binary in release web builds (per Bevy examples README).
|
|
[profile.wasm-release]
|
|
inherits = "release"
|
|
opt-level = "z"
|
|
lto = "fat"
|
|
codegen-units = 1
|