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/suffix.h", 35 "public/pw_bytes/units.h", 36 ] 37 sources = [ "byte_builder.cc" ] 38 public_deps = [ 39 "$dir_pw_bytes:bit", 40 "$dir_pw_containers:iterator", 41 dir_pw_preprocessor, 42 dir_pw_span, 43 dir_pw_status, 44 ] 45} 46 47pw_source_set("alignment") { 48 public_configs = [ ":public_include_path" ] 49 public = [ "public/pw_bytes/alignment.h" ] 50 public_deps = [ 51 ":pw_bytes", 52 dir_pw_assert, 53 dir_pw_preprocessor, 54 ] 55 sources = [ "alignment.cc" ] 56} 57 58pw_source_set("bit") { 59 public_configs = [ ":public_include_path" ] 60 public = [ "public/pw_bytes/bit.h" ] 61 public_deps = [ "$dir_pw_third_party/fuchsia:stdcompat" ] 62} 63 64pw_test_group("tests") { 65 tests = [ 66 ":alignment_test", 67 ":array_test", 68 ":bit_test", 69 ":byte_builder_test", 70 ":endian_test", 71 ":suffix_test", 72 ":units_test", 73 ] 74 group_deps = [ 75 "$dir_pw_preprocessor:tests", 76 "$dir_pw_status:tests", 77 ] 78} 79 80pw_test("alignment_test") { 81 deps = [ ":alignment" ] 82 sources = [ "alignment_test.cc" ] 83} 84 85pw_test("array_test") { 86 deps = [ ":pw_bytes" ] 87 sources = [ "array_test.cc" ] 88} 89 90pw_test("bit_test") { 91 deps = [ ":bit" ] 92 sources = [ "bit_test.cc" ] 93} 94 95pw_test("byte_builder_test") { 96 deps = [ ":pw_bytes" ] 97 sources = [ "byte_builder_test.cc" ] 98} 99 100pw_test("endian_test") { 101 deps = [ ":pw_bytes" ] 102 sources = [ "endian_test.cc" ] 103} 104 105pw_test("suffix_test") { 106 deps = [ ":pw_bytes" ] 107 sources = [ "suffix_test.cc" ] 108 negative_compilation_tests = true 109} 110 111pw_test("units_test") { 112 deps = [ ":pw_bytes" ] 113 sources = [ "units_test.cc" ] 114} 115 116pw_doc_group("docs") { 117 sources = [ "docs.rst" ] 118 report_deps = [ ":byte_builder_size_report" ] 119} 120 121pw_size_diff("byte_builder_size_report") { 122 title = "Using pw::ByteBuilder" 123 124 binaries = [ 125 { 126 target = "size_report:with_byte_builder" 127 base = "size_report:without_byte_builder" 128 label = "Using ByteBuilder vs not using it" 129 }, 130 ] 131} 132