]> gitweb.ps.run Git - ziglmdb/blobdiff - build.zig
changes
[ziglmdb] / build.zig
index 572a55cc56d9e4f26a9bcc6f433a103898e9eeeb..3e340908af596793d559fd90b8015c0a1e17716a 100644 (file)
--- a/build.zig
+++ b/build.zig
@@ -18,25 +18,19 @@ pub fn build(b: *std.Build) void {
 
     const db = b.addModule("db", .{
         .root_source_file = b.path("src/db.zig"),
+        .target = target,
+        .optimize = optimize,
     });
     db.addImport("lmdb", lmdb);
 
     const lmdb_tests = b.addTest(.{
-        .root_source_file = b.path("src/lmdb.zig"),
-        .target = target,
-        .optimize = optimize,
+        .root_module = lmdb,
     });
     lmdb_tests.addIncludePath(b.path("lmdb"));
-    lmdb_tests.addCSourceFiles(.{ .files = &.{
-        "./lmdb/midl.c",
-        "./lmdb/mdb.c",
-    } });
     lmdb_tests.linkLibC();
 
     const db_tests = b.addTest(.{
-        .root_source_file = b.path("src/db.zig"),
-        .target = target,
-        .optimize = optimize,
+        .root_module = db,
     });
     db_tests.root_module.addImport("lmdb", lmdb);
 
@@ -54,4 +48,8 @@ pub fn build(b: *std.Build) void {
     test_step.dependOn(&db_tests.step);
     test_step.dependOn(&lmdb_test_bin.step);
     test_step.dependOn(&db_test_bin.step);
+
+    const check = b.step("check", "Check if ziglmdb compiles");
+    check.dependOn(&lmdb_tests.step);
+    check.dependOn(&db_tests.step);
 }