1*61c4878aSAndroid Build Coastguard Worker# Copyright 2021 The Pigweed Authors 2*61c4878aSAndroid Build Coastguard Worker# 3*61c4878aSAndroid Build Coastguard Worker# Licensed under the Apache License, Version 2.0 (the "License"); you may not 4*61c4878aSAndroid Build Coastguard Worker# use this file except in compliance with the License. You may obtain a copy of 5*61c4878aSAndroid Build Coastguard Worker# the License at 6*61c4878aSAndroid Build Coastguard Worker# 7*61c4878aSAndroid Build Coastguard Worker# https://www.apache.org/licenses/LICENSE-2.0 8*61c4878aSAndroid Build Coastguard Worker# 9*61c4878aSAndroid Build Coastguard Worker# Unless required by applicable law or agreed to in writing, software 10*61c4878aSAndroid Build Coastguard Worker# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 11*61c4878aSAndroid Build Coastguard Worker# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 12*61c4878aSAndroid Build Coastguard Worker# License for the specific language governing permissions and limitations under 13*61c4878aSAndroid Build Coastguard Worker# the License. 14*61c4878aSAndroid Build Coastguard Worker 15*61c4878aSAndroid Build Coastguard Workerimport("//build_overrides/pigweed.gni") 16*61c4878aSAndroid Build Coastguard Worker 17*61c4878aSAndroid Build Coastguard Workerimport("$dir_pw_bloat/bloat.gni") 18*61c4878aSAndroid Build Coastguard Workerimport("$dir_pw_build/target_types.gni") 19*61c4878aSAndroid Build Coastguard Workerimport("$dir_pw_docgen/docs.gni") 20*61c4878aSAndroid Build Coastguard Workerimport("$dir_pw_unit_test/test.gni") 21*61c4878aSAndroid Build Coastguard Worker 22*61c4878aSAndroid Build Coastguard Workerconfig("public_include_path") { 23*61c4878aSAndroid Build Coastguard Worker include_dirs = [ "public" ] 24*61c4878aSAndroid Build Coastguard Worker visibility = [ ":*" ] 25*61c4878aSAndroid Build Coastguard Worker} 26*61c4878aSAndroid Build Coastguard Worker 27*61c4878aSAndroid Build Coastguard Workerpw_source_set("pw_bytes") { 28*61c4878aSAndroid Build Coastguard Worker public_configs = [ ":public_include_path" ] 29*61c4878aSAndroid Build Coastguard Worker public = [ 30*61c4878aSAndroid Build Coastguard Worker "public/pw_bytes/array.h", 31*61c4878aSAndroid Build Coastguard Worker "public/pw_bytes/byte_builder.h", 32*61c4878aSAndroid Build Coastguard Worker "public/pw_bytes/endian.h", 33*61c4878aSAndroid Build Coastguard Worker "public/pw_bytes/span.h", 34*61c4878aSAndroid Build Coastguard Worker "public/pw_bytes/suffix.h", 35*61c4878aSAndroid Build Coastguard Worker "public/pw_bytes/units.h", 36*61c4878aSAndroid Build Coastguard Worker ] 37*61c4878aSAndroid Build Coastguard Worker sources = [ "byte_builder.cc" ] 38*61c4878aSAndroid Build Coastguard Worker public_deps = [ 39*61c4878aSAndroid Build Coastguard Worker "$dir_pw_bytes:bit", 40*61c4878aSAndroid Build Coastguard Worker "$dir_pw_containers:iterator", 41*61c4878aSAndroid Build Coastguard Worker dir_pw_preprocessor, 42*61c4878aSAndroid Build Coastguard Worker dir_pw_span, 43*61c4878aSAndroid Build Coastguard Worker dir_pw_status, 44*61c4878aSAndroid Build Coastguard Worker ] 45*61c4878aSAndroid Build Coastguard Worker} 46*61c4878aSAndroid Build Coastguard Worker 47*61c4878aSAndroid Build Coastguard Workerpw_source_set("alignment") { 48*61c4878aSAndroid Build Coastguard Worker public_configs = [ ":public_include_path" ] 49*61c4878aSAndroid Build Coastguard Worker public = [ "public/pw_bytes/alignment.h" ] 50*61c4878aSAndroid Build Coastguard Worker public_deps = [ 51*61c4878aSAndroid Build Coastguard Worker ":pw_bytes", 52*61c4878aSAndroid Build Coastguard Worker "$dir_pw_third_party/fuchsia:stdcompat", 53*61c4878aSAndroid Build Coastguard Worker dir_pw_assert, 54*61c4878aSAndroid Build Coastguard Worker dir_pw_preprocessor, 55*61c4878aSAndroid Build Coastguard Worker ] 56*61c4878aSAndroid Build Coastguard Worker sources = [ "alignment.cc" ] 57*61c4878aSAndroid Build Coastguard Worker} 58*61c4878aSAndroid Build Coastguard Worker 59*61c4878aSAndroid Build Coastguard Workerpw_source_set("bit") { 60*61c4878aSAndroid Build Coastguard Worker public_configs = [ ":public_include_path" ] 61*61c4878aSAndroid Build Coastguard Worker public = [ "public/pw_bytes/bit.h" ] 62*61c4878aSAndroid Build Coastguard Worker public_deps = [ "$dir_pw_third_party/fuchsia:stdcompat" ] 63*61c4878aSAndroid Build Coastguard Worker} 64*61c4878aSAndroid Build Coastguard Worker 65*61c4878aSAndroid Build Coastguard Workerpw_source_set("packed_ptr") { 66*61c4878aSAndroid Build Coastguard Worker public_configs = [ ":public_include_path" ] 67*61c4878aSAndroid Build Coastguard Worker public = [ "public/pw_bytes/packed_ptr.h" ] 68*61c4878aSAndroid Build Coastguard Worker public_deps = [ 69*61c4878aSAndroid Build Coastguard Worker "$dir_pw_third_party/fuchsia:stdcompat", 70*61c4878aSAndroid Build Coastguard Worker dir_pw_assert, 71*61c4878aSAndroid Build Coastguard Worker ] 72*61c4878aSAndroid Build Coastguard Worker} 73*61c4878aSAndroid Build Coastguard Worker 74*61c4878aSAndroid Build Coastguard Workerpw_test_group("tests") { 75*61c4878aSAndroid Build Coastguard Worker tests = [ 76*61c4878aSAndroid Build Coastguard Worker ":alignment_test", 77*61c4878aSAndroid Build Coastguard Worker ":array_test", 78*61c4878aSAndroid Build Coastguard Worker ":bit_test", 79*61c4878aSAndroid Build Coastguard Worker ":byte_builder_test", 80*61c4878aSAndroid Build Coastguard Worker ":endian_test", 81*61c4878aSAndroid Build Coastguard Worker ":packed_ptr_test", 82*61c4878aSAndroid Build Coastguard Worker ":suffix_test", 83*61c4878aSAndroid Build Coastguard Worker ":units_test", 84*61c4878aSAndroid Build Coastguard Worker ] 85*61c4878aSAndroid Build Coastguard Worker group_deps = [ 86*61c4878aSAndroid Build Coastguard Worker "$dir_pw_preprocessor:tests", 87*61c4878aSAndroid Build Coastguard Worker "$dir_pw_status:tests", 88*61c4878aSAndroid Build Coastguard Worker ] 89*61c4878aSAndroid Build Coastguard Worker} 90*61c4878aSAndroid Build Coastguard Worker 91*61c4878aSAndroid Build Coastguard Workerpw_test("alignment_test") { 92*61c4878aSAndroid Build Coastguard Worker deps = [ ":alignment" ] 93*61c4878aSAndroid Build Coastguard Worker sources = [ "alignment_test.cc" ] 94*61c4878aSAndroid Build Coastguard Worker} 95*61c4878aSAndroid Build Coastguard Worker 96*61c4878aSAndroid Build Coastguard Workerpw_test("array_test") { 97*61c4878aSAndroid Build Coastguard Worker deps = [ ":pw_bytes" ] 98*61c4878aSAndroid Build Coastguard Worker sources = [ "array_test.cc" ] 99*61c4878aSAndroid Build Coastguard Worker} 100*61c4878aSAndroid Build Coastguard Worker 101*61c4878aSAndroid Build Coastguard Workerpw_test("bit_test") { 102*61c4878aSAndroid Build Coastguard Worker deps = [ ":bit" ] 103*61c4878aSAndroid Build Coastguard Worker sources = [ "bit_test.cc" ] 104*61c4878aSAndroid Build Coastguard Worker} 105*61c4878aSAndroid Build Coastguard Worker 106*61c4878aSAndroid Build Coastguard Workerpw_test("byte_builder_test") { 107*61c4878aSAndroid Build Coastguard Worker deps = [ ":pw_bytes" ] 108*61c4878aSAndroid Build Coastguard Worker sources = [ "byte_builder_test.cc" ] 109*61c4878aSAndroid Build Coastguard Worker} 110*61c4878aSAndroid Build Coastguard Worker 111*61c4878aSAndroid Build Coastguard Workerpw_test("endian_test") { 112*61c4878aSAndroid Build Coastguard Worker deps = [ ":pw_bytes" ] 113*61c4878aSAndroid Build Coastguard Worker sources = [ "endian_test.cc" ] 114*61c4878aSAndroid Build Coastguard Worker} 115*61c4878aSAndroid Build Coastguard Worker 116*61c4878aSAndroid Build Coastguard Workerpw_test("packed_ptr_test") { 117*61c4878aSAndroid Build Coastguard Worker deps = [ ":packed_ptr" ] 118*61c4878aSAndroid Build Coastguard Worker sources = [ "packed_ptr_test.cc" ] 119*61c4878aSAndroid Build Coastguard Worker negative_compilation_tests = true 120*61c4878aSAndroid Build Coastguard Worker} 121*61c4878aSAndroid Build Coastguard Worker 122*61c4878aSAndroid Build Coastguard Workerpw_test("suffix_test") { 123*61c4878aSAndroid Build Coastguard Worker deps = [ ":pw_bytes" ] 124*61c4878aSAndroid Build Coastguard Worker sources = [ "suffix_test.cc" ] 125*61c4878aSAndroid Build Coastguard Worker negative_compilation_tests = true 126*61c4878aSAndroid Build Coastguard Worker} 127*61c4878aSAndroid Build Coastguard Worker 128*61c4878aSAndroid Build Coastguard Workerpw_test("units_test") { 129*61c4878aSAndroid Build Coastguard Worker deps = [ ":pw_bytes" ] 130*61c4878aSAndroid Build Coastguard Worker sources = [ "units_test.cc" ] 131*61c4878aSAndroid Build Coastguard Worker} 132*61c4878aSAndroid Build Coastguard Worker 133*61c4878aSAndroid Build Coastguard Workerpw_doc_group("docs") { 134*61c4878aSAndroid Build Coastguard Worker inputs = [ "Kconfig" ] 135*61c4878aSAndroid Build Coastguard Worker sources = [ "docs.rst" ] 136*61c4878aSAndroid Build Coastguard Worker report_deps = [ ":byte_builder_size_report" ] 137*61c4878aSAndroid Build Coastguard Worker} 138*61c4878aSAndroid Build Coastguard Worker 139*61c4878aSAndroid Build Coastguard Workerpw_size_diff("byte_builder_size_report") { 140*61c4878aSAndroid Build Coastguard Worker title = "Using pw::ByteBuilder" 141*61c4878aSAndroid Build Coastguard Worker 142*61c4878aSAndroid Build Coastguard Worker binaries = [ 143*61c4878aSAndroid Build Coastguard Worker { 144*61c4878aSAndroid Build Coastguard Worker target = "size_report:with_byte_builder" 145*61c4878aSAndroid Build Coastguard Worker base = "size_report:without_byte_builder" 146*61c4878aSAndroid Build Coastguard Worker label = "Using ByteBuilder vs not using it" 147*61c4878aSAndroid Build Coastguard Worker }, 148*61c4878aSAndroid Build Coastguard Worker ] 149*61c4878aSAndroid Build Coastguard Worker} 150