ITADN

How can I use chameleon within a library I'm building?

#14Closedjasperdunn 创建于 2025-03-28
J
jasperdunncommented
The documentation has: ``` const cham = b.dependency("chameleon", .{}); exe_mod.addImport("chameleon", cham.module("chameleon")); ``` But this only works for executables, I haven't been able to find an example of adding dependencies to static libraries in either Zig documentation or existing projects online. So far I have: ``` const lib = b.addStaticLibrary(.{ .name = "my-library", .root_source_file = .{ .src_path = .{ .sub_path = "src/main.zig", .owner = b } }, .target = target, .optimize = optimize, }); const chameleon = b.dependency("chameleon", .{}); ``` but I'm not sure how to add / link the dependency to my library. Thanks for your help
关闭于 2025-03-29 2 条评论