qt_generate_wayland_protocol_client_sources

为 Wayland 协议 .XML 文件生成客户端 C++ 绑定

该命令定义在Qt6 软件包的WaylandClient 组件中,可按如下方式加载:

find_package(Qt6 REQUIRED COMPONENTS WaylandClient)

该命令在 Qt 6.0 中引入。

简介

qt_generate_wayland_protocol_client_sources(target
                                            [PUBLIC_CODE | PRIVATE_CODE]
                                            FILES file1.xml [file2.xml ...])

如果禁用了无版本命令,请使用qt6_generate_wayland_protocol_client_sources() 代替。它支持与此命令相同的参数集。

说明

qt_generate_wayland_protocol_client_sources() 创建构建步骤,以便在一个或多个 Wayland 协议文件上运行wayland-scannerqtwaylandscanner 。这些工具将反过来生成实现协议的 C 和 C++ 绑定代码,生成的文件将作为target 的一部分进行构建。

PUBLIC_CODEPRIVATE_CODE 选项(在 Qt 6.8 中添加)与wayland-scannerpublic-codeprivate-code 选项相对应。PUBLIC_CODE 将使wayland-scanner 生成的代码中的符号被导出。为了向后兼容,默认使用PUBLIC_CODE ,但一般强烈建议使用PRIVATE_CODE

qt_generate_wayland_protocol_client_sources() 将触发生成实现协议客户端所需的文件。

请参阅自定义 Shell自定义扩展示例,了解如何使用这些函数。

© 2025 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.