1 const std = @import("std");
3 pub fn build(b: *std.Build) void {
4 const target = b.standardTargetOptions(.{});
6 const optimize = b.standardOptimizeOption(.{});
8 const exe = b.addExecutable(.{
10 // In this case the main source file is merely a path, however, in more
11 // complicated build scripts, this could be a generated file.
12 .root_source_file = .{ .cwd_relative = "src/main.zig" },
17 const epoll = b.addExecutable(.{
19 // In this case the main source file is merely a path, however, in more
20 // complicated build scripts, this could be a generated file.
21 .root_source_file = .{ .cwd_relative = "src/epoll.zig" },
26 const lmdb_mod = b.createModule(.{
27 .root_source_file = .{ .cwd_relative = "../ziglmdb/src/lmdb.zig" },
29 lmdb_mod.addIncludePath(.{ .cwd_relative = "./lmdb/libraries/liblmdb" });
30 lmdb_mod.addCSourceFiles(.{ .files = &.{
31 "./lmdb/libraries/liblmdb/midl.c",
32 "./lmdb/libraries/liblmdb/mdb.c",
35 exe.root_module.addImport("lmdb", lmdb_mod);
38 epoll.root_module.addImport("lmdb", lmdb_mod);
41 b.installArtifact(exe);
43 const run_cmd = b.addRunArtifact(exe);
45 run_cmd.step.dependOn(b.getInstallStep());
48 run_cmd.addArgs(args);
51 const run_step = b.step("run", "Run the app");
52 run_step.dependOn(&run_cmd.step);
54 const run_epoll_cmd = b.addRunArtifact(epoll);
55 const run_epoll_step = b.step("runepoll", "run epoll");
56 run_epoll_step.dependOn(&run_epoll_cmd.step);