• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright 2021 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_bloat/bloat.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_bytes") {
28  public_configs = [ ":public_include_path" ]
29  public = [
30    "public/pw_bytes/array.h",
31    "public/pw_bytes/byte_builder.h",
32    "public/pw_bytes/endian.h",
33    "public/pw_bytes/span.h",
34    "public/pw_bytes/units.h",
35  ]
36  sources = [ "byte_builder.cc" ]
37  public_deps = [
38    "$dir_pw_bytes:bit",
39    "$dir_pw_containers:iterator",
40    dir_pw_preprocessor,
41    dir_pw_span,
42    dir_pw_status,
43  ]
44}
45
46pw_source_set("bit") {
47  public_configs = [ ":public_include_path" ]
48  public = [ "public/pw_bytes/bit.h" ]
49  remove_public_deps = [ "*" ]
50}
51
52pw_test_group("tests") {
53  tests = [
54    ":array_test",
55    ":bit_test",
56    ":byte_builder_test",
57    ":endian_test",
58    ":units_test",
59  ]
60  group_deps = [
61    "$dir_pw_preprocessor:tests",
62    "$dir_pw_status:tests",
63  ]
64}
65
66pw_test("array_test") {
67  deps = [ ":pw_bytes" ]
68  sources = [ "array_test.cc" ]
69}
70
71pw_test("bit_test") {
72  deps = [ ":bit" ]
73  sources = [ "bit_test.cc" ]
74}
75
76pw_test("byte_builder_test") {
77  deps = [ ":pw_bytes" ]
78  sources = [ "byte_builder_test.cc" ]
79}
80
81pw_test("endian_test") {
82  deps = [ ":pw_bytes" ]
83  sources = [ "endian_test.cc" ]
84}
85
86pw_test("units_test") {
87  deps = [ ":pw_bytes" ]
88  sources = [ "units_test.cc" ]
89}
90
91pw_doc_group("docs") {
92  sources = [ "docs.rst" ]
93  report_deps = [ ":byte_builder_size_report" ]
94}
95
96pw_size_diff("byte_builder_size_report") {
97  title = "Using pw::ByteBuilder"
98
99  binaries = [
100    {
101      target = "size_report:with_byte_builder"
102      base = "size_report:without_byte_builder"
103      label = "Using ByteBuilder vs not using it"
104    },
105  ]
106}
107