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
compilerName : string |
The name of the capnp binary.
Default: "capnpc"
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 import paths that are passed to the capnpc
tool via the --import-path
option.
Default: []
outputDir : string |
The directory where the capnpc
compiler generated files are placed.
Default: product.buildDirectory
+ "/capnp"
useRpc : bool |
Use this property to enable support for the RPC framework.
A simple qbs file that uses rpc can be written as follows:
import qbs.Host Project { CppApplication { Depends { name: "capnproto.cpp"; required: false } name: "server" condition: capnproto.cpp.present && qbs.targetPlatform === Host.platform() 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 === Host.platform() consoleApplication: true capnproto.cpp.useRpc: true files: [ "calculator.capnp", "calculator-client.cpp" ] } }
Default: false
© 2023 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.