/**************************************************************************** ** ** Copyright (C) 2018 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of Qbs. ** ** $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$ ** ****************************************************************************/ /*! \contentspage index.html \qmltype protobuf.cpp \inqmlmodule QbsModules \since Qbs 1.13 \brief Provides support for protocol buffers for the C++ language. The \c protobuf.cpp module provides support for generating C++ headers and sources from proto definition files using the \l protoc tool. A simple qbs file that uses protobuf can be written as follows: \code CppApplication { Depends { name: "protobuf.cpp" } files: ["foo.proto", "main.cpp"] } \endcode A generated header now can be included in the C++ sources: \code #include int main(int argc, char* argv[]) { Foo bar; bar.set_answer(42); google::protobuf::ShutdownProtobufLibrary(); return 0; } \endcode \section2 Relevant File Tags \table \header \li Tag \li Auto-tagged File Names \li Since \li Description \row \li \c{"protobuf.input"} \li \c{*.proto} \li 1.13.0 \li Source files with this tag are considered inputs to the \c protoc compiler. \row \li \c{"protobuf.grpc"} \li \li 1.14.0 \li Source files with this tag are considered as gRPC files. \endtable */ /*! \qmlproperty string protobuf.cpp::grpcIncludePath The path where grpc++ headers are located. Set this property to override the default location. \defaultvalue \c auto-detected */ /*! \qmlproperty string protobuf.cpp::grpcLibraryPath The path where the grpc++ library is located. Set this property to override the default location. \defaultvalue \c auto-detected */ /*! \qmlproperty string protobuf.cpp::protocBinary The command to invoke when compiling proto definition files. \defaultvalue \c auto-detected */ /*! \qmlproperty pathList protobuf.cpp::importPaths The list of imports that are passed to the \c protoc tool via the \c --proto_path option. These imports should contain the proto files. They are used to determine the relative structure of the generated files. \note The paths are passed to \c protoc in the same order as specified in this property and \c protoc output may differ depending on that order. \defaultvalue \c [] */ /*! \qmlproperty string protobuf.cpp::includePath The path where protobuf C++ headers are located. Set this property to override the default location. \defaultvalue \c auto-detected */ /*! \qmlproperty string protobuf.cpp::libraryPath The path where the protobuf C++ library is located. Set this property to override the default location. \defaultvalue \c auto-detected */ /*! \qmlproperty bool protobuf.cpp::useGrpc Whether to use gRPC framework. Use this property to enable support for the modern open source high performance RPC framework by Google, gRPC (\l{https://www.grpc.io}). A simple qbs file that uses grpc can be written as follows: \code CppApplication { Depends { name: "protobuf.cpp" } protobuf.cpp.useGrpc: true files: ["main.cpp"] Group { files: "grpc.proto" fileTags: "protobuf.grpc" } } \endcode \note that \c protobuf.grpc tag should be assigned manually because gRPC uses same \c *.proto files and \QBS can't detect whether to generate gRPC or \c protobuf. The following \c grpc.proto file... \code syntax = "proto3"; package Qbs; message Request { string name = 1; } message Response { string name = 1; } service Grpc { rpc doWork(Request) returns (Response) {} } \endcode ...can be used in the C++ sources as follows: \code #include class Service final : public Qbs::Grpc::Service { grpc::Status doWork( grpc::ServerContext* context, const Qbs::Request* request, Qbs::Response* reply) override { (void)context; reply->set_name(request->name()); return grpc::Status::OK; } }; \endcode \defaultvalue \c false */