test-link: migrate from deprecated std.Build APIs

This commit is contained in:
mlugg 2024-12-16 16:47:17 +00:00 committed by Eric Joldasov
parent 6179d9ef55
commit 82659c4594
No known key found for this signature in database
GPG Key ID: 5C9C69060686B588
21 changed files with 290 additions and 206 deletions

View File

@ -6,9 +6,11 @@ pub fn build(b: *std.Build) void {
const exe = b.addExecutable(.{
.name = "bss",
.root_module = b.createModule(.{
.root_source_file = b.path("main.zig"),
.target = b.graph.host,
.optimize = .Debug,
}),
});
const run = b.addRunArtifact(exe);

View File

@ -13,19 +13,24 @@ pub fn build(b: *std.Build) void {
fn add(b: *std.Build, test_step: *std.Build.Step, optimize: std.builtin.OptimizeMode) void {
const lib_a = b.addStaticLibrary(.{
.name = "a",
.root_module = b.createModule(.{
.root_source_file = null,
.optimize = optimize,
.target = b.graph.host,
}),
});
lib_a.addCSourceFiles(.{
lib_a.root_module.addCSourceFiles(.{
.files = &.{ "c.c", "a.c", "b.c" },
.flags = &.{"-fcommon"},
});
const test_exe = b.addTest(.{
.root_module = b.createModule(.{
.root_source_file = b.path("main.zig"),
.optimize = optimize,
}),
});
test_exe.linkLibrary(lib_a);
test_exe.root_module.linkLibrary(lib_a);
test_step.dependOn(&b.addRunArtifact(test_exe).step);
}

View File

@ -13,19 +13,25 @@ pub fn build(b: *std.Build) void {
fn add(b: *std.Build, test_step: *std.Build.Step, optimize: std.builtin.OptimizeMode) void {
const lib_a = b.addStaticLibrary(.{
.name = "a",
.root_module = b.createModule(.{
.root_source_file = null,
.optimize = optimize,
.target = b.graph.host,
}),
});
lib_a.addCSourceFiles(.{
lib_a.root_module.addCSourceFiles(.{
.files = &.{"a.c"},
.flags = &.{"-fcommon"},
});
const test_exe = b.addTest(.{
.root_module = b.createModule(.{
.root_source_file = b.path("main.zig"),
.target = b.graph.host,
.optimize = optimize,
}),
});
test_exe.linkLibrary(lib_a);
test_exe.root_module.linkLibrary(lib_a);
test_step.dependOn(&b.addRunArtifact(test_exe).step);
}

View File

@ -14,12 +14,15 @@ pub fn build(b: *std.Build) void {
for ([_][]const u8{ "aarch64-linux-gnu.2.27", "aarch64-linux-gnu.2.34" }) |t| {
const exe = b.addExecutable(.{
.name = t,
.root_module = b.createModule(.{
.root_source_file = null,
.target = b.resolveTargetQuery(std.Target.Query.parse(
.{ .arch_os_abi = t },
) catch unreachable),
.link_libc = true,
}),
});
exe.addCSourceFile(.{ .file = b.path("main.c") });
exe.linkLibC();
exe.root_module.addCSourceFile(.{ .file = b.path("main.c") });
// TODO: actually test the output
_ = exe.getEmittedBin();
test_step.dependOn(&exe.step);
@ -53,10 +56,13 @@ pub fn build(b: *std.Build) void {
const exe = b.addExecutable(.{
.name = t,
.root_module = b.createModule(.{
.root_source_file = null,
.target = target,
.link_libc = true,
}),
});
exe.addCSourceFile(.{ .file = b.path("glibc_runtime_check.c") });
exe.linkLibC();
exe.root_module.addCSourceFile(.{ .file = b.path("glibc_runtime_check.c") });
// Only try running the test if the host glibc is known to be good enough. Ideally, the Zig
// test runner would be able to check this, but see https://github.com/ziglang/zig/pull/17702#issuecomment-1831310453
@ -149,10 +155,12 @@ pub fn build(b: *std.Build) void {
const exe = b.addExecutable(.{
.name = t,
.root_module = b.createModule(.{
.root_source_file = b.path("glibc_runtime_check.zig"),
.target = target,
.link_libc = true,
}),
});
exe.linkLibC();
// Only try running the test if the host glibc is known to be good enough. Ideally, the Zig
// test runner would be able to check this, but see https://github.com/ziglang/zig/pull/17702#issuecomment-1831310453

View File

@ -13,27 +13,36 @@ pub fn build(b: *std.Build) void {
fn add(b: *std.Build, test_step: *std.Build.Step, optimize: std.builtin.OptimizeMode) void {
const lib_a = b.addStaticLibrary(.{
.name = "a",
.root_module = b.createModule(.{
.root_source_file = null,
.optimize = optimize,
.target = b.graph.host,
}),
});
lib_a.addCSourceFile(.{ .file = b.path("a.c"), .flags = &[_][]const u8{} });
lib_a.addIncludePath(b.path("."));
lib_a.root_module.addCSourceFile(.{ .file = b.path("a.c"), .flags = &[_][]const u8{} });
lib_a.root_module.addIncludePath(b.path("."));
const lib_b = b.addStaticLibrary(.{
.name = "b",
.root_module = b.createModule(.{
.root_source_file = null,
.optimize = optimize,
.target = b.graph.host,
}),
});
lib_b.addCSourceFile(.{ .file = b.path("b.c"), .flags = &[_][]const u8{} });
lib_b.addIncludePath(b.path("."));
lib_b.root_module.addCSourceFile(.{ .file = b.path("b.c"), .flags = &[_][]const u8{} });
lib_b.root_module.addIncludePath(b.path("."));
const test_exe = b.addTest(.{
.root_module = b.createModule(.{
.root_source_file = b.path("main.zig"),
.target = b.graph.host,
.optimize = optimize,
}),
});
test_exe.linkLibrary(lib_a);
test_exe.linkLibrary(lib_b);
test_exe.addIncludePath(b.path("."));
test_exe.root_module.linkLibrary(lib_a);
test_exe.root_module.linkLibrary(lib_b);
test_exe.root_module.addIncludePath(b.path("."));
test_step.dependOn(&b.addRunArtifact(test_exe).step);
}

View File

@ -47,81 +47,85 @@ const OverlayOptions = struct {
};
pub fn addExecutable(b: *std.Build, base: Options, overlay: OverlayOptions) *Compile {
return addCompileStep(b, base, overlay, .exe);
return b.addExecutable(.{
.name = overlay.name,
.root_module = createModule(b, base, overlay),
.use_llvm = base.use_llvm,
.use_lld = base.use_lld,
});
}
pub fn addObject(b: *Build, base: Options, overlay: OverlayOptions) *Compile {
return addCompileStep(b, base, overlay, .obj);
return b.addObject(.{
.name = overlay.name,
.root_module = createModule(b, base, overlay),
.use_llvm = base.use_llvm,
.use_lld = base.use_lld,
});
}
pub fn addStaticLibrary(b: *Build, base: Options, overlay: OverlayOptions) *Compile {
return addCompileStep(b, base, overlay, .static_lib);
return b.addStaticLibrary(.{
.name = overlay.name,
.root_module = createModule(b, base, overlay),
.use_llvm = base.use_llvm,
.use_lld = base.use_lld,
});
}
pub fn addSharedLibrary(b: *Build, base: Options, overlay: OverlayOptions) *Compile {
return addCompileStep(b, base, overlay, .shared_lib);
return b.addSharedLibrary(.{
.name = overlay.name,
.root_module = createModule(b, base, overlay),
.use_llvm = base.use_llvm,
.use_lld = base.use_lld,
});
}
fn addCompileStep(
b: *Build,
base: Options,
overlay: OverlayOptions,
kind: enum { exe, obj, shared_lib, static_lib },
) *Compile {
const compile_step = Compile.create(b, .{
.name = overlay.name,
.root_module = b.createModule(.{
fn createModule(b: *Build, base: Options, overlay: OverlayOptions) *Build.Module {
const write_files = b.addWriteFiles();
const mod = b.createModule(.{
.target = base.target,
.optimize = base.optimize,
.root_source_file = rsf: {
const bytes = overlay.zig_source_bytes orelse break :rsf null;
const name = b.fmt("{s}.zig", .{overlay.name});
break :rsf b.addWriteFiles().add(name, bytes);
break :rsf write_files.add(name, bytes);
},
.pic = overlay.pic,
.strip = if (base.strip) |s| s else overlay.strip,
}),
.use_llvm = base.use_llvm,
.use_lld = base.use_lld,
.kind = switch (kind) {
.exe => .exe,
.obj => .obj,
.shared_lib, .static_lib => .lib,
},
.linkage = switch (kind) {
.exe, .obj => null,
.shared_lib => .dynamic,
.static_lib => .static,
},
});
if (overlay.objcpp_source_bytes) |bytes| {
compile_step.addCSourceFile(.{
.file = b.addWriteFiles().add("a.mm", bytes),
mod.addCSourceFile(.{
.file = write_files.add("a.mm", bytes),
.flags = overlay.objcpp_source_flags,
});
}
if (overlay.objc_source_bytes) |bytes| {
compile_step.addCSourceFile(.{
.file = b.addWriteFiles().add("a.m", bytes),
mod.addCSourceFile(.{
.file = write_files.add("a.m", bytes),
.flags = overlay.objc_source_flags,
});
}
if (overlay.cpp_source_bytes) |bytes| {
compile_step.addCSourceFile(.{
.file = b.addWriteFiles().add("a.cpp", bytes),
mod.addCSourceFile(.{
.file = write_files.add("a.cpp", bytes),
.flags = overlay.cpp_source_flags,
});
}
if (overlay.c_source_bytes) |bytes| {
compile_step.addCSourceFile(.{
.file = b.addWriteFiles().add("a.c", bytes),
mod.addCSourceFile(.{
.file = write_files.add("a.c", bytes),
.flags = overlay.c_source_flags,
});
}
if (overlay.asm_source_bytes) |bytes| {
compile_step.addAssemblyFile(b.addWriteFiles().add("a.s", bytes));
mod.addAssemblyFile(write_files.add("a.s", bytes));
}
return compile_step;
return mod;
}
pub fn addRunArtifact(comp: *Compile) *Run {

View File

@ -57,13 +57,15 @@ fn add(b: *Build, test_step: *Step, files: []const LazyPath, optimize: std.built
{
const exe = b.addExecutable(.{
.name = "test1",
.root_module = b.createModule(.{
.root_source_file = b.path("main.zig"),
.optimize = optimize,
.target = b.graph.host,
}),
});
for (files) |file| {
exe.addCSourceFile(.{ .file = file, .flags = &flags });
exe.root_module.addCSourceFile(.{ .file = file, .flags = &flags });
}
const run_cmd = b.addRunArtifact(exe);
@ -75,30 +77,33 @@ fn add(b: *Build, test_step: *Step, files: []const LazyPath, optimize: std.built
// using static librairies
{
const mod_a = b.createModule(.{ .target = b.graph.host, .optimize = optimize });
const mod_b = b.createModule(.{ .target = b.graph.host, .optimize = optimize });
for (files, 1..) |file, i| {
const mod = if (i & 1 == 0) mod_a else mod_b;
mod.addCSourceFile(.{ .file = file, .flags = &flags });
}
const lib_a = b.addStaticLibrary(.{
.name = "test2_a",
.target = b.graph.host,
.optimize = optimize,
.root_module = mod_a,
});
const lib_b = b.addStaticLibrary(.{
.name = "test2_b",
.target = b.graph.host,
.optimize = optimize,
.root_module = mod_b,
});
for (files, 1..) |file, i| {
const lib = if (i & 1 == 0) lib_a else lib_b;
lib.addCSourceFile(.{ .file = file, .flags = &flags });
}
const exe = b.addExecutable(.{
.name = "test2",
.root_module = b.createModule(.{
.root_source_file = b.path("main.zig"),
.target = b.graph.host,
.optimize = optimize,
}),
});
exe.linkLibrary(lib_a);
exe.linkLibrary(lib_b);
exe.root_module.linkLibrary(lib_a);
exe.root_module.linkLibrary(lib_b);
const run_cmd = b.addRunArtifact(exe);
run_cmd.skip_foreign_checks = true;
@ -109,37 +114,41 @@ fn add(b: *Build, test_step: *Step, files: []const LazyPath, optimize: std.built
// using static librairies and object files
{
const mod_a = b.createModule(.{ .target = b.graph.host, .optimize = optimize });
const mod_b = b.createModule(.{ .target = b.graph.host, .optimize = optimize });
for (files, 1..) |file, i| {
const obj_mod = b.createModule(.{ .target = b.graph.host, .optimize = optimize });
obj_mod.addCSourceFile(.{ .file = file, .flags = &flags });
const obj = b.addObject(.{
.name = b.fmt("obj_{}", .{i}),
.root_module = obj_mod,
});
const lib_mod = if (i & 1 == 0) mod_a else mod_b;
lib_mod.addObject(obj);
}
const lib_a = b.addStaticLibrary(.{
.name = "test3_a",
.target = b.graph.host,
.optimize = optimize,
.root_module = mod_a,
});
const lib_b = b.addStaticLibrary(.{
.name = "test3_b",
.target = b.graph.host,
.optimize = optimize,
.root_module = mod_b,
});
for (files, 1..) |file, i| {
const obj = b.addObject(.{
.name = b.fmt("obj_{}", .{i}),
.target = b.graph.host,
.optimize = optimize,
});
obj.addCSourceFile(.{ .file = file, .flags = &flags });
const lib = if (i & 1 == 0) lib_a else lib_b;
lib.addObject(obj);
}
const exe = b.addExecutable(.{
.name = "test3",
.root_module = b.createModule(.{
.root_source_file = b.path("main.zig"),
.target = b.graph.host,
.optimize = optimize,
}),
});
exe.linkLibrary(lib_a);
exe.linkLibrary(lib_b);
exe.root_module.linkLibrary(lib_a);
exe.root_module.linkLibrary(lib_b);
const run_cmd = b.addRunArtifact(exe);
run_cmd.skip_foreign_checks = true;

View File

@ -17,10 +17,12 @@ fn add(b: *std.Build, test_step: *std.Build.Step, optimize: std.builtin.Optimize
// and therefore link with its archive file.
const lib = b.addExecutable(.{
.name = "main",
.root_module = b.createModule(.{
.root_source_file = b.path("main.zig"),
.optimize = optimize,
.target = b.resolveTargetQuery(.{ .cpu_arch = .wasm32, .os_tag = .freestanding }),
.strip = false,
}),
});
lib.entry = .disabled;
lib.use_llvm = false;

View File

@ -6,6 +6,7 @@ pub fn build(b: *std.Build) void {
// Library with explicitly set cpu features
const lib = b.addExecutable(.{
.name = "lib",
.root_module = b.createModule(.{
.root_source_file = b.path("main.zig"),
.optimize = .Debug,
.target = b.resolveTargetQuery(.{
@ -14,6 +15,7 @@ pub fn build(b: *std.Build) void {
.cpu_features_add = std.Target.wasm.featureSet(&.{.atomics}),
.os_tag = .freestanding,
}),
}),
});
lib.entry = .disabled;
lib.use_llvm = false;

View File

@ -16,10 +16,12 @@ fn add(b: *std.Build, test_step: *std.Build.Step, optimize_mode: std.builtin.Opt
{
const lib = b.addExecutable(.{
.name = "lib",
.root_module = b.createModule(.{
.root_source_file = b.path("lib.zig"),
.target = b.resolveTargetQuery(.{ .cpu_arch = .wasm32, .os_tag = .freestanding }),
.optimize = optimize_mode,
.strip = false,
}),
});
lib.entry = .disabled;
lib.use_llvm = false;
@ -64,10 +66,12 @@ fn add(b: *std.Build, test_step: *std.Build.Step, optimize_mode: std.builtin.Opt
{
const lib = b.addExecutable(.{
.name = "lib",
.root_module = b.createModule(.{
.root_source_file = b.path("lib2.zig"),
.target = b.resolveTargetQuery(.{ .cpu_arch = .wasm32, .os_tag = .freestanding }),
.optimize = optimize_mode,
.strip = false,
}),
});
lib.entry = .disabled;
lib.use_llvm = false;

View File

@ -11,9 +11,11 @@ pub fn build(b: *std.Build) void {
const lib = b.addExecutable(.{
.name = "lib",
.root_module = b.createModule(.{
.root_source_file = b.path("lib.zig"),
.optimize = .ReleaseSafe, // to make the output deterministic in address positions
.target = b.resolveTargetQuery(.{ .cpu_arch = .wasm32, .os_tag = .freestanding }),
}),
});
lib.entry = .disabled;
lib.use_lld = false;

View File

@ -15,9 +15,11 @@ pub fn build(b: *std.Build) void {
fn add(b: *std.Build, test_step: *std.Build.Step, optimize: std.builtin.OptimizeMode) void {
const no_export = b.addExecutable(.{
.name = "no-export",
.root_module = b.createModule(.{
.root_source_file = b.path("main.zig"),
.optimize = optimize,
.target = b.resolveTargetQuery(.{ .cpu_arch = .wasm32, .os_tag = .freestanding }),
}),
});
no_export.entry = .disabled;
no_export.use_llvm = false;
@ -25,9 +27,11 @@ fn add(b: *std.Build, test_step: *std.Build.Step, optimize: std.builtin.Optimize
const dynamic_export = b.addExecutable(.{
.name = "dynamic",
.root_module = b.createModule(.{
.root_source_file = b.path("main.zig"),
.optimize = optimize,
.target = b.resolveTargetQuery(.{ .cpu_arch = .wasm32, .os_tag = .freestanding }),
}),
});
dynamic_export.entry = .disabled;
dynamic_export.rdynamic = true;
@ -36,9 +40,11 @@ fn add(b: *std.Build, test_step: *std.Build.Step, optimize: std.builtin.Optimize
const force_export = b.addExecutable(.{
.name = "force",
.root_module = b.createModule(.{
.root_source_file = b.path("main.zig"),
.optimize = optimize,
.target = b.resolveTargetQuery(.{ .cpu_arch = .wasm32, .os_tag = .freestanding }),
}),
});
force_export.entry = .disabled;
force_export.root_module.export_symbol_names = &.{"foo"};

View File

@ -13,9 +13,11 @@ pub fn build(b: *std.Build) void {
fn add(b: *std.Build, test_step: *std.Build.Step, optimize: std.builtin.OptimizeMode) void {
const lib = b.addExecutable(.{
.name = "lib",
.root_module = b.createModule(.{
.root_source_file = b.path("lib.zig"),
.target = b.resolveTargetQuery(.{ .cpu_arch = .wasm32, .os_tag = .freestanding }),
.optimize = optimize,
}),
});
lib.entry = .disabled;
lib.import_symbols = true; // import `a` and `b`

View File

@ -15,9 +15,11 @@ pub fn build(b: *std.Build) void {
fn add(b: *std.Build, test_step: *std.Build.Step, optimize: std.builtin.OptimizeMode) void {
const exe = b.addExecutable(.{
.name = "extern",
.root_module = b.createModule(.{
.root_source_file = b.path("main.zig"),
.optimize = optimize,
.target = b.resolveTargetQuery(.{ .cpu_arch = .wasm32, .os_tag = .wasi }),
}),
});
exe.addCSourceFile(.{ .file = b.path("foo.c"), .flags = &.{} });
exe.use_llvm = false;

View File

@ -15,9 +15,11 @@ pub fn build(b: *std.Build) void {
fn add(b: *std.Build, test_step: *std.Build.Step, optimize: std.builtin.OptimizeMode) void {
const import_table = b.addExecutable(.{
.name = "import_table",
.root_module = b.createModule(.{
.root_source_file = b.path("lib.zig"),
.target = b.resolveTargetQuery(.{ .cpu_arch = .wasm32, .os_tag = .freestanding }),
.optimize = optimize,
}),
});
import_table.entry = .disabled;
import_table.use_llvm = false;
@ -27,9 +29,11 @@ fn add(b: *std.Build, test_step: *std.Build.Step, optimize: std.builtin.Optimize
const export_table = b.addExecutable(.{
.name = "export_table",
.root_module = b.createModule(.{
.root_source_file = b.path("lib.zig"),
.target = b.resolveTargetQuery(.{ .cpu_arch = .wasm32, .os_tag = .freestanding }),
.optimize = optimize,
}),
});
export_table.entry = .disabled;
export_table.use_llvm = false;
@ -39,9 +43,11 @@ fn add(b: *std.Build, test_step: *std.Build.Step, optimize: std.builtin.Optimize
const regular_table = b.addExecutable(.{
.name = "regular_table",
.root_module = b.createModule(.{
.root_source_file = b.path("lib.zig"),
.target = b.resolveTargetQuery(.{ .cpu_arch = .wasm32, .os_tag = .freestanding }),
.optimize = optimize,
}),
});
regular_table.entry = .disabled;
regular_table.use_llvm = false;

View File

@ -6,19 +6,23 @@ pub fn build(b: *std.Build) void {
// Wasm Object file which we will use to infer the features from
const c_obj = b.addObject(.{
.name = "c_obj",
.root_module = b.createModule(.{
.root_source_file = null,
.optimize = .Debug,
.target = b.resolveTargetQuery(.{
.cpu_arch = .wasm32,
.cpu_model = .{ .explicit = &std.Target.wasm.cpu.bleeding_edge },
.os_tag = .freestanding,
}),
}),
});
c_obj.addCSourceFile(.{ .file = b.path("foo.c"), .flags = &.{} });
c_obj.root_module.addCSourceFile(.{ .file = b.path("foo.c"), .flags = &.{} });
// Wasm library that doesn't have any features specified. This will
// infer its featureset from other linked object files.
const lib = b.addExecutable(.{
.name = "lib",
.root_module = b.createModule(.{
.root_source_file = b.path("main.zig"),
.optimize = .Debug,
.target = b.resolveTargetQuery(.{
@ -26,11 +30,12 @@ pub fn build(b: *std.Build) void {
.cpu_model = .{ .explicit = &std.Target.wasm.cpu.mvp },
.os_tag = .freestanding,
}),
}),
});
lib.entry = .disabled;
lib.use_llvm = false;
lib.use_lld = false;
lib.addObject(c_obj);
lib.root_module.addObject(c_obj);
// Verify the result contains the features from the C Object file.
const check = lib.checkObject();

View File

@ -16,10 +16,12 @@ pub fn build(b: *std.Build) void {
fn add(b: *std.Build, test_step: *std.Build.Step, optimize: std.builtin.OptimizeMode) void {
const lib = b.addExecutable(.{
.name = "lib",
.root_module = b.createModule(.{
.root_source_file = b.path("lib.zig"),
.target = b.resolveTargetQuery(.{ .cpu_arch = .wasm32, .os_tag = .freestanding }),
.optimize = optimize,
.strip = false,
}),
});
lib.entry = .disabled;
lib.use_llvm = false;

View File

@ -15,10 +15,12 @@ pub fn build(b: *std.Build) void {
fn add(b: *std.Build, test_step: *std.Build.Step, optimize: std.builtin.OptimizeMode) void {
const lib = b.addExecutable(.{
.name = "lib",
.root_module = b.createModule(.{
.root_source_file = b.path("lib.zig"),
.target = b.resolveTargetQuery(.{ .cpu_arch = .wasm32, .os_tag = .freestanding }),
.optimize = optimize,
.strip = false,
}),
});
lib.entry = .disabled;
lib.use_llvm = false;

View File

@ -13,6 +13,7 @@ pub fn build(b: *std.Build) void {
fn add(b: *std.Build, test_step: *std.Build.Step, optimize_mode: std.builtin.OptimizeMode) void {
const exe = b.addExecutable(.{
.name = "lib",
.root_module = b.createModule(.{
.root_source_file = b.path("lib.zig"),
.target = b.resolveTargetQuery(.{
.cpu_arch = .wasm32,
@ -23,6 +24,7 @@ fn add(b: *std.Build, test_step: *std.Build.Step, optimize_mode: std.builtin.Opt
.optimize = optimize_mode,
.strip = false,
.single_threaded = false,
}),
});
exe.entry = .disabled;
exe.use_lld = false;

View File

@ -15,10 +15,12 @@ pub fn build(b: *std.Build) void {
fn add(b: *std.Build, test_step: *std.Build.Step, optimize: std.builtin.OptimizeMode) void {
const lib = b.addExecutable(.{
.name = "lib",
.root_module = b.createModule(.{
.root_source_file = b.path("lib.zig"),
.target = b.resolveTargetQuery(.{ .cpu_arch = .wasm32, .os_tag = .freestanding }),
.optimize = optimize,
.strip = false,
}),
});
lib.entry = .disabled;
lib.use_llvm = false;

View File

@ -15,10 +15,12 @@ pub fn build(b: *std.Build) void {
fn add(b: *std.Build, test_step: *std.Build.Step, optimize: std.builtin.OptimizeMode) void {
const exe = b.addExecutable(.{
.name = "lib",
.root_module = b.createModule(.{
.root_source_file = b.path("lib.zig"),
.target = b.resolveTargetQuery(.{ .cpu_arch = .wasm32, .os_tag = .freestanding }),
.optimize = optimize,
.strip = false,
}),
});
exe.entry = .disabled;
exe.use_llvm = false;