1/* 2 * Copyright (C) 2022 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17package { 18 default_applicable_licenses: ["Android-Apache-2.0"], 19} 20 21genrule { 22 name: "TracingVMProtoStub_h", 23 tools: [ 24 "aprotoc", 25 "protoc-gen-grpc-cpp-plugin", 26 ], 27 cmd: "$(location aprotoc) -I$$(dirname $(in)) --plugin=protoc-gen-grpc=$(location protoc-gen-grpc-cpp-plugin) $(in) --grpc_out=$(genDir) --cpp_out=$(genDir)", 28 srcs: [ 29 "TracingVM.proto", 30 ], 31 out: [ 32 "TracingVM.pb.h", 33 "TracingVM.grpc.pb.h", 34 ], 35} 36 37genrule { 38 name: "TracingVMProtoStub_cc", 39 tools: [ 40 "aprotoc", 41 "protoc-gen-grpc-cpp-plugin", 42 ], 43 cmd: "$(location aprotoc) -I$$(dirname $(in)) --plugin=protoc-gen-grpc=$(location protoc-gen-grpc-cpp-plugin) $(in) --grpc_out=$(genDir) --cpp_out=$(genDir)", 44 srcs: [ 45 "TracingVM.proto", 46 ], 47 out: [ 48 "TracingVM.pb.cc", 49 "TracingVM.grpc.pb.cc", 50 ], 51} 52 53genrule { 54 name: "perfetto_trace_gen_h", 55 tools: [ 56 "aprotoc", 57 "protoc-gen-grpc-cpp-plugin", 58 ], 59 cmd: "$(location aprotoc) -I$$(dirname $(in)) --plugin=protoc-gen-grpc=$(location protoc-gen-grpc-cpp-plugin) $(in) --grpc_out=$(genDir) --cpp_out=$(genDir)", 60 srcs: [ 61 "perfetto_trace.proto", 62 ], 63 out: [ 64 "perfetto_trace.pb.h", 65 ], 66} 67 68 69genrule { 70 name: "perfetto_trace_gen_cc", 71 tools: [ 72 "aprotoc", 73 "protoc-gen-grpc-cpp-plugin", 74 ], 75 cmd: "$(location aprotoc) -I$$(dirname $(in)) --plugin=protoc-gen-grpc=$(location protoc-gen-grpc-cpp-plugin) $(in) --grpc_out=$(genDir) --cpp_out=$(genDir)", 76 srcs: [ 77 "perfetto_trace.proto", 78 ], 79 out: [ 80 "perfetto_trace.pb.cc", 81 ], 82} 83 84cc_library_static { 85 name: "tracing_vm_protos", 86 vendor: true, 87 srcs: [ 88 ":TracingVMProtoStub_cc", 89 ":perfetto_trace_gen_cc", 90 ], 91 host_supported: true, 92 generated_headers: [ 93 "TracingVMProtoStub_h", 94 "perfetto_trace_gen_h", 95 ], 96 export_generated_headers: [ 97 "TracingVMProtoStub_h", 98 "perfetto_trace_gen_h", 99 ], 100 shared_libs: [ 101 "libgrpc++", 102 "libprotobuf-cpp-lite", 103 ], 104 cflags: [ 105 "-O2", 106 "-Wno-error=return-type", 107 "-Wno-sign-compare", 108 "-Wno-sign-promo", 109 "-Wno-unused-parameter", 110 "-fvisibility=hidden", 111 "-DGOOGLE_PROTOBUF_NO_RTTI", 112 "-DGOOGLE_PROTOBUF_NO_STATIC_INITIALIZER", 113 ], 114}