Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qdoc-guide.qdoc
Go to the documentation of this file.
1
// Copyright (C) 2020 The Qt Company Ltd.
2
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
3
/*!
4
\page qdoc-guide.html
5
\title Getting Started with QDoc
6
\nextpage Installing Clang for QDoc
7
8
Qt uses QDoc to generate its documentation set into HTML and DocBook XML
9
formats. QDoc uses a set of configuration files to generate documentation
10
from QDoc comments. The comments have types called
11
\l{writing-topic-commands}{topics} that determine whether a comment is a
12
class documentation or a property documentation. A comment may also have
13
\l{writing-markup}{mark up} to enhance the layout and formatting of the
14
final output.
15
16
There are three essential materials for generating documentation with QDoc:
17
\list
18
\li \c QDoc binary
19
\li \c qdocconf configuration files
20
\li \c Documentation in \c C++, \c QML, and \c .qdoc files
21
\endlist
22
23
\l {QDoc Manual} {QDoc} requires \l{https://clang.llvm.org}{Clang} for
24
parsing C++ header and source files, and for parsing the function
25
signatures in \l {fn-command} {\\fn} commands. See
26
\l {Installing Clang for QDoc} for details.
27
28
This section intends to cover the basic necessities for creating a
29
documentation set. Additionally, the guide presents special considerations
30
and options to documenting non-C++ API documentation as well as QML
31
documentation. Finally, the guide will provide a sample project
32
documentation and an example of a QML type documentation.
33
34
For specific QDoc information, consult the
35
\l{QDoc Manual}.
36
\section1 Chapters
37
38
\list 1
39
\li \l{Installing Clang for QDoc}
40
\li \l{Creating QDoc Configuration Files}
41
\li \l{Writing Documentation}
42
\li \l{Categories of Documentation}
43
\list
44
\li \l{C++ Documentation Style}
45
\li \l{QML Documentation Style}
46
\endlist
47
\li \l{Troubleshooting QDoc Warnings}
48
\endlist
49
50
*/
51
52
/*!
53
\page qdoc-guide-conf.html
54
\title Creating QDoc Configuration Files
55
\previouspage Installing Clang for QDoc
56
\nextpage Writing Documentation
57
To generate documentation, QDoc uses configuration files, with the
58
\c qdocconf extension, to store configuration settings.
59
60
The \l{The QDoc Configuration File} article covers the various configuration
61
variables in greater detail.
62
63
\section1 QDoc Configuration Files
64
QDoc's configuration settings can reside in a single \e qdocconf file, but
65
can also be in other qdocconf files. The \c {include(<filepath>)} command
66
allows configuration files to include other configuration files.
67
68
QDoc has two outputs, HTML documentation and documentation in DocBook XML
69
format. The main distinction between the two outputs is that HTML
70
documentation needs to have its HTML styling information in the
71
configuration files. DocBook documentation does not, and a separate process
72
can style the documentation in DocBook at a later time. DocBook therefore
73
more flexible in allowing different styles to apply to the same information.
74
75
To run QDoc, the project configuration file is supplied as an argument.
76
\code
77
qdoc project.qdocconf
78
\endcode
79
80
The project configuration contains information that QDoc uses to create the
81
documentation.
82
83
\section2 Project Information
84
85
QDoc uses the \c project information to generate the documentation.
86
\code
87
project = QDoc Project
88
description = Sample QDoc project
89
\endcode
90
91
\target qdoc-input-output-dir
92
\section2 Input and Output Directories
93
94
Specifying the path to the source directories allow QDoc to find sources and
95
generate documentation.
96
97
\badcode
98
sourcedirs = <path to source code>
99
exampledirs = <path to examples directory>
100
imagedirs = <path to image directory>
101
102
sources.fileextensions = "*.cpp *.qdoc *.mm *.qml"
103
headers.fileextensions = "*.h *.ch *.h++ *.hh *.hpp *.hxx"
104
examples.fileextensions = "*.cpp *.h *.js *.xq *.svg *.xml *.ui *.qhp *.qhcp *.qml"
105
examples.imageextensions = "*.png *.jpeg *.jpg *.gif *.mng"
106
\endcode
107
108
QDoc will process headers and sources from the ones specified in the
109
\c fileextensions variable.
110
111
Likewise, QDoc needs the path to the output directory. The \c outputformats
112
variable determines the type of documentation. These variables should be
113
in separate configuration files to modularize the documentation build.
114
\badcode
115
outputdir = $SAMPLE_PROJECT/doc/html
116
outputformats = HTML
117
\endcode
118
119
QDoc can resolve the paths relative to the qdocconf file as well as
120
environment variables.
121
122
\note During each QDoc run, the output directory is deleted.
123
\section2 Extra Files
124
125
QDoc will output generated documentation into the directory specified in
126
the \l{Input and Output Directories}{output} directory. It is also possible
127
to specify extra files that QDoc should export.
128
129
\badcode
130
HTML.extraimages = extraImage.png \
131
extraImage2.png
132
\endcode
133
134
The \c extraImage.png and the \c extraImage2.png files will be copied to the
135
HTML output directory.
136
137
\section2 Qt Help Framework Configuration
138
139
QDoc will also export a \e {Qt Help Project} file, in a \c qhp file.
140
The qhp file is then used by the \c qhelpgenerator to package the
141
documentation into a \c qch file. Qt Creator and Qt Assistant reads the qch
142
file to display the documentation.
143
144
The \l {Creating Help Project Files} article covers the configuration
145
options.
146
147
\section2 HTML Configuration
148
149
QDoc has an HTML generator that will export a set of documentation into
150
HTML files using various configuration settings. QDoc will place the
151
generated documentation into the directory specified by the \c outputdir
152
variable.
153
154
\badcode
155
outputformats = HTML
156
outputdir = <path to output directory>
157
\endcode
158
159
QDoc needs to know where the styles and templates for generating HTML
160
are located. Typically, the templates directory contains a \c scripts,
161
\c images, and a \c style directory, containing scripts and CSS files.
162
163
The main configuration variables are:
164
\badcode
165
HTML.postheader
166
HTML.postpostheader
167
HTML.footer
168
169
HTML.headerstyles
170
HTML.stylesheets = template/style/style.css \
171
template/style/style1.css
172
173
HTML.scripts = template/scripts/script.js
174
\endcode
175
176
The \c{HTML.headerstyles} variable inserts the style information into the
177
HTML file and the \c{HTML.stylesheets} specifies which files QDoc should
178
copy into the output directory. In addition, QDoc will embed the string
179
in the \c postheader, \c footer, and related variables into each HTML file.
180
181
The \l {Format-specific Configuration Variables} article outlines the usage
182
of each variable.
183
184
\section2 QDoc Index Files
185
186
Documentation projects can link to targets in other projects by specifying
187
a set of dependencies, or a set of direct paths to index file(s) this
188
project depends on. When QDoc generates documentation for a project,
189
it will also generate an \c .index file containing URLs to each linkable
190
entity in the project. Other projects can then define a dependency to the
191
index file in order to link to the documentation within that project.
192
193
\b {See also}: \l {depends-variable}{depends} and
194
\l {indexes-variable}{indexes}.
195
196
\section1 Macros and Other Configurations
197
198
Macros for substituting HTML characters exist and are helpful for generating
199
specific HTML-valid characters.
200
201
\badcode
202
macro.pi.HTML = "Π"
203
\endcode
204
The snippet code will replace any instances of \c{\\pi} with \c Π in the
205
HTML file, which will appear as the Greek \pi symbol when viewed in
206
browsers.
207
208
\b {See also:} \l {macro-variable}{macro}.
209
210
\section2 QML Additions
211
212
QDoc is able to parse QML files for QDoc comments. QDoc will parse files
213
with the QML extension, \c{.qml}, if the extension type is included in the
214
\l{Input and Output Directories}{fileextensions} variable.
215
216
Also, the generated HTML files can have a prefix and a suffix following the
217
QML module name, specified in the QDoc configuration file.
218
\badcode
219
outputprefixes = QML
220
outputprefixes.QML = uicomponents-
221
outputsuffixes = QML
222
outputsuffixes.QML = -tp
223
\endcode
224
225
\b {See also}: \l {outputprefixes-variable}{outputprefixes},
226
\l {outputsuffixes-variable}{outputsuffixes}.
227
228
*/
229
230
/*!
231
\page qdoc-guide-writing.html
232
\title Writing Documentation
233
\previouspage Creating QDoc Configuration Files
234
\nextpage Categories of Documentation
235
236
\section1 QDoc Comments
237
238
Documentation is contained within QDoc \e comments, delimited by
239
\beginqdoc and \endqdoc comments. Note that these are valid comments
240
in C++ and QML.
241
242
Within a QDoc comment, \c {//!} is used as a single-line documentation
243
comment; the comment itself and anything after it, until a newline,
244
is omitted from the generated output.
245
246
QDoc will parse C++ and QML files to look for QDoc comments. To explicitly
247
omit a certain file type, omit it from the
248
\l{Input and Output Directories}{configuration} file.
249
250
\section1 QDoc Commands
251
252
QDoc uses \e commands to retrieve information about the documentation. \c
253
Topic commands determine the type of documentation element, the \c context
254
commands provide hints and information about a topic, and \c markup commands
255
provide information on how QDoc should format a piece of documentation.
256
257
\target writing-topic-commands
258
\section2 QDoc Topics
259
Each QDoc comment must have a \e topic type. A topic distinguishes it from
260
other topics. To specify a topic type, use one of the several
261
\l{Topic Commands}{topic commands}.
262
263
QDoc will collect similar topics and create a page for each one. For
264
example, all the enumerations, properties, functions, and class description
265
of a particular C++ class will reside in one page. A generic page is
266
specified using the \l{page-command}{\\page} command and the filename is the
267
argument.
268
269
Example of topic commands:
270
\list
271
\li \l{enum-command}{\\enum} - for enumeration documentation
272
\li \l{class-command}{\\class} - for C++ class documentation
273
\li \l{qmltype-command}{\\qmltype} - for QML type documentation
274
\li \l{page-command}{\\page} - for creating a page.
275
\endlist
276
277
\section3 Multiple topics
278
279
A QDoc comment can contain multiple topic commands in the same category, with
280
some restrictions. This way, it's possible to write a single comment that
281
documents all overloads of a function (using multiple \l {fn-command}{\\fn}
282
commands), or all properties in a QML property group (using
283
\l {qmlproperty-command}{\\qmlproperty} commands) in one go.
284
285
If a QDoc comment contains multiple topic commands, it's possible to
286
provide additional \e {context commands} for individual topics in
287
follow-up comments:
288
289
\badcode *
290
/\1!
291
\qmlproperty string Type::element.name
292
\qmlproperty int Type::element.id
293
294
\brief Holds the element name and id.
295
\1/
296
297
/\1!
298
\qmlproperty int Type::element.id
299
\readonly
300
\1/
301
\endcode
302
303
Here, the follow-up comment marks the \e element.id property as read-only,
304
while \e element.name remains writable.
305
306
\note A follow-up comment cannot contain any additional text, only
307
\l {writing-context}{context commands} that document the context of
308
the item.
309
310
The \l{Topic Commands} page has information on all of the available topic
311
commands.
312
313
\target writing-context
314
\section2 Topic Contexts
315
316
Context commands give QDoc a hint about the \e context of the topic. For
317
example, if a C++ function is deprecated, then it should be marked as such
318
with the \l{deprecated-command}{\\deprecated} command. Likewise,
319
\l{nextpage-command}{page navigation} and \l{title-command}{page title}
320
give extra page information to QDoc.
321
322
QDoc will create additional links or pages for these contexts. For example,
323
a group is created using the \l{group-command}{\\group} command and the
324
members have the \l{ingroup-command}{\\ingroup} command. The group name is
325
supplied as an argument.
326
327
The \l{Context Commands} page has a listing of all the available context
328
commands.
329
330
\target writing-markup
331
\section2 Documentation Markup
332
333
QDoc can do \e markup of text similar to other markup or
334
documentation tools. QDoc can mark a section of text in \b{bold},
335
when the text is marked up with the \l{b-command}{\\b} command.
336
337
\code
338
\b{This} text will be in \b{bold}.
339
\endcode
340
341
The \l{Markup Commands} page has a full listing of the available markup
342
commands.
343
344
\section1 Anatomy of Documentation
345
346
Essentially, for QDoc to create a page, there must be some essential
347
ingredients present.
348
349
\list
350
\li Assign a topic to a QDoc comment - A comment could be a page, a
351
property documentation, a class documentation, or any of the available
352
\l{Topic Commands}{topic commands}.
353
354
\li Give the topic a context - QDoc can associate certain topics to other
355
pages such as associating deprecated elements when the documentation is
356
marked with \l{deprecated-command}{\\deprecated}.
357
358
\li Mark sections of the document with
359
\l{Markup Commands}{markup commands} - QDoc can create layouts and
360
format the documentation for the documentation.
361
\endlist
362
363
In Qt, the \l{QVector3D} class was documented with the following QDoc
364
comment:
365
\snippet examples/samples.qdocinc qvector3d-class
366
367
It has a constructor, \l{QVector3D::QVector3D()}, which was documented with
368
the following QDoc comment:
369
\snippet examples/samples.qdocinc qvector3d-function
370
371
The different comments may reside in different files and QDoc will collect
372
them depending on their topic and their context. The resulting documentation
373
from the snippets are generated into the \l{QVector3D} class documentation.
374
375
Note that if the documentation immediately precedes the function or class
376
in the source code, then it does not need to have a topic. QDoc will assume
377
that the documentation above the code is the documentation for that code.
378
379
An article is created using \l{page-command}{\\page} command. The first
380
argument is the HTML file that QDoc will create. The topic is supplemented
381
with context commands, the \l{title-command}{\\title} and
382
\l{nextpage-command}{\\nextpage} commands. There are several other
383
QDoc commands such as the \l{list-command}{\\list} command.
384
\snippet examples/samples.qdocinc sample-page
385
386
The section on \l{QDoc Topics}{topic commands} gives an overview on several
387
other topic types.
388
389
390
*/
391
392
/*!
393
\page qdoc-categories.html
394
\title Categories of Documentation
395
\previouspage Writing Documentation
396
\nextpage Troubleshooting QDoc Warnings
397
\brief Describes the different types of documentation pages.
398
399
There are several types of predefined documentation \e categories or
400
\e types:
401
\list
402
\li Article
403
\li C++ API Documentation
404
\li QML Type Documentation
405
\li Code Example
406
\endlist
407
408
QDoc has the ability to format a page depending on the type. Further,
409
stylesheets can provide additional control on the display of each category.
410
411
\section1 API Documentation
412
QDoc excels in the creation of API documentation given a set of source code
413
and documentation in QDoc comments. Specifically, QDoc is aware of Qt's
414
architecture and can validate the existence of Qt C++ class, function, or
415
property documentation. QDoc gives warnings and errors if it cannot
416
associate a documentation with a code entity or if a code entity does not
417
have documentation.
418
419
In general, every Qt code entity such as properties, classes, methods,
420
signals, and enumerations have a corresponding
421
\l{qdoc-topics}{topic command}. QDoc will associate the documentation to the
422
source using C++ naming rules.
423
424
QDoc will parse the header files (typically \c .h files) to build a tree of
425
the class structures. Then QDoc will parse the source files and
426
documentation files to attach documentation to the class structure.
427
Afterwards, QDoc will generate a page for the class.
428
429
\note QDoc uses the header files to inform itself about the class and will
430
not properly process QDoc comments in header files.
431
432
\section2 Language Styles
433
434
To produce quality API documentation, the Qt API references follow a
435
particular language guidelines. While the contents of this page demonstrates
436
how to create API documentation, the style guidelines demonstrate how
437
the reference materials follow a consistent use of language.
438
439
\list
440
\li \l{C++ Documentation Style}
441
\li \l{QML Documentation Style}
442
\endlist
443
444
\keyword qml-documentation
445
\section2 Documenting QML Types
446
447
In the world of \l{Qt Quick}{QML}, there are additional entities we need to
448
document such as QML signals, attached properties, and QML methods.
449
Internally, they use Qt technologies, however, QML API documentation
450
requires different layout and naming conventions from the Qt C++ API
451
documentation.
452
453
A list of QML related QDoc commands:
454
\list
455
\li \l{qmlattachedmethod-command}{\\qmlattachedmethod}
456
\li \l{qmlattachedproperty-command}{\\qmlattachedproperty}
457
\li \l{qmlattachedsignal-command}{\\qmlattachedsignal}
458
\li \l{qmlvaluetype-command}{\\qmlvaluetype}
459
\li \l{qmltype-command}{\\qmltype} - creates a QML type documentation
460
\li \l{qmlmethod-command}{\\qmlmethod}
461
\li \l{qmlproperty-command}{\\qmlproperty}
462
\li \l{qmlsignal-command}{\\qmlsignal}
463
\li \l{inherits-command}{\\inherits}
464
\li \l{qmlmodule-command}{\\qmlmodule}
465
\li \l{inqmlmodule-command}{\\inqmlmodule}
466
\li \l{nativetype-command}{\\nativetype}
467
468
\endlist
469
470
\note Remember to enable QML parsing by including the \c{*.qml} filetype in
471
the \l{qdoc-input-output-dir}{fileextension} variable.
472
473
To document a QML type, start by creating a QDoc comment that uses the
474
\l{qmltype-command} {\\qmltype} command as its topic command.
475
476
\section3 QML Parser
477
478
If your QML type is defined in a \e qml file, document it there.
479
If your QML type is represented by a C++ class, document it in the
480
\e cpp file for that C++ class and include an
481
\l{nativetype-command}{\\nativetype} command to specify the
482
name of the C++ class. Don't document a QML type in a \e{cpp} file
483
if the QML type is defined in a \e{qml} file.
484
485
When documenting a QML type in a \e{qml} file, place each QDoc
486
comment directly above the entity to which the comment applies.
487
For example, place the QDoc comment containing the \e{\\qmltype}
488
command (the topic comment) directly above the outer QML type in
489
the \e{qml} file. Place the comment for documenting a QML property
490
directly above the property declaration, and so on for QML signal
491
handlers and QML methods. Note that when documenting QML
492
properties in a \e{qml} file, you don't normally include the
493
\e{\\qmlproperty} command as a topic command (which you must do
494
when documenting QML types in \e{cpp} files), because the QML
495
parser automatically associates each QDoc comment with the next
496
QML declaration it parses. The same is true for QML signal handler
497
and QML method comments. But it is sometimes useful to include one
498
or more \e{\\qmlproperty} commands in the comment, e.g. when the
499
property type is another QML type and you want the user to only
500
use certain properties within that other QML type, but not all of
501
them. But when documenting a property that has an alias, place the
502
QDoc comment for it directly above the alias declaration. In these
503
cases, the QDoc comment \e must contain a \e{\\qmlproperty}
504
command, because that is the only way QDoc can know the type of
505
the aliased property.
506
507
When documenting a QML type in the \e cpp file of its
508
corresponding C++ class (if it has one), you normally place each
509
QDoc comment directly above the entity it documents. However, QDoc
510
does not use the QML parser to parse these files (the C++ parser
511
is used), so these QML QDoc comments can appear anywhere in the
512
\e{cpp} file. Note that QML QDoc comments in \e cpp files \e must
513
use the QML topic commands. i.e., the \l{qmltype-command}
514
{\\qmltype} command \e must appear in the QDoc comment for the
515
QML type, and a \l{qmlproperty-command} {\\qmlproperty} command \e
516
must appear in each QML property QDoc comment.
517
518
\section3 QML Modules
519
520
A QML type belongs to a \e module. The module
521
may include all the related types for a platform or contain a certain
522
version of \l{Qt Quick}. For example, the Qt Quick 2 QML types belong
523
to the Qt Quick 2 module while there is also a Qt Quick 1 module for the older
524
types introduced in Qt 4.
525
526
QML modules allow grouping QML types. The \l{qmltype-command}
527
{\\qmltype} topic command must have an \l{inqmlmodule-command}
528
{\\inqmlmodule} context command to relate the type to a QML
529
module. Similarly, a \l{qmlmodule-command}{\\qmlmodule} topic
530
command must exist in a separate \c{.qdoc} file to create the
531
overview page for the module. The overview page will list the
532
QML types of the QML module.
533
534
The links to the QML types must therefore also contain the module name.
535
For example, if a type called \c TabWidget is in the \c UIComponents
536
module, it must be linked as \c {UIComponents::TabWidget}.
537
538
\section3 Read-only and Internal QML Properties
539
540
QDoc detects QML properties that are marked as \c readonly. Note that the
541
property must be initialized with a value.
542
543
\badcode
544
readonly property int sampleReadOnlyProperty: 0
545
\endcode
546
547
Properties and signals that are not meant for the public interface may
548
be marked with the \l{internal-command}{\\internal} command. QDoc will not
549
publish the documentation in the generated outputs.
550
551
\section1 Articles & Overviews
552
553
Articles and overviews are a style of writing best used for providing
554
summary detail on a topic or concept. It may introduce a technology or
555
discuss how a concept may be applied, but without discussing exact steps
556
in too much detail. However, this type of content could provide the entry
557
point for readers to find instructional and reference materials that do,
558
such as tutorials, examples and class documentation. An example of an
559
overview might be a product page, such as a top level discussion of
560
Qt Quick, individual modules, design principles, or tools.
561
562
To signify that a document is an article, you append the article keyword
563
to the \\page command:
564
565
\snippet examples/samples.qdocinc sample-overview
566
567
The \l{writing-topic-commands}{writing topic commands} section has a listing
568
of the available \\page command arguments.
569
570
\section1 Code Examples
571
Examples are an effective way to demonstrate practical usage of a given
572
technology or concept. When it comes to middleware this is usually in the
573
form of an application using simple code and clear explanations of what the
574
code is doing. Any module, API, project, pattern etc. should have at least
575
one good example.
576
577
An example may have an accompanying tutorial. The tutorial instructs and
578
describes the code, while the code example is the code content that users
579
may study. Code examples may have accompanying text that are not in the
580
tutorial.
581
582
QDoc will create a page containing the example code with a description
583
using the \l{example-command}{\\example} command.
584
585
\snippet examples/samples.qdocinc sample-example
586
587
QDoc will use the directory specified in the input
588
\l{Input and Output Directories}{exampledirs} variable to find the Qt
589
Project (\c .pro) file to generate the example files. The generated HTML
590
will have the filename, \c {declarative-ui-components-tabwidget.html}. QDoc
591
will also list all of the example code.
592
593
\note The example's project file must be the same as the
594
directory name.
595
*/
596
597
598
/*!
599
\page qdoc-guide-clang.html
600
\title Installing Clang for QDoc
601
\previouspage Getting Started with QDoc
602
\nextpage Creating QDoc Configuration Files
603
604
QDoc uses Clang when parsing C++ files as well as function signatures in
605
\l {fn-command} {\\fn} commands. Clang is part of
606
\l {https://llvm.org/}{the LLVM Compiler Infrastructure Project}.
607
If you're going to build QDoc from source, you must install
608
\l{https://clang.llvm.org}{Clang 17.0} or later.
609
610
\section1 Installation Options
611
612
\section2 Qt's Prebuilt Packages (Recommended)
613
614
Qt provides officially supported prebuilt LLVM/Clang packages that are
615
tested and used for Qt's official builds:
616
617
\list
618
\li Download from:
619
\l {https://download.qt.io/development_releases/prebuilt/libclang/qt/}.
620
\li Available for Windows, macOS, and Linux.
621
\li Support static linking of LLVM/Clang libraries.
622
\li Version alignment with QDoc requirements and Qt’s CI.
623
\endlist
624
625
\note On Windows, Qt's prebuilt packages only support Release builds.
626
627
\section2 System Package Managers
628
629
As an alternative to Qt's prebuilt packages, you can install Clang through
630
system package managers. QDoc specifically needs the Clang compiler
631
libraries and their CMake configuration files. The dependencies are:
632
633
\list
634
\li \c {llvm-<version>} (infrastructure)
635
\li \c {clang-<version>} (compiler and libraries)
636
\li \c {libclang-<version>-dev} (development headers)
637
\li \c {libclang-cpp<version>-dev} (C++ API development files)
638
\endlist
639
640
The following lists some typical invocations of package managers on popular
641
Linux distributions and macOS.
642
643
\section3 Linux
644
LLVM and Clang are separate packages in most distributions. Ensure you
645
install the (versioned) \c {-dev} packages that provide the file
646
\e {ClangConfig.cmake}.
647
648
\list
649
\li \b{Debian/Ubuntu}: \c {apt install libclang-dev clang libclang-cpp-dev}
650
\li \b{Fedora/RHEL}: \c {dnf install clang-devel}
651
\li \b{Arch Linux}: \c {pacman -S clang llvm}
652
\endlist
653
654
\section3 macOS
655
Use Homebrew's \l{https://formulae.brew.sh/formula/llvm}{llvm formula}:
656
\list
657
\li \c {brew install llvm}
658
\li For ARM64 Macs: Configure with
659
\c {LLVM_INSTALL_DIR="/opt/homebrew/opt/llvm"}
660
\li For Intel Macs: Configure with
661
\c {LLVM_INSTALL_DIR="/usr/local/opt/llvm"}
662
\endlist
663
664
\note Qt's build system instructs CMake to look for \e {ClangConfig.cmake}.
665
Make sure your package installation provides this file. The prebuilt binaries
666
from \l{https://releases.llvm.org/download.html} cannot be used, as they miss
667
certain components required by QDoc.
668
669
\section1 Configuration
670
671
When Qt's configure script cannot locate LLVM/Clang libraries, it will
672
display platform-specific installation guidance and the exact configuration
673
commands needed for your system.
674
675
To manually specify a custom LLVM installation location:
676
677
\list
678
\li Set the \c LLVM_INSTALL_DIR variable:
679
\c {configure LLVM_INSTALL_DIR="/path/to/llvm" FEATURE_clang=ON}
680
\li Or add to \c {CMAKE_PREFIX_PATH}:
681
\c {configure CMAKE_PREFIX_PATH="/path/to/llvm" FEATURE_clang=ON}
682
\endlist
683
684
After installing LLVM/Clang libraries, always reconfigure with
685
\c {FEATURE_clang=ON} to enable QDoc compilation.
686
*/
qttools
src
qdoc
qdoc
doc
qdoc-guide
qdoc-guide.qdoc
Generated on
for Qt by
1.16.1