Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
f9c57fa
Add `no_std` support to `bevy`
bushrat011899 Feb 20, 2025
8ea1787
Fix `thumbv6m-none-eabi` Compatibility and add to CI
bushrat011899 Feb 21, 2025
1999297
Merge branch 'main' into NoSTDForBevyItselfV2
bushrat011899 Feb 21, 2025
3295da6
Merge remote-tracking branch 'upstream/main' into NoSTDForBevyItselfV2
bushrat011899 Feb 23, 2025
52ee47f
Merge remote-tracking branch 'upstream/main' into NoSTDForBevyItselfV2
bushrat011899 Feb 24, 2025
9931f17
Merge remote-tracking branch 'upstream/main' into NoSTDForBevyItselfV2
bushrat011899 Feb 24, 2025
7b49b9c
Simplify features now that `portable-atomic` is removed
bushrat011899 Feb 24, 2025
5991069
Update ci.yml
bushrat011899 Feb 24, 2025
e3ac49d
Fix `bevy_color` feature gates
bushrat011899 Feb 25, 2025
c6c7a60
Formatting
bushrat011899 Feb 25, 2025
70b6c5b
Merge remote-tracking branch 'upstream/main' into NoSTDForBevyItselfV2
bushrat011899 Feb 25, 2025
0755b51
Fix arbitrary self types issue
bushrat011899 Feb 25, 2025
184ef80
Merge remote-tracking branch 'upstream/main' into NoSTDForBevyItselfV2
bushrat011899 Mar 1, 2025
e3262ce
Merge branch 'main' into NoSTDForBevyItselfV2
alice-i-cecile Mar 6, 2025
f5af460
Inline `edge-executor`
bushrat011899 Mar 6, 2025
b5d3762
cargo fmt
bushrat011899 Mar 6, 2025
13fabea
Refactor features to allow `--no-default-features` to compile
bushrat011899 Mar 7, 2025
d032c2e
Merge remote-tracking branch 'upstream/main' into NoSTDForBevyItselfV2
bushrat011899 Mar 7, 2025
3d09e4b
Update cargo_features.md
bushrat011899 Mar 7, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 25 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,31 @@ jobs:
- name: Install Linux dependencies
uses: ./.github/actions/install-linux-deps
- name: Check Compile
run: cargo run -p ci -- compile-check-no-std
run: cargo check -p bevy --no-default-features --features default_no_std --target x86_64-unknown-none
check-compiles-no-std-portable-atomic:
runs-on: ubuntu-latest
timeout-minutes: 30
needs: ci
steps:
- uses: actions/checkout@v4
- uses: actions/cache@v4
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
crates/bevy_ecs_compile_fail_tests/target/
crates/bevy_reflect_compile_fail_tests/target/
key: ${{ runner.os }}-cargo-check-compiles-no-std-portable-atomic-${{ hashFiles('**/Cargo.toml') }}
- uses: dtolnay/rust-toolchain@stable
with:
targets: thumbv6m-none-eabi
- name: Install Linux dependencies
uses: ./.github/actions/install-linux-deps
- name: Check Compile
run: cargo check -p bevy --no-default-features --features default_no_std,portable-atomic --target thumbv6m-none-eabi

build-wasm:
runs-on: ubuntu-latest
Expand Down
31 changes: 31 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,8 @@ unused_qualifications = "warn"

[features]
default = [
"std",
"async_executor",
"android-game-activity",
"android_shared_stdcxx",
"animation",
Expand All @@ -124,6 +126,8 @@ default = [
"bevy_gilrs",
"bevy_gizmos",
"bevy_gltf",
"bevy_input_focus",
"bevy_log",
"bevy_mesh_picking_backend",
"bevy_pbr",
"bevy_picking",
Expand All @@ -150,6 +154,9 @@ default = [
"x11",
]

# Recommended defaults for no_std applications
default_no_std = ["edge_executor", "libm", "critical-section", "bevy_state"]

# Provides an implementation for picking meshes
bevy_mesh_picking_backend = [
"bevy_picking",
Expand Down Expand Up @@ -257,6 +264,12 @@ bevy_dev_tools = ["bevy_internal/bevy_dev_tools"]
# Enable the Bevy Remote Protocol
bevy_remote = ["bevy_internal/bevy_remote"]

# Enable integration with `tracing` and `log`
bevy_log = ["bevy_internal/bevy_log"]

# Enable input focus subsystem
bevy_input_focus = ["bevy_internal/bevy_input_focus"]

# Enable passthrough loading for SPIR-V shaders (Only supported on Vulkan, shader capabilities and extensions must agree with the platform implementation)
spirv_shader_passthrough = ["bevy_internal/spirv_shader_passthrough"]

Expand Down Expand Up @@ -479,6 +492,24 @@ custom_cursor = ["bevy_internal/custom_cursor"]
# Experimental support for nodes that are ignored for UI layouting
ghost_nodes = ["bevy_internal/ghost_nodes"]

# Uses `async-executor` as a task execution backend.
async_executor = ["std", "bevy_internal/async_executor"]

# Uses `edge-executor` as a task execution backend.
edge_executor = ["bevy_internal/edge_executor"]

# Allows access to the `std` crate.
std = ["bevy_internal/std"]

# `critical-section` provides the building blocks for synchronization primitives on all platforms, including `no_std`.
critical-section = ["bevy_internal/critical-section"]

# `portable-atomic` provides additional platform support for atomic types and operations, even on targets without native support.
portable-atomic = ["bevy_internal/portable-atomic"]

# Uses the `libm` maths library instead of the one provided in `std` and `core`.
libm = ["bevy_internal/libm"]

[dependencies]
bevy_internal = { path = "crates/bevy_internal", version = "0.16.0-dev", default-features = false }
tracing = { version = "0.1", default-features = false, optional = true }
Expand Down
1 change: 0 additions & 1 deletion crates/bevy_animation/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ bevy_derive = { path = "../bevy_derive", version = "0.16.0-dev" }
bevy_log = { path = "../bevy_log", version = "0.16.0-dev" }
bevy_math = { path = "../bevy_math", version = "0.16.0-dev" }
bevy_reflect = { path = "../bevy_reflect", version = "0.16.0-dev", features = [
"bevy",
"petgraph",
] }
bevy_render = { path = "../bevy_render", version = "0.16.0-dev" }
Expand Down
4 changes: 1 addition & 3 deletions crates/bevy_audio/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,7 @@ bevy_app = { path = "../bevy_app", version = "0.16.0-dev" }
bevy_asset = { path = "../bevy_asset", version = "0.16.0-dev" }
bevy_ecs = { path = "../bevy_ecs", version = "0.16.0-dev" }
bevy_math = { path = "../bevy_math", version = "0.16.0-dev" }
bevy_reflect = { path = "../bevy_reflect", version = "0.16.0-dev", features = [
"bevy",
] }
bevy_reflect = { path = "../bevy_reflect", version = "0.16.0-dev" }
bevy_transform = { path = "../bevy_transform", version = "0.16.0-dev" }
bevy_derive = { path = "../bevy_derive", version = "0.16.0-dev" }

Expand Down
4 changes: 1 addition & 3 deletions crates/bevy_color/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,7 @@ rust-version = "1.83.0"
bevy_math = { path = "../bevy_math", version = "0.16.0-dev", default-features = false, features = [
"curve",
] }
bevy_reflect = { path = "../bevy_reflect", version = "0.16.0-dev", features = [
"bevy",
], optional = true }
bevy_reflect = { path = "../bevy_reflect", version = "0.16.0-dev", optional = true }
bytemuck = { version = "1", features = ["derive"] }
serde = { version = "1.0", features = [
"derive",
Expand Down
7 changes: 4 additions & 3 deletions crates/bevy_ecs/src/entity/unique_slice.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,11 @@ use alloc::{
boxed::Box,
collections::VecDeque,
rc::Rc,
sync::Arc,
vec::Vec,
};

use bevy_platform_support::sync::Arc;

use super::{
unique_vec, EntitySet, EntitySetIterator, FromEntitySetIterator, TrustedEntityBorrow,
UniqueEntityIter, UniqueEntityVec,
Expand Down Expand Up @@ -85,9 +86,9 @@ impl<T: TrustedEntityBorrow> UniqueEntitySlice<T> {
}

/// Casts `self` to the inner slice.
pub fn into_arc_inner(self: Arc<Self>) -> Arc<[T]> {
pub fn into_arc_inner(this: Arc<Self>) -> Arc<[T]> {
// SAFETY: UniqueEntitySlice is a transparent wrapper around [T].
unsafe { Arc::from_raw(Arc::into_raw(self) as *mut [T]) }
unsafe { Arc::from_raw(Arc::into_raw(this) as *mut [T]) }
}

// Constructs a `UniqueEntitySlice` from a [`Rc<[T]>`] unsafely.
Expand Down
3 changes: 2 additions & 1 deletion crates/bevy_ecs/src/entity/unique_vec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,11 @@ use alloc::{
boxed::Box,
collections::{BTreeSet, BinaryHeap, TryReserveError, VecDeque},
rc::Rc,
sync::Arc,
vec::{self, Vec},
};

use bevy_platform_support::sync::Arc;

use super::{
unique_slice, EntitySet, FromEntitySetIterator, TrustedEntityBorrow, UniqueEntityIter,
UniqueEntitySlice,
Expand Down
4 changes: 1 addition & 3 deletions crates/bevy_gltf/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,7 @@ bevy_ecs = { path = "../bevy_ecs", version = "0.16.0-dev" }
bevy_image = { path = "../bevy_image", version = "0.16.0-dev" }
bevy_math = { path = "../bevy_math", version = "0.16.0-dev" }
bevy_pbr = { path = "../bevy_pbr", version = "0.16.0-dev" }
bevy_reflect = { path = "../bevy_reflect", version = "0.16.0-dev", features = [
"bevy",
] }
bevy_reflect = { path = "../bevy_reflect", version = "0.16.0-dev" }
bevy_render = { path = "../bevy_render", version = "0.16.0-dev" }
bevy_scene = { path = "../bevy_scene", version = "0.16.0-dev", features = [
"bevy_render",
Expand Down
4 changes: 1 addition & 3 deletions crates/bevy_image/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,7 @@ bevy_color = { path = "../bevy_color", version = "0.16.0-dev", features = [
"wgpu-types",
] }
bevy_math = { path = "../bevy_math", version = "0.16.0-dev" }
bevy_reflect = { path = "../bevy_reflect", version = "0.16.0-dev", features = [
"bevy",
], optional = true }
bevy_reflect = { path = "../bevy_reflect", version = "0.16.0-dev", optional = true }
bevy_utils = { path = "../bevy_utils", version = "0.16.0-dev" }
bevy_platform_support = { path = "../bevy_platform_support", version = "0.16.0-dev", default-features = false, features = [
"std",
Expand Down
145 changes: 124 additions & 21 deletions crates/bevy_internal/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ shader_format_glsl = [
shader_format_spirv = ["bevy_render/shader_format_spirv"]

serialize = [
"bevy_a11y?/serialize",
"bevy_color?/serialize",
"bevy_ecs/serialize",
"bevy_image?/serialize",
Expand All @@ -104,12 +105,13 @@ serialize = [
"bevy_platform_support/serialize",
]
multi_threaded = [
"std",
"bevy_asset?/multi_threaded",
"bevy_ecs/multi_threaded",
"bevy_render?/multi_threaded",
"bevy_tasks/multi_threaded",
]
async-io = ["bevy_tasks/async-io"]
async-io = ["std", "bevy_tasks/async-io"]

# Display server protocol support (X11 is enabled by default)
wayland = ["bevy_winit/wayland"]
Expand Down Expand Up @@ -272,31 +274,122 @@ custom_cursor = ["bevy_winit/custom_cursor"]
# Experimental support for nodes that are ignored for UI layouting
ghost_nodes = ["bevy_ui/ghost_nodes"]

# Allows access to the `std` crate. Enabling this feature will prevent compilation
# on `no_std` targets, but provides access to certain additional features on
# supported platforms.
std = [
"bevy_a11y?/std",
"bevy_app/std",
"bevy_diagnostic/std",
"bevy_ecs/std",
"bevy_input/std",
"bevy_input_focus?/std",
"bevy_math/std",
"bevy_platform_support/std",
"bevy_reflect/std",
"bevy_state?/std",
"bevy_time/std",
"bevy_transform/std",
"bevy_utils/std",
"bevy_tasks/std",
"bevy_window?/std",
]

# `critical-section` provides the building blocks for synchronization primitives
# on all platforms, including `no_std`.
critical-section = [
"bevy_a11y?/critical-section",
"bevy_app/critical-section",
"bevy_diagnostic/critical-section",
"bevy_ecs/critical-section",
"bevy_input/critical-section",
"bevy_input_focus?/critical-section",
"bevy_platform_support/critical-section",
"bevy_reflect/critical-section",
"bevy_state?/critical-section",
"bevy_time/critical-section",
"bevy_utils/critical-section",
"bevy_tasks/critical-section",
]

# `portable-atomic` provides additional platform support for atomic types and
# operations, even on targets without native support.
portable-atomic = [
"bevy_a11y?/portable-atomic",
"bevy_app/portable-atomic",
"bevy_diagnostic/portable-atomic",
"bevy_ecs/portable-atomic",
"bevy_input/portable-atomic",
"bevy_input_focus?/portable-atomic",
"bevy_platform_support/portable-atomic",
"bevy_reflect/portable-atomic",
"bevy_state?/portable-atomic",
"bevy_time/portable-atomic",
"bevy_utils/portable-atomic",
"bevy_tasks/portable-atomic",
]

# Uses the `libm` maths library instead of the one provided in `std` and `core`.
libm = [
"bevy_a11y?/libm",
"bevy_input/libm",
"bevy_input_focus?/libm",
"bevy_math/libm",
"bevy_transform/libm",
"bevy_window?/libm",
]

# Executor Backend (choose one)
# Uses `async-executor` as a task execution backend.
# This backend is incompatible with `no_std` targets.
async_executor = ["std", "bevy_tasks/async_executor", "bevy_ecs/async_executor"]
# Uses `edge-executor` as a task execution backend.
# Use this instead of `async-executor` if working on a `no_std` target.
edge_executor = ["bevy_tasks/edge_executor", "bevy_ecs/edge_executor"]

[dependencies]
# bevy
bevy_a11y = { path = "../bevy_a11y", version = "0.16.0-dev", optional = true }
bevy_app = { path = "../bevy_app", version = "0.16.0-dev" }
bevy_derive = { path = "../bevy_derive", version = "0.16.0-dev" }
bevy_diagnostic = { path = "../bevy_diagnostic", version = "0.16.0-dev" }
bevy_ecs = { path = "../bevy_ecs", version = "0.16.0-dev" }
bevy_state = { path = "../bevy_state", optional = true, version = "0.16.0-dev" }
bevy_input = { path = "../bevy_input", version = "0.16.0-dev" }
bevy_input_focus = { path = "../bevy_input_focus", version = "0.16.0-dev" }
bevy_log = { path = "../bevy_log", version = "0.16.0-dev" }
bevy_math = { path = "../bevy_math", version = "0.16.0-dev", features = [
# bevy (no_std)
bevy_app = { path = "../bevy_app", version = "0.16.0-dev", default-features = false, features = [
"bevy_tasks",
"bevy_reflect",
] }
bevy_derive = { path = "../bevy_derive", version = "0.16.0-dev", default-features = false }
bevy_diagnostic = { path = "../bevy_diagnostic", version = "0.16.0-dev", default-features = false }
bevy_ecs = { path = "../bevy_ecs", version = "0.16.0-dev", default-features = false, features = [
"bevy_reflect",
] }
bevy_input = { path = "../bevy_input", version = "0.16.0-dev", default-features = false, features = [
"bevy_reflect",
] }
bevy_math = { path = "../bevy_math", version = "0.16.0-dev", default-features = false, features = [
"bevy_reflect",
] }
bevy_platform_support = { path = "../bevy_platform_support", version = "0.16.0-dev" }
bevy_ptr = { path = "../bevy_ptr", version = "0.16.0-dev" }
bevy_reflect = { path = "../bevy_reflect", version = "0.16.0-dev", features = [
"bevy",
bevy_platform_support = { path = "../bevy_platform_support", version = "0.16.0-dev", default-features = false, features = [
"alloc",
] }
bevy_ptr = { path = "../bevy_ptr", version = "0.16.0-dev", default-features = false }
bevy_reflect = { path = "../bevy_reflect", version = "0.16.0-dev", default-features = false, features = [
"smallvec",
] }
bevy_time = { path = "../bevy_time", version = "0.16.0-dev" }
bevy_transform = { path = "../bevy_transform", version = "0.16.0-dev" }
bevy_utils = { path = "../bevy_utils", version = "0.16.0-dev" }
bevy_window = { path = "../bevy_window", version = "0.16.0-dev", optional = true }
bevy_tasks = { path = "../bevy_tasks", version = "0.16.0-dev" }
bevy_time = { path = "../bevy_time", version = "0.16.0-dev", default-features = false, features = [
"bevy_reflect",
] }
bevy_transform = { path = "../bevy_transform", version = "0.16.0-dev", default-features = false, features = [
"bevy-support",
"bevy_reflect",
] }
bevy_utils = { path = "../bevy_utils", version = "0.16.0-dev", default-features = false, features = [
"alloc",
] }
bevy_tasks = { path = "../bevy_tasks", version = "0.16.0-dev", default-features = false }

# bevy (std required)
bevy_log = { path = "../bevy_log", version = "0.16.0-dev", optional = true }

# bevy (optional)
bevy_a11y = { path = "../bevy_a11y", optional = true, version = "0.16.0-dev", features = [
"bevy_reflect",
] }
bevy_animation = { path = "../bevy_animation", optional = true, version = "0.16.0-dev" }
bevy_asset = { path = "../bevy_asset", optional = true, version = "0.16.0-dev" }
bevy_audio = { path = "../bevy_audio", optional = true, version = "0.16.0-dev" }
Expand All @@ -307,14 +400,24 @@ bevy_gilrs = { path = "../bevy_gilrs", optional = true, version = "0.16.0-dev" }
bevy_gizmos = { path = "../bevy_gizmos", optional = true, version = "0.16.0-dev", default-features = false }
bevy_gltf = { path = "../bevy_gltf", optional = true, version = "0.16.0-dev" }
bevy_image = { path = "../bevy_image", optional = true, version = "0.16.0-dev" }
bevy_input_focus = { path = "../bevy_input_focus", optional = true, version = "0.16.0-dev", default-features = false, features = [
"bevy_reflect",
] }
bevy_pbr = { path = "../bevy_pbr", optional = true, version = "0.16.0-dev" }
bevy_picking = { path = "../bevy_picking", optional = true, version = "0.16.0-dev" }
bevy_remote = { path = "../bevy_remote", optional = true, version = "0.16.0-dev" }
bevy_render = { path = "../bevy_render", optional = true, version = "0.16.0-dev" }
bevy_scene = { path = "../bevy_scene", optional = true, version = "0.16.0-dev" }
bevy_sprite = { path = "../bevy_sprite", optional = true, version = "0.16.0-dev" }
bevy_state = { path = "../bevy_state", optional = true, version = "0.16.0-dev", default-features = false, features = [
"bevy_app",
"bevy_reflect",
] }
bevy_text = { path = "../bevy_text", optional = true, version = "0.16.0-dev" }
bevy_ui = { path = "../bevy_ui", optional = true, version = "0.16.0-dev" }
bevy_window = { path = "../bevy_window", optional = true, version = "0.16.0-dev", default-features = false, features = [
"bevy_reflect",
] }
bevy_winit = { path = "../bevy_winit", optional = true, version = "0.16.0-dev" }

[lints]
Expand Down
2 changes: 2 additions & 0 deletions crates/bevy_internal/src/default_plugins.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ plugin_group! {
/// This plugin group will add all the default plugins for a *Bevy* application:
pub struct DefaultPlugins {
bevy_app:::PanicHandlerPlugin,
#[cfg(feature = "bevy_log")]
bevy_log:::LogPlugin,
bevy_app:::TaskPoolPlugin,
bevy_diagnostic:::FrameCountPlugin,
Expand All @@ -17,6 +18,7 @@ plugin_group! {
bevy_window:::WindowPlugin,
#[cfg(feature = "bevy_window")]
bevy_a11y:::AccessibilityPlugin,
#[cfg(feature = "std")]
#[custom(cfg(any(unix, windows)))]
bevy_app:::TerminalCtrlCHandlerPlugin,
#[cfg(feature = "bevy_asset")]
Expand Down
Loading
Loading