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

std feature flag doesn't override libm #587

Closed
DavJCosby opened this issue Nov 14, 2024 · 1 comment
Closed

std feature flag doesn't override libm #587

DavJCosby opened this issue Nov 14, 2024 · 1 comment

Comments

@DavJCosby
Copy link
Contributor

DavJCosby commented Nov 14, 2024

I ran into an interesting issue the other day while making my crate compatible with no_std.

Our cargo.toml setup looked roughly like this:

# --snip--
[features]
std = ["glam/std"]

[dependencies]
glam = { version = "0.29", default-features = false, features = ["libm"] }

The goal was to use std features whenever they were available and fall back on libm when they weren't. Benchmarks showed, however, that even on std-enabled compilations libm functionality was being preferred. I believe this is unintended behavior, but I wanted to confirm before submitting a PR.

For my crate, I ended up just doing:

[features]
std = ["glam/std"]
libm = ["glam/libm"]

[dependencies]
glam = { version = "0.29", default-features = false, features = [] }
@bitshifter
Copy link
Owner

This is intended behaviour. People may want to enable libm independent of whether std is being used. For example libm will be more deterministic across platforms because the implementation is consistent.

Neat crate, I need to buy some LEDs :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants