File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -287,6 +287,24 @@ pub fn build(b: *std.Build) !void {
287287 const install_test = b .addInstallArtifact (t , .{});
288288 test_step .dependOn (& install_test .step );
289289 }
290+
291+ { // Generate zig bindings from C headers
292+ const include_all = b .addWriteFile ("grpc.h" ,
293+ \\#include <libpq-fe.h>
294+ \\#include <libpq-events.h>
295+ );
296+ const binding = b .addTranslateC (.{
297+ .root_source_file = try include_all .getDirectory ().join (b .allocator , "grpc.h" ),
298+ .target = target ,
299+ .optimize = optimize ,
300+ });
301+ for (config_headers ) | header | {
302+ binding .addConfigHeader (header );
303+ }
304+ binding .addIncludePath (upstream .path (libpq_path ));
305+ binding .addIncludePath (upstream .path ("src/include" ));
306+ _ = binding .addModule ("libpq" );
307+ }
290308}
291309
292310const libpq_sources = .{
You can’t perform that action at this time.
0 commit comments