diff --git a/Cargo.lock b/Cargo.lock index 2dd2f98e..5ddf186d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -10578,6 +10578,7 @@ dependencies = [ "tokio", "tracing", "tracing-subscriber 0.3.18", + "winres", ] [[package]] @@ -12967,6 +12968,15 @@ dependencies = [ "windows-sys 0.48.0", ] +[[package]] +name = "winres" +version = "0.1.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b68db261ef59e9e52806f688020631e987592bd83619edccda9c47d42cde4f6c" +dependencies = [ + "toml 0.5.11", +] + [[package]] name = "wyz" version = "0.5.1" diff --git a/Cargo.toml b/Cargo.toml index 5a453f1f..105be4b9 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -13,7 +13,7 @@ include = [ # TODO: Menu shortcut will not be generated automatically in case of re-init: https://github.com/volks73/cargo-wix/issues/141 [package.metadata.wix] -product-icon = "res/space-acres.ico" +product-icon = "res/windows/space-acres.ico" # TODO: This option will not have effect until https://github.com/volks73/cargo-wix/issues/270 is fixed in case of re-init product-name = "Space Acres" @@ -68,6 +68,9 @@ tokio = { version = "1.34.0", features = ["fs", "time"] } tracing = "0.1.40" tracing-subscriber = "0.3.18" +[target.'cfg(windows)'.build-dependencies] +winres = "0.1.12" + # The list of dependencies below (which can be both direct and indirect dependencies) are crates # that are suspected to be CPU-intensive, and that are unlikely to require debugging (as some of # their debug info might be missing) or to require to be frequently recompiled. We compile these diff --git a/build.rs b/build.rs new file mode 100644 index 00000000..afff9e6b --- /dev/null +++ b/build.rs @@ -0,0 +1,8 @@ +fn main() { + #[cfg(windows)] + { + let mut res = winres::WindowsResource::new(); + res.set_icon("res\\windows\\space-acres.ico"); + res.compile().unwrap(); + } +} diff --git a/res/space-acres.desktop b/res/linux/space-acres.desktop similarity index 100% rename from res/space-acres.desktop rename to res/linux/space-acres.desktop diff --git a/res/space-acres.png b/res/linux/space-acres.png similarity index 100% rename from res/space-acres.png rename to res/linux/space-acres.png diff --git a/res/space-acres.ico b/res/windows/space-acres.ico similarity index 100% rename from res/space-acres.ico rename to res/windows/space-acres.ico diff --git a/wix/space-acres.wxs b/wix/space-acres.wxs index be9b39ba..87c20369 100644 --- a/wix/space-acres.wxs +++ b/wix/space-acres.wxs @@ -308,7 +308,7 @@ Add/Remove Programs control panel requires commenting out or removing the following `Icon` and `Property` tags. --> - +