File tree Expand file tree Collapse file tree 2 files changed +27
-3
lines changed
Expand file tree Collapse file tree 2 files changed +27
-3
lines changed Original file line number Diff line number Diff line change 22
33Status: Work in progress
44
5+ | Refname | libGRPC version | Zig ` 0.16.x ` | Zig ` 0.15.x ` |
6+ | ----------| -----------------| --------------| --------------|
7+ | ` 1.76.0 ` | ` v1.76.0 ` | ✅ | ✅ |
8+
9+ ## Use
10+
11+ Add the dependency in your ` build.zig.zon ` by running the following command:
12+ ``` zig
13+ zig fetch --save git+https://github.com/allyourcodebase/grpc#master
14+ ```
15+
16+ Then, in your ` build.zig ` :
17+ ``` zig
18+ const grpc = b.dependency("grpc", { .target = target, .optimize = optimize });
19+
20+ // to use from Zig:
21+ mod.addImport("cgrpc", grpc.module("cgrpc"));
22+
23+ // to use from C:
24+ exe.linkLibrary(grpc.artifact("grpc"));
25+ ```
26+
527## Bump dependencies
628
729When bumping upstream version, also bump dependencies. Example:
Original file line number Diff line number Diff line change @@ -263,13 +263,15 @@ pub fn build(b: *Build) !void {
263263 \\#include <grpc/credentials.h>
264264 \\#include <grpc/byte_buffer_reader.h>
265265 );
266- const binding = b .addTranslateC (.{
266+ const grpc_capi = b .addTranslateC (.{
267267 .root_source_file = try include_all .getDirectory ().join (b .allocator , "grpc_api.h" ),
268268 .target = target ,
269269 .optimize = optimize ,
270270 });
271- binding .addIncludePath (upstream .path ("include" ));
272- _ = binding .addModule ("cgrpc" );
271+ grpc_capi .addIncludePath (upstream .path ("include" ));
272+
273+ const bindings = grpc_capi .addModule ("cgrpc" );
274+ bindings .linkLibrary (libgrpc );
273275 }
274276}
275277
You can’t perform that action at this time.
0 commit comments