Skip to content

Commit a191345

Browse files
committed
chore: move cImport to buildscript
@cImport is being removed, see: ziglang/zig#20630
1 parent ea68588 commit a191345

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

build.zig

+8-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,14 @@ pub fn build(b: *std.Build) void {
2121
.target = target,
2222
.optimize = optimize,
2323
});
24-
lib.linkLibC();
24+
const cjni = b.addTranslateC(.{
25+
.root_source_file = b.path("src/include/jni/jni.h"),
26+
.target = target,
27+
.optimize = optimize,
28+
.link_libc = true,
29+
});
30+
lib.root_module.addImport("cjni", cjni.createModule());
31+
2532
lib.addIncludePath(.{ .src_path = .{
2633
.owner = b,
2734
.sub_path = "src/include/jni",

src/main/zig/lib.zig

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
const std = @import("std");
22

3-
pub const cjni = @cImport({
4-
@cInclude("jni.h");
5-
});
3+
pub const cjni = @import("cjni");
64

75
pub const cEnv = cjni.JNIEnv;
86

0 commit comments

Comments
 (0)