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        "libgrpc++_unsecure",
23        "libprotobuf-cpp-full",
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        "libgrpc++_unsecure",
59        "libprotobuf-cpp-full",
60    ],
61    static_libs: [
62        "libcasimir_control_server",
63        "libcuttlefish_host_config",
64        "libgflags",
65        "libgrpc++_reflection",
66    ],
67    header_libs: ["casimir_rf_packets_cxx"],
68    srcs: [
69        "casimir_controller.cpp",
70        "hex.cpp",
71        "main.cpp",
72    ],
73    cflags: [
74        "-Wno-unused-parameter",
75    ],
76    defaults: ["cuttlefish_host"],
77    target: {
78        darwin: {
79            enabled: true,
80        },
81    },
82}
83
84filegroup {
85    name: "CasimirControlServerProto",
86    srcs: [
87        ":libprotobuf-internal-protos",
88        "casimir_control.proto",
89    ],
90}
91
92genrule {
93    name: "CasimirControlServerProto_h",
94    tools: [
95        "aprotoc",
96        "protoc-gen-grpc-cpp-plugin",
97    ],
98    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)",
99    srcs: [
100        ":CasimirControlServerProto",
101    ],
102    out: [
103        "casimir_control.grpc.pb.h",
104        "casimir_control.pb.h",
105    ],
106}
107
108genrule {
109    name: "CasimirControlServerProto_cc",
110    tools: [
111        "aprotoc",
112        "protoc-gen-grpc-cpp-plugin",
113    ],
114    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)",
115    srcs: [
116        ":CasimirControlServerProto",
117    ],
118    out: [
119        "casimir_control.grpc.pb.cc",
120        "casimir_control.pb.cc",
121    ],
122}
123