-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathbuild.zig
40 lines (36 loc) · 1.24 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
39
40
const std = @import("std");
pub fn build(b: *std.Build) void {
const target = b.standardTargetOptions(.{});
const optimize = b.standardOptimizeOption(.{});
const x_mod = b.createModule(.{
.root_source_file = b.path("../x.zig" ),
});
const x11_lib = b.addStaticLibrary(.{
.name = "x11",
.root_source_file = b.path("x11.zig"),
.target = target,
.optimize = optimize,
});
x11_lib.addIncludePath(b.path("include"));
x11_lib.root_module.addImport("x", x_mod);
// I *think* we'll want to link libc here because it's probably guaranteed that
// the application will be linking libc and not linking libc means we could have
// discrepancies, for example, zig's start code that initializes the environment
// variables wouldn't have run
x11_lib.linkLibC();
b.installArtifact(x11_lib);
{
const exe = b.addExecutable(.{
.name = "hellox11",
.target = target,
.optimize = optimize,
});
exe.addCSourceFiles(.{
.files = &.{ "example/hellox11.c" },
});
exe.addIncludePath(b.path("include"));
exe.linkLibC();
exe.linkLibrary(x11_lib);
b.installArtifact(exe);
}
}