diff options
Diffstat (limited to 'build.zig')
| -rw-r--r-- | build.zig | 17 |
1 files changed, 13 insertions, 4 deletions
@@ -4,12 +4,24 @@ pub fn build(b: *std.Build) void { const target = b.standardTargetOptions(.{}); const optimize = b.standardOptimizeOption(.{}); + const translate_c = b.addTranslateC(.{ + .root_source_file = b.path("src/c.h"), + .target = target, + .optimize = optimize, + }); + translate_c.addIncludePath(b.path("lmdb")); + const lmdb = b.addModule("lmdb", .{ .root_source_file = b.path("src/lmdb.zig"), .target = target, .optimize = optimize, + .imports = &.{ + .{ + .name = "c", + .module = translate_c.createModule(), + }, + }, }); - lmdb.addIncludePath(b.path("lmdb")); lmdb.addCSourceFiles(.{ .files = &.{ "./lmdb/midl.c", "./lmdb/mdb.c", @@ -26,13 +38,10 @@ pub fn build(b: *std.Build) void { const lmdb_tests = b.addTest(.{ .root_module = lmdb, }); - lmdb_tests.addIncludePath(b.path("lmdb")); - lmdb_tests.linkLibC(); const db_tests = b.addTest(.{ .root_module = db, }); - db_tests.root_module.addImport("lmdb", lmdb); const lmdb_test_bin = b.addInstallBinFile(lmdb_tests.getEmittedBin(), "./lmdb_test"); const db_test_bin = b.addInstallBinFile(db_tests.getEmittedBin(), "./db_test"); |
