forked from 1b-agent/opencadstudio-upstream
fix(windows): embed the app icon into the .exe
The Windows executable carried no icon, so Explorer, the taskbar, the Start-menu tile and file-association entries showed a generic icon. Embed AppIcon.ico via winresource in build.rs, and generate the .ico from the logo before the build (it was produced after the build, too late to embed). Local and non-Windows builds skip the step when the .ico is absent. Fixes #107. Co-Authored-By: Claude Opus 4.8 <[email protected]>
This commit is contained in:
1 parent
6376080336
commit
084dfb1bdb
4 files changed
+75
-12
No files matched your search
@@ -26,6 +26,22 @@ use std::path::Path;
|
||||
const PRIORITY: &[&str] = &["home", "model", "insert", "annotate", "view", "manage"];
|
||||
|
||||
fn main() {
|
||||
// Windows: embed AppIcon.ico into the .exe so the executable carries its
|
||||
// own icon (Explorer, taskbar, Start-menu tile, file associations). The
|
||||
// .ico is produced from assets/logo.svg by the release workflow before the
|
||||
// build; when it is absent (local/dev builds) this is skipped. See #107.
|
||||
#[cfg(windows)]
|
||||
{
|
||||
println!("cargo:rerun-if-changed=packaging/windows/AppIcon.ico");
|
||||
if Path::new("packaging/windows/AppIcon.ico").exists() {
|
||||
let mut res = winresource::WindowsResource::new();
|
||||
res.set_icon("packaging/windows/AppIcon.ico");
|
||||
if let Err(e) = res.compile() {
|
||||
println!("cargo:warning=failed to embed Windows icon: {e}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
let mods_dir = Path::new("src/modules");
|
||||
println!("cargo:rerun-if-changed=src/modules");
|
||||
|
||||
|
||||
Reference in new issue
Block a user