-
Notifications
You must be signed in to change notification settings - Fork 149
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Some WASM changes - including a run_wasm alias (#251)
- Loading branch information
Showing
7 changed files
with
36 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
[alias] | ||
run_wasm = "run --release --package run_wasm --" | ||
# Other crates use the alias run-wasm, even though crate names should use `_`s not `-`s | ||
# Allow this to be used | ||
run-wasm = "run_wasm" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
target/ | ||
/target | ||
Cargo.lock |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,11 @@ | ||
[package] | ||
name = "run-wasm" | ||
name = "run_wasm" | ||
version.workspace = true | ||
edition.workspace = true | ||
publish = false | ||
|
||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html | ||
|
||
[dependencies] | ||
cargo-run-wasm = "0.2.0" | ||
# We use cargo-run-wasm main because of our workspace layout | ||
cargo-run-wasm = { git = "https://github.com/rukai/cargo-run-wasm", rev = "d14f73de77eaae44714b4817d660026a31f5f5a9" } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,21 @@ | ||
/// Use [cargo-run-wasm](https://github.com/rukai/cargo-run-wasm) to build an example for web | ||
/// | ||
/// Usage: | ||
/// ``` | ||
/// cargo run_wasm --package [example_name] | ||
/// ``` | ||
/// Generally: | ||
/// ``` | ||
/// cargo run_wasm --package with_winit | ||
/// ``` | ||
fn main() { | ||
// HACK: We rely heavily on compute shaders; which means we need WebGPU to be supported | ||
// However, that requires unstable APIs to be enabled, which are not exposed through a feature | ||
let current_value = std::env::var("RUSTFLAGS").unwrap_or("".to_owned()); | ||
std::env::set_var( | ||
"RUSTFLAGS", | ||
format!("{current_value} --cfg=web_sys_unstable_apis",), | ||
); | ||
cargo_run_wasm::run_wasm_with_css("body { margin: 0px; }"); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters