From f335337bca742c8f0181798be75de65bfb4e8283 Mon Sep 17 00:00:00 2001 From: Isaac Freund Date: Sun, 1 Nov 2020 13:53:47 +0100 Subject: [PATCH] Add README --- README.md | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..795012d --- /dev/null +++ b/README.md @@ -0,0 +1,49 @@ +# zig-wayland + +Zig bindings and protocol scanner for libwayland. + +## Usage + +A `ScanProtocolsStep` is provided which you may intergrate with your +`build.zig`: + +```zig +const std = @import("std"); +const Builder = std.build.Builder; + +const ScanProtocolsStep = @import("zig-wayland/build.zig").ScanProtocolsStep; + +pub fn build(b: *Builder) void { + const target = b.standardTargetOptions(.{}); + const mode = b.standardReleaseOptions(); + + var scanner = ScanProtocolsStep.create(b, "zig-wayland/", .client); + scanner.addSystemProtocol("stable/xdg-shell/xdg-shell.xml"); + scanner.addProtocolPath("protocol/foobar.xml"); + + const exe = b.addExecutable("foo", "foo.zig"); + exe.setTarget(target); + exe.setBuildMode(mode); + + exe.step.dependOn(&scanner.step); + exe.addPackage(scanner.getPkg()); + scanner.link(exe); + + exe.install(); +} + +``` + +Then, you may import the provided package in your project: + +```zig +const wayland = @import("wayland"); +const wl = wayland.client.wl; +``` + +There is an example project using zig-wayland here: +[hello-zig-wayland](https://github.com/ifreund/hello-zig-wayland). + +## License + +zig-wayland is relased under the MIT (expat) license.