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{How to Resolve 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 = "&Pi;"
203 \endcode
204 The snippet code will replace any instances of \c{\\pi} with \c &Pi; 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 functions 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 How to Resolve 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{qmlattachedproperty-command}{\\qmlattachedproperty}
456 \li \l{qmlattachedsignal-command}{\\qmlattachedsignal}
457 \li \l{qmlvaluetype-command}{\\qmlvaluetype}
458 \li \l{qmltype-command}{\\qmltype} - creates a QML type documentation
459 \li \l{qmlmethod-command}{\\qmlmethod}
460 \li \l{qmlproperty-command}{\\qmlproperty}
461 \li \l{qmlsignal-command}{\\qmlsignal}
462 \li \l{inherits-command}{\\inherits}
463 \li \l{qmlmodule-command}{\\qmlmodule}
464 \li \l{inqmlmodule-command}{\\inqmlmodule}
465 \li \l{nativetype-command}{\\nativetype}
466
467 \endlist
468
469 \note Remember to enable QML parsing by including the \c{*.qml} filetype in
470 the \l{qdoc-input-output-dir}{fileextension} variable.
471
472 To document a QML type, start by creating a QDoc comment that uses the
473 \l{qmltype-command} {\\qmltype} command as its topic command.
474
475 \section3 QML Parser
476
477 If your QML type is defined in a \e qml file, document it there.
478 If your QML type is represented by a C++ class, document it in the
479 \e cpp file for that C++ class and include an
480 \l{nativetype-command}{\\nativetype} command to specify the
481 name of the C++ class. Don't document a QML type in a \e{cpp} file
482 if the QML type is defined in a \e{qml} file.
483
484 When documenting a QML type in a \e{qml} file, place each QDoc
485 comment directly above the entity to which the comment applies.
486 For example, place the QDoc comment containing the \e{\\qmltype}
487 command (the topic comment) directly above the outer QML type in
488 the \e{qml} file. Place the comment for documenting a QML property
489 directly above the property declaration, and so on for QML signal
490 handlers and QML methods. Note that when documenting QML
491 properties in a \e{qml} file, you don't normally include the
492 \e{\\qmlproperty} command as a topic command (which you must do
493 when documenting QML types in \e{cpp} files), because the QML
494 parser automatically associates each QDoc comment with the next
495 QML declaration it parses. The same is true for QML signal handler
496 and QML method comments. But it is sometimes useful to include one
497 or more \e{\\qmlproperty} commands in the comment, e.g. when the
498 property type is another QML type and you want the user to only
499 use certain properties within that other QML type, but not all of
500 them. But when documenting a property that has an alias, place the
501 QDoc comment for it directly above the alias declaration. In these
502 cases, the QDoc comment \e must contain a \e{\\qmlproperty}
503 command, because that is the only way QDoc can know the type of
504 the aliased property.
505
506 When documenting a QML type in the \e cpp file of its
507 corresponding C++ class (if it has one), you normally place each
508 QDoc comment directly above the entity it documents. However, QDoc
509 does not use the QML parser to parse these files (the C++ parser
510 is used), so these QML QDoc comments can appear anywhere in the
511 \e{cpp} file. Note that QML QDoc comments in \e cpp files \e must
512 use the QML topic commands. i.e., the \l{qmltype-command}
513 {\\qmltype} command \e must appear in the QDoc comment for the
514 QML type, and a \l{qmlproperty-command} {\\qmlproperty} command \e
515 must appear in each QML property QDoc comment.
516
517 \section3 QML Modules
518
519 A QML type belongs to a \e module. The module
520 may include all the related types for a platform or contain a certain
521 version of \l{Qt Quick}. For example, the Qt Quick 2 QML types belong
522 to the Qt Quick 2 module while there is also a Qt Quick 1 module for the older
523 types introduced in Qt 4.
524
525 QML modules allow grouping QML types. The \l{qmltype-command}
526 {\\qmltype} topic command must have an \l{inqmlmodule-command}
527 {\\inqmlmodule} context command to relate the type to a QML
528 module. Similarly, a \l{qmlmodule-command}{\\qmlmodule} topic
529 command must exist in a separate \c{.qdoc} file to create the
530 overview page for the module. The overview page will list the
531 QML types of the QML module.
532
533 The links to the QML types must therefore also contain the module name.
534 For example, if a type called \c TabWidget is in the \c UIComponents
535 module, it must be linked as \c {UIComponents::TabWidget}.
536
537 \section3 Read-only and Internal QML Properties
538
539 QDoc detects QML properties that are marked as \c readonly. Note that the
540 property must be initialized with a value.
541
542 \badcode
543 readonly property int sampleReadOnlyProperty: 0
544 \endcode
545
546 Properties and signals that are not meant for the public interface may
547 be marked with the \l{internal-command}{\\internal} command. QDoc will not
548 publish the documentation in the generated outputs.
549
550 \section1 Articles & Overviews
551
552 Articles and overviews are a style of writing best used for providing
553 summary detail on a topic or concept. It may introduce a technology or
554 discuss how a concept may be applied, but without discussing exact steps
555 in too much detail. However, this type of content could provide the entry
556 point for readers to find instructional and reference materials that do,
557 such as tutorials, examples and class documentation. An example of an
558 overview might be a product page, such as a top level discussion of
559 Qt Quick, individual modules, design principles, or tools.
560
561 To signify that a document is an article, you append the article keyword
562 to the \\page command:
563
564 \snippet examples/samples.qdocinc sample-overview
565
566 The \l{writing-topic-commands}{writing topic commands} section has a listing
567 of the available \\page command arguments.
568
569 \section1 Code Examples
570 Examples are an effective way to demonstrate practical usage of a given
571 technology or concept. When it comes to middleware this is usually in the
572 form of an application using simple code and clear explanations of what the
573 code is doing. Any module, API, project, pattern etc. should have at least
574 one good example.
575
576 An example may have an accompanying tutorial. The tutorial instructs and
577 describes the code, while the code example is the code content that users
578 may study. Code examples may have accompanying text that are not in the
579 tutorial.
580
581 QDoc will create a page containing the example code with a description
582 using the \l{example-command}{\\example} command.
583
584 \snippet examples/samples.qdocinc sample-example
585
586 QDoc will use the directory specified in the input
587 \l{Input and Output Directories}{exampledirs} variable to find the Qt
588 Project (\c .pro) file to generate the example files. The generated HTML
589 will have the filename, \c {declarative-ui-components-tabwidget.html}. QDoc
590 will also list all of the example code.
591
592 \note The example's project file must be the same as the
593 directory name.
594*/
595
596
597/*!
598 \page qdoc-guide-clang.html
599 \title Installing Clang for QDoc
600 \previouspage Getting Started with QDoc
601 \nextpage Creating QDoc Configuration Files
602
603 QDoc uses Clang when parsing C++ files as well as function signatures in
604 \l {fn-command} {\\fn} commands. Clang is part of
605 \l {https://llvm.org/}{the LLVM Compiler Infrastructure Project}.
606 If you're going to build QDoc from source, you must install
607 \l{https://clang.llvm.org}{Clang 17.0} or later.
608
609 \section1 Installation Options
610
611 \section2 Qt's Prebuilt Packages (Recommended)
612
613 Qt provides officially supported prebuilt LLVM/Clang packages that are
614 tested and used for Qt's official builds:
615
616 \list
617 \li Download from:
618 \l {https://download.qt.io/development_releases/prebuilt/libclang/qt/}.
619 \li Available for Windows, macOS, and Linux.
620 \li Support static linking of LLVM/Clang libraries.
621 \li Version alignment with QDoc requirements and Qt’s CI.
622 \endlist
623
624 \note On Windows, Qt's prebuilt packages only support Release builds.
625
626 \section2 System Package Managers
627
628 As an alternative to Qt's prebuilt packages, you can install Clang through
629 system package managers. QDoc specifically needs the Clang compiler
630 libraries and their CMake configuration files. The dependencies are:
631
632 \list
633 \li \c {llvm-<version>} (infrastructure)
634 \li \c {clang-<version>} (compiler and libraries)
635 \li \c {libclang-<version>-dev} (development headers)
636 \li \c {libclang-cpp<version>-dev} (C++ API development files)
637 \endlist
638
639 The following lists some typical invocations of package managers on popular
640 Linux distributions and macOS.
641
642 \section3 Linux
643 LLVM and Clang are separate packages in most distributions. Ensure you
644 install the (versioned) \c {-dev} packages that provide the file
645 \e {ClangConfig.cmake}.
646
647 \list
648 \li \b{Debian/Ubuntu}: \c {apt install libclang-dev clang libclang-cpp-dev}
649 \li \b{Fedora/RHEL}: \c {dnf install clang-devel}
650 \li \b{Arch Linux}: \c {pacman -S clang llvm}
651 \endlist
652
653 \section3 macOS
654 Use Homebrew's \l{https://formulae.brew.sh/formula/llvm}{llvm formula}:
655 \list
656 \li \c {brew install llvm}
657 \li For ARM64 Macs: Configure with
658 \c {LLVM_INSTALL_DIR="/opt/homebrew/opt/llvm"}
659 \li For Intel Macs: Configure with
660 \c {LLVM_INSTALL_DIR="/usr/local/opt/llvm"}
661 \endlist
662
663 \note Qt's build system instructs CMake to look for \e {ClangConfig.cmake}.
664 Make sure your package installation provides this file. The prebuilt binaries
665 from \l{https://releases.llvm.org/download.html} cannot be used, as they miss
666 certain components required by QDoc.
667
668 \section1 Configuration
669
670 When Qt's configure script cannot locate LLVM/Clang libraries, it will
671 display platform-specific installation guidance and the exact configuration
672 commands needed for your system.
673
674 To manually specify a custom LLVM installation location:
675
676 \list
677 \li Set the \c LLVM_INSTALL_DIR variable:
678 \c {configure LLVM_INSTALL_DIR="/path/to/llvm" FEATURE_clang=ON}
679 \li Or add to \c {CMAKE_PREFIX_PATH}:
680 \c {configure CMAKE_PREFIX_PATH="/path/to/llvm" FEATURE_clang=ON}
681 \endlist
682
683 After installing LLVM/Clang libraries, always reconfigure with
684 \c {FEATURE_clang=ON} to enable QDoc compilation.
685*/