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 application feature, which allows to build freestanding wgpu app #1196

Merged
merged 2 commits into from
Sep 26, 2022

Conversation

aentity
Copy link
Contributor

@aentity aentity commented Jan 15, 2022

This PR adds new "application" feature, which is default. When user builds with:

cargo build --no-default-features --features "wgpu"

it allows to user to build "freestanding" app, with all the nice building blocks of iced, but user responsible for window creation, and rendering.

This also fixes building for iOS, for example, because user can turn off application, and put together pieces they need, similar to integration example.

We can also reduce other dependencies in parts of the workspace I think -- make them optional as example--, to decrease compile time of iced and codegen in this case, but I leave it here for now, for @hecrj to consider. We can do such things in future if desired.

Thank you for your time!

I think this is a better answer than #1190

@aentity aentity force-pushed the application_feature branch from f1fb67a to 7c35111 Compare January 15, 2022 08:32
@hecrj hecrj force-pushed the master branch 2 times, most recently from e6ab610 to 8b0f2e6 Compare January 19, 2022 15:04
@aentity aentity force-pushed the application_feature branch from 7c35111 to 3cab848 Compare January 21, 2022 02:42
@aentity aentity force-pushed the application_feature branch from 3cab848 to 076a523 Compare February 22, 2022 01:28
@aentity
Copy link
Contributor Author

aentity commented Feb 23, 2022

@hecrj what do you think of this pr, can we be reviewed?

@aentity
Copy link
Contributor Author

aentity commented Jun 21, 2022

@hecrj hello i would love see this merged into crates release. perhaps 0.4.3? this is very useful to allow crates release supported to have ios/no application build. i will do whatever is needed to see merged, is there some blocking issue i can help resolve? Thank you

I can also rebase onto 0.4 branch if it is easier for you, just tell me what to do :)

@hecrj hecrj force-pushed the application_feature branch from f45410e to 98b5832 Compare September 26, 2022 13:58
Copy link
Member

@hecrj hecrj left a comment

Choose a reason for hiding this comment

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

Thanks! 🎉

I think we can just add the application feature to iced_winit for now.

@hecrj hecrj added improvement An internal improvement shell labels Sep 26, 2022
@hecrj hecrj added this to the 0.5.0 milestone Sep 26, 2022
@hecrj hecrj merged commit 77800bc into iced-rs:master Sep 26, 2022
@aentity
Copy link
Contributor Author

aentity commented Nov 9, 2022

@hecrj I do not see how this can work, here you set feature unconditional: https://github.com/iced-rs/iced/pull/1196/files#diff-2e9d962a08321605940b5a657135052fbcef87b5e360662bb527c96d9a615542R99

so user cannot turn off by saying default-features = false when using iced-winit, because iced turns it on unconditional.

i think my original PR is correct...

if you try to build it will fail same as usual:

cargo check --target aarch64-apple-ios --no-default-features
 
error[E0432]: unresolved import `winit::platform::run_return`
   --> winit/src/application.rs:744:30
    |
744 |         use winit::platform::run_return::EventLoopExtRunReturn;
    |                              ^^^^^^^^^^ could not find `run_return` in `platform`

error[E0599]: no method named `run_return` found for struct `EventLoop<T>` in the current scope
   --> winit/src/application.rs:746:28
    |
746 |         let _ = event_loop.run_return(event_handler);
    |                            ^^^^^^^^^^ method not found in `EventLoop<T>`

Some errors have detailed explanations: E0432, E0599.
For more information about an error, try `rustc --explain E0432`.

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

Successfully merging this pull request may close these issues.

2 participants