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 19cc_library_static { 20 name: "pw_protobuf", 21 vendor_available: true, 22 export_include_dirs: ["public"], 23 header_libs: [ 24 "fuschia_sdk_lib_fit", 25 "fuschia_sdk_lib_stdcompat", 26 "pw_assert_headers", 27 "pw_assert_log_headers", 28 "pw_function_headers", 29 "pw_log_headers", 30 "pw_log_null_headers", 31 "pw_polyfill_headers", 32 "pw_preprocessor_headers", 33 "pw_result_headers", 34 "pw_span_headers", 35 ], 36 host_supported: true, 37 srcs: [ 38 "decoder.cc", 39 "encoder.cc", 40 "find.cc", 41 "map_utils.cc", 42 "message.cc", 43 "stream_decoder.cc", 44 ], 45 static_libs: [ 46 "pw_bytes", 47 "pw_containers", 48 "pw_status", 49 "pw_stream", 50 "pw_string", 51 "pw_varint", 52 ], 53} 54 55genrule { 56 name: "pw_protobuf_codegen_protos_py", 57 srcs: ["pw_protobuf_codegen_protos/codegen_options.proto"], 58 cmd: "$(location aprotoc) " + 59 "-I$$(dirname $(in)) " + 60 "--python_out=$(genDir) " + 61 "$(in)", 62 out: [ 63 "codegen_options_pb2.py", 64 ], 65 tools: [ 66 "aprotoc", 67 ], 68} 69 70python_library_host { 71 name: "pw_protobuf_codegen_protos_py_lib", 72 srcs: [ 73 ":pw_protobuf_codegen_protos_py", 74 ], 75 pkg_path: "pw_protobuf_codegen_protos", 76} 77 78genrule { 79 name: "pw_protobuf_protos_py", 80 srcs: [ 81 "pw_protobuf_protos/common.proto", 82 "pw_protobuf_protos/field_options.proto", 83 "pw_protobuf_protos/status.proto", 84 ":libprotobuf-internal-descriptor-proto", 85 ], 86 cmd: "$(location aprotoc) " + 87 "-I$$(dirname $(location pw_protobuf_protos/common.proto)) " + 88 "-Iexternal/protobuf/src/ " + 89 "--python_out=$(genDir) " + 90 "$(in)", 91 out: [ 92 "common_pb2.py", 93 "field_options_pb2.py", 94 "status_pb2.py", 95 ], 96 tools: [ 97 "aprotoc", 98 ], 99} 100 101python_library_host { 102 name: "pw_protobuf_protos_py_lib", 103 srcs: [ 104 ":pw_protobuf_protos_py", 105 ], 106 pkg_path: "pw_protobuf_protos", 107}