• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright 2024 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_build/target_types.gni")
18import("$dir_pw_unit_test/test.gni")
19
20config("public_include_path") {
21  include_dirs = [ "public" ]
22  visibility = [ ":*" ]
23}
24
25pw_source_set("result") {
26  public_configs = [ ":public_include_path" ]
27  public = [ "public/pw_allocator/block/result.h" ]
28  public_deps = [
29    "$dir_pw_allocator:hardening",
30    dir_pw_assert,
31    dir_pw_status,
32  ]
33}
34
35# Block mixins
36
37pw_source_set("alignable") {
38  public_configs = [ ":public_include_path" ]
39  public = [ "public/pw_allocator/block/alignable.h" ]
40  public_deps = [
41    ":allocatable",
42    "$dir_pw_allocator:hardening",
43    "$dir_pw_bytes:alignment",
44    "$dir_pw_third_party/fuchsia:stdcompat",
45    dir_pw_allocator,
46    dir_pw_status,
47  ]
48}
49
50pw_source_set("allocatable") {
51  public_configs = [ ":public_include_path" ]
52  public = [ "public/pw_allocator/block/allocatable.h" ]
53  public_deps = [
54    ":contiguous",
55    ":result",
56    "$dir_pw_allocator:hardening",
57    "$dir_pw_bytes:alignment",
58    dir_pw_allocator,
59    dir_pw_status,
60  ]
61}
62
63pw_source_set("basic") {
64  public_configs = [ ":public_include_path" ]
65  public = [ "public/pw_allocator/block/basic.h" ]
66  public_deps = [
67    "$dir_pw_allocator:hardening",
68    "$dir_pw_bytes:alignment",
69    "$dir_pw_third_party/fuchsia:stdcompat",
70    dir_pw_result,
71    dir_pw_status,
72  ]
73  sources = [ "basic.cc" ]
74  deps = [ dir_pw_assert ]
75}
76
77pw_source_set("contiguous") {
78  public_configs = [ ":public_include_path" ]
79  public = [ "public/pw_allocator/block/contiguous.h" ]
80  public_deps = [
81    ":basic",
82    "$dir_pw_allocator:hardening",
83    "$dir_pw_third_party/fuchsia:stdcompat",
84    dir_pw_bytes,
85  ]
86  sources = [ "contiguous.cc" ]
87  deps = [ dir_pw_assert ]
88}
89
90pw_source_set("iterable") {
91  public_configs = [ ":public_include_path" ]
92  public = [ "public/pw_allocator/block/iterable.h" ]
93  public_deps = [ ":contiguous" ]
94}
95
96pw_source_set("poisonable") {
97  public_configs = [ ":public_include_path" ]
98  public = [ "public/pw_allocator/block/poisonable.h" ]
99  public_deps = [
100    ":contiguous",
101    "$dir_pw_allocator:config",
102    "$dir_pw_allocator:hardening",
103    "$dir_pw_third_party/fuchsia:stdcompat",
104  ]
105  sources = [ "poisonable.cc" ]
106  deps = [ dir_pw_assert ]
107}
108
109pw_source_set("with_layout") {
110  public_configs = [ ":public_include_path" ]
111  public = [ "public/pw_allocator/block/with_layout.h" ]
112  public_deps = [
113    ":alignable",
114    "$dir_pw_allocator:hardening",
115    dir_pw_allocator,
116  ]
117}
118
119# Block implementations
120
121pw_source_set("detailed_block") {
122  public_configs = [ ":public_include_path" ]
123  public = [ "public/pw_allocator/block/detailed_block.h" ]
124  public_deps = [
125    ":alignable",
126    ":allocatable",
127    ":basic",
128    ":contiguous",
129    ":iterable",
130    ":poisonable",
131    ":with_layout",
132    "$dir_pw_allocator:hardening",
133    dir_pw_allocator,
134    dir_pw_assert,
135    dir_pw_bytes,
136    dir_pw_status,
137  ]
138}
139
140pw_source_set("small_block_base") {
141  public_configs = [ ":public_include_path" ]
142  public = [ "public/pw_allocator/block/small_block_base.h" ]
143  public_deps = [
144    ":allocatable",
145    ":basic",
146    ":contiguous",
147    ":iterable",
148    "$dir_pw_allocator/bucket:fast_sorted",
149    dir_pw_bytes,
150  ]
151}
152
153pw_source_set("small_block") {
154  public_configs = [ ":public_include_path" ]
155  public = [ "public/pw_allocator/block/small_block.h" ]
156  public_deps = [ ":small_block_base" ]
157}
158
159pw_source_set("small_alignable_block") {
160  public_configs = [ ":public_include_path" ]
161  public = [ "public/pw_allocator/block/small_alignable_block.h" ]
162  public_deps = [
163    ":alignable",
164    ":small_block_base",
165  ]
166}
167
168pw_source_set("tiny_block") {
169  public_configs = [ ":public_include_path" ]
170  public = [ "public/pw_allocator/block/tiny_block.h" ]
171  public_deps = [ ":small_block_base" ]
172}
173
174# Testing
175
176pw_source_set("testing") {
177  public = [
178    "public/pw_allocator/block/testing.h",
179    "public/pw_allocator/block/unit_tests.h",
180  ]
181  public_deps = [
182    ":allocatable",
183    ":result",
184    "$dir_pw_allocator:testing",
185    "$dir_pw_bytes:alignment",
186    "$dir_pw_third_party/fuchsia:stdcompat",
187    dir_pw_assert,
188    dir_pw_status,
189  ]
190}
191
192pw_test("result_test") {
193  deps = [
194    ":basic",
195    ":result",
196    dir_pw_status,
197  ]
198  sources = [ "result_test.cc" ]
199}
200
201pw_test("detailed_block_test") {
202  deps = [
203    ":testing",
204    "$dir_pw_bytes:alignment",
205    "$dir_pw_third_party/fuchsia:stdcompat",
206    dir_pw_assert,
207    dir_pw_bytes,
208    dir_pw_span,
209    dir_pw_status,
210  ]
211  sources = [ "detailed_block_test.cc" ]
212}
213
214pw_test("small_block_test") {
215  sources = [ "small_block_test.cc" ]
216  deps = [
217    ":small_block",
218    ":testing",
219  ]
220}
221
222pw_test("small_alignable_block_test") {
223  sources = [ "small_alignable_block_test.cc" ]
224  deps = [
225    ":small_alignable_block",
226    ":testing",
227  ]
228}
229
230pw_test("tiny_block_test") {
231  sources = [ "tiny_block_test.cc" ]
232  deps = [
233    ":testing",
234    ":tiny_block",
235  ]
236}
237
238pw_test_group("tests") {
239  tests = [
240    ":detailed_block_test",
241    ":result_test",
242    ":small_alignable_block_test",
243    ":small_block_test",
244    ":tiny_block_test",
245  ]
246}
247