summaryrefslogtreecommitdiffstats
path: root/src/dbus/doc/src/qtdbus-cmake.qdoc
blob: 227642bfb715670c11a6160e411789c6d001b7c7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
// Copyright (C) 2019 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only

/*!
\group cmake-commands-qtdbus
\title CMake Commands in Qt6 DBus

The following CMake commands are defined when Qt6::DBus is loaded, for instance
with

\code
find_package(Qt6 REQUIRED COMPONENTS DBus)
\endcode

\sa{CMake Command Reference}
*/

/*!
\page qtdbus-cmake-qt-add-dbus-interface.html
\ingroup cmake-commands-qtdbus

\title qt_add_dbus_interface
\target qt6_add_dbus_interface

\summary {Generates C++ sources implementing an interface for a D-Bus interface
description file.}

\include cmake-find-package-dbus.qdocinc

\cmakecommandsince 6.0

\section1 Synopsis

\badcode
qt_add_dbus_interface(<VAR> dbus_spec basename)
\endcode

\versionlessCMakeCommandsNote qt6_add_dbus_interface()

\section1 Description

Generates C++ sources implementing an interface for a D-Bus interface description
file defined in \c{dbus_spec}. The generated files are named after \c{basename}:
\c{basename.h}, \c{basename.cpp}, \c{basename.moc}. The paths of the files
are added to \c{<VAR>}.

The function sets up a call to the \l{Qt D-Bus XML compiler (qdbusxml2cpp)}
in interface (proxy) mode. By default, \c{qdbusxml2cpp} generates a C++
class named after the interface name, with a namespaced alias:

\table
\header
  \li D-Bus Interface Name
  \li Class name
  \li Namespaced name
\row
  \li \c{org.example.chat}
  \li \c{OrgExampleChatInterface}
  \li \c{org.example.chat}
\endtable

\section1 Options

Options can be set using \c set_source_files_properties on the \c dbus_spec:

\table
\header
  \li Option
  \li Value
  \li Description
\row
  \li \c CLASSNAME
  \li \c class_name
  \li Override the default interface class name with \c{class_name}.
\row
  \li \c NO_NAMESPACE
  \li boolean
  \li Do not generate the namespaced name if set to \c{ON}.
\row
  \li \c INCLUDE
  \li \c path
  \li Add an \c{#include "path"} in the generated code.
\endtable
*/

/*!
\page qtdbus-cmake-qt-add-dbus-interfaces.html
\ingroup cmake-commands-qtdbus

\title qt_add_dbus_interfaces
\target qt6_add_dbus_interfaces

\summary {Generates C++ sources implementing interfaces for D-Bus interface
description files.}

\include cmake-find-package-dbus.qdocinc

\cmakecommandsince 6.0

\section1 Synopsis

\badcode
qt_add_dbus_interfaces(<VAR> dbus_spec1 [dbus_spec2 ...])
\endcode

\versionlessCMakeCommandsNote qt6_add_dbus_interfaces()

\section1 Description

Generates C++ sources implementing D-Bus interfaces defined in \c{dbus_spec1},
\c{dbus_spec2}, where each argument needs to be the path to a valid D-Bus
interface description file. The paths of the generated files are added to
\c{<VAR>}.

For each argument, a call to the \l{Qt D-Bus XML compiler (qdbusxml2cpp)}
in interface (proxy) mode is set up.

The generated C++ source files are named after the XML file: For the file
\c{org.example.chat.xml} the generated header will be named
\c{orgexamplechatinterface.h}.

\section1 Options

Options can be set using \c set_source_files_properties on each of the file
arguments:

\table
\header
  \li Option
  \li Value
  \li Description
\row
  \li \c CLASSNAME
  \li \c class_name
  \li Override the default interface class name with \c{class_name}.
\row
  \li \c NO_NAMESPACE
  \li boolean
  \li Do not generate the namespaced name if set to \c{ON}.
\row
  \li \c INCLUDE
  \li \c path
  \li Add an \c{#include "path"} in the generated code.
\endtable
*/

/*!
\page qtdbus-cmake-qt-generate-dbus-interface.html
\ingroup cmake-commands-qtdbus

\title qt_generate_dbus_interface
\target qt6_generate_dbus_interface

\summary {Generates a D-Bus interface from a header file.}

\include cmake-find-package-dbus.qdocinc

\cmakecommandsince 6.0

\section1 Synopsis

\badcode
qt_generate_dbus_interface(header
    [customName]
    [OPTIONS options]
)
\endcode

\versionlessCMakeCommandsNote qt6_generate_dbus_interface()

\section1 Description

Parses the C++ source or header file containing a QObject-derived class
declaration and generates a file containing the D-BUS Introspection XML.

By default, the generated XML file is stored in the current binary directory,
and has the same base name as the header. You can specify a different name or
path by adding \c{customName} as an optional second argument.

\section1 Options

The function sets up a call to the \c{qdbuscpp2xml} command line tool. Further
arguments to the tool can be set after \c{OPTIONS}.
*/

/*!
\page qtdbus-cmake-qt-add-dbus-adaptor.html
\ingroup cmake-commands-qtdbus

\title qt_add_dbus_adaptor
\target qt6_add_dbus_adaptor

\summary {Generates an adaptor class for a D-Bus interface.}

\include cmake-find-package-dbus.qdocinc

\cmakecommandsince 6.0

\section1 Synopsis

\badcode
qt_add_dbus_adaptor(<VAR> dbus_spec header
    [parent_class]
    [basename]
    [classname]
)
\endcode

\versionlessCMakeCommandsNote qt6_add_dbus_adaptor()

\section1 Description

Generates a C++ header file implementing an adaptor for a D-Bus interface
description file defined in \c{dbus_spec}. The path of the generated file is
added to \c{<VAR>}. The generated adaptor class takes a pointer to
\c{parent_class} as QObject parent. \c{parent_class} should be declared in
\c{header}, which is included in the generated code as \c{#include "header"}.

The function sets up a call to the \l{Qt D-Bus XML compiler (qdbusxml2cpp)}
in adaptor mode. The default file and class name are generated from the last
segment in the \c{dbus_spec} base name:

\table
\header
  \li XML file
  \li Header file
  \li Class name
\row
  \li \c{org.example.chat}
  \li \c{chatadaptor.h}
  \li \c{ChatAdaptor}
\endtable


You can change the name of the header file to be generated by passing
\c{basename} as the fifth argument. The \c{.h} suffix is always added.

You can change the default class name by passing \c{classname} as the sixth
argument.

\section1 Examples

\snippet cmake/examples.cmake qt_add_dbus_adaptor
*/

/*!
\group cmake-source-file-properties-qtdbus
\title CMake Source File Properties in Qt6 DBus

\l{CMake Commands in Qt6 DBus}{CMake Commands} know about the following CMake
source file properties:

\sa{CMake Property Reference}
*/

/*!
\page cmake-source-file-property-CLASSNAME.html
\ingroup cmake-source-file-properties-qtdbus

\title CLASSNAME
\target cmake-source-file-property-CLASSNAME

\summary {Overrides the default interface class name.}

\cmakepropertysince 5.0

When this property is set, the generated C++ class name is overridden
with the provided property value.

\sa{qt6_add_dbus_interface}{qt_add_dbus_interface}
*/

/*!
\page cmake-source-file-property-INCLUDE.html
\ingroup cmake-source-file-properties-qtdbus

\title INCLUDE
\target cmake-source-file-property-INCLUDE

\summary {Adds an include path.}

\cmakepropertysince 5.0

When this property is set, an #include "path" is added
to the generated C++ file.

\sa{qt6_add_dbus_interface}{qt_add_dbus_interface}
*/

/*!
\page cmake-source-file-property-NO_NAMESPACE.html
\ingroup cmake-source-file-properties-qtdbus

\title NO_NAMESPACE
\target cmake-source-file-property-NO_NAMESPACE

\summary {Disables generation of a namespaced name.}

\cmakepropertysince 5.0

When this property is set, the generated C++ class will not contain a namespaced alias.

\sa{qt6_add_dbus_interface}{qt_add_dbus_interface}
*/