Commit Graph

6 Commits

Author SHA1 Message Date
Wyatt Hepler
8f357f439e CMake build: Change how third party libraries are included
- Always use dir_pw_third_party_nanopb as a path.
- Improve error messages when building Nanopb protos without
  dir_pw_third_party_nanopb set.
- Specify python3 instead of python in case the build isn't run in a
  Python 3 virtual environment.

Change-Id: Id8ca6f7f944348803c0275883fc7125c465235fd
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/38400
Reviewed-by: Keir Mierle <keir@google.com>
Reviewed-by: Alexei Frolov <frolv@google.com>
Pigweed-Auto-Submit: Wyatt Hepler <hepler@google.com>
Commit-Queue: Auto-Submit <auto-submit@pigweed.google.com.iam.gserviceaccount.com>
2021-03-18 00:40:58 +00:00
Wyatt Hepler
752d7d3459 pw_protobuf_compiler: Decouple proto packaging from directory
- Allow specifying prefix and strip_prefix arguments for proto files.
  The proto directory tree is built as specified in the out directory.
- Only invoke protoc from the default toolchain. This prevents duplicate
  protoc invocations.
- Prevent duplicate pw_proto_library Python package definitions anywhere
  in the build.
- Replace implicit handling of standalone external protos with a
  python_package_as_module option.

Change-Id: Id37d8b4d83294f7d3142a389e74ceea96dd4d620
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/34640
Reviewed-by: Alexei Frolov <frolv@google.com>
2021-03-05 20:43:22 +00:00
Wyatt Hepler
d517afc161 pw_protobuf_compiler: Support standalone external protos
Projects may want to use externally defined proto files that are not
organized for Python packaging as required by pw_proto_library. This
change makes it possible to support standalone, externally defined
protobufs, such as nanopb.proto.

Change-Id: I4ae053a950c664878150d911cea9e9de031bb20d
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/31800
Reviewed-by: Alexei Frolov <frolv@google.com>
2021-02-04 22:37:28 +00:00
Wyatt Hepler
c9e51d20b2 CMake: Support protobuf code gen; add pw_rpc
- Add proto.cmake and the pw_proto_library function. Like the GN
  version, this generates code for .proto files.
- Provide CMakeLists.txt for pw_protobuf, pw_rpc, and pw_hdlc_lite.
- Add a Nanopb wrapper CMakeLists.txt with a cache variable for Nanopb,
  similar to the variable for GN.

Change-Id: I15d09af8aa3575a86fc360787b117988a75f569e
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/22841
Reviewed-by: Zoltan Szatmary-Ban <szatmz@google.com>
Reviewed-by: Alexei Frolov <frolv@google.com>
Reviewed-by: Keir Mierle <keir@google.com>
Commit-Queue: Wyatt Hepler <hepler@google.com>
2020-11-05 20:13:44 +00:00
Wyatt Hepler
d49f8fe3f3 BUILD.gn files: Improve import formatting
The "# gn-format disable" comments are no longer necessary. Delete these
comments and reformat with a Vim macro and gn format.

Change-Id: Ia62c40ad73eef91187d0d443d6e3b0fa723e5aa9
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/21380
Reviewed-by: Armando Montanez <amontanez@google.com>
Commit-Queue: Wyatt Hepler <hepler@google.com>
2020-10-15 18:12:55 +00:00
Alexei Frolov
dd6fa5c7bd third_party: Add nanopb BUILD.gn file
This change creates a Pigweed third_party directory and defines a GN
build file for nanopb which exposes a pw_source_set for the nanopb
library from a build arg pointing to a local nanopb installation.

Change-Id: I6779203626abce7821dc3fcef6dcbc11c319b43c
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/15763
Reviewed-by: Keir Mierle <keir@google.com>
2020-08-14 16:58:59 +00:00