rust-embed-resource
A Cargo
build script library to handle compilation and inclusion of Windows resources
in the most resilient fashion imaginable
Documentation
Quickstart
In your build script, assuming the resource file is called checksums.rc
:
extern crate embed_resource;
Example: Embedding a Windows Manifest
Courtesy of @jpoles1.
The following steps are used to embed a manifest in your compiled rust .exe file. In this example the manifest will cause admin permissions to be requested for the final executable:
- Add the following to your cargo.toml:
[]
= "1.4"
- In your project root directory, add a file named
build.rs
with the following:
extern crate embed_resource;
- In your project root directory, add a file named
app-name-manifest.rc
with the following:
1 RT_MANIFEST "app-name.exe.manifest"
- In your project root directory, add a file named
app-name.exe.manifest
with the following:
- Build your project!
Credit
In chronological order:
@liigo -- persistency in pestering me and investigating problems where I have failed
@mzji -- MSVC lab rat
@TheCatPlusPlus -- knowledge and providing first iteration of manifest-embedding code
@azyobuzin -- providing code for finding places where RC.EXE could hide
@retep998 -- fixing MSVC support
@SonnyX -- Windows cross-compilation support and testing
Special thanks
To all who support further development on Patreon, in particular:
- ThePhD