mirror of
https://github.com/emilk/egui.git
synced 2026-08-31 22:00:03 -04:00
[egui-wgpu] Put the capture module behind a feature flag, make the egui dependency optional (#7698)
This PR enables users of `egui-wgpu` to render `epaint` primitives without having to bring in the complete `egui` crate and all it's dependencies. --------- Co-authored-by: Emil Ernerfeldt <emil.ernerfeldt@gmail.com>
This commit is contained in:
@@ -135,6 +135,7 @@ winit = { workspace = true, default-features = false, features = ["rwh_06"] }
|
|||||||
# optional native:
|
# optional native:
|
||||||
egui-wgpu = { workspace = true, optional = true, features = [
|
egui-wgpu = { workspace = true, optional = true, features = [
|
||||||
"winit",
|
"winit",
|
||||||
|
"capture",
|
||||||
] } # if wgpu is used, use it with winit
|
] } # if wgpu is used, use it with winit
|
||||||
pollster = { workspace = true, optional = true } # needed for wgpu
|
pollster = { workspace = true, optional = true } # needed for wgpu
|
||||||
|
|
||||||
@@ -240,7 +241,7 @@ web-sys = { workspace = true, features = [
|
|||||||
] }
|
] }
|
||||||
|
|
||||||
# optional web:
|
# optional web:
|
||||||
egui-wgpu = { workspace = true, optional = true } # if wgpu is used, use it without (!) winit
|
egui-wgpu = { workspace = true, optional = true, features = ["capture"] } # if wgpu is used, use it without (!) winit
|
||||||
wgpu = { workspace = true, optional = true }
|
wgpu = { workspace = true, optional = true }
|
||||||
|
|
||||||
# Native dev dependencies for testing
|
# Native dev dependencies for testing
|
||||||
|
|||||||
@@ -27,8 +27,11 @@ rustdoc-args = ["--generate-link-to-definition"]
|
|||||||
[features]
|
[features]
|
||||||
default = ["fragile-send-sync-non-atomic-wasm", "macos-window-resize-jitter-fix", "wgpu/default"]
|
default = ["fragile-send-sync-non-atomic-wasm", "macos-window-resize-jitter-fix", "wgpu/default"]
|
||||||
|
|
||||||
|
## Enables the `capture` module for capturing screenshots.
|
||||||
|
capture = ["dep:egui"]
|
||||||
|
|
||||||
## Enable [`winit`](https://docs.rs/winit) integration. On Linux, requires either `wayland` or `x11`
|
## Enable [`winit`](https://docs.rs/winit) integration. On Linux, requires either `wayland` or `x11`
|
||||||
winit = ["dep:winit", "winit/rwh_06"]
|
winit = ["dep:winit", "winit/rwh_06", "dep:egui", "capture"]
|
||||||
|
|
||||||
## Enables Wayland support for winit.
|
## Enables Wayland support for winit.
|
||||||
wayland = ["winit?/wayland"]
|
wayland = ["winit?/wayland"]
|
||||||
@@ -47,7 +50,6 @@ fragile-send-sync-non-atomic-wasm = ["wgpu/fragile-send-sync-non-atomic-wasm"]
|
|||||||
macos-window-resize-jitter-fix = ["wgpu/metal"]
|
macos-window-resize-jitter-fix = ["wgpu/metal"]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
egui = { workspace = true, default-features = false }
|
|
||||||
epaint = { workspace = true, default-features = false, features = ["bytemuck"] }
|
epaint = { workspace = true, default-features = false, features = ["bytemuck"] }
|
||||||
|
|
||||||
ahash.workspace = true
|
ahash.workspace = true
|
||||||
@@ -62,4 +64,5 @@ wgpu = { workspace = true, features = ["wgsl"] }
|
|||||||
|
|
||||||
# Optional dependencies:
|
# Optional dependencies:
|
||||||
|
|
||||||
|
egui = { workspace = true, optional = true, default-features = false }
|
||||||
winit = { workspace = true, optional = true, default-features = false }
|
winit = { workspace = true, optional = true, default-features = false }
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ pub use renderer::*;
|
|||||||
pub use setup::{NativeAdapterSelectorMethod, WgpuSetup, WgpuSetupCreateNew, WgpuSetupExisting};
|
pub use setup::{NativeAdapterSelectorMethod, WgpuSetup, WgpuSetupCreateNew, WgpuSetupExisting};
|
||||||
|
|
||||||
/// Helpers for capturing screenshots of the UI.
|
/// Helpers for capturing screenshots of the UI.
|
||||||
|
#[cfg(feature = "capture")]
|
||||||
pub mod capture;
|
pub mod capture;
|
||||||
|
|
||||||
/// Module for painting [`egui`](https://github.com/emilk/egui) with [`wgpu`] on [`winit`].
|
/// Module for painting [`egui`](https://github.com/emilk/egui) with [`wgpu`] on [`winit`].
|
||||||
|
|||||||
Reference in New Issue
Block a user