1// Copyright (C) 2018 The Android Open Source Project
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7//      http://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,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15
16package {
17    default_applicable_licenses: ["Android-Apache-2.0"],
18}
19
20cc_library {
21    name: "libcvd_gnss_grpc_proxy",
22    shared_libs: [
23        "libbase",
24        "libcuttlefish_fs",
25        "libcuttlefish_utils",
26        "libjsoncpp",
27        "libprotobuf-cpp-full",
28        "libgrpc++_unsecure",
29    ],
30    static_libs: [
31        "libcuttlefish_host_config",
32        "libgflags",
33    ],
34    cflags: [
35        "-Wno-unused-parameter",
36        "-D_XOPEN_SOURCE",
37    ],
38    generated_headers: [
39        "GnssGrpcProxyStub_h",
40    ],
41    generated_sources: [
42        "GnssGrpcProxyStub_cc",
43    ],
44    export_generated_headers: [
45        "GnssGrpcProxyStub_h",
46    ],
47    defaults: ["cuttlefish_host"],
48    include_dirs: [
49        "external/grpc-grpc/include",
50        "external/protobuf/src",
51    ],
52    target: {
53        darwin: {
54            enabled: true,
55        },
56    },
57}
58
59cc_binary_host {
60    name: "gnss_grpc_proxy",
61    shared_libs: [
62        "libbase",
63        "libcuttlefish_fs",
64        "libcuttlefish_utils",
65        "libjsoncpp",
66        "libprotobuf-cpp-full",
67        "libgrpc++_unsecure",
68    ],
69    static_libs: [
70        "libcuttlefish_host_config",
71        "libgflags",
72        "libcvd_gnss_grpc_proxy",
73        "libgrpc++_reflection",
74    ],
75    srcs: [
76        "gnss_grpc_proxy.cpp",
77    ],
78    cflags: [
79        "-Wno-unused-parameter",
80        "-D_XOPEN_SOURCE",
81    ],
82    defaults: ["cuttlefish_host"],
83    target: {
84        darwin: {
85            enabled: true,
86        },
87    },
88}
89
90filegroup {
91    name: "GnssGrpcProxyProto",
92    srcs: [
93        "gnss_grpc_proxy.proto",
94    ],
95}
96
97genrule {
98    name: "GnssGrpcProxyStub_h",
99    tools: [
100        "aprotoc",
101        "protoc-gen-grpc-cpp-plugin",
102    ],
103    cmd: "$(location aprotoc) -Idevice/google/cuttlefish/host/commands/gnss_grpc_proxy -Iexternal/protobuf/src --plugin=protoc-gen-grpc=$(location protoc-gen-grpc-cpp-plugin) $(in) --grpc_out=$(genDir) --cpp_out=$(genDir)",
104    srcs: [
105        ":GnssGrpcProxyProto",
106    ],
107    out: [
108        "gnss_grpc_proxy.grpc.pb.h",
109        "gnss_grpc_proxy.pb.h",
110    ],
111}
112
113genrule {
114    name: "GnssGrpcProxyStub_cc",
115    tools: [
116        "aprotoc",
117        "protoc-gen-grpc-cpp-plugin",
118    ],
119    cmd: "$(location aprotoc) -Idevice/google/cuttlefish/host/commands/gnss_grpc_proxy -Iexternal/protobuf/src --plugin=protoc-gen-grpc=$(location protoc-gen-grpc-cpp-plugin) $(in) --grpc_out=$(genDir) --cpp_out=$(genDir)",
120    srcs: [
121        ":GnssGrpcProxyProto",
122    ],
123    out: [
124        "gnss_grpc_proxy.grpc.pb.cc",
125        "gnss_grpc_proxy.pb.cc",
126    ],
127}
128