xref: /aosp_15_r20/external/pigweed/pw_grpc/BUILD.gn (revision 61c4878ac05f98d0ceed94b57d316916de578985)
1# Copyright 2024 The Pigweed Authors
2#
3# Licensed under the Apache License, Version 2.0 (the "License"); you may not
4# use this file except in compliance with the License. You may obtain a copy of
5# the License at
6#
7#     https://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, WITHOUT
11# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
12# License for the specific language governing permissions and limitations under
13# the License.
14
15import("//build_overrides/pigweed.gni")
16
17import("$dir_pw_build/error.gni")
18import("$dir_pw_build/target_types.gni")
19import("$dir_pw_docgen/docs.gni")
20import("$dir_pw_unit_test/test.gni")
21
22config("public_include_path") {
23  include_dirs = [ "public" ]
24  visibility = [ ":*" ]
25}
26
27pw_source_set("connection") {
28  sources = [ "connection.cc" ]
29  public_configs = [ ":public_include_path" ]
30  public = [ "public/pw_grpc/connection.h" ]
31  deps = [
32    ":hpack",
33    ":send_queue",
34    "$dir_pw_assert",
35    "$dir_pw_async:dispatcher",
36    "$dir_pw_async_basic:dispatcher",
37    "$dir_pw_bytes",
38    "$dir_pw_function",
39    "$dir_pw_log",
40    "$dir_pw_result",
41    "$dir_pw_span",
42    "$dir_pw_status",
43    "$dir_pw_stream",
44    "$dir_pw_string",
45    "$dir_pw_sync:inline_borrowable",
46    "$dir_pw_thread:thread",
47    "$dir_pw_thread:thread_core",
48  ]
49}
50
51pw_source_set("send_queue") {
52  sources = [ "send_queue.cc" ]
53  public = [ "public/pw_grpc/send_queue.h" ]
54  public_configs = [ ":public_include_path" ]
55  deps = [
56    "$dir_pw_async:dispatcher",
57    "$dir_pw_async_basic:dispatcher",
58    "$dir_pw_bytes",
59    "$dir_pw_chrono:system_clock",
60    "$dir_pw_function",
61    "$dir_pw_log",
62    "$dir_pw_result",
63    "$dir_pw_span",
64    "$dir_pw_status",
65    "$dir_pw_stream",
66    "$dir_pw_string",
67    "$dir_pw_sync:lock_annotations",
68    "$dir_pw_sync:mutex",
69    "$dir_pw_thread:thread",
70    "$dir_pw_thread:thread_core",
71  ]
72}
73
74pw_source_set("grpc_channel_output") {
75  public = [ "public/pw_grpc/grpc_channel_output.h" ]
76  public_configs = [ ":public_include_path" ]
77  deps = [
78    ":connection",
79    "$dir_pw_bytes",
80    "$dir_pw_rpc",
81  ]
82}
83
84pw_source_set("pw_rpc_handler") {
85  public = [ "public/pw_grpc/pw_rpc_handler.h" ]
86  sources = [ "pw_rpc_handler.cc" ]
87  public_configs = [ ":public_include_path" ]
88  deps = [
89    ":connection",
90    ":grpc_channel_output",
91    "$dir_pw_bytes",
92    "$dir_pw_log",
93    "$dir_pw_rpc",
94    "$dir_pw_rpc_transport:rpc_transport",
95    "$dir_pw_string",
96  ]
97}
98
99pw_source_set("hpack") {
100  sources = [
101    "hpack.autogen.inc",
102    "hpack.cc",
103    "pw_grpc_private/hpack.h",
104  ]
105  deps = [
106    "$dir_pw_assert",
107    "$dir_pw_bytes",
108    "$dir_pw_log",
109    "$dir_pw_result",
110    "$dir_pw_span",
111    "$dir_pw_status",
112    "$dir_pw_string",
113  ]
114}
115
116pw_test("hpack_test") {
117  sources = [ "hpack_test.cc" ]
118  deps = [ ":hpack" ]
119}
120
121pw_executable("test_pw_rpc_server") {
122  sources = [ "test_pw_rpc_server.cc" ]
123  deps = [
124    ":connection",
125    ":echo_cc.pwpb_rpc",
126    ":grpc_channel_output",
127    ":pw_rpc_handler",
128    "$dir_pw_assert_basic:pw_assert_basic_handler",
129    "$dir_pw_assert_log:assert_backend",
130    "$dir_pw_assert_log:check_backend",
131    "$dir_pw_bytes",
132    "$dir_pw_log",
133    "$dir_pw_result",
134    "$dir_pw_rpc",
135    "$dir_pw_rpc_transport:service_registry",
136    "$dir_pw_span",
137    "$dir_pw_status",
138    "$dir_pw_stream",
139    "$dir_pw_stream:socket_stream",
140    "$dir_pw_string",
141    "$dir_pw_thread:test_thread_context",
142    "$dir_pw_thread:thread",
143  ]
144}
145
146pw_doc_group("docs") {
147  sources = [ "docs.rst" ]
148}
149
150pw_test_group("tests") {
151  group_deps = []
152}
153