-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.zig
More file actions
executable file
·58 lines (49 loc) · 1.87 KB
/
build.zig
File metadata and controls
executable file
·58 lines (49 loc) · 1.87 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
53
54
55
56
57
58
pub fn build(b: *std.Build) !void {
const target = b.standardTargetOptions(.{});
const optimize = b.standardOptimizeOption(.{});
const godot_path = b.option([]const u8, "godot", "Path to Godot engine binary [default: `godot`]") orelse "godot";
const gdzig_dep = b.dependency("gdzig", .{
.target = target,
.optimize = optimize,
.godot = godot_path,
// This is the default value, so could be omitted. If you want, you can change it to "double".
// You should hardcode this for your project, rather than exposing it as a build option like the godot path.
.precision = @as([]const u8, "float"),
});
const mod = b.createModule(.{
.root_source_file = b.path("src/root.zig"),
.target = target,
.optimize = optimize,
});
mod.addImport("gdzig", gdzig_dep.module("gdzig"));
const lib = b.addLibrary(.{
.linkage = .dynamic,
.name = "example",
.root_module = mod,
.use_llvm = true,
});
const out_path = "../project/lib";
const install = b.addInstallArtifact(lib, .{
.dest_dir = .{
.override = .{ .custom = out_path },
}
});
b.default_step.dependOn(&install.step);
const project_path = b.path("./project");
const load_cmd = b.addSystemCommand(&.{
godot_path, "--headless", "--quit", "--editor", "--path",
});
load_cmd.addDirectoryArg(project_path);
//load_cmd.expectExitCode(0);
load_cmd.step.dependOn(b.getInstallStep());
const load_step = b.step("load", "Load project");
load_step.dependOn(&load_cmd.step);
const run_cmd = b.addSystemCommand(&.{
godot_path, "--path",
});
run_cmd.addDirectoryArg(project_path);
run_cmd.step.dependOn(load_step);
const run_step = b.step("run", "Run with Godot");
run_step.dependOn(&run_cmd.step);
}
const std = @import("std");