diff --git a/Cargo.lock b/Cargo.lock index b7d48b7..bbfd65d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2741,7 +2741,7 @@ dependencies = [ "cfg-expr", "heck", "pkg-config", - "toml", + "toml 0.8.2", "version-compare", ] @@ -2897,6 +2897,15 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" +[[package]] +name = "toml" +version = "0.5.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f4f7f0dd8d50a853a531c426359045b1998f04219d88799810762cd4ad314234" +dependencies = [ + "serde", +] + [[package]] name = "toml" version = "0.8.2" @@ -3000,6 +3009,7 @@ dependencies = [ "http", "image", "tao", + "winres", "wry", "zip", ] @@ -3470,6 +3480,15 @@ dependencies = [ "memchr", ] +[[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 = "wry" version = "0.35.1" diff --git a/Cargo.toml b/Cargo.toml index bff4bc4..546423a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -12,11 +12,17 @@ zip = "0.6.6" http = "0.2" bytes = "1.5.0" clap = { version = "4.4.12", features = ["derive"] } -image = { version = "0.24", default-features = true, features = ["webp"] } +image = { version = "0.24", default-features = true, features = [ + "webp", + "ico", +] } dirs = "5.0.1" +[build-dependencies] +winres = "0.1" + [[bin]] -name = "stub" +name = "um-react-wry-stub" path = "src/stub.rs" [[bin]] diff --git a/build.rs b/build.rs new file mode 100644 index 0000000..c651f99 --- /dev/null +++ b/build.rs @@ -0,0 +1,14 @@ +use { + std::{env, io}, + winres::WindowsResource, +}; + +fn main() -> io::Result<()> { + if env::var_os("CARGO_CFG_WINDOWS").is_some() { + WindowsResource::new() + // This path can be absolute, or relative to your crate root. + .set_icon("src/um-react.ico") + .compile()?; + } + Ok(()) +} diff --git a/src/builder.rs b/src/builder.rs index c9449f8..fa9ba06 100644 --- a/src/builder.rs +++ b/src/builder.rs @@ -14,7 +14,7 @@ struct BuildArgs { resource: std::path::PathBuf, /// The path to stub. - #[arg(short = 't', long, default_value = "target/release/stub.exe")] + #[arg(short = 't', long, default_value = "um-react-wry-stub.exe")] stub: std::path::PathBuf, // The path to final executable diff --git a/src/um-react.ico b/src/um-react.ico new file mode 100644 index 0000000..ca8c3f0 Binary files /dev/null and b/src/um-react.ico differ