kassane / asio

Asio C++ Library (uses zig build-system)

Home Page:http://think-async.com/Asio

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Asio Standalone for Zig Package Manager (MVP)

How to use

e.g:

  • build.zig
    const asio_dep = b.dependency("asio", .{ // <== 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
# '--save=asio': (over)write latest git commit (no need manually update)
$ zig fetch --save=asio git+https://github.com/kassane/asio

or add manually to your build.zig.zon file:

.{
    .name = "example",
    .version = "0.1.0",
    .paths = .{""},
    .dependencies = .{
        .asio = .{
            .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]",
        },
    },
}
# zig project helper
Project-Specific Options:
  -Dtarget=[string]            The CPU architecture, OS, and ABI to build for
  -Dcpu=[string]               Target CPU features to add or subtract
  -Ddynamic-linker=[string]    Path to interpreter on the target system
  -Doptimize=[enum]            Prioritize performance, safety, or binary size
                                 Supported Values:
                                   Debug
                                   ReleaseSafe
                                   ReleaseFast
                                   ReleaseSmall
  -DShared=[bool]              Build the Shared Library (default: false)
  -DSSL=[bool]                 Build Asio with OpenSSL support (default: false)
  -DTests=[bool]               Build tests (default: false)

More info about zig-pkg

About

Asio C++ Library (uses zig build-system)

http://think-async.com/Asio

License:Boost Software License 1.0


Languages

Language:C++ 96.6%Language:XSLT 1.1%Language:Makefile 1.0%Language:Perl 0.8%Language:HTML 0.2%Language:Zig 0.1%Language:M4 0.1%Language:TeX 0.0%Language:Shell 0.0%