Generate bindings for Godot and integrate it to Zig's build system

I’m looking quiet closely to this issue which will enable compiling Godot as a static or dynamic library, allowing it to be embedded in any application.

I know that you can use a C/C++ compiled binary under the @cImport() builtin, but I was wondering how much of an effort it would be to generate bindings for a big project like Godot, knowing that I’ve never write any.

Also, while not mandatory to link against a pre-compiled binary, how difficult would it be to build Godot with Zig build system, replacing all of their SConstruct logic?

Godot provides a way to generate bindings via extension-api.json, and over at godot-zig we already have a way to write Zig for games in Godot. It’s still early days for the bindings, but we’re working on it.

However if you want to embed Godot into an application, that will likely require more work since there is likely a big difference between Godot’s library API and the GDExtension API.

I’ve actually had a look at this. The complexity is in recreating the SConstruct logic in a build.zig for example. I’d say that step 1 would be modifying it to use zig cc and zig c++ on all platforms.

2 Likes

I saw the godot-zig repo already, which seem really nice to use btw, but haven’t tried them yet (I thought it wasn’t maintained anymore), but yes I was talking about the future possible library API.

Building it with Zig seems however a bit too complicated.

The core maintainer has been busy with other things. I’m in the process of getting maintainer permissions.

1 Like

Awesome! I hope you’re gonna get them :slight_smile: