- Original source: https://github.com/chriskohlhoff/asio
- Download Zig v0.12 or higher
- Make on your project
build.zig&build.zig.zonfile
e.g:
- build.zig
const asio_dep = b.dependency("libasio", .{ // <== as declared in build.zig.zon
.target = target, // the same as passing `-Dtarget=<...>` to the library's build.zig script
.optimize = optimize, // ditto for `-Doptimize=<...>`
});
const libasio = asio_dep.artifact("asio"); // <== has the location of the dependency files (asio)
/// your executable config
exe.linkLibrary(libasio); // <== link libasio
exe.installLibraryHeaders(libasio); // <== get copy asio headers to zig-out/include - build.zig.zon
.{
.name = "example",
.version = "0.1.0",
.paths = .{""},
.dependencies = .{
.libasio = .{
.url = "https://github.com/kassane/asio/archive/[tag/commit-hash].tar.gz",
// or
.url = "git+https://https://github.com/kassane/asio#commit-hash",
.hash = "[multihash - sha256-2]",
},
},
}