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
15package {
16    default_applicable_licenses: ["Android-Apache-2.0"],
17}
18
19cc_library {
20    name: "libcvd_gnss_grpc_proxy",
21    shared_libs: [
22        "libbase",
23        "libcuttlefish_fs",
24        "libcuttlefish_utils",
25        "libgrpc++_unsecure",
26        "libjsoncpp",
27        "libprotobuf-cpp-full",
28    ],
29    static_libs: [
30        "libcuttlefish_host_config",
31        "libgflags",
32    ],
33    cflags: [
34        "-D_XOPEN_SOURCE",
35        "-Wno-unused-parameter",
36    ],
37    generated_headers: [
38        "GnssGrpcProxyStub_h",
39    ],
40    generated_sources: [
41        "GnssGrpcProxyStub_cc",
42    ],
43    export_generated_headers: [
44        "GnssGrpcProxyStub_h",
45    ],
46    defaults: ["cuttlefish_host"],
47    include_dirs: [
48        "external/grpc-grpc/include",
49        "external/protobuf/src",
50    ],
51    target: {
52        darwin: {
53            enabled: true,
54        },
55    },
56}
57
58cc_binary_host {
59    name: "gnss_grpc_proxy",
60    shared_libs: [
61        "libbase",
62        "libcuttlefish_fs",
63        "libcuttlefish_utils",
64        "libgrpc++_unsecure",
65        "libjsoncpp",
66        "libprotobuf-cpp-full",
67    ],
68    static_libs: [
69        "libcuttlefish_host_config",
70        "libcvd_gnss_grpc_proxy",
71        "libgflags",
72        "libgrpc++_reflection",
73    ],
74    srcs: [
75        "gnss_grpc_proxy.cpp",
76    ],
77    cflags: [
78        "-D_XOPEN_SOURCE",
79        "-Wno-unused-parameter",
80    ],
81    defaults: ["cuttlefish_host"],
82    target: {
83        darwin: {
84            enabled: true,
85        },
86    },
87}
88
89filegroup {
90    name: "GnssGrpcProxyProto",
91    srcs: [
92        "gnss_grpc_proxy.proto",
93    ],
94}
95
96genrule {
97    name: "GnssGrpcProxyStub_h",
98    tools: [
99        "aprotoc",
100        "protoc-gen-grpc-cpp-plugin",
101    ],
102    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)",
103    srcs: [
104        ":GnssGrpcProxyProto",
105    ],
106    out: [
107        "gnss_grpc_proxy.grpc.pb.h",
108        "gnss_grpc_proxy.pb.h",
109    ],
110}
111
112genrule {
113    name: "GnssGrpcProxyStub_cc",
114    tools: [
115        "aprotoc",
116        "protoc-gen-grpc-cpp-plugin",
117    ],
118    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)",
119    srcs: [
120        ":GnssGrpcProxyProto",
121    ],
122    out: [
123        "gnss_grpc_proxy.grpc.pb.cc",
124        "gnss_grpc_proxy.pb.cc",
125    ],
126}
127