diff options
Diffstat (limited to 'pw_protobuf_compiler/docs.rst')
-rw-r--r-- | pw_protobuf_compiler/docs.rst | 48 |
1 files changed, 45 insertions, 3 deletions
diff --git a/pw_protobuf_compiler/docs.rst b/pw_protobuf_compiler/docs.rst index 9362ca1bd..31160e865 100644 --- a/pw_protobuf_compiler/docs.rst +++ b/pw_protobuf_compiler/docs.rst @@ -375,13 +375,52 @@ compile them. e.g. deps = [":my_proto"], ) - # Library that depends on generated proto targets. + # Library that depends on only pw_protobuf generated proto targets. + pw_cc_library( + name = "my_proto_only_lib", + srcs = ["my/proto_only.cc"], + deps = [":my_cc_proto.pwpb"], + ) + + # Library that depends on only Nanopb generated proto targets. + pw_cc_library( + name = "my_nanopb_only_lib", + srcs = ["my/nanopb_only.cc"], + deps = [":my_cc_proto.nanopb"], + ) + + # Library that depends on pw_protobuf and pw_rpc/raw. + pw_cc_library( + name = "my_raw_rpc_lib", + srcs = ["my/raw_rpc.cc"], + deps = [ + ":my_cc_proto.pwpb", + ":my_cc_proto.raw_rpc", + ], + ) + pw_cc_library( + name = "my_nanopb_rpc_lib", + srcs = ["my/proto_only.cc"], + deps = [ + ":my_cc_proto.nanopb_rpc", + ], + ) + + + # Library that depends on generated proto targets. Prefer to depend only on + # those generated targets ("my_lib.pwpb", "my_lib.nanopb") that are actually + # required. Note that the .nanopb target may not compile for some proto + # messages, e.g. self-referring messages; + # see https://github.com/nanopb/nanopb/issues/433. pw_cc_library( name = "my_lib", srcs = ["my/lib.cc"], + # This target depends on all generated proto targets + # e.g. name.{pwpb, nanopb, raw_rpc, nanopb_rpc} deps = [":my_cc_proto"], ) + From ``my/lib.cc`` you can now include the generated headers. e.g. @@ -390,10 +429,10 @@ e.g. #include "my_protos/bar.pwpb.h" // and/or RPC headers #include "my_protos/bar.raw_rpc.pb.h + // or + #include "my_protos/bar.nanopb_rpc.pb.h" -.. note:: - Currently only raw RPC is supported by the Bazel build. **Supported Codegen** @@ -401,5 +440,8 @@ Bazel supports the following compiled proto libraries via the specified sub-targets generated by a ``pw_proto_library``. * ``${NAME}.pwpb`` - Generated C++ pw_protobuf code +* ``${NAME}.nanopb`` - Generated C++ nanopb code * ``${NAME}.raw_rpc`` - Generated C++ raw pw_rpc code (no protobuf library) +* ``${NAME}.nanopb_rpc`` - Generated C++ Nanopb pw_rpc code + |