freedesktop.wayland
importlibwayland-client — the client side of the Wayland protocol, with a C++23 module wrapper
import freedesktop.wayland.client;
#include <wayland-client.h>
模块名读自上游 src/wayland-client.cppm 里的 `export module` 声明。
mcpp add freedesktop.wayland@1.26.0
用法
来自本仓库自己的测试项目 —— CI 真的编译并运行过,不是为了网站写的。
// compat.wayland — behavioral test, runnable with no compositor.
//
// Two seams, and the second is the one a compositor author depends on.
//
// 1. THE CLIENT LIBRARY, which the package puts on the link line itself.
// `wl_display_connect` on a machine with no compositor must return NULL
// cleanly -- that exercises the real library (it reads WAYLAND_DISPLAY,
// builds a socket path and fails to connect) without needing a server.
//
// 2. THE LIBRARIES THE PACKAGE DELIBERATELY DOES NOT LINK. libwayland-server
// is harvested into the farm but kept off `ldflags`, so a consumer reaches
// it by adding `-lwayland-server` to its own build — which this member's
// mcpp.toml does. If the farm ever stops carrying the server library, the
// documented escape hatch silently stops working; this file is what turns
// that into a link error here instead.
#ifdef __linux__
#include <wayland-client.h>
#include <wayland-server-core.h>
#include <dlfcn.h>
// …
tests/examples/wayland/tests/wayland.cpp · 项目 tests/examples/wayland
构建 · 上游清单
- modules
freedesktop.wayland.client- targets
wayland-client (shared), wayland (lib)- language
c++23- manifest version
1.26.0- dependencies
compat- 来源
https://raw.githubusercontent.com/mcpplibs/wayland/v1.26.0/mcpp/client/mcpp.toml