forked from canvasxyz/zig-lmdb
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.zig
38 lines (30 loc) · 1.23 KB
/
build.zig
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
const std = @import("std");
pub fn build(b: *std.Build) void {
const optimize = b.standardOptimizeOption(.{});
const target = b.standardTargetOptions(.{});
const lmdb = b.addModule("lmdb", .{
.root_source_file = b.path("src/lib.zig"),
.target = target,
.optimize = optimize,
.link_libc = true,
});
const lmdb_dep = b.dependency("lmdb", .{});
lmdb.addIncludePath(lmdb_dep.path("libraries/liblmdb"));
lmdb.addCSourceFile(.{ .file = lmdb_dep.path("libraries/liblmdb/mdb.c") });
lmdb.addCSourceFile(.{ .file = lmdb_dep.path("libraries/liblmdb/midl.c") });
// Tests
const tests = b.addTest(.{ .root_source_file = b.path("test/main.zig") });
tests.root_module.addImport("lmdb", lmdb);
const test_runner = b.addRunArtifact(tests);
b.step("test", "Run LMDB tests").dependOn(&test_runner.step);
// Benchmarks
const bench = b.addExecutable(.{
.name = "lmdb-benchmark",
.root_source_file = b.path("benchmarks/main.zig"),
.optimize = optimize,
.target = target,
});
bench.root_module.addImport("lmdb", lmdb);
const bench_runner = b.addRunArtifact(bench);
b.step("bench", "Run LMDB benchmarks").dependOn(&bench_runner.step);
}