QtProtobuf
0.6
Protobuf plugin to generate Qt classes
|
QtProtobuf code generator for protobuf messages and grpc services. More...
QtProtobuf code generator for protobuf messages and grpc services.
QtProtobuf code generator is program to be used in conjunction with proto compiler aka protoc.
It might be used in few ways:
Generator supports options that could be provided as environment variable to tune generation. Following options are supported:
SINGLE - enables single-file generation when for each *.proto* file single pair of *.h* *.cpp* files is generated
MULTI - enables multi-file generation when for each message separate pair of *.h* *.cpp*
QML - enables QML code generation in protobuf classes. If is set QML-related code for lists and QML registration to be generated.
COMMENTS - enables comments copying from .proto files
FOLDER - enables folder-based generation
For CMake based project QtProtobuf has macroses those should be used to generate code and in link it to your project:
qtprotobuf_generate is cmake helper function that automatically generates STATIC library target from your .proto files
TARGET | name of you target that generated code archive will be linked to |
GENERATED_TARGET | name that will be used for generated archive library target. It's usefull when you supposed to have multiple generated targets to be linked to single one. |
OUT_DIR | output directory that will contain generated artifacts. Usually subfolder in build directory should be used |
GENERATED_HEADERS | List of header files expected after generator job finished |
EXCLUDE_HEADERS | List of header files to be excluded from pre-parsed list of expected header files (e.g. nested messages that are not supported by QtProtobuf generator) |
PROTO_FILES | List of .proto files that will be used in generation procedure |
MULTI | Enables multi-files generation mode. If provided in parameter list generator will create pair of header/source files for each message |
QML | Enables QML code generation in protobuf classes. If provided in parameter list QML related code for lists and QML registration to be generated. |
COMMENTS | Enables comments copying from .proto files. If provided in parameter list message and field related comments will be copied to generated header files. |
FOLDER | Enables folder based generation. If provided in parameter list generator will place generated artifacts to folder structure according to package of corresponding .proto file |
FIELDENUM | Enables generation of field numbers as an enum within the message class. |
EXTRA_NAMESPACE | <namespace> Wraps the generated code with the specified namespace(EXPERIMENTAL). |
qtprotobuf_link_target is cmake helper function that links generated protobuf target to your binary
It's useful when you try to link generated target to shared library or/and to executable that doesn't utilize all protobuf generated classes directly from C++ code, but requires them from QML.
TARGET | name of target to link to |
GENERATED_TARGET | protobuf generated target name |
qtprotobuf_generate is qmake helper test function that generates QtProtobuf source code based on files provided by PROTO_FILES global context variable
generate_qml | generate_qml enables/disables QML code generation in protobuf classes. If set to true QML-related code for lists and QML registration to be generated. |