Skip to content

Commit

Permalink
Add x11 and wayland features to egui-wgpu and egui_glow (#3909)
Browse files Browse the repository at this point in the history
This allows them to build correctly on Linux by passing one or both of
the features alongside `winit`.

Closes #3492
Closes #2286
  • Loading branch information
YgorSouza authored Jan 30, 2024
1 parent ca513ce commit d72f92c
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 6 deletions.
12 changes: 10 additions & 2 deletions crates/eframe/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,11 @@ puffin = [
]

## Enables wayland support and fixes clipboard issue.
wayland = ["egui-winit/wayland"]
wayland = [
"egui-winit/wayland",
"egui-wgpu?/wayland",
"egui_glow?/wayland",
]

## Enable screen reader support (requires `ctx.options_mut(|o| o.screen_reader = true);`) on web.
##
Expand All @@ -114,7 +118,11 @@ web_screen_reader = [
wgpu = ["dep:wgpu", "dep:egui-wgpu", "dep:pollster"]

## Enables compiling for x11.
x11 = ["egui-winit/x11"]
x11 = [
"egui-winit/x11",
"egui-wgpu?/x11",
"egui_glow?/x11",
]

## If set, eframe will look for the env-var `EFRAME_SCREENSHOT_TO` and write a screenshot to that location, and then quit.
## This is used to generate images for examples.
Expand Down
8 changes: 7 additions & 1 deletion crates/egui-wgpu/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,15 @@ all-features = true
## Enable profiling with the [`puffin`](https://docs.rs/puffin) crate.
puffin = ["dep:puffin"]

## Enable [`winit`](https://docs.rs/winit) integration.
## Enable [`winit`](https://docs.rs/winit) integration. On Linux, requires either `wayland` or `x11`
winit = ["dep:winit"]

## Enables Wayland support for winit.
wayland = ["winit?/wayland"]

## Enables x11 support for winit.
x11 = ["winit?/x11"]


[dependencies]
egui = { version = "0.25.0", path = "../egui", default-features = false }
Expand Down
2 changes: 2 additions & 0 deletions crates/egui_demo_app/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ syntect = ["egui_demo_lib/syntect"]

glow = ["eframe/glow"]
wgpu = ["eframe/wgpu", "bytemuck", "dep:wgpu"]
wayland = ["eframe/wayland"]
x11 = ["eframe/x11"]

[dependencies]
chrono = { version = "0.4", default-features = false, features = [
Expand Down
8 changes: 7 additions & 1 deletion crates/egui_glow/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,15 @@ links = ["egui-winit?/links"]
## Enable profiling with the [`puffin`](https://docs.rs/puffin) crate.
puffin = ["dep:puffin", "egui-winit?/puffin", "egui/puffin"]

## Enable [`winit`](https://docs.rs/winit) integration.
## Enable [`winit`](https://docs.rs/winit) integration. On Linux, requires either `wayland` or `x11`
winit = ["egui-winit", "dep:winit"]

## Enables Wayland support for winit.
wayland = ["winit?/wayland"]

## Enables x11 support for winit.
x11 = ["winit?/x11"]


[dependencies]
egui = { version = "0.25.0", path = "../egui", default-features = false, features = [
Expand Down
17 changes: 15 additions & 2 deletions scripts/check.sh
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,23 @@ cargo test --quiet --all-targets --all-features
cargo test --quiet --doc # slow - checks all doc-tests

cargo check --quiet -p eframe --no-default-features --features "glow"
cargo check --quiet -p eframe --no-default-features --features "wgpu"
if [[ "$OSTYPE" == "linux-gnu"* ]]; then
cargo check --quiet -p eframe --no-default-features --features "wgpu","x11"
cargo check --quiet -p eframe --no-default-features --features "wgpu","wayland"
else
cargo check --quiet -p eframe --no-default-features --features "wgpu"
fi

cargo check --quiet -p egui --no-default-features --features "serde"
cargo check --quiet -p egui_demo_app --no-default-features --features "glow"
cargo check --quiet -p egui_demo_app --no-default-features --features "wgpu"

if [[ "$OSTYPE" == "linux-gnu"* ]]; then
cargo check --quiet -p egui_demo_app --no-default-features --features "wgpu","x11"
cargo check --quiet -p egui_demo_app --no-default-features --features "wgpu","wayland"
else
cargo check --quiet -p egui_demo_app --no-default-features --features "wgpu"
fi

cargo check --quiet -p egui_demo_lib --no-default-features
cargo check --quiet -p egui_extras --no-default-features
cargo check --quiet -p egui_glow --no-default-features
Expand Down

0 comments on commit d72f92c

Please sign in to comment.