Skip to content

Commit c878e24

Browse files
ids1024jackpot51
authored andcommitted
Fix build on Windows/non-Unix
We'll need libcosmic to work on Windows and macOS if we want to use it in the Keyboard Configurator. `freedesktop-icons` doesn't seem to build on Windows, so only use it on Unix systems. It does seem to build on macOS, so leave it as a dependency there. A good solution for icon bundling on macOS/Windows will need to be figured out at some point.
1 parent 93ec06a commit c878e24

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

Cargo.toml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ winit = ["iced/winit", "iced_winit"]
1818
applet = ["cosmic-panel-config", "sctk", "wayland"]
1919
winit_softbuffer = ["winit", "softbuffer"]
2020
winit_wgpu = ["winit", "wgpu"]
21+
2122
[dependencies]
22-
freedesktop-icons = "0.2.2"
2323
apply = "0.3.0"
2424
derive_setters = "0.1.5"
2525
lazy_static = "1.4.0"
@@ -30,6 +30,9 @@ sctk = { package = "smithay-client-toolkit", git = "https://github.com/Smithay/c
3030
slotmap = "1.0.6"
3131
fraction = "0.13.0"
3232

33+
[target.'cfg(unix)'.dependencies]
34+
freedesktop-icons = "0.2.2"
35+
3336
[dependencies.cosmic-theme]
3437
git = "https://github.com/pop-os/cosmic-theme.git"
3538

src/widget/icon.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ impl<'a> IconSource<'a> {
3535
let icon: Option<&Path> = match self {
3636
IconSource::Handle(handle) => return handle.clone(),
3737
IconSource::Path(ref path) => Some(path),
38+
#[cfg(unix)]
3839
IconSource::Name(ref name) => {
3940
let icon = crate::settings::DEFAULT_ICON_THEME.with(|default_theme| {
4041
let default_theme: &str = &default_theme.borrow();
@@ -56,6 +57,9 @@ impl<'a> IconSource<'a> {
5657

5758
name_path_buffer.as_deref()
5859
}
60+
// TODO: Icon loading mechanism for non-Unix systems
61+
#[cfg(not(unix))]
62+
IconSource::Name(_) => None,
5963
};
6064

6165
let is_svg = svg

0 commit comments

Comments
 (0)