Skip to content

Releases: 42LM/zig-package-manager-example

zig-0.16

31 Dec 21:58
0608576

Choose a tag to compare

Using it

In your zig project folder (where build.zig is located), run:

zig fetch --save "git+https://github.com/42LM/zig-package-manager-example#zig-0.16"

Then, in your build.zig's build function, add the following before
b.installArtifact(exe):

    const hello = b.dependency("zig_package_manager_example", .{
        .target = target,
        .optimize = optimize,
    });

    const exe = b.addExecutable(.{
        .name = "foo",
        .root_module = b.createModule(.{
            .root_source_file = b.path("src/main.zig"),
            .target = target,
            .optimize = optimize,
            .imports = &.{
                .{ .name = "foo", .module = mod },
                .{ .name = "hello", .module = hello.module("hello") }, // <<<
            },
        }),
    });

zig-0.14, zig-0.15

31 Dec 21:42
1b2a27b

Choose a tag to compare

Using it

In your zig project folder (where build.zig is located), run:

zig fetch --save "git+https://github.com/42LM/zig-package-manager-example#zig-0.15"

Then, in your build.zig's build function, add the following before
b.installArtifact(exe):

    const hello = b.dependency("hello", .{
        .target = target,
        .optimize = optimize,
    });
    exe.root_module.addImport("hello", hello.module("hello"));