pmbanugo/uSockets.zig
build.zig for the uSockets C library
master
This is uNetworking/uSockets packaged for use in Zig
Use zig fetch
:
zig fetch --save git+https://github.com/yourusername/uSockets.zig#master
You can then import usockets
in your build.zig
:
const usockets = b.dependency("usockets", .{
.target = target,
.optimize = optimize,
});
// Link the library to your executable/library
your_exe.linkLibrary(usockets.artifact("usockets"));
This package supports several build-time options that can be passed via -D
flags when building:
-Dssl=true
: Enable SSL/TLS support (default: false
)-Dssl-backend=openssl
: Choose SSL backend - openssl
or wolfssl
(default: openssl
)-Dio-uring=true
: Enable io_uring support on Linux for better performance (default: false
)Example:
zig build -Dssl=true -Dssl-backend=openssl
Include the header in your Zig code:
const c = @cImport({
@cInclude("libusockets.h");
});
For detailed API documentation and examples, see the upstream uSockets repository.
This package follows the same license as the upstream uSockets project.