capnproto.cpp
Provides support for Cap'n Proto for the C++ language. More...
Since: | Qbs 1.17 |
Properties
- compilerName : string
- compilerPath : string
- importPaths : pathList
- outputDir : string
- useRpc : bool
Detailed Description
The capnproto.cpp
module provides support for generating C++ headers and sources from proto definition files using the capnpc
tool.
A simple qbs file that uses Cap'n Proto can be written as follows:
CppApplication { Depends { name: "capnproto.cpp" } files: ["foo.capnp", "main.cpp"] }
A generated header now can be included in the C++ sources:
#include <foo.capnp.h> int main(int argc, char* argv[]) { ::capnp::MallocMessageBuilder message; auto foo = message.initRoot<Foo>(); foo.setAnswer(42); return 0; }
Relevant File Tags
Tag | Auto-tagged File Names | Since | Description |
---|---|---|---|
"capnproto.input" | *.capnp | 1.17.0 | Source files with this tag are considered inputs to the capnpc compiler. |
Dependencies
This module depends on the capnp
module and on the capnp-rpc
module if useRpc property is true
. These modules are created by the Module Providers via the pkg-config
tool.
Property Documentation
The path to the protoc binary.
Use this property to override the auto-detected location.
Default: auto-detected
The list of import paths that are passed to the capnpc
tool via the --import-path
option.
Default: []
The directory where the capnpc
compiler generated files are placed.
The value of this property is automatically set by Qbs and cannot be changed by the user.
Use this property to enable support for the RPC framework.
A simple qbs file that uses rpc can be written as follows:
Project { CppApplication { Depends { name: "capnproto.cpp"; required: false } name: "server" condition: capnproto.cpp.present && qbs.targetPlatform === qbs.hostPlatform consoleApplication: true capnproto.cpp.useRpc: true files: [ "calculator.capnp", "calculator-server.cpp" ] } CppApplication { Depends { name: "capnproto.cpp"; required: false } name: "client" condition: capnproto.cpp.present && qbs.targetPlatform === qbs.hostPlatform consoleApplication: true capnproto.cpp.useRpc: true files: [ "calculator.capnp", "calculator-client.cpp" ] } }
Default: false