-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.zig
More file actions
44 lines (37 loc) · 1.26 KB
/
Copy pathbuild.zig
File metadata and controls
44 lines (37 loc) · 1.26 KB
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
39
40
41
42
43
44
const std = @import("std");
pub fn build(b: *std.Build) void {
const optimize = b.standardOptimizeOption(.{});
const target = b.standardTargetOptions(.{});
const system_magic_h = b.addTranslateC(.{
.optimize = optimize,
.target = target,
.root_source_file = b.path("src/c/zmime.c"),
.link_libc = true,
});
system_magic_h.linkSystemLibrary("magic", .{ .needed = true });
const lib = b.addModule("zmime", .{
.root_source_file = b.path("src/lib.zig"),
.target = target,
.optimize = optimize,
.imports = &.{
.{ .name = "c_zmime", .module = system_magic_h.createModule() },
},
});
// smoke exe
const smoke = b.addExecutable(.{
.name = "smoke",
.root_module = b.createModule(.{
.root_source_file = b.path("src/smoke.zig"),
.target = target,
.optimize = optimize,
.imports = &.{
.{ .name = "zmime", .module = lib },
},
}),
});
b.installArtifact(smoke);
const smoke_step = b.step("smoke", "run the smoke exe");
const run_smoke_cmd = b.addRunArtifact(smoke);
run_smoke_cmd.step.dependOn(b.getInstallStep());
smoke_step.dependOn(&run_smoke_cmd.step);
}