Skip to content

Releases: Afirium/wasmer-zig-api

Release v0.2.0

22 Nov 19:50
Compare
Choose a tag to compare

What's Changed

Using it

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

zig fetch --save "git+https://github.com/Afirium/wasmer-zig-api#v0.2.0"

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

    const wasmerZigAPI= b.dependency("wasmer_zig_api", .{
        .target = target,
        .optimize = optimize,
    });
    exe.root_module.addImport("wasmer", wasmerZigAPI.module("wasmer"));
    exe.linkLibC();
    exe.addLibraryPath(.{ .cwd_relative = "/home/path_to_your_wasmer/.wasmer/lib" });
    exe.linkSystemLibrary("wasmer");

New Contributors

Full Changelog: v0.1.0...v0.2.0

Release v0.1.0

23 Jun 20:40
Compare
Choose a tag to compare

Using it

To use in your own projects, put this dependency into your build.zig.zon:

        .wasmer_zig_api = .{
            .url = "https://github.com/Afirium/wasmer-zig-api/archive/refs/tags/v0.1.0.tar.gz",
        }

Here is a complete build.zig.zon example:

.{
    .name = "My example project",
    .version = "0.0.1",

    .dependencies = .{
        .wasmer_zig_api = .{
            .url = "https://github.com/Afirium/wasmer-zig-api/archive/refs/tags/v0.1.0.tar.gz",
        },
        .paths = .{
            "",
        },
    }
}

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

    const wasmerZigAPI= b.dependency("wasmer_zig_api", .{
        .target = target,
        .optimize = optimize,
    });
    exe.root_module.addImport("wasmer", wasmerZigAPI.module("wasmer"));
    exe.linkLibC();
    exe.addLibraryPath(.{ .cwd_relative = "/home/path_to_your_wasmer/.wasmer/lib" });
    exe.linkSystemLibrary("wasmer");