Skip to content

Commit

Permalink
Optimize dev experience for different targets
Browse files Browse the repository at this point in the history
  • Loading branch information
janhohenheim committed Jul 5, 2024
1 parent cebb0e4 commit 5b8de24
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 9 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
/target
/wasm
21 changes: 17 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,9 +1,25 @@
[package]
name = "bevy_github_ci_template"
name = "bevy_template"
version = "0.1.0"
edition = "2021"
license = "MIT OR Apache-2.0 OR CC0-1.0"

[dependencies]
bevy = "0.14.0"

[target.'cfg(target_family = "wasm")'.dependencies]
wasm-bindgen = "0.2"

# The following block tweaks Bevy's features according to our build environment

[dev-dependencies.bevy]
version = "0.14.0"
features = ["dynamic_linking"]

[target.'cfg(not(target_family = "wasm"))'.dev-dependencies.bevy]
version = "0.14.0"
features = ["file_watcher", "embedded_watcher"]

# Compile with Performance Optimizations:
# https://bevyengine.org/learn/book/getting-started/setup/#compile-with-performance-optimizations

Expand All @@ -14,6 +30,3 @@ opt-level = 1
# Enable high optimizations for dependencies (incl. Bevy), but not for our code:
[profile.dev.package."*"]
opt-level = 3

[dependencies]
bevy = "0.12"
12 changes: 7 additions & 5 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,13 @@ use bevy::prelude::*;

fn main() {
App::new()
// Wasm builds will check for meta files (that don't exist) if this isn't set.
// This causes errors and even panics on web build on itch.
// See https://github.com/bevyengine/bevy_github_ci_template/issues/48.
.insert_resource(AssetMetaCheck::Never)
.add_plugins(DefaultPlugins)
.add_plugins(DefaultPlugins.set(AssetPlugin {
// Wasm builds will check for meta files (that don't exist) if this isn't set.
// This causes errors and even panics on web build on itch.
// See https://github.com/bevyengine/bevy_github_ci_template/issues/48.
meta_check: AssetMetaCheck::Never,
..default()
}))
.add_systems(Startup, setup)
.run();
}
Expand Down

0 comments on commit 5b8de24

Please sign in to comment.