Zig package manager distribution of Godot Engine binaries.
This repository syncs Godot releases from godotengine/godot-builds and exposes them as lazy dependencies for use in Zig projects. Headers are generated on-demand by running the Godot executable.
Requires Zig 0.17.0.
Add this package to your build.zig.zon:
zig fetch --save=godot git+https://github.com/gdzig/godot-versionsThen in your build.zig:
const std = @import("std");
const godot = @import("godot");
pub fn build(b: *std.Build) void {
const target = b.standardTargetOptions(.{});
// Get the Godot executable (a LazyPath to the Godot binary)
const exe_path = godot.executable(b, target, "4.5");
// Get the headers (extension_api.json, gdextension_interface.h)
const headers_dir = godot.headers(b, target, .{ .version = "4.5" });
}By default, constraints match stable releases only. Append a prerelease suffix to include prereleases at that level or above.
| Constraint | Meaning | Example Match |
|---|---|---|
"4.5.1" |
Exact stable version | 4.5.1 |
"4.5" |
Any 4.5.x stable | 4.5.0, 4.5.1, ... (highest) |
"4" |
Any 4.x.x stable | 4.0.0, 4.5.1, ... (highest) |
"latest" |
Latest stable | 4.5.1 (currently) |
"4.6.0-beta2" |
Exact prerelease | 4.6.0-beta2 only |
"4.6-rc" |
Any 4.6.x rc or stable | 4.6.0-rc1 ... 4.6.0 (highest) |
"4.6-beta" |
Any 4.6.x beta or above | 4.6.0-beta1 ... 4.6.0 (highest) |
"4.6-dev" |
Any 4.6.x including prereleases | 4.6.0-dev1 ... 4.6.0 (highest) |
"rc" |
Latest rc or stable | 4.5.1 (currently) |
"beta" |
Latest beta, rc or stable | 4.5.1 (currently) |
"dev" |
Latest including all prereleases | 4.6.0-beta2 (currently) |
| Platform | Architectures |
|---|---|
| Linux | x86_64, x86, aarch64, arm |
| macOS | universal |
| Windows | x86_64, x86, aarch64 |
Returns a LazyPath to the Godot executable matching the version constraint for the given target.
const exe = godot.executable(b, target, "4.5");
const run = b.addRunFile(exe);Returns a LazyPath to a directory containing the generated header files. Headers are generated by running the Godot executable with the appropriate flags for the version:
extension_api.json- GDExtension API (with docs for 4.2+)gdextension_interface.h- C interface headergdextension_interface.json- JSON interface (4.6.0-dev5+ only)
// From a version constraint
const dir = godot.headers(b, target, .{ .version = "4.5" });
const api = dir.path(b, "extension_api.json");
const header = dir.path(b, "gdextension_interface.h");
// From a custom executable
const custom_godot = b.path("path/to/godot");
const custom_dir = godot.headers(b, target, .{ .exe = custom_godot });Returns the extracted release directory if you need access to other files in the archive.
When used as the root package, you can fetch and run Godot directly:
# Install Godot to zig-out/bin/ and headers to zig-out/include/
zig build
# Install a specific version
zig build -Dversion="4.5.1"
zig build -Dversion="4.6-beta"
# Run Godot
zig build run -- --helpThis repository automatically syncs new releases from godotengine/godot-builds daily via GitHub Actions. New stable releases, betas, release candidates, and dev builds are typically available within 24 hours of their official release.
Godot Engine is licensed under the MIT license. See https://github.com/godotengine/godot/blob/master/LICENSE.txt