authorgravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2023-11-23 23:20:33 -08:00
committergravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2023-11-23 23:20:33 -08:00
loge2d42e8ff71c3e6f534a380b7d16465fa77032f7
tree404d2bf4adfb9c59557713877ec662cafb08371f
parentf3aabb5e4e3baa7cf58af4f36f8683532d49fce3

add deps.addAllLibrariesTo(), closes #84


4 files changed, 19 insertions(+), 0 deletions(-)

deps.zig+5
...@@ -95,6 +95,11 @@ pub fn addAllTo(exe: *std.build.LibExeObjStep) void {...@@ -95,6 +95,11 @@ pub fn addAllTo(exe: *std.build.LibExeObjStep) void {
95 const moddep = pkg.zp(b);95 const moddep = pkg.zp(b);
96 exe.addModule(moddep.name, moddep.module);96 exe.addModule(moddep.name, moddep.module);
97 }97 }
98 addAllLibrariesTo(exe);
99}
100
101pub fn addAllLibrariesTo(exe: *std.build.LibExeObjStep) void {
102 const b = exe.step.owner;
98 var llc = false;103 var llc = false;
99 var vcpkg = false;104 var vcpkg = false;
100 inline for (comptime std.meta.declarations(package_data)) |decl| {105 inline for (comptime std.meta.declarations(package_data)) |decl| {
docs/deps.zig.md+4
...@@ -15,6 +15,10 @@ A helper function to automatically pull in dependencies, purely from the `zig bu...@@ -15,6 +15,10 @@ A helper function to automatically pull in dependencies, purely from the `zig bu
15- Type: `pub fn (exe: *std.build.LibExeObjStep) void`15- Type: `pub fn (exe: *std.build.LibExeObjStep) void`
16A 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.16A 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.
1717
18### `addAllLibrariesTo`
19- Type: `pub fn (exe: *std.build.LibExeObjStep) void`
20A helper function called by `addAllTo` that adds the C files and libraries.
21
18### `Package`22### `Package`
19```zig23```zig
20pub const Package = struct {24pub const Package = struct {
src/cmd/fetch.zig+5
...@@ -63,6 +63,11 @@ pub fn create_depszig(alloc: std.mem.Allocator, cachepath: string, dir: std.fs.D...@@ -63,6 +63,11 @@ pub fn create_depszig(alloc: std.mem.Allocator, cachepath: string, dir: std.fs.D
63 \\ const moddep = pkg.zp(b);63 \\ const moddep = pkg.zp(b);
64 \\ exe.addModule(moddep.name, moddep.module);64 \\ exe.addModule(moddep.name, moddep.module);
65 \\ }65 \\ }
66 \\ addAllLibrariesTo(exe);
67 \\}
68 \\
69 \\pub fn addAllLibrariesTo(exe: *std.build.LibExeObjStep) void {
70 \\ const b = exe.step.owner;
66 \\ var llc = false;71 \\ var llc = false;
67 \\ var vcpkg = false;72 \\ var vcpkg = false;
68 \\ inline for (comptime std.meta.declarations(package_data)) |decl| {73 \\ inline for (comptime std.meta.declarations(package_data)) |decl| {
src/cmd/generate.zig+5
...@@ -132,6 +132,11 @@ pub fn create_depszig(alloc: std.mem.Allocator, cachepath: string, dir: std.fs.D...@@ -132,6 +132,11 @@ pub fn create_depszig(alloc: std.mem.Allocator, cachepath: string, dir: std.fs.D
132 \\ const moddep = pkg.zp(b);132 \\ const moddep = pkg.zp(b);
133 \\ exe.addModule(moddep.name, moddep.module);133 \\ exe.addModule(moddep.name, moddep.module);
134 \\ }134 \\ }
135 \\ addAllLibrariesTo(exe);
136 \\}
137 \\
138 \\pub fn addAllLibrariesTo(exe: *std.build.LibExeObjStep) void {
139 \\ const b = exe.step.owner;
135 \\ var llc = false;140 \\ var llc = false;
136 \\ var vcpkg = false;141 \\ var vcpkg = false;
137 \\ inline for (comptime std.meta.declarations(package_data)) |decl| {142 \\ inline for (comptime std.meta.declarations(package_data)) |decl| {