-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.zig
52 lines (45 loc) · 1.45 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
41
42
43
44
45
46
47
48
49
50
51
52
const std = @import("std");
pub fn build(b: *std.Build) void {
const target = b.standardTargetOptions(.{
.default_target = .{
.cpu_arch = .wasm32,
.os_tag = .wasi,
},
});
const optimize = b.standardOptimizeOption(.{
.preferred_optimize_mode = .ReleaseSmall,
});
const bincode_zig = b.dependency("bincode-zig", .{
.target = target,
.optimize = optimize,
});
const lunatic_zig = b.addModule("lunatic-zig", .{
.source_file = .{ .path = "src/lunatic.zig" },
.dependencies = &.{
.{ .name = "bincode-zig", .module = bincode_zig.module("bincode-zig") },
},
});
const exe = b.addExecutable(.{
.name = "lunatic-test",
.root_source_file = .{ .path = "test/main.zig" },
.target = target,
.optimize = optimize,
.linkage = .dynamic,
});
exe.export_symbol_names = &.{
"child1",
"child2",
};
exe.addModule("lunatic-zig", lunatic_zig);
exe.addModule("bincode-zig", bincode_zig.module("bincode-zig"));
exe.install();
const run_cmd = b.addSystemCommand(&.{
"lunatic",
"run",
exe.out_filename,
});
run_cmd.cwd = std.fmt.allocPrint(b.allocator, "{s}/bin", .{b.install_path}) catch unreachable;
run_cmd.step.dependOn(b.getInstallStep());
const run_step = b.step("run", "Run the app with lunatic");
run_step.dependOn(&run_cmd.step);
}