| 1 |
// Copyright (C) 2022 The Qt Company Ltd. |
| 2 |
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only |
| 3 |
|
| 4 |
//! [proto_files-li] |
| 5 |
\li \c {PROTO_FILES} |
| 6 |
specifies the list of \e {.proto} files used by the code generation |
| 7 |
procedure. |
| 8 |
//! [proto_files-li] |
| 9 |
|
| 10 |
//! [proto_includes-li] |
| 11 |
\li \c {PROTO_INCLUDES} |
| 12 |
specifies the list of directories to be searched for protobuf dependencies. |
| 13 |
|
| 14 |
\note The location of the \c {PROTO_FILES} is implicitly considered part of |
| 15 |
the protobuf include path. |
| 16 |
//! [proto_includes-li] |
| 17 |
|
| 18 |
//! [output_directory-li] |
| 19 |
\li \c {OUTPUT_DIRECTORY} |
| 20 |
defines the directory where the generated files will be placed. By default, |
| 21 |
the current build directory is used. |
| 22 |
//! [output_directory-li] |
| 23 |
|
| 24 |
//! [generate_package_subfolders-li] |
| 25 |
\li \c {GENERATE_PACKAGE_SUBFOLDERS} |
| 26 |
uses the package name specifier from the \c {.proto} files to create the |
| 27 |
folder structure for the generated files. For example, if the package is |
| 28 |
defined as: \c {package io.qt.test}, the generated files will be placed in |
| 29 |
\e {OUTPUT_DIRECTORY/io/qt/test/}. |
| 30 |
//! [generate_package_subfolders-li] |
| 31 |
|
| 32 |
//! [copy_comments-li] |
| 33 |
\li \c {COPY_COMMENTS} |
| 34 |
copies comments from the \c {.proto} files into the generated code. |
| 35 |
//! [copy_comments-li] |
| 36 |
|
| 37 |
//! [export_macro-cmake-li] |
| 38 |
\li \c {EXPORT_MACRO} |
| 39 |
applies only when creating a new shared library from the \e <target>. This |
| 40 |
option specifies the base name for the export macro used in the generated |
| 41 |
code. The final macro name is constructed as \c |
| 42 |
{QPB_<EXPORT_MACRO>_EXPORT}. If this option is not set, the target name is |
| 43 |
used as \c {EXPORT_MACRO}. |
| 44 |
|
| 45 |
Read \l {Creating Shared Libraries} for further in-depth information. |
| 46 |
//! [export_macro-cmake-li] |
| 47 |
|
| 48 |
//! [export_macro-cli-li] |
| 49 |
\li \c {EXPORT_MACRO} |
| 50 |
defines the base name for the export macro used in the generated code. The |
| 51 |
final macro name is constructed as \c {QPB_<EXPORT_MACRO>_EXPORT}. If this |
| 52 |
option is not set, no export macro is generated. |
| 53 |
|
| 54 |
Since Qt 6.8, the following format is supported: \c |
| 55 |
{EXPORT_MACRO=macro_name[:macro_output_file[:<true|false>]]}. This format |
| 56 |
allows you to specify the name of the header file containing the export |
| 57 |
macro and explicitly control whether it is generated. |
| 58 |
|
| 59 |
\note If \b {<macro_output_file>} is not provided, the option defaults to |
| 60 |
the previous syntax. |
| 61 |
//! [export_macro-cli-li] |
| 62 |
|
| 63 |
//! [output_headers-li] |
| 64 |
\li \c {OUTPUT_HEADERS} |
| 65 |
specifies a variable that will store the list of generated headers. This list |
| 66 |
can be useful for defining custom project install rules. |
| 67 |
//! [output_headers-li] |
| 68 |
|
| 69 |
//! [output_targets-li] |
| 70 |
\li \c {OUTPUT_TARGETS} |
| 71 |
specifies a variable that will store the list of generated targets. This |
| 72 |
list can be useful for defining custom project install rules. |
| 73 |
//! [output_targets-li] |
| 74 |
|
| 75 |
//! [header_guard-li] |
| 76 |
\li \c {HEADER_GUARD} |
| 77 |
specifies the mechanism used for guarding generated header files from |
| 78 |
multiple inclusion. Possible values are \c pragma, \c filename. Defaults |
| 79 |
to \c {filename}. |
| 80 |
Setting the option to \c pragma generates the modern pragma header guard: |
| 81 |
\code |
| 82 |
#pragma once |
| 83 |
... |
| 84 |
\endcode |
| 85 |
Omitting the option or setting the option to \c filename generates the |
| 86 |
\c ifdef wrapping guard, and uses the '.proto' filename as the guard infix: |
| 87 |
\code |
| 88 |
#ifdef MYMESSAGES_QPB_H |
| 89 |
#define MYMESSAGES_QPB_H |
| 90 |
... |
| 91 |
#endif // MYMESSAGES_QPB_H |
| 92 |
\endcode |
| 93 |
Select the preferred guard style according to your project structure. |
| 94 |
//! [header_guard-li] |