summaryrefslogtreecommitdiffstats
path: root/src/dbus/doc/src/qtdbus-cmake.qdoc
blob: 0c8a253e1929755632b7ac9280ee30f2281e472f (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
/****************************************************************************
**
** Copyright (C) 2019 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:FDL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Free Documentation License Usage
** Alternatively, this file may be used under the terms of the GNU Free
** Documentation License version 1.3 as published by the Free Software
** Foundation and appearing in the file included in the packaging of
** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
** $QT_END_LICENSE$
**
****************************************************************************/

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

\title qt_add_dbus_interface
\target qt6_add_dbus_interface

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

\section1 Synopsis

\badcode
qt_add_dbus_interface(<VAR> dbus_spec basename)

qt6_add_dbus_interface(<VAR> dbus_spec basename)
\endcode

\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_file_property 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_interface

\brief Generates C++ sources implementing interfaces for D-Bus interface
description files.

\section1 Synopsis

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

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

\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_file_property 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

\brief Generates a D-Bus interface from a header file.

\section1 Synopsis

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

qt6_generate_dbus_interface(header
    [customName]
    [OPTIONS options]
)
\endcode

\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

\brief Generates an adaptor class for a D-Bus interface.

\section1 Synopsis

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

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

\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
*/