• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright 2020 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/target_types.gni")
18import("$dir_pw_docgen/docs.gni")
19import("$dir_pw_toolchain/generate_toolchain.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_stream") {
28  public_configs = [ ":public_include_path" ]
29  public = [
30    "public/pw_stream/memory_stream.h",
31    "public/pw_stream/null_stream.h",
32    "public/pw_stream/seek.h",
33    "public/pw_stream/stream.h",
34  ]
35  sources = [ "memory_stream.cc" ]
36  public_deps = [
37    dir_pw_assert,
38    dir_pw_bytes,
39    dir_pw_polyfill,
40    dir_pw_result,
41    dir_pw_span,
42    dir_pw_status,
43  ]
44}
45
46pw_source_set("socket_stream") {
47  public_configs = [ ":public_include_path" ]
48  public_deps = [ ":pw_stream" ]
49  deps = [
50    dir_pw_assert,
51    dir_pw_log,
52    dir_pw_string,
53  ]
54  sources = [ "socket_stream.cc" ]
55  public = [ "public/pw_stream/socket_stream.h" ]
56}
57
58pw_source_set("sys_io_stream") {
59  public_configs = [ ":public_include_path" ]
60  public_deps = [
61    "$dir_pw_stream",
62    "$dir_pw_sys_io",
63  ]
64  public = [ "public/pw_stream/sys_io_stream.h" ]
65}
66
67pw_source_set("std_file_stream") {
68  public_configs = [ ":public_include_path" ]
69  public_deps = [ ":pw_stream" ]
70  deps = [ "$dir_pw_assert" ]
71  public = [ "public/pw_stream/std_file_stream.h" ]
72  sources = [ "std_file_stream.cc" ]
73}
74
75pw_source_set("interval_reader") {
76  public_configs = [ ":public_include_path" ]
77  public_deps = [
78    ":pw_stream",
79    dir_pw_assert,
80    dir_pw_status,
81  ]
82  public = [ "public/pw_stream/interval_reader.h" ]
83  sources = [ "interval_reader.cc" ]
84}
85
86pw_doc_group("docs") {
87  sources = [ "docs.rst" ]
88}
89
90pw_test_group("tests") {
91  tests = [
92    ":interval_reader_test",
93    ":memory_stream_test",
94    ":null_stream_test",
95    ":seek_test",
96    ":stream_test",
97  ]
98
99  if (defined(pw_toolchain_SCOPE.is_host_toolchain) &&
100      pw_toolchain_SCOPE.is_host_toolchain) {
101    tests += [ ":std_file_stream_test" ]
102
103    # socket_stream_test doesn't compile on Windows.
104    if (host_os != "win") {
105      tests += [ ":socket_stream_test" ]
106    }
107  }
108}
109
110pw_test("memory_stream_test") {
111  sources = [ "memory_stream_test.cc" ]
112  deps = [ ":pw_stream" ]
113}
114
115pw_test("null_stream_test") {
116  sources = [ "null_stream_test.cc" ]
117  deps = [ ":pw_stream" ]
118}
119
120pw_test("std_file_stream_test") {
121  sources = [ "std_file_stream_test.cc" ]
122  deps = [
123    ":std_file_stream",
124    "$dir_pw_assert",
125    "$dir_pw_bytes",
126    "$dir_pw_containers",
127    "$dir_pw_random",
128    "$dir_pw_result",
129    "$dir_pw_status",
130    "$dir_pw_string",
131  ]
132}
133
134pw_test("seek_test") {
135  sources = [ "seek_test.cc" ]
136  deps = [ ":pw_stream" ]
137}
138
139pw_test("stream_test") {
140  sources = [ "stream_test.cc" ]
141  deps = [ ":pw_stream" ]
142}
143
144pw_test("interval_reader_test") {
145  sources = [ "interval_reader_test.cc" ]
146  deps = [ ":interval_reader" ]
147}
148
149pw_test("socket_stream_test") {
150  sources = [ "socket_stream_test.cc" ]
151  deps = [ ":socket_stream" ]
152}
153