The libprotobuf-c runtime library ported to the zig build system
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
torque 9deee2efd3
bump protobuf-c version to 1.5.2
Looking at the diff, this is mostly changes to the code generator and
not the runtime library, but it appears to have at least one fix for
the runtime library included.
2025-12-06 16:12:52 -07:00
.github/workflows ci: update setup-zig 2025-12-06 16:41:18 +01:00
.gitignore build: support 0.14.0 2025-03-05 20:31:30 -07:00
build.zig build: update to 0.15.2 2025-12-06 16:33:43 +01:00
build.zig.zon bump protobuf-c version to 1.5.2 2025-12-06 16:12:52 -07:00
LICENSE init 2024-09-15 18:14:51 -07:00
LICENSE-PROTOBUF_C init 2024-09-15 18:14:51 -07:00
readme.md build: support 0.14.0 2025-03-05 20:31:30 -07:00

protobuf-c Runtime

This is the protobuf-c runtime, packaged for Zig.

Status

This project only builds the protobuf-c runtime library. It does not build protoc-c, the corresponding protocol buffers C language code generator.

The runtime library depends only on a small amount of functionality from libc, so it should compile for most targets. Linux, macOS and Windows are tested by CI.

Usage

First, update your build.zig.zon:

# Initialize a `zig build` project if you haven't already
zig init
# replace <refname> with the version you want to use, e.g. 1.5.0
zig fetch --save git+https://github.com/allyourcodebase/protobuf-c#<refname>

You can then use protobuf_c in your build.zig with:

const protobuf_c_dep = b.dependency("protobuf_c", .{
    .target = target,
    .optimize = optimize,
});
your_exe.linkLibrary(protobuf_c_dep.artifact("protobuf_c"));

Version Support Matrix

Refname protobuf-c Version Zig 0.14.0 Zig 0.13.x Zig 0.12.x
1.5.0+1 1.5.0 ✅ ❌ ❌
1.5.0 1.5.0 (as a dependency) ✅ ✅