protobuf.nanopb

Provides support for protocol buffers for embedded systems. More...

Since: Qbs 1.18

Properties

Detailed Description

The protobuf.nanopb module provides support for generating nanopb C headers and sources from proto definition files using the nanopb plugin for the protoc tool suitable for embedded systems.

A simple qbs file that uses protobuf can be written as follows:

 CppApplication {
     Depends { name: "protobuf.nanopb" }
     files: ["foo.proto", "main.cpp"]
 }

A generated header now can be included in the C++ sources:

 #include <foo.pb.h>

 int main(int argc, char* argv[]) {
     Foo bar;
     bar.has_answer = true;
     bar.answer = 42;
     return 0;
 }

Nanopb .options files to define nanopb specific proto options are supported.

Relevant File Tags

TagAuto-tagged File NamesSinceDescription
"protobuf.input"*.proto1.13.0Source files with this tag are considered inputs to the protoc compiler.
"protobuf.hpp"1.18.0This tag is attached to the header files generated by protoc compiler.

Property Documentation

compilerName : string

The name of the protoc binary.

Default: "protoc"


compilerPath : string

The path to the protoc binary.

Use this property to override the auto-detected location.

Default: auto-detected


importPaths : pathList

The list of imports that are passed to the protoc tool via the --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 protoc in the same order as specified in this property and protoc output may differ depending on that order.

Default: []


includePath : string

The path where protobuf nanopb C headers are located. Set this property to override the default location.

Default: auto-detected


libraryPath : string

The path where the protobuf nanopb runtime library is located. Set this property to override the default location.

Default: auto-detected


[read-only] outputDir : string

The directory where the protoc compiler generated files are placed.

The value of this property is automatically set by Qbs and cannot be changed by the user.


pluginName : string

The name of the nanopb protoc plugin.

Default: "protoc-gen-nanopb"


pluginPath : string

The path to the nanopb protoc plugin.

Use this property to override the auto-detected location.

Default: auto-detected