Skip to content

zig bindings and scanner for libwayland

License

Notifications You must be signed in to change notification settings

maringuu/zig-wayland

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

75 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

zig-wayland

Zig bindings and protocol scanner for libwayland.

Usage

A ScanProtocolsStep is provided which you may intergrate with your build.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();

    const scanner = ScanProtocolsStep.create(b, "zig-wayland/");
    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());
    exe.linkLibC();
    exe.linkSystemLibrary("wayland-client");
    
    // TODO: remove when https://github.com/ziglang/zig/issues/131 is implemented
    scanner.addCSource(exe);

    exe.install();
}

Then, you may import the provided package in your project:

const wayland = @import("wayland");
const wl = wayland.client.wl;

There is an example project using zig-wayland here: hello-zig-wayland.

License

zig-wayland is relased under the MIT (expat) license.

About

zig bindings and scanner for libwayland

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Zig 100.0%