Closed travisstaloch closed 1 year ago
Also suggest this in your usage code:
- .url = "https://github.com/travisstaloch/zig-clap/archive/refs/heads/master.tar.gz",
- .hash = "1220caf0689cafa7d546ef413f1c1cc5a278dfa1aa2e4de437d3ccee7527bf8e68cd",
+ .url = "https://github.com/travisstaloch/zig-clap/archive/a4940c3dcff9a2a711ddf1ec9f2e1d64d34c63f0.tar.gz",
(don't forget to delete the hash field when changing the url field)
Wow. you're quick :laughing: Thanks for the pointers. Will do! :+1:
I assume it would then also be nice to change the line
example.addAnonymousModule("clap", .{ .source_file = .{ .path = "clap.zig" } });
to
example.addModule("clap", clap_mod);
sorry for the messy commits. i should have actually tried building locally. got mixed up between using b.createModule()/addModule()
. let me know if i need to squash them.
to
example.addModule("clap", clap_mod);
Originally posted by @Hejsil in https://github.com/Hejsil/zig-clap/issues/92#issuecomment-1445353656
Would work if changed back to original:
const clap_mod = b.createModule(.{ .source_file = .{ .path = "clap.zig" } });
b.modules.put(b.dupe("clap"), clap_mod) catch @panic("OOM");
Let me know again if there is a better way.
to
example.addModule("clap", clap_mod);
Originally posted by @Hejsil in #92 (comment)
Would work if changed back to original:
const clap_mod = b.createModule(.{ .source_file = .{ .path = "clap.zig" } }); b.modules.put(b.dupe("clap"), clap_mod) catch @panic("OOM");
Let me know again if there is a better way.
Hmm. Alright, then I have no idea how the package manager works yet :shrug:
I'll just merge this, as it is an improvement for people who are trying to use it. I'll look into further improvements at some later date.
With this change i was able to use clap with the new package manager.
In my package's build.zig:
Note: before this patch, this change ^ resulted in an error. Something like 'can't find module clap'.
and my package's build.zig.zon:
I hope this is the correct way to do this. I haven't used the package manager much other than this. I got the idea from felix' similar repo: https://github.com/MasterQ32/zig-args/blob/master/build.zig#L7 . But i wanted to use the
usage()/help()
methods clap provides.