chore: bump zig version to 0.16.0
This commit is contained in:
parent
96866ba9ae
commit
e004d00990
13 changed files with 171 additions and 113 deletions
28
build.zig
28
build.zig
|
|
@ -121,18 +121,20 @@ fn buildExamples(
|
|||
optimize: std.builtin.OptimizeMode,
|
||||
c_lib_: ?*std.Build.Step.Compile,
|
||||
) ![]const *std.Build.Step.Compile {
|
||||
const alloc = b.allocator;
|
||||
var steps: std.ArrayList(*std.Build.Step.Compile) = .empty;
|
||||
defer steps.deinit(alloc);
|
||||
const gpa = b.allocator;
|
||||
const io = b.graph.io;
|
||||
|
||||
var dir = try std.fs.cwd().openDir(try b.build_root.join(
|
||||
b.allocator,
|
||||
var steps: std.ArrayList(*std.Build.Step.Compile) = .empty;
|
||||
defer steps.deinit(gpa);
|
||||
|
||||
var dir = try std.Io.Dir.cwd().openDir(io, try b.build_root.join(
|
||||
gpa,
|
||||
&.{"examples"},
|
||||
), .{ .iterate = true });
|
||||
defer dir.close();
|
||||
defer dir.close(io);
|
||||
|
||||
var it = dir.iterate();
|
||||
while (try it.next()) |entry| {
|
||||
while (try it.next(io)) |entry| {
|
||||
const index = std.mem.lastIndexOfScalar(u8, entry.name, '.') orelse continue;
|
||||
if (index == 0) continue;
|
||||
|
||||
|
|
@ -159,11 +161,11 @@ fn buildExamples(
|
|||
.root_module = b.createModule(.{
|
||||
.target = target,
|
||||
.optimize = optimize,
|
||||
.link_libc = true,
|
||||
}),
|
||||
});
|
||||
exe.linkLibC();
|
||||
exe.addIncludePath(b.path("include"));
|
||||
exe.addCSourceFile(.{
|
||||
exe.root_module.addIncludePath(b.path("include"));
|
||||
exe.root_module.addCSourceFile(.{
|
||||
.file = b.path(b.fmt(
|
||||
"examples/{s}",
|
||||
.{entry.name},
|
||||
|
|
@ -176,10 +178,10 @@ fn buildExamples(
|
|||
"-D_POSIX_C_SOURCE=199309L",
|
||||
},
|
||||
});
|
||||
exe.linkLibrary(c_lib);
|
||||
exe.root_module.linkLibrary(c_lib);
|
||||
break :exe exe;
|
||||
};
|
||||
try steps.append(alloc, exe);
|
||||
try steps.append(gpa, exe);
|
||||
}
|
||||
return steps.toOwnedSlice(alloc);
|
||||
return steps.toOwnedSlice(gpa);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue