pw_rpc: Add config header; Nanopb struct options
- Add a configuration header for pw_rpc.
- Expose options for configuring how to allocate the buffers for Nanopb
request/response structs and how large to make them by default.
Change-Id: I741fdf852468d6e4200e5338a9dd939751ba19e4
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/26141
Pigweed-Auto-Submit: Wyatt Hepler <hepler@google.com>
Reviewed-by: Keir Mierle <keir@google.com>
Commit-Queue: Auto-Submit <auto-submit@pigweed.google.com.iam.gserviceaccount.com>
diff --git a/pw_rpc/BUILD.gn b/pw_rpc/BUILD.gn
index 4b6d0ea..939f074 100644
--- a/pw_rpc/BUILD.gn
+++ b/pw_rpc/BUILD.gn
@@ -15,19 +15,35 @@
import("//build_overrides/pigweed.gni")
import("$dir_pw_bloat/bloat.gni")
+import("$dir_pw_build/module_config.gni")
import("$dir_pw_build/target_types.gni")
import("$dir_pw_docgen/docs.gni")
import("$dir_pw_protobuf_compiler/proto.gni")
import("$dir_pw_third_party/nanopb/nanopb.gni")
import("$dir_pw_unit_test/test.gni")
-config("default_config") {
+declare_args() {
+ # The build target that overrides the default configuration options for this
+ # module. This should point to a source set that provides defines through a
+ # public config (which may -include a file or add defines directly).
+ pw_rpc_CONFIG = pw_build_DEFAULT_MODULE_CONFIG
+}
+
+config("public_include_path") {
include_dirs = [ "public" ]
visibility = [ ":*" ]
}
+pw_source_set("config") {
+ sources = [ "public/pw_rpc/internal/config.h" ]
+ public_configs = [ ":public_include_path" ]
+ public_deps = [ pw_rpc_CONFIG ]
+ visibility = [ "./*" ]
+ friend = [ "./*" ]
+}
+
pw_source_set("server") {
- public_configs = [ ":default_config" ]
+ public_configs = [ ":public_include_path" ]
public_deps = [ ":common" ]
deps = [ dir_pw_log ]
public = [
@@ -51,7 +67,7 @@
}
pw_source_set("client") {
- public_configs = [ ":default_config" ]
+ public_configs = [ ":public_include_path" ]
public_deps = [ ":common" ]
deps = [ dir_pw_log ]
public = [
@@ -66,7 +82,7 @@
# Classes shared by the server and client.
pw_source_set("common") {
- public_configs = [ ":default_config" ]
+ public_configs = [ ":public_include_path" ]
public_deps = [
":protos.pwpb",
"$dir_pw_containers:intrusive_list",