summaryrefslogtreecommitdiff
path: root/build.rs
blob: 5038c02bc267bd64a4f568a9238598334660735b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
use std::path::Path;

fn main() {
    println!("cargo:rerun-if-changed=icon/rustyip.ico");
    println!("cargo:rerun-if-changed=Cargo.toml");
    
    // Embed Windows resources (icon, version info, etc.)
    #[cfg(target_os = "windows")]
    {
        let mut res = winres::WindowsResource::new();
        
        // Set icon if available
        if Path::new("icon/rustyip.ico").exists() {
            res.set_icon("icon/rustyip.ico");
            println!("cargo:warning=✅ Embedding Windows icon: icon/rustyip.ico");
        } else {
            println!("cargo:warning=⚠️  Icon not found at icon/rustyip.ico");
            println!("cargo:warning=Run ./icon/svg-import.sh to generate icons");
        }

        // Set application metadata
        res.set("ProductName", "RustyIP Client");
        res.set("FileDescription", "RustyIP - Dynamic DNS client"); 
        res.set("LegalCopyright", "Copyright (C) Billy Richardson");
        res.set("CompanyName", "richardsondev");
        res.set("ProductVersion", env!("CARGO_PKG_VERSION"));
        res.set("FileVersion", env!("CARGO_PKG_VERSION"));
        res.set("OriginalFilename", "RustyIP.exe");
        res.set("InternalName", "RustyIP");
        res.set("Comments", "GitHub: https://github.com/richardsondev/rustyip");
        
        // Compile the resources
        if let Err(e) = res.compile() {
            println!("cargo:warning=❌ Failed to embed Windows resources: {}", e);
        } else {
            println!("cargo:warning=✅ Windows resources embedded successfully");
        }
    }
    
    #[cfg(not(target_os = "windows"))]
    {
        println!("cargo:warning=Skipping Windows resource embedding on non-Windows platform");
    }
}