Files
lightcraft/apps/app/build.rs
T
Andrew FrahnandClaude Opus 5.5 6cbc0eb5a9 Phase 0: configurable brand, MIT licence, plan/ and Immich tracker
- brand.toml is the only place the product name lives; every crate and app
  reads it through dac-brand (env vars with legacy fallback, settings folder
  with copy-only migration, default library, preset extensions, i18n {app})
- cargo xtask brand check|test, run|install|package, docs, rename-crates,
  deny and immich; packaging files are templates rendered from brand.toml
- icons regenerated from brand/icon.svg; upstream branding removed
- MIT licence (segment and fetch stay Apache-2.0); cargo deny licence policy
- clean-room rules in AGENTS.md/CLAUDE.md; docs/upstream-merge.md
- plan/ rebuilt and committed; parity tracker reopens Classic rows, adds
  PLAN.md section 2 rows and the IMM Immich section; plan/immich.md and a
  pinned Immich test server

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-10 10:30:06 +11:00

34 lines
1.6 KiB
Rust

//! Windows only: embed the app icon and version info (VERSIONINFO) into the desktop executable, so
//! Explorer, the taskbar, the Start menu and Alt-Tab show the lynx.
//!
//! On every other target this does nothing. A missing resource compiler is a warning, so a
//! cross-compile from macOS or Linux still links, unless `<PREFIX>_REQUIRE_WINRES=1` turns it
//! into an error (for release builds).
fn main() {
println!("cargo:rerun-if-changed=build.rs");
println!("cargo:rerun-if-changed=../../assets/app-icon/app.ico");
let require = dac_brand::env_var("REQUIRE_WINRES");
println!("cargo:rerun-if-env-changed={require}");
for prefix in dac_brand::LEGACY_ENV_PREFIXES {
println!("cargo:rerun-if-env-changed={prefix}_REQUIRE_WINRES");
}
if std::env::var("CARGO_CFG_TARGET_OS").as_deref() != Ok("windows") {
return;
}
let mut res = winresource::WindowsResource::new();
res.set_icon("../../assets/app-icon/app.ico")
.set("ProductName", dac_brand::DISPLAY_NAME)
.set("FileDescription", &format!("{}: {}", dac_brand::DISPLAY_NAME, dac_brand::TAGLINE))
.set("CompanyName", dac_brand::VENDOR)
.set("LegalCopyright", &format!("Copyright (c) {}. MIT OR Apache-2.0.", dac_brand::VENDOR))
.set("OriginalFilename", &format!("{}.exe", dac_brand::BINARY))
.set("InternalName", dac_brand::BINARY);
if let Err(e) = res.compile() {
if dac_brand::env_is_set("REQUIRE_WINRES") {
panic!("embedding Windows resources failed: {e}");
}
println!("cargo:warning={}.exe built without icon/version resources: {e}", dac_brand::BINARY);
}
}