1 # Copyright 2020 The Pigweed Authors
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
7 # https://www.apache.org/licenses/LICENSE-2.0
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
15 import("//build_overrides/pigweed.gni")
17 import("$dir_pw_build/target_types.gni")
18 import("$dir_pw_docgen/docs.gni")
19 import("$dir_pw_unit_test/test.gni")
22 pw_allocator_POISON_HEAP = false
25 config("default_config") {
26 include_dirs = [ "public" ]
29 config("enable_heap_poison") {
30 if (pw_allocator_POISON_HEAP) {
31 defines = [ "PW_ALLOCATOR_POISON_ENABLE=1" ]
35 group("pw_allocator") {
43 pw_source_set("block") {
44 public_configs = [ ":default_config" ]
45 configs = [ ":enable_heap_poison" ]
46 public = [ "public/pw_allocator/block.h" ]
51 sources = [ "block.cc" ]
54 pw_source_set("freelist") {
55 public_configs = [ ":default_config" ]
56 configs = [ ":enable_heap_poison" ]
57 public = [ "public/pw_allocator/freelist.h" ]
59 "$dir_pw_containers:vector",
62 sources = [ "freelist.cc" ]
65 pw_source_set("freelist_heap") {
66 public_configs = [ ":default_config" ]
67 configs = [ ":enable_heap_poison" ]
68 public = [ "public/pw_allocator/freelist_heap.h" ]
77 sources = [ "freelist_heap.cc" ]
80 pw_test_group("tests") {
84 ":freelist_heap_test",
88 pw_test("block_test") {
89 configs = [ ":enable_heap_poison" ]
91 sources = [ "block_test.cc" ]
94 pw_test("freelist_test") {
95 configs = [ ":enable_heap_poison" ]
96 deps = [ ":freelist" ]
97 sources = [ "freelist_test.cc" ]
100 pw_test("freelist_heap_test") {
101 configs = [ ":enable_heap_poison" ]
102 deps = [ ":freelist_heap" ]
103 sources = [ "freelist_heap_test.cc" ]
106 pw_doc_group("docs") {
107 inputs = [ "doc_resources/pw_allocator_heap_visualizer_demo.png" ]
108 sources = [ "docs.rst" ]