1# Copyright 2019 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_toolchain/traits.gni") 21import("$dir_pw_unit_test/test.gni") 22 23config("public_include_path") { 24 include_dirs = [ "public" ] 25} 26 27group("pw_containers") { 28 public_deps = [ 29 ":algorithm", 30 ":flat_map", 31 ":inline_deque", 32 ":inline_queue", 33 ":intrusive_list", 34 ":vector", 35 ] 36} 37 38pw_source_set("algorithm") { 39 public_configs = [ ":public_include_path" ] 40 public = [ 41 "public/pw_containers/algorithm.h", 42 "public/pw_containers/internal/algorithm_internal.h", 43 ] 44} 45 46pw_source_set("filtered_view") { 47 public_configs = [ ":public_include_path" ] 48 public = [ "public/pw_containers/filtered_view.h" ] 49 public_deps = [ 50 dir_pw_assert, 51 dir_pw_preprocessor, 52 ] 53} 54 55pw_source_set("flat_map") { 56 public_configs = [ ":public_include_path" ] 57 public = [ "public/pw_containers/flat_map.h" ] 58 public_deps = [ "$dir_pw_assert:assert" ] 59} 60 61pw_source_set("inline_deque") { 62 public_configs = [ ":public_include_path" ] 63 public_deps = [ 64 ":raw_storage", 65 dir_pw_assert, 66 dir_pw_preprocessor, 67 dir_pw_span, 68 ] 69 public = [ "public/pw_containers/inline_deque.h" ] 70} 71 72pw_source_set("inline_queue") { 73 public_configs = [ ":public_include_path" ] 74 public_deps = [ ":inline_deque" ] 75 public = [ "public/pw_containers/inline_queue.h" ] 76} 77 78pw_source_set("iterator") { 79 public_configs = [ ":public_include_path" ] 80 public_deps = [ dir_pw_polyfill ] 81 public = [ "public/pw_containers/iterator.h" ] 82} 83 84pw_source_set("raw_storage") { 85 public_configs = [ ":public_include_path" ] 86 public = [ "public/pw_containers/internal/raw_storage.h" ] 87 visibility = [ ":*" ] 88} 89 90pw_source_set("test_helpers") { 91 public = [ "pw_containers_private/test_helpers.h" ] 92 sources = [ "test_helpers.cc" ] 93 visibility = [ ":*" ] 94} 95 96pw_source_set("to_array") { 97 public_configs = [ ":public_include_path" ] 98 public = [ "public/pw_containers/to_array.h" ] 99} 100 101pw_source_set("inline_var_len_entry_queue") { 102 public_configs = [ ":public_include_path" ] 103 public_deps = [ dir_pw_varint ] 104 deps = [ dir_pw_assert ] 105 public = [ "public/pw_containers/inline_var_len_entry_queue.h" ] 106 sources = [ "inline_var_len_entry_queue.c" ] 107 108 # TODO: b/259746255 - Remove this when everything compiles with -Wconversion. 109 configs = [ "$dir_pw_build:conversion_warnings" ] 110} 111 112pw_source_set("vector") { 113 public_configs = [ ":public_include_path" ] 114 public_deps = [ 115 dir_pw_assert, 116 dir_pw_preprocessor, 117 ] 118 public = [ "public/pw_containers/vector.h" ] 119} 120 121pw_source_set("wrapped_iterator") { 122 public_configs = [ ":public_include_path" ] 123 public = [ "public/pw_containers/wrapped_iterator.h" ] 124} 125 126pw_source_set("intrusive_list") { 127 public_configs = [ ":public_include_path" ] 128 public = [ 129 "public/pw_containers/internal/intrusive_list_impl.h", 130 "public/pw_containers/intrusive_list.h", 131 ] 132 sources = [ "intrusive_list.cc" ] 133 deps = [ dir_pw_assert ] 134} 135 136pw_test_group("tests") { 137 tests = [ 138 ":algorithm_test", 139 ":filtered_view_test", 140 ":flat_map_test", 141 ":inline_deque_test", 142 ":inline_queue_test", 143 ":intrusive_list_test", 144 ":raw_storage_test", 145 ":to_array_test", 146 ":inline_var_len_entry_queue_test", 147 ":vector_test", 148 ":wrapped_iterator_test", 149 ] 150} 151 152pw_test("algorithm_test") { 153 sources = [ "algorithm_test.cc" ] 154 deps = [ 155 ":algorithm", 156 ":flat_map", 157 ":intrusive_list", 158 ":vector", 159 dir_pw_span, 160 ] 161 162 # TODO: b/259746255 - Remove this when everything compiles with -Wconversion. 163 configs = [ "$dir_pw_build:conversion_warnings" ] 164} 165 166pw_test("filtered_view_test") { 167 sources = [ "filtered_view_test.cc" ] 168 deps = [ 169 ":algorithm", 170 ":filtered_view", 171 ":flat_map", 172 ":intrusive_list", 173 dir_pw_span, 174 ] 175 176 # TODO: b/259746255 - Remove this when everything compiles with -Wconversion. 177 configs = [ "$dir_pw_build:conversion_warnings" ] 178} 179 180pw_test("flat_map_test") { 181 sources = [ "flat_map_test.cc" ] 182 deps = [ 183 ":flat_map", 184 dir_pw_polyfill, 185 ] 186 187 # TODO: b/259746255 - Remove this when everything compiles with -Wconversion. 188 configs = [ "$dir_pw_build:conversion_warnings" ] 189} 190 191pw_test("inline_deque_test") { 192 sources = [ "inline_deque_test.cc" ] 193 deps = [ 194 ":algorithm", 195 ":inline_deque", 196 ":test_helpers", 197 ] 198 negative_compilation_tests = true 199 200 # TODO: b/259746255 - Remove this when everything compiles with -Wconversion. 201 configs = [ "$dir_pw_build:conversion_warnings" ] 202} 203 204pw_test("inline_queue_test") { 205 sources = [ "inline_queue_test.cc" ] 206 deps = [ 207 ":algorithm", 208 ":inline_queue", 209 ":test_helpers", 210 ] 211 negative_compilation_tests = true 212 213 # TODO: b/259746255 - Remove this when everything compiles with -Wconversion. 214 configs = [ "$dir_pw_build:conversion_warnings" ] 215} 216 217pw_test("raw_storage_test") { 218 sources = [ "raw_storage_test.cc" ] 219 deps = [ 220 ":raw_storage", 221 ":test_helpers", 222 ] 223 224 # TODO: b/259746255 - Remove this when everything compiles with -Wconversion. 225 configs = [ "$dir_pw_build:conversion_warnings" ] 226} 227 228pw_test("to_array_test") { 229 sources = [ "to_array_test.cc" ] 230 deps = [ ":to_array" ] 231 232 # TODO: b/259746255 - Remove this when everything compiles with -Wconversion. 233 configs = [ "$dir_pw_build:conversion_warnings" ] 234} 235 236pw_test("inline_var_len_entry_queue_test") { 237 sources = [ 238 "inline_var_len_entry_queue_test.cc", 239 "pw_containers_private/inline_var_len_entry_queue_test_oracle.h", 240 ] 241 deps = [ 242 ":inline_var_len_entry_queue", 243 dir_pw_bytes, 244 ] 245 246 # TODO: b/259746255 - Remove this when everything compiles with -Wconversion. 247 configs = [ "$dir_pw_build:conversion_warnings" ] 248} 249 250pw_test("vector_test") { 251 sources = [ "vector_test.cc" ] 252 deps = [ 253 ":test_helpers", 254 ":vector", 255 ] 256 257 negative_compilation_tests = true 258 259 # TODO: b/259746255 - Remove this when everything compiles with -Wconversion. 260 configs = [ "$dir_pw_build:conversion_warnings" ] 261} 262 263pw_test("wrapped_iterator_test") { 264 sources = [ "wrapped_iterator_test.cc" ] 265 deps = [ ":wrapped_iterator" ] 266 267 # TODO: b/259746255 - Remove this when everything compiles with -Wconversion. 268 configs = [ "$dir_pw_build:conversion_warnings" ] 269} 270 271pw_test("intrusive_list_test") { 272 sources = [ "intrusive_list_test.cc" ] 273 deps = [ 274 ":intrusive_list", 275 ":vector", 276 "$dir_pw_preprocessor", 277 ] 278 negative_compilation_tests = true 279 280 # TODO: b/259746255 - Remove this when everything compiles with -Wconversion. 281 configs = [ "$dir_pw_build:conversion_warnings" ] 282} 283 284pw_doc_group("docs") { 285 sources = [ "docs.rst" ] 286 report_deps = [ ":containers_size_report" ] 287} 288 289pw_size_diff("containers_size_report") { 290 title = "Pigweed containers size report" 291 binaries = [ 292 { 293 target = "size_report:linked_list_one_item" 294 base = "size_report:base" 295 label = "linked list one item" 296 }, 297 { 298 target = "size_report:linked_list_two_item" 299 base = "size_report:base" 300 label = "linked list two item" 301 }, 302 { 303 target = "size_report:linked_list_four_item" 304 base = "size_report:base" 305 label = "linked list four item" 306 }, 307 { 308 target = "size_report:intrusive_list_one_item" 309 base = "size_report:base" 310 label = "intrusive list one item" 311 }, 312 { 313 target = "size_report:intrusive_list_two_item" 314 base = "size_report:base" 315 label = "intrusive list two item" 316 }, 317 { 318 target = "size_report:intrusive_list_four_item" 319 base = "size_report:base" 320 label = "intrusive list four item" 321 }, 322 ] 323} 324