mirror of
https://codeberg.org/ziglang/rc.git
synced 2026-11-04 02:36:02 +00:00
A Zig package for compiling Windows resource scripts/manifests into linkable object files.
- Zig 100%
| Filename | Latest commit message | Latest commit date |
|---|---|---|
| .forgejo/workflows | ||
| example | ||
| src | ||
| .gitattributes | ||
| .gitignore | ||
| build.zig | ||
| build.zig.zon | ||
| LICENSE | ||
| README.md | ||
RC
A Zig package for compiling Windows resource scripts and manifests into linkable object files.
This is the main branch, which tracks master branch of Zig. Other branches track other versions of Zig.
Usage
Add the rc package to your build.zig.zon with this command:
$ zig fetch --save git+https://codeberg.org/ziglang/rc
info: resolved to commit ...
Then, within your build.zig, write something like this:
const rc = @import("rc");
if (target.result.os.tag == .windows) {
// This call being inside the `if` means `resinator` will only be fetched when it's used.
const rc_dep = b.dependency("rc", .{});
// `Compiler` is the high-level/convenient API. If you want more fine-grained
// control you can use rc.Win32Resource, rc.Manifest, and rc.CvtRes instead.
var rc_compiler: rc.Compiler = .init(rc_dep, .{
.rc_files = &.{b.path("example.rc")},
.manifest = .{
.file = b.path("example.manifest"),
.for_dll = false,
},
.target = target,
.optimize = optimize,
});
// All the resources eventually get compiled into an object file
// that you can add to the relevant module like so:
some_module.addObjectFile(rc_compiler.getObjectFile());
}
For a more complete usage example, take a look at the example/ directory.