1// Copyright 2023 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: "libcasimir_control_server",
21    shared_libs: [
22        "libprotobuf-cpp-full",
23        "libgrpc++_unsecure",
24    ],
25    static_libs: [
26        "libgflags",
27    ],
28    cflags: [
29        "-Wno-unused-parameter",
30    ],
31    generated_headers: [
32        "CasimirControlServerProto_h",
33    ],
34    generated_sources: [
35        "CasimirControlServerProto_cc",
36    ],
37    export_generated_headers: [
38        "CasimirControlServerProto_h",
39    ],
40    defaults: ["cuttlefish_host"],
41    include_dirs: [
42        "external/grpc-grpc/include",
43        "external/protobuf/src",
44    ],
45    target: {
46        darwin: {
47            enabled: true,
48        },
49    },
50}
51
52cc_binary_host {
53    name: "casimir_control_server",
54    shared_libs: [
55        "libbase",
56        "libcuttlefish_fs",
57        "libcuttlefish_utils",
58        "libprotobuf-cpp-full",
59        "libgrpc++_unsecure",
60    ],
61    static_libs: [
62        "libcuttlefish_host_config",
63        "libgflags",
64        "libcasimir_control_server",
65        "libgrpc++_reflection",
66    ],
67    header_libs: ["casimir_rf_packets_cxx"],
68    srcs: [
69        "casimir_controller.cpp",
70        "main.cpp",
71    ],
72    cflags: [
73        "-Wno-unused-parameter",
74    ],
75    defaults: ["cuttlefish_host"],
76    target: {
77        darwin: {
78            enabled: true,
79        },
80    },
81}
82
83filegroup {
84    name: "CasimirControlServerProto",
85    srcs: [
86        "casimir_control.proto",
87        ":libprotobuf-internal-protos",
88    ],
89}
90
91genrule {
92    name: "CasimirControlServerProto_h",
93    tools: [
94        "aprotoc",
95        "protoc-gen-grpc-cpp-plugin",
96    ],
97    cmd: "$(location aprotoc) -Idevice/google/cuttlefish/host/commands/casimir_control_server -Iexternal/protobuf/src --plugin=protoc-gen-grpc=$(location protoc-gen-grpc-cpp-plugin) $(in) --grpc_out=$(genDir) --cpp_out=$(genDir)",
98    srcs: [
99        ":CasimirControlServerProto",
100    ],
101    out: [
102        "casimir_control.grpc.pb.h",
103        "casimir_control.pb.h",
104    ],
105}
106
107genrule {
108    name: "CasimirControlServerProto_cc",
109    tools: [
110        "aprotoc",
111        "protoc-gen-grpc-cpp-plugin",
112    ],
113    cmd: "$(location aprotoc) -Idevice/google/cuttlefish/host/commands/casimir_control_server -Iexternal/protobuf/src --plugin=protoc-gen-grpc=$(location protoc-gen-grpc-cpp-plugin) $(in) --grpc_out=$(genDir) --cpp_out=$(genDir)",
114    srcs: [
115        ":CasimirControlServerProto",
116    ],
117    out: [
118        "casimir_control.grpc.pb.cc",
119        "casimir_control.pb.cc",
120    ],
121}
122