test-standalone: migrate from deprecated std.Build APIs

This commit is contained in:
mlugg
2024-12-16 22:26:34 +00:00
committed by Eric Joldasov
parent 82659c4594
commit 6bd590ad37
56 changed files with 596 additions and 381 deletions

View File

@@ -20,11 +20,13 @@ pub fn build(b: *std.Build) void {
{
const exe = b.addExecutable(.{
.name = "unwind_fp",
.root_source_file = b.path("unwind.zig"),
.target = target,
.optimize = optimize,
.unwind_tables = if (target.result.isDarwin()) .@"async" else null,
.omit_frame_pointer = false,
.root_module = b.createModule(.{
.root_source_file = b.path("unwind.zig"),
.target = target,
.optimize = optimize,
.unwind_tables = if (target.result.isDarwin()) .@"async" else null,
.omit_frame_pointer = false,
}),
});
const run_cmd = b.addRunArtifact(exe);
@@ -43,11 +45,13 @@ pub fn build(b: *std.Build) void {
{
const exe = b.addExecutable(.{
.name = "unwind_nofp",
.root_source_file = b.path("unwind.zig"),
.target = target,
.optimize = optimize,
.unwind_tables = .@"async",
.omit_frame_pointer = true,
.root_module = b.createModule(.{
.root_source_file = b.path("unwind.zig"),
.target = target,
.optimize = optimize,
.unwind_tables = .@"async",
.omit_frame_pointer = true,
}),
});
const run_cmd = b.addRunArtifact(exe);
@@ -66,27 +70,32 @@ pub fn build(b: *std.Build) void {
{
const c_shared_lib = b.addSharedLibrary(.{
.name = "c_shared_lib",
.target = target,
.optimize = optimize,
.strip = false,
.root_module = b.createModule(.{
.root_source_file = null,
.target = target,
.optimize = optimize,
.link_libc = true,
.strip = false,
}),
});
if (target.result.os.tag == .windows)
c_shared_lib.root_module.addCMacro("LIB_API", "__declspec(dllexport)");
c_shared_lib.addCSourceFile(.{
c_shared_lib.root_module.addCSourceFile(.{
.file = b.path("shared_lib.c"),
.flags = &.{"-fomit-frame-pointer"},
});
c_shared_lib.linkLibC();
const exe = b.addExecutable(.{
.name = "shared_lib_unwind",
.root_source_file = b.path("shared_lib_unwind.zig"),
.target = target,
.optimize = optimize,
.unwind_tables = if (target.result.isDarwin()) .@"async" else null,
.omit_frame_pointer = true,
.root_module = b.createModule(.{
.root_source_file = b.path("shared_lib_unwind.zig"),
.target = target,
.optimize = optimize,
.unwind_tables = if (target.result.isDarwin()) .@"async" else null,
.omit_frame_pointer = true,
}),
});
exe.linkLibrary(c_shared_lib);
@@ -117,14 +126,16 @@ pub fn build(b: *std.Build) void {
inline for (no_os_targets) |os_tag| {
const exe = b.addExecutable(.{
.name = "unwind_freestanding",
.root_source_file = b.path("unwind_freestanding.zig"),
.target = b.resolveTargetQuery(.{
.cpu_arch = .x86_64,
.os_tag = os_tag,
.root_module = b.createModule(.{
.root_source_file = b.path("unwind_freestanding.zig"),
.target = b.resolveTargetQuery(.{
.cpu_arch = .x86_64,
.os_tag = os_tag,
}),
.optimize = optimize,
.unwind_tables = null,
.omit_frame_pointer = false,
}),
.optimize = optimize,
.unwind_tables = null,
.omit_frame_pointer = false,
});
// This "freestanding" binary is runnable because it invokes the