FEMM/crates/femm-app/build.rs

20 lines
786 B
Rust

fn main() {
#[cfg(target_os = "windows")]
embed_windows_icon();
}
#[cfg(target_os = "windows")]
fn embed_windows_icon() {
let manifest = std::path::PathBuf::from(std::env::var_os("CARGO_MANIFEST_DIR").unwrap());
let repo_root = manifest.parent().unwrap().parent().unwrap();
let icon = repo_root.join("build").join("assets").join("femm.ico");
println!("cargo:rerun-if-changed={}", icon.display());
if !icon.is_file() {
println!("cargo:warning=femm.ico not found at {} - skipping icon embed (run scripts/windows/build.ps1 to generate)", icon.display());
return;
}
let mut res = winresource::WindowsResource::new();
res.set_icon(icon.to_str().expect("non-utf8 icon path"));
res.compile().expect("winresource compile failed");
}