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_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} 25 26pw_source_set("pw_ring_buffer") { 27 public_configs = [ ":public_include_path" ] 28 public_deps = [ 29 "$dir_pw_containers", 30 "$dir_pw_result", 31 "$dir_pw_span", 32 "$dir_pw_status", 33 ] 34 sources = [ "prefixed_entry_ring_buffer.cc" ] 35 public = [ "public/pw_ring_buffer/prefixed_entry_ring_buffer.h" ] 36 deps = [ 37 "$dir_pw_assert:pw_assert", 38 "$dir_pw_varint", 39 ] 40 41 # TODO: b/259746255 - Remove this when everything compiles with -Wconversion. 42 configs = [ "$dir_pw_build:conversion_warnings" ] 43} 44 45pw_test_group("tests") { 46 tests = [ ":prefixed_entry_ring_buffer_test" ] 47} 48 49pw_test("prefixed_entry_ring_buffer_test") { 50 deps = [ 51 ":pw_ring_buffer", 52 "$dir_pw_assert:pw_assert", 53 "$dir_pw_varint", 54 ] 55 sources = [ "prefixed_entry_ring_buffer_test.cc" ] 56} 57 58pw_doc_group("docs") { 59 sources = [ "docs.rst" ] 60 report_deps = [ ":ring_buffer_size" ] 61} 62 63pw_size_diff("ring_buffer_size") { 64 title = "pw::ring_buffer::PrefixedEntryRingBuffer" 65 66 binaries = [ 67 { 68 target = "size_report:ring_buffer_simple" 69 base = "$dir_pw_bloat:bloat_base" 70 label = "Initialize single-reader ring buffer" 71 }, 72 { 73 target = "size_report:ring_buffer_multi" 74 base = "$dir_pw_bloat:bloat_base" 75 label = "Initialize multi-reader ring buffer" 76 }, 77 { 78 target = "size_report:ring_buffer_multi" 79 base = "size_report:ring_buffer_simple" 80 label = "Initialized multi-reader vs. single-reader" 81 }, 82 ] 83} 84