Crate tauri_winres
source ·Expand description
Rust Windows resource helper
This crate implements a simple generator for Windows resource (.rc) files
for use with either Microsoft rc.exe
resource compiler or with GNU windres.exe
The WindowsResorce::compile()
method is intended to be used from a build script and
needs environment variables from cargo to be set. It not only compiles the resource
but directs cargo to link the resource compiler’s output.
Example
if cfg!(target_os = "windows") {
let mut res = tauri_winres::WindowsResource::new();
res.set_icon("test.ico")
.set("InternalName", "TEST.EXE")
// manually set version 1.0.0.0
.set_version_info(tauri_winres::VersionInfo::PRODUCTVERSION, 0x0001000000000000);
res.compile()?;
}
Defaults
We try to guess some sensible default values from Cargo’s build time environement variables
This is described in WindowsResource::new()
. Furthermore we have to know where to find the
resource compiler for the MSVC Toolkit. This can be done by looking up a registry key but
for MinGW this has to be done manually.
The following paths are the hardcoded defaults:
MSVC the last registry key at
HKLM\SOFTWARE\Microsoft\Windows Kits\Installed Roots
, for MinGW we try our luck by simply
using the %PATH%
environment variable.
Note that the toolkit bitness as to match the one from the current Rust compiler. If you are using Rust GNU 64-bit you have to use MinGW64. For MSVC this is simpler as (recent) Windows SDK always installs both versions on a 64-bit system.
Structs
Enums
- Version info field names