0.1.20
This commit is contained in:
@@ -7,9 +7,35 @@ fn main() {
|
||||
let version = resolve_app_version();
|
||||
println!("cargo:rustc-env=APP_VERSION={version}");
|
||||
|
||||
embed_windows_icon();
|
||||
|
||||
slint_build::compile("ui/app.slint").expect("Slint build failed");
|
||||
}
|
||||
|
||||
/// Shell icon for `rcalc.exe` in Explorer (needs `assets/icon.ico` + windres/rc).
|
||||
fn embed_windows_icon() {
|
||||
let target_os = env::var("CARGO_CFG_TARGET_OS").unwrap_or_default();
|
||||
if target_os != "windows" {
|
||||
return;
|
||||
}
|
||||
|
||||
println!("cargo:rerun-if-changed=assets/icon.ico");
|
||||
|
||||
let mut res = winresource::WindowsResource::new();
|
||||
res.set_icon("assets/icon.ico");
|
||||
|
||||
// Cross-compile from Linux: mingw windres is prefixed.
|
||||
if cfg!(not(windows)) {
|
||||
let target = env::var("TARGET").unwrap_or_default();
|
||||
if target.contains("windows-gnu") {
|
||||
res.set_windres_path("x86_64-w64-mingw32-windres");
|
||||
}
|
||||
}
|
||||
|
||||
res.compile()
|
||||
.expect("failed to embed Windows icon (is windres/rc available?)");
|
||||
}
|
||||
|
||||
/// Window / package version shown as `Rcalc-{version}`.
|
||||
///
|
||||
/// On each `release` build the patch in `Cargo.toml` is incremented once
|
||||
|
||||
Reference in New Issue
Block a user