glfw: support compiling for wayland

This commit is contained in:
PiergiorgioZagaria 2022-06-28 12:39:24 +02:00 committed by Stephen Gutekanst
parent 952ea5c3c5
commit b4ea44c647
2 changed files with 5 additions and 13 deletions

View file

@ -38,9 +38,7 @@ pub const Options = struct {
x11: bool = true,
/// Only respected on Linux.
// TODO(build-system): update wayland-protocol source generation in linux system SDKs so we can
// turn this on by default.
wayland: bool = false,
wayland: bool = true,
/// System SDK options.
system_sdk: system_sdk.Options = .{},
@ -170,7 +168,10 @@ fn linkGLFWDependencies(b: *Builder, step: *std.build.LibExeObjStep, options: Op
},
else => {
// Assume Linux-like
if (options.wayland) step.linkSystemLibraryName("wayland-client");
if (options.wayland) {
step.linkSystemLibraryName("wayland-client");
step.defineCMacro("WL_MARSHAL_FLAG_DESTROY", null);
}
if (options.x11) {
step.linkSystemLibraryName("X11");
step.linkSystemLibraryName("xcb");

View file

@ -2,12 +2,3 @@
#include "wl_monitor.c"
#include "wl_window.c"
#include "wl_init.c"
// Note: These sources are generated by wayland-scanner, and distributed in sdk-linux-*
// See e.g. https://github.com/hexops/sdk-linux-x86_64/blob/main/generate-wayland.sh
#include "wayland-viewporter-client-protocol.c"
#include "wayland-xdg-decoration-client-protocol.c"
#include "wayland-xdg-shell-client-protocol.c"
#include "wayland-idle-inhibit-unstable-v1-client-protocol.c"
#include "wayland-pointer-constraints-unstable-v1-client-protocol.c"
#include "wayland-relative-pointer-unstable-v1-client-protocol.c"