Skip to content

Commit 3a85499

Browse files
authored
Display logo on windows executable (#5790)
1 parent 8589b55 commit 3a85499

File tree

4 files changed

+90
-0
lines changed

4 files changed

+90
-0
lines changed

Cargo.lock

Lines changed: 70 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@ ssl = ["rustpython-stdlib/ssl"]
2424
ssl-vendor = ["ssl", "rustpython-stdlib/ssl-vendor"]
2525
tkinter = ["rustpython-stdlib/tkinter"]
2626

27+
[build-dependencies]
28+
winresource = "0.1"
29+
2730
[dependencies]
2831
rustpython-compiler = { workspace = true }
2932
rustpython-pylib = { workspace = true, optional = true }

build.rs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
fn main() {
2+
if std::env::var("CARGO_CFG_TARGET_OS").unwrap() == "windows" {
3+
println!("cargo:rerun-if-changed=logo.ico");
4+
let mut res = winresource::WindowsResource::new();
5+
if std::path::Path::new("logo.ico").exists() {
6+
res.set_icon("logo.ico");
7+
} else {
8+
println!("cargo:warning=logo.ico not found, skipping icon embedding");
9+
return;
10+
}
11+
res.compile()
12+
.map_err(|e| {
13+
println!("cargo:warning=Failed to compile Windows resources: {e}");
14+
})
15+
.ok();
16+
}
17+
}

logo.ico

4.19 KB
Binary file not shown.

0 commit comments

Comments
 (0)