// Copyright (C) 2022 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only

/*!
\page qtgrpcgen-qt-tool.html
\brief An overview of the qtgrpcgen tool and how to use it.
\title The qtgrpcgen Tool
\inmodule Qt GRPC

The \c qtgrpcgen tool can be used to generate Qt GRPC service classes from a
protobuf schema. The tool is provided by the CMake \c {Qt6::GrpcTools}
package. It works as an extension to Google's \c protoc tool.

\badcode
    find_package(Qt6 COMPONENTS GrpcTools REQUIRED)
\endcode

\section1 Usage

Qt provides CMake functions that ease the use of the \c qtgrpcgen tool.
When using CMake as a build tool you should prefer using the Qt CMake API.
For build systems other than CMake, adapt the commands described in
\l{Running qtgrpcgen manually}.

\note there is no explicit support for building gRPC and Protobuf
applications using the Qt GRPC module with \e qmake.

\section2 CMake
The following CMake commands integrate a gRPC service into a Qt project.

\target cmake-commands-qtgrpc
\annotatedlist cmake-commands-qtgrpc

Usually \c qtgrpcgen would be invoked through CMake using the
\c{qt_add_grpc} macro, as shown in the following example:

\include qt-add-grpc-example.qdocinc

\section2 Running \c qtgrpcgen manually

\badcode
    protoc --plugin=protoc-gen-qtgrpc=<path/to/bin/>qtgrpcgen \
        --qtgrpc_out="[<options>:]<output_dir>" \
        [--qtgrpc_opt="<options>"] \
        [-I/extra/proto/include/path] \
        <protofile>.proto
\endcode

The \c{options} argument is a semicolon-separated list of \l{Options}.
It can be passed by prepending the \c options to the \c output_dir argument,
delimited by a colon, or through a separate argument, \c{--qtgrpc_opt}.
You also can pass the corresponding keys as the \c{QT_GRPC_OPTIONS}
environment variable. Keys must be presented as a semicolon-separated list:
\badcode
    export QT_GRPC_OPTIONS="COPY_COMMENTS;GENERATE_PACKAGE_SUBFOLDERS;EXTRA_NAMESPACE=MyTopLevelNamespace"
\endcode

\section2 Options
The generator supports options that can be provided to tune generation.
Options have direct aliases in the \l{qt_add_grpc} function. The following
options are supported:

\list
    \include qtprotogen-options.qdocinc 0
\endlist
*/
