diff --git a/deps.zig b/deps.zig index d9791963a7c4d17a6a76c25a19477521c3d0cf2f..2b7b9903319ff9f1a9b6ccfda757e5eb7cd28f3e 100644 --- a/deps.zig +++ b/deps.zig @@ -95,6 +95,11 @@ pub fn addAllTo(exe: *std.build.LibExeObjStep) void { const moddep = pkg.zp(b); exe.addModule(moddep.name, moddep.module); } + addAllLibrariesTo(exe); +} + +pub fn addAllLibrariesTo(exe: *std.build.LibExeObjStep) void { + const b = exe.step.owner; var llc = false; var vcpkg = false; inline for (comptime std.meta.declarations(package_data)) |decl| { diff --git a/docs/deps.zig.md b/docs/deps.zig.md index 9c6848e46fa60db563e8302f565eba731af34315..dc99cf0594811544cbd068d6c88b26f67e71fe30 100644 --- a/docs/deps.zig.md +++ b/docs/deps.zig.md @@ -15,6 +15,10 @@ A helper function to automatically pull in dependencies, purely from the `zig bu - Type: `pub fn (exe: *std.build.LibExeObjStep) void` A helper function to add all of the packages, C files, and system libraries to the passed exectuable. It will also automatically link libC in the event that any C files are found in the dependency tree. +### `addAllLibrariesTo` +- Type: `pub fn (exe: *std.build.LibExeObjStep) void` +A helper function called by `addAllTo` that adds the C files and libraries. + ### `Package` ```zig pub const Package = struct { diff --git a/src/cmd/fetch.zig b/src/cmd/fetch.zig index 8aa13456186529629715ff4aaebdd0e6b580f995..560f5f40e6fe0c9d34855cad4f3a52632fb45d72 100644 --- a/src/cmd/fetch.zig +++ b/src/cmd/fetch.zig @@ -63,6 +63,11 @@ pub fn create_depszig(alloc: std.mem.Allocator, cachepath: string, dir: std.fs.D \\ const moddep = pkg.zp(b); \\ exe.addModule(moddep.name, moddep.module); \\ } + \\ addAllLibrariesTo(exe); + \\} + \\ + \\pub fn addAllLibrariesTo(exe: *std.build.LibExeObjStep) void { + \\ const b = exe.step.owner; \\ var llc = false; \\ var vcpkg = false; \\ inline for (comptime std.meta.declarations(package_data)) |decl| { diff --git a/src/cmd/generate.zig b/src/cmd/generate.zig index 980663e9e84f08f21fa7f19a1a9e77743dc8e517..f70b81a9d96ae1818cdbc8c7724684388e9f91dc 100644 --- a/src/cmd/generate.zig +++ b/src/cmd/generate.zig @@ -132,6 +132,11 @@ pub fn create_depszig(alloc: std.mem.Allocator, cachepath: string, dir: std.fs.D \\ const moddep = pkg.zp(b); \\ exe.addModule(moddep.name, moddep.module); \\ } + \\ addAllLibrariesTo(exe); + \\} + \\ + \\pub fn addAllLibrariesTo(exe: *std.build.LibExeObjStep) void { + \\ const b = exe.step.owner; \\ var llc = false; \\ var vcpkg = false; \\ inline for (comptime std.meta.declarations(package_data)) |decl| {