embed assets only in release builds
This commit is contained in:
parent
ce65022905
commit
29f0850874
|
@ -24,7 +24,7 @@ build = "build/build.rs"
|
|||
regex = "1"
|
||||
bevy = { version = "0.13.2", default-features = false, features = ["jpeg", "bevy_asset", "bevy_audio", "bevy_scene", "bevy_winit", "bevy_core_pipeline", "bevy_pbr", "bevy_gltf", "bevy_render", "bevy_text", "bevy_ui", "multi-threaded", "tonemapping_luts", "vorbis"]}
|
||||
bevy_xpbd_3d = { version = "0.4.2", default-features = false, features = ["3d", "f64", "parry-f64", "parallel", "async-collider"] }
|
||||
bevy_embedded_assets = "0.10.2"
|
||||
bevy_embedded_assets = { version = "0.10.2", optional = true }
|
||||
fastrand = "2.0"
|
||||
serde = "1.0"
|
||||
serde_yaml = "0.9"
|
||||
|
@ -38,6 +38,7 @@ dev = ["bevy/dynamic_linking", "bevy/file_watcher"]
|
|||
wasm = ["bevy/webgl2"]
|
||||
x11 = ["bevy/x11"]
|
||||
wayland = ["bevy/wayland"]
|
||||
embed_assets = ["dep:bevy_embedded_assets"]
|
||||
|
||||
[profile.dev]
|
||||
opt-level = 1
|
||||
|
|
|
@ -15,8 +15,8 @@
|
|||
set -e
|
||||
|
||||
if [ "$1" == "-b" ]; then
|
||||
cargo build --release --target=x86_64-unknown-linux-gnu --features "x11 wayland"
|
||||
cargo build --release --target=x86_64-pc-windows-gnu --no-default-features
|
||||
cargo build --release --target=x86_64-unknown-linux-gnu --no-default-features --features "x11 wayland embed_assets"
|
||||
cargo build --release --target=x86_64-pc-windows-gnu --no-default-features --features "embed_assets"
|
||||
fi
|
||||
|
||||
VERSION="$(sed -nr 's/^\s*version\s*=\s*"(.*)"\s*$/\1/p' Cargo.toml)"
|
||||
|
|
16
src/main.rs
16
src/main.rs
|
@ -26,7 +26,6 @@ mod nature;
|
|||
use bevy::window::{Window, WindowMode, PrimaryWindow, CursorGrabMode};
|
||||
use bevy::diagnostic::FrameTimeDiagnosticsPlugin;
|
||||
use bevy::prelude::*;
|
||||
use bevy_embedded_assets::{EmbeddedAssetPlugin, PluginMode};
|
||||
use bevy::pbr::ExtendedMaterial;
|
||||
use std::env;
|
||||
|
||||
|
@ -43,15 +42,12 @@ fn main() {
|
|||
return;
|
||||
}
|
||||
}
|
||||
if cfg!(debug_assertions) {
|
||||
App::new().add_plugins(OutFlyPlugin).run();
|
||||
} else {
|
||||
// In release builds, embed assets into the binary
|
||||
App::new().add_plugins((
|
||||
EmbeddedAssetPlugin { mode: PluginMode::ReplaceDefault },
|
||||
OutFlyPlugin,
|
||||
)).run();
|
||||
}
|
||||
let mut app = App::new();
|
||||
#[cfg(feature = "embed_assets")]
|
||||
app.add_plugins(bevy_embedded_assets::EmbeddedAssetPlugin {
|
||||
mode: bevy_embedded_assets::PluginMode::ReplaceDefault
|
||||
});
|
||||
app.add_plugins(OutFlyPlugin).run();
|
||||
}
|
||||
|
||||
pub struct OutFlyPlugin;
|
||||
|
|
Loading…
Reference in a new issue