build: add icon, change default build exe

This commit is contained in:
Jixun Wu 2023-12-28 22:07:43 +00:00
parent 964eae3e0b
commit 555b76d3c1
5 changed files with 43 additions and 4 deletions

21
Cargo.lock generated
View File

@ -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"

View File

@ -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]]

14
build.rs Normal file
View File

@ -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(())
}

View File

@ -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

BIN
src/um-react.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 180 KiB