このページでは

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]
                                            [NO_INCLUDE_CORE_ONLY]
                                            FILES file1.xml [file2.xml ...])

バージョンレスコマンドが無効になっている場合は、qt6_generate_wayland_protocol_client_sources() 。このコマンドと同じ引数セットをサポートしています。

説明

qt_generate_wayland_protocol_client_sources() は1つ以上のWaylandプロトコルファイルに対してwayland-scannerqtwaylandscanner を実行するためのビルド手順を作成します。このツールはプロトコルを実装するためのバインディングコードをCおよびC++で生成し、生成されたファイルはtarget の一部としてビルドされます。

PUBLIC_CODEPRIVATE_CODE オプション(Qt 6.8で追加)はwayland-scannerpublic-codeprivate-code オプションに対応します。PUBLIC_CODEwayland-scanner で生成されたコードのシンボルをエクスポートします。後方互換性のためにPUBLIC_CODE がデフォルトですが、一般的にはPRIVATE_CODE を強く推奨します。

デフォルトでは、wayland-scanner--include-core-only 引数とともに呼び出され、生成されるコードに"wayland-client-core.h" が含まれるようにする。この動作はNO_INCLUDE_CORE_ONLY オプションで無効にすることができ、インクルードを"wayland-client.h" に切り替えます。

注意: NO_INCLUDE_CORE_ONLY の使用は一般的に推奨されません。"wayland-client.h" はWaylandのコア・プロトコルのコンパイル済みバージョンを含んでおり、新しいプロトコル・バージョンや他のヘッダー(古いバージョンのVulkanなど)と衝突する可能性があります。このオプションはコアヘッダにはない型が特に必要で、ビルド時に競合する可能性があることを認識している場合にのみ使用してください。

qt_generate_wayland_protocol_client_sources() は、プロトコルのクライアント側を実装するために必要なファイルの生成をトリガーします。qt_generate_wayland_protocol_server_sources()は、コンポジター用の同等の関数です。

これらの関数の使い方はカスタムシェルや カスタム拡張の例を参照してください。

© 2026 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.