-
Notifications
You must be signed in to change notification settings - Fork 950
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
Make winit truly optional #290
Conversation
This looks straightforward (and @grovesNL is travelling) |
Build failed |
Alright, this is nasty. So when we have a feature that enables "xxx/yyy", where "xxx" is optional, this automatically enables "xxx" out of a sudden. Anybody knows a workaround? @omni-viral hit this before in Amethyst, perhaps? |
I hit it multiple times. There is an issue in cargo (I'd insert link here, but can't find it). The issue was created long ago, but no one fixed it. Same as issue where dependencies that are filtered out by platform still enable features in other dependencies. We need a hero! Intermediate solution is listing dependencies that can't be build on any platform under For gfx backends I write it like this: [dependencies]
gfx-hal = "0.3"
gfx-backend-empty = { version = "0.3", optional = true }
gfx-backend-gl = { version = "0.3", optional = true }
[target.'cfg(all(target_os = "windows", not(target_arch = "wasm32")))'.dependencies]
gfx-backend-dx12 = { version = "0.3", optional = true }
[target.'cfg(all(any(target_os = "windows", all(unix, not(any(target_os = "macos", target_os = "ios")))), not(target_arch = "wasm32")))'.dependencies]
gfx-backend-vulkan = { version = "0.3", optional = true }
[target.'cfg(any(all(target_os = "macos", not(target_arch = "wasm32"), all(target_arch = "aarch64", target_os = "ios"))))'.dependencies]
gfx-backend-metal = { version = "0.3", optional = true } And I have a macro that repeat those |
I decided to go a different route and just route the responsibility to the user of the library (which shouldn't be a problem for wgpu-rs, and possibly easy for others?..). Also filed #7259. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suspect this is a typo.
17f2c30
to
596cf2c
Compare
@seivan thank you for the quick review! Apparently, there was a bunch of code pieces using the old "window-winit" that are now rewritten. |
Finally, CI appears to be happy. |
Build succeeded |
@kvark This can be real problem because cargo enables features eagerly. User won't be able to enable features based on target platform and thus would end up reexport them same way transitively to the binary. And features would have to be enabled to build final binary. |
Fixes #64