-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.zig
More file actions
43 lines (39 loc) · 1.18 KB
/
Copy pathbuild.zig
File metadata and controls
43 lines (39 loc) · 1.18 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
const std = @import("std");
pub fn build(b: *std.build.Builder) void {
// const mode = b.standardReleaseOptions();
const mode = std.builtin.Mode.ReleaseSmall;
const lib = b.addSharedLibrary("cart_unoptimised", "src/main.zig", .unversioned);
lib.use_stage1 = true;
lib.setBuildMode(mode);
lib.setTarget(.{
.cpu_arch = .wasm32,
.cpu_features_add = std.Target.wasm.featureSet(&.{
// .bulk_memory,
// .multivalue,
// .simd128,
// .nontrapping_fptoint,
}),
.os_tag = .freestanding,
});
lib.strip = true;
lib.import_memory = true;
lib.initial_memory = 65536;
lib.max_memory = 65536;
lib.global_base = 6560;
lib.stack_size = 8192;
lib.install();
const optimise = b.addSystemCommand(&[_][]const u8{
"wasm-opt",
"zig-out\\lib\\cart_unoptimised.wasm",
"-Oz",
"--strip-debug",
"--strip-dwarf",
"--strip-producers",
// "--enable-bulk-memory",
"--zero-filled-memory",
"--output",
"zig-out\\lib\\cart.wasm",
});
optimise.step.dependOn(&lib.step);
b.default_step.dependOn(&optimise.step);
}