xref: /aosp_15_r20/external/pigweed/pw_rpc/nanopb/Android.bp (revision 61c4878ac05f98d0ceed94b57d316916de578985)
1// Copyright 2022 The Pigweed Authors
2//
3// Licensed under the Apache License, Version 2.0 (the "License"); you may not
4// use this file except in compliance with the License. You may obtain a copy of
5// the License at
6//
7//     https://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
11// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
12// License for the specific language governing permissions and limitations under
13// the License.
14
15package {
16    default_applicable_licenses: ["external_pigweed_license"],
17}
18
19filegroup {
20    name: "pw_rpc_nanopb_src_files",
21    srcs: [
22        "common.cc",
23        "method.cc",
24        "server_reader_writer.cc",
25    ],
26}
27
28cc_library_headers {
29    name: "pw_rpc_nanopb_include_dirs",
30    cpp_std: "c++20",
31    export_include_dirs: [
32        "public",
33    ],
34    vendor_available: true,
35    host_supported: true,
36}
37
38// This rule must be instantiated, i.e.
39//
40//   cc_library_static {
41//       name: "pw_rpc_nanopb_<instance_name>",
42//       defaults: [
43//           "pw_rpc_cflags_<instance_name>",
44//           "pw_rpc_nanopb_defaults",
45//       ],
46//       static_libs: [
47//           "pw_rpc_raw_<instance_name>",
48//           "pw_rpc_<instance_name>",
49//       ],
50//       export_static_lib_headers: [
51//           "pw_rpc_raw_<instance_name>",
52//           "pw_rpc_<instance_name>",
53//       ],
54//   }
55//
56// where pw_rpc_cflags_<instance_name> defines your flags, i.e.
57//
58//   cc_defaults {
59//       name: "pw_rpc_cflags_<instance_name>",
60//       cflags: [
61//           "-DPW_RPC_USE_GLOBAL_MUTEX=0",
62//           "-DPW_RPC_COMPLETION_REQUEST_CALLBACK",
63//           "-DPW_RPC_DYNAMIC_ALLOCATION",
64//       ],
65//   }
66//
67// see pw_rpc_defaults, pw_rpc_raw_defaults
68cc_defaults {
69    name: "pw_rpc_nanopb_defaults",
70    cpp_std: "c++20",
71    static_libs: [
72        "libprotobuf-c-nano",
73    ],
74    header_libs: [
75        "pw_rpc_nanopb_include_dirs",
76    ],
77    export_header_lib_headers: [
78        "pw_rpc_nanopb_include_dirs",
79    ],
80    srcs: [
81        ":pw_rpc_nanopb_src_files",
82    ],
83}
84