You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I think it would be nice to have a build.zig file to support C/C++ projects that are built using Zig. I have created a simple one that is by no means perfect, just to give an idea of what it could look like.
Since we maintain a few build types e.g. Autotools, CMake, VisualStudio, meson... I'm not sure for new one, also we need to keep this updated and compatible with new ZIG versions...
As much as I love Zig, I agree with recp that this would incur a lot of extra work before Zig goes 1.0 as the language (and the build system) is still evolving a lot.
On a different note: You don't need to manually list out all of the sources. You can recursively search the src directory for any .c files like this:
varsrc_files=std.ArrayList([]constu8).init(b.allocator);
defersrc_files.deinit();
// Open directory, assuming cglm was added into project root via git submodulevarsrc_dir=trystd.fs.cwd().openDir("cglm/src", .{ .iterate=true });
defersrc_dir.close();
// Create walkervarsrc_walker=trysrc_dir.walk(b.allocator);
defersrc_walker.deinit();
// Iteratewhile (trysrc_walker.next()) |entry| {
if (entry.kind!=.fileor!std.mem.eql(u8, std.fs.path.extension(entry.basename), ".c")) {
continue;
}
trysrc_files.append(b.dupePath(entry.path));
}
Hi,
I think it would be nice to have a build.zig file to support C/C++ projects that are built using Zig. I have created a simple one that is by no means perfect, just to give an idea of what it could look like.
The text was updated successfully, but these errors were encountered: