This repository was archived by the owner on Dec 12, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.zig
More file actions
52 lines (44 loc) · 1.63 KB
/
build.zig
File metadata and controls
52 lines (44 loc) · 1.63 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
45
46
47
48
49
50
51
52
const std = @import("std");
const deps = @import("./deps.zig");
pub fn build(b: *std.build.Builder) void {
// Standard target options allows the person running `zig build` to choose
// what target to build for. Here we do not override the defaults, which
// means any target is allowed, and the default is native. Other options
// for restricting supported target set are available.
const target = b.standardTargetOptions(.{});
// Standard release options allow the person running `zig build` to select
// between Debug, ReleaseSafe, ReleaseFast, and ReleaseSmall.
const mode = b.standardReleaseOptions();
// library
const lib = b.addStaticLibrary("godot-zig", "src/main.zig");
lib.setBuildMode(mode);
lib.addIncludeDir("./godot-headers");
lib.linkLibC();
lib.install();
// bindings generator
const bindgen = b.addExecutable("godot-zig-bindgen", "bindgen/main.zig");
bindgen.setTarget(target);
bindgen.setBuildMode(mode);
bindgen.install();
deps.addAllTo(bindgen);
const bindgen_cmd = bindgen.run();
bindgen_cmd.step.dependOn(&bindgen.step);
if (b.args) |args| {
bindgen_cmd.addArgs(args);
}
// tests
const testFiles = [_][]const u8{
"src/main.zig",
"bindgen/main.zig",
"bindgen/names.zig",
};
// define steps
const test_step = b.step("test", "Run tests");
for (testFiles) |file| {
const t = b.addTest(file);
t.setBuildMode(mode);
test_step.dependOn(&t.step);
}
const bindgen_step = b.step("generate", "Generate Godot bindings");
bindgen_step.dependOn(&bindgen_cmd.step);
}