• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright 2023 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_async2/backend.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("pw_channel") {
28  public_configs = [ ":public_include_path" ]
29  public = [ "public/pw_channel/channel.h" ]
30  public_deps = [
31    "$dir_pw_async2:dispatcher",
32    "$dir_pw_async2:poll",
33    "$dir_pw_multibuf:allocator",
34    "$dir_pw_toolchain:sibling_cast",
35    dir_pw_assert,
36    dir_pw_bytes,
37    dir_pw_multibuf,
38    dir_pw_result,
39    dir_pw_span,
40    dir_pw_status,
41  ]
42  sources = [ "public/pw_channel/internal/channel_specializations.h" ]
43}
44
45pw_source_set("forwarding_channel") {
46  public_configs = [ ":public_include_path" ]
47  public = [ "public/pw_channel/forwarding_channel.h" ]
48  sources = [ "forwarding_channel.cc" ]
49  public_deps = [
50    ":pw_channel",
51    "$dir_pw_multibuf:allocator",
52    "$dir_pw_sync:mutex",
53  ]
54}
55
56pw_test("forwarding_channel_test") {
57  sources = [ "forwarding_channel_test.cc" ]
58  deps = [
59    ":forwarding_channel",
60    "$dir_pw_allocator:testing",
61    "$dir_pw_multibuf:header_chunk_region_tracker",
62    "$dir_pw_multibuf:simple_allocator",
63    dir_pw_preprocessor,
64  ]
65  enable_if = pw_async2_DISPATCHER_BACKEND != ""
66}
67
68pw_source_set("loopback_channel") {
69  public_configs = [ ":public_include_path" ]
70  public = [ "public/pw_channel/loopback_channel.h" ]
71  sources = [ "loopback_channel.cc" ]
72  public_deps = [
73    ":pw_channel",
74    "$dir_pw_multibuf:allocator",
75  ]
76}
77
78pw_test("loopback_channel_test") {
79  sources = [ "loopback_channel_test.cc" ]
80  deps = [
81    ":loopback_channel",
82    "$dir_pw_multibuf:testing",
83  ]
84  enable_if = pw_async2_DISPATCHER_BACKEND != ""
85}
86
87pw_source_set("epoll_channel") {
88  public_configs = [ ":public_include_path" ]
89  public = [ "public/pw_channel/epoll_channel.h" ]
90  sources = [ "epoll_channel.cc" ]
91  public_deps = [
92    ":pw_channel",
93    "$dir_pw_multibuf:allocator",
94    "$dir_pw_sync:mutex",
95  ]
96  deps = [ dir_pw_log ]
97}
98
99pw_test("epoll_channel_test") {
100  sources = [ "epoll_channel_test.cc" ]
101  deps = [
102    ":epoll_channel",
103    "$dir_pw_multibuf:testing",
104    "$dir_pw_thread:sleep",
105    "$dir_pw_thread:thread",
106  ]
107  enable_if =
108      pw_async2_DISPATCHER_BACKEND == "$dir_pw_async2_epoll:dispatcher_backend"
109}
110
111pw_doc_group("docs") {
112  sources = [ "docs.rst" ]
113}
114
115pw_test_group("tests") {
116  tests = [
117    ":channel_test",
118    ":epoll_channel_test",
119    ":forwarding_channel_test",
120    ":loopback_channel_test",
121  ]
122}
123
124pw_test("channel_test") {
125  sources = [ "channel_test.cc" ]
126  deps = [
127    ":pw_channel",
128    "$dir_pw_allocator:testing",
129    "$dir_pw_multibuf:simple_allocator",
130  ]
131  enable_if = pw_async2_DISPATCHER_BACKEND != ""
132  negative_compilation_tests = true
133}
134