Open ali-shahwali opened 6 months ago
Hi @ali-shahwali,
Thanks for the feedback,
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...
Im not opposite but let's get more feedbacks
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:
var src_files = std.ArrayList([]const u8).init(b.allocator);
defer src_files.deinit();
// Open directory, assuming cglm was added into project root via git submodule
var src_dir = try std.fs.cwd().openDir("cglm/src", .{ .iterate = true });
defer src_dir.close();
// Create walker
var src_walker = try src_dir.walk(b.allocator);
defer src_walker.deinit();
// Iterate
while (try src_walker.next()) |entry| {
if (entry.kind != .file or !std.mem.eql(u8, std.fs.path.extension(entry.basename), ".c")) {
continue;
}
try src_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.