Skip to content

Harden Windows resource embedding and add exe metadata and manifest - #21

Merged
cyb0rg56 merged 3 commits into
mainfrom
chore/platform-fixes
Sep 30, 2026
Merged

cyb0rg56 merged 3 commits into
mainfrom
chore/platform-fixes

Conversation

@cyb0rg56

Copy link
Copy Markdown
Owner

Summary

The build script now checks the platform it's building for, reruns only when its own inputs change, and uses a maintained resource crate. The .exe also gains version details and an application manifest with per-monitor DPI awareness.

Changes

  • build.rs

    • Checks CARGO_CFG_TARGET_OS instead of #[cfg(windows)], so it looks at the platform being built for rather than the build machine. Cross-compiling to Windows now embeds resources correctly.
    • Adds rerun-if-changed for build.rs, icon.ico and app.manifest. Before this, edits to any file in the root package (including docs and packaging) reran the script.
    • Sets the icon with set_icon_with_id("icon.ico", "1"). tray.rs loads the tray icon from resource ID 1, and that link was previously only implied by a default.
    • Embeds ProductName, FileDescription and LegalCopyright. The file and product versions come from the Cargo package version.
    • Embeds app.manifest.
    • main returns std::io::Result<()> instead of calling .unwrap().
  • Cargo.toml

    • Replaces winres 0.1 (unmaintained) with winresource 0.1 (maintained fork, same API).
    • Removes the redundant [[bin]] section. main.rs and the binary name are Cargo's defaults.
  • app.manifest (new)

    • PerMonitorV2 DPI awareness, with true/pm as a fallback for older Windows.
    • UTF-8 active code page.
    • Declares Windows 10/11 as a supported OS.
    • asInvoker execution level, so the app never asks for admin rights.

@cyb0rg56
cyb0rg56 merged commit c153db2 into main Sep 30, 2026
2 checks passed
@cyb0rg56
cyb0rg56 deleted the chore/platform-fixes branch September 30, 2026 00:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant