Fix for x86_64 build fail
[platform/upstream/connectedhomeip.git] / third_party / pigweed / repo / pw_allocator / BUILD.gn
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
15 import("//build_overrides/pigweed.gni")
16
17 import("$dir_pw_build/target_types.gni")
18 import("$dir_pw_docgen/docs.gni")
19 import("$dir_pw_unit_test/test.gni")
20
21 declare_args() {
22   pw_allocator_POISON_HEAP = false
23 }
24
25 config("default_config") {
26   include_dirs = [ "public" ]
27 }
28
29 config("enable_heap_poison") {
30   if (pw_allocator_POISON_HEAP) {
31     defines = [ "PW_ALLOCATOR_POISON_ENABLE=1" ]
32   }
33 }
34
35 group("pw_allocator") {
36   public_deps = [
37     ":block",
38     ":freelist",
39     ":freelist_heap",
40   ]
41 }
42
43 pw_source_set("block") {
44   public_configs = [ ":default_config" ]
45   configs = [ ":enable_heap_poison" ]
46   public = [ "public/pw_allocator/block.h" ]
47   public_deps = [
48     "$dir_pw_assert",
49     "$dir_pw_status",
50   ]
51   sources = [ "block.cc" ]
52 }
53
54 pw_source_set("freelist") {
55   public_configs = [ ":default_config" ]
56   configs = [ ":enable_heap_poison" ]
57   public = [ "public/pw_allocator/freelist.h" ]
58   public_deps = [
59     "$dir_pw_containers:vector",
60     "$dir_pw_status",
61   ]
62   sources = [ "freelist.cc" ]
63 }
64
65 pw_source_set("freelist_heap") {
66   public_configs = [ ":default_config" ]
67   configs = [ ":enable_heap_poison" ]
68   public = [ "public/pw_allocator/freelist_heap.h" ]
69   public_deps = [
70     ":block",
71     ":freelist",
72   ]
73   deps = [
74     "$dir_pw_assert",
75     "$dir_pw_log",
76   ]
77   sources = [ "freelist_heap.cc" ]
78 }
79
80 pw_test_group("tests") {
81   tests = [
82     ":block_test",
83     ":freelist_test",
84     ":freelist_heap_test",
85   ]
86 }
87
88 pw_test("block_test") {
89   configs = [ ":enable_heap_poison" ]
90   deps = [ ":block" ]
91   sources = [ "block_test.cc" ]
92 }
93
94 pw_test("freelist_test") {
95   configs = [ ":enable_heap_poison" ]
96   deps = [ ":freelist" ]
97   sources = [ "freelist_test.cc" ]
98 }
99
100 pw_test("freelist_heap_test") {
101   configs = [ ":enable_heap_poison" ]
102   deps = [ ":freelist_heap" ]
103   sources = [ "freelist_heap_test.cc" ]
104 }
105
106 pw_doc_group("docs") {
107   inputs = [ "doc_resources/pw_allocator_heap_visualizer_demo.png" ]
108   sources = [ "docs.rst" ]
109 }