#windows #resources #icons #compiler #external #file #script

build embedinator

A simple windows resource compiler that does not rely on external tools

1 unstable release

0.1.0 Nov 24, 2024

#328 in Build Utils

MIT license

36KB
857 lines

embedinator

A simple utility to embed resources such as icons or manifests into a Windows executable from a cargo build script.

The advantage of crate over others such as windres is that this crate directly outputs a linkable library file instead of relying on, possibly missing, platform tools such as rc.exe and cvtres.exe.

Additionally, this crate has no other dependencies.

Example

#[cfg(windows)]
fn main() {
    embedinator::ResourceBuilder::from_env()
        .add_manifest(std::fs::read_to_string("assets/app.manifest").unwrap())
        .add_icon(32512, Icon::from_png_bytes(std::fs::read("app.png").unwrap()))
        .finish();
    println!("cargo:rerun-if-changed=app.manifest");
    println!("cargo:rerun-if-changed=app.png");
}

lib.rs:

A simple utility for embedding resources in Windows executables.

Example

#[cfg(windows)]
fn main() {
   embedinator::ResourceBuilder::from_env()
       .add_manifest(std::fs::read_to_string("assets/app.manifest").unwrap())
       .add_icon(32512, Icon::from_png_bytes(std::fs::read("app.png").unwrap()))
       .finish();
   println!("cargo:rerun-if-changed=app.manifest");
   println!("cargo:rerun-if-changed=app.png");
}

Limitations

Currently always sets the language to 0x0409 (English, US) as I don't fully understand how multilingual resource files are supposed to look like.

No runtime deps

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy