diff --git a/build.rs b/build.rs new file mode 100644 index 0000000..4d29842 --- /dev/null +++ b/build.rs @@ -0,0 +1,27 @@ +fn main() { + // Embed icon on Windows (via windres for cross-compilation support) + #[cfg(target_os = "windows")] + { + let out_dir = std::env::var("OUT_DIR").unwrap(); + let rc_path = "resources/app.rc"; + let res_path = format!("{}/app.res", out_dir); + let status = std::process::Command::new("x86_64-w64-mingw32-windres") + .args([rc_path, "-O", "coff", "-o", &res_path]) + .status(); + if let Ok(s) = status { + if s.success() { + println!("cargo:rustc-link-arg={}", res_path); + return; + } + } + // Fallback: try plain windres + let status = std::process::Command::new("windres") + .args([rc_path, "-O", "coff", "-o", &res_path]) + .status(); + if let Ok(s) = status { + if s.success() { + println!("cargo:rustc-link-arg={}", res_path); + } + } + } +} diff --git a/resources/app.ico b/resources/app.ico new file mode 100755 index 0000000..86aec24 Binary files /dev/null and b/resources/app.ico differ diff --git a/resources/app.rc b/resources/app.rc new file mode 100644 index 0000000..0a9daf1 --- /dev/null +++ b/resources/app.rc @@ -0,0 +1 @@ +1 ICON "app.ico"