From 7c3511186ec06971e993da7a337ddbf04683cff5 Mon Sep 17 00:00:00 2001 From: aentity Date: Sat, 15 Jan 2022 00:06:36 -0800 Subject: [PATCH] Add application feature, which allows to build freestanding wgpu app --- Cargo.toml | 3 ++- native/src/lib.rs | 2 +- src/lib.rs | 5 +++++ winit/Cargo.toml | 1 + winit/src/lib.rs | 2 ++ 5 files changed, 11 insertions(+), 2 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index bb50888a68..5443286677 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -13,7 +13,8 @@ categories = ["gui"] resolver = "2" [features] -default = ["wgpu", "default_system_font"] +default = ["wgpu", "default_system_font", "application"] +application = ["iced_winit/application"] # Enables the `iced_wgpu` renderer wgpu = ["iced_wgpu"] # Enables the `Image` widget diff --git a/native/src/lib.rs b/native/src/lib.rs index a5526e6d49..d65a0e86a6 100644 --- a/native/src/lib.rs +++ b/native/src/lib.rs @@ -91,5 +91,5 @@ pub use renderer::Renderer; pub use runtime::Runtime; pub use shell::Shell; pub use subscription::Subscription; -pub use user_interface::UserInterface; +pub use user_interface::{Cache, UserInterface}; pub use widget::Widget; diff --git a/src/lib.rs b/src/lib.rs index 6c0e03e830..d6423bc718 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -180,10 +180,13 @@ #![forbid(unsafe_code)] #![forbid(rust_2018_idioms)] #![cfg_attr(docsrs, feature(doc_cfg))] + +#[cfg(feature = "application")] mod application; mod element; mod error; mod result; +#[cfg(feature = "application")] mod sandbox; pub mod clipboard; @@ -234,11 +237,13 @@ use iced_web as runtime; #[doc(no_inline)] pub use widget::*; +#[cfg(feature = "application")] pub use application::Application; pub use element::Element; pub use error::Error; pub use executor::Executor; pub use result::Result; +#[cfg(feature = "application")] pub use sandbox::Sandbox; pub use settings::Settings; diff --git a/winit/Cargo.toml b/winit/Cargo.toml index bfcfacbcf5..d52283b944 100644 --- a/winit/Cargo.toml +++ b/winit/Cargo.toml @@ -12,6 +12,7 @@ categories = ["gui"] [features] debug = ["iced_native/debug"] +application = [] [dependencies] window_clipboard = "0.2" diff --git a/winit/src/lib.rs b/winit/src/lib.rs index b31adf6e62..86a702ed91 100644 --- a/winit/src/lib.rs +++ b/winit/src/lib.rs @@ -27,6 +27,7 @@ pub use iced_native::*; pub use winit; +#[cfg(feature = "application")] pub mod application; pub mod clipboard; pub mod conversion; @@ -38,6 +39,7 @@ mod mode; mod position; mod proxy; +#[cfg(feature = "application")] pub use application::Application; pub use clipboard::Clipboard; pub use error::Error;