Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add no_std support to bevy_input #16995

Merged
merged 5 commits into from
Dec 29, 2024

Conversation

bushrat011899
Copy link
Contributor

@bushrat011899 bushrat011899 commented Dec 27, 2024

Objective

Solution

  • Added the following features:
    • std (default)
    • smol_str (default)
    • portable-atomic
    • critical-section
    • libm
  • Fixed an existing issue where bevy_reflect wasn't properly feature gated.

Testing

  • CI

Notes

  • There were some minor issues with bevy_math and bevy_ecs noticed in this PR which I have also resolved here. I can split these out if desired, but I've left them here for now as they're very small changes and I don't consider this PR itself to be very controversial.
  • libm, portable-atomic, and critical-section are shortcuts to enable the relevant features in dependencies, making the usage of this crate on atomically challenged platforms possible and simpler.
  • smol_str is gated as it doesn't support atomically challenged platforms (e.g., Raspberry Pi Pico). I have an issue and a PR to discuss this upstream.

Also fixed some minor issues with `bevy_math` and `bevy_ecs`
@bushrat011899 bushrat011899 added C-Feature A new feature, making something new possible D-Trivial Nice and easy! A great choice to get started with Bevy A-Input Player input via keyboard, mouse, gamepad, and more X-Uncontroversial This work is generally agreed upon S-Needs-Review Needs reviewer attention (from anyone!) to move forward labels Dec 27, 2024
@bushrat011899 bushrat011899 changed the title Add no_std support to `bevy_input Add no_std support to bevy_input Dec 27, 2024
#[cfg(feature = "bevy_reflect")]
use bevy_reflect::Reflect;

#[cfg(not(feature = "smol_str"))]
use alloc::string::String as SmolStr;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursed

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just avoids further changing code without reason, but I do agree this isn't pretty haha. I'm hoping the PR I've made upstream will be worked-on/accepted so we can just remove this feature gate entirely.

"serialize",
] }
bevy_math = { path = "../bevy_math", version = "0.15.0-dev", default-features = false, features = [
"rand",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems that the bevy_math/rand feature just disappeared during these changes.
Is that intentional? (I mean I don't see a reason for bevy_input to need random numbers.)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah I deliberately left that feature off since I couldn't see anything in bevy_input that actually needed it.

@alice-i-cecile alice-i-cecile added this pull request to the merge queue Dec 29, 2024
@alice-i-cecile alice-i-cecile added S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it and removed S-Needs-Review Needs reviewer attention (from anyone!) to move forward labels Dec 29, 2024
Merged via the queue into bevyengine:main with commit 46af466 Dec 29, 2024
33 checks passed
@TimJentzsch TimJentzsch added the O-Embedded Weird hardware and no_std platforms label Dec 31, 2024
ecoskey pushed a commit to ecoskey/bevy that referenced this pull request Jan 6, 2025
# Objective

- Contributes to bevyengine#15460

## Solution

- Added the following features:
  - `std` (default)
  - `smol_str` (default)
  - `portable-atomic`
  - `critical-section`
  - `libm`
- Fixed an existing issue where `bevy_reflect` wasn't properly feature
gated.

## Testing

- CI

## Notes

- There were some minor issues with `bevy_math` and `bevy_ecs` noticed
in this PR which I have also resolved here. I can split these out if
desired, but I've left them here for now as they're very small changes
and I don't consider this PR itself to be very controversial.
- `libm`, `portable-atomic`, and `critical-section` are shortcuts to
enable the relevant features in dependencies, making the usage of this
crate on atomically challenged platforms possible and simpler.
- `smol_str` is gated as it doesn't support atomically challenged
platforms (e.g., Raspberry Pi Pico). I have an issue and a
[PR](rust-analyzer/smol_str#91) to discuss this
upstream.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Input Player input via keyboard, mouse, gamepad, and more C-Feature A new feature, making something new possible D-Trivial Nice and easy! A great choice to get started with Bevy O-Embedded Weird hardware and no_std platforms S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it X-Uncontroversial This work is generally agreed upon
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants