-
Notifications
You must be signed in to change notification settings - Fork 16
/
build.zig
34 lines (28 loc) · 910 Bytes
/
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
const std = @import("std");
const Options = @import("../../bof-launcher/build.zig").Options;
pub fn build(
b: *std.Build,
options: Options,
bof_launcher_lib: *std.Build.Step.Compile,
) void {
const exe = b.addExecutable(.{
.name = std.mem.join(b.allocator, "_", &.{
"integration_with_c",
options.osTagStr(),
options.cpuArchStr(),
}) catch @panic("OOM"),
.target = options.target,
.optimize = options.optimize,
});
exe.addIncludePath(.{ .cwd_relative = thisDir() ++ "/../../bof-launcher/src" });
exe.addCSourceFile(.{
.file = .{ .cwd_relative = thisDir() ++ "/main.c" },
.flags = &.{"-std=c99"},
});
exe.linkLibrary(bof_launcher_lib);
exe.linkLibC();
b.installArtifact(exe);
}
inline fn thisDir() []const u8 {
return comptime std.fs.path.dirname(@src().file) orelse ".";
}