Hello all ! This is my very first message here. I’m getting back to zig, I used to use it back in 2017 and slowly stopped touching it since early 2018. Eight years later, I want to have a shot back ![]()
I try to get to use the zig build system for fun and profit and discovered the build.zig.zon file.
It seems cool to get to express your dependency this way, but I was wondering if I could do without it.
For testing, I have two folder, a pack/ folder, with just a root.zig and build.zig file, nothing fancy, root has a unique function and build just do addModule.
The second folder is a exec/ folder, with a main.zig file, a build.zig file, and a build.zig.zon file. I have a setup that works. Basically, in my build.zig I have something like:
const pack = b.dependency("pack", .{});
const pack_mod = pack.module("pack");
mod.addImport("pack", pack_mod);
and in build.zig.zon:
.dependencies = .{
.pack = .{
.path = "../pack",
},
}
Ok. But I wished I could just express, for my use case, my dependency directly inside my build.zig file. Something like:
b.declareDependency("pack", .{ .path = "../pack" });
const pack = b.dependency("pack", .{});
const pack_mod = pack.module("pack");
mod.addImport("pack", pack_mod);
Then the build.zig.zon would be useless in my case !
Is this possible ? Wanted ? Planned ?
Thanks a lot and have a nice day all !