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
Use Cargo features instead of cfg gating whole crates #3278
Comments
I see that there are Is the scope of this issue only for the extern crates (like those present in lib.rs files)? |
Currently cargo must compile every dependency so even if a crate is conditionally included in the rust source, it must be declared as a dependency and compiled. Therefore for rust-core-foundation, we have to cfg out the whole crate at the top level. Most of the time, this is a few annotations, but in the case of glfw-rs, it was quite a bit. Cargo features allow us to not compile crates on some platforms, so all those cfgs can be removed in rust-core-foundation and we just tell cargo not to include that feature unless we're on macos. Does that help? |
Yep, thanks. |
The pull request for the |
I'm going to be reorganizing the code in components/compositing/platform, and will probably add |
@mbrubeck I had originally said I was looking into it but then found out the "features" feature wasn't implemented in Cargo yet so I started working on something else in the mean time and didn't get back to it. So I haven't done anything yet. I'll unassign myself from this for the mean time. |
It look like |
This is possibly related to #5973 |
Anyone mind if I pick this up? |
Go for it! |
A brief glance through some of the Cargo files suggests the problem was already fixed by making various dependencies target-specific. Is there anything left to do? |
No, I think this is done. |
Currently we add
#[cfg(target_os=...)]
lines to crates that are platform specific so they compile on every platform. We should instead use Cargo's new feature support.The text was updated successfully, but these errors were encountered: