forked from zig-wasm/zig-mcp
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.zig
More file actions
42 lines (35 loc) · 1.16 KB
/
build.zig
File metadata and controls
42 lines (35 loc) · 1.16 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
const std = @import("std");
pub fn build(b: *std.Build) !void {
const optimize = b.standardOptimizeOption(.{ .preferred_optimize_mode = .ReleaseSmall });
const wasm_target = b.resolveTargetQuery(.{
.cpu_arch = .wasm32,
.os_tag = .freestanding,
.cpu_features_add = std.Target.wasm.featureSet(&.{
.atomics,
.bulk_memory,
.multivalue,
.mutable_globals,
.nontrapping_fptoint,
.reference_types,
.sign_ext,
}),
});
const wasm_exe = b.addExecutable(.{
.name = "main",
.root_module = b.createModule(.{
.root_source_file = b.path("docs/main.zig"),
.target = wasm_target,
.optimize = optimize,
}),
});
const walk_module = b.createModule(.{
.root_source_file = b.path("docs/Walk.zig"),
});
wasm_exe.root_module.addImport("Walk", walk_module);
wasm_exe.entry = .disabled;
wasm_exe.rdynamic = true;
const install_wasm = b.addInstallArtifact(wasm_exe, .{
.dest_dir = .{ .override = .prefix },
});
b.getInstallStep().dependOn(&install_wasm.step);
}