This commit is contained in:
2026-08-02 13:11:42 +03:00
parent 4f043fc1c0
commit 0e40f7f1cd
14 changed files with 716 additions and 219 deletions
+26
View File
@@ -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