Hello,
I have added a small dependency to my project and managed to get it working.
I just needed to do
./build.zig
+ const time_dep = b.dependency("datetime", .{ .target = target, .optimize = optimize });
+ exe.root_module.addImport("datetime", time_dep.module("datetime"));
I want to add .lazy = true,
to the zon
file I also needed to adapt the build.zig
, so I have switched to b.lazyDependency
.
Now however I get this error:
repo/build.zig:50:51: error: no field or member function named 'module' in '?*Build.Dependency'
exe.root_module.addImport("datetime", time_dep.module("datetime"));
~~~~~~~~^~~~~~~
and I have no idea on how to fix it.
I have checked the source code:
pub const Dependency = struct {
builder: *Build,
...
pub fn module(d: *Dependency, name: []const u8) *Module {
return d.builder.modules.get(name) orelse {
panic("unable to find module '{s}'", .{name});
};
}
and it definetly is there.
There probably is some step to make sure that the pointer is not null which I am missing.
Do any of you know how to fix this?