master
1const std = @import("std");
2
3pub fn build(b: *std.Build) void {
4 const test_step = b.step("test", "Test");
5 b.default_step = test_step;
6
7 const lib = b.addExecutable(.{
8 .name = "lib",
9 .root_module = b.createModule(.{
10 .root_source_file = b.path("lib.zig"),
11 .optimize = .Debug,
12 .target = b.resolveTargetQuery(.{ .cpu_arch = .wasm32, .os_tag = .freestanding }),
13 }),
14 });
15 lib.entry = .disabled;
16 // Disabled to work around the Wasm linker crashing.
17 // Can be reproduced by commenting out the line below.
18 lib.bundle_ubsan_rt = false;
19 lib.use_lld = false;
20 lib.root_module.export_symbol_names = &.{ "foo", "bar" };
21 // Object being linked has neither functions nor globals named "foo" or "bar" and
22 // so these names correctly fail to be exported when creating an executable.
23 lib.expect_errors = .{ .exact = &.{
24 "error: manually specified export name 'foo' undefined",
25 "error: manually specified export name 'bar' undefined",
26 } };
27 _ = lib.getEmittedBin();
28
29 test_step.dependOn(&lib.step);
30}