xref: /aosp_15_r20/external/pigweed/pw_persistent_ram/BUILD.gn (revision 61c4878ac05f98d0ceed94b57d316916de578985)
1# Copyright 2021 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  visibility = [ ":*" ]
25}
26
27pw_source_set("pw_persistent_ram") {
28  public_configs = [ ":public_include_path" ]
29  public = [
30    "public/pw_persistent_ram/persistent.h",
31    "public/pw_persistent_ram/persistent_buffer.h",
32  ]
33  sources = [ "persistent_buffer.cc" ]
34  public_deps = [
35    dir_pw_assert,
36    dir_pw_bytes,
37    dir_pw_checksum,
38    dir_pw_preprocessor,
39    dir_pw_span,
40    dir_pw_stream,
41  ]
42}
43
44pw_source_set("flat_file_system_entry") {
45  public_configs = [ ":public_include_path" ]
46  public = [ "public/pw_persistent_ram/flat_file_system_entry.h" ]
47  sources = []
48  public_deps = [
49    ":pw_persistent_ram",
50    "$dir_pw_file:flat_file_system",
51    dir_pw_status,
52  ]
53  deps = []
54}
55
56pw_test_group("tests") {
57  tests = [
58    ":persistent_test",
59    ":persistent_buffer_test",
60    ":flat_file_system_entry_test",
61  ]
62}
63
64pw_test("persistent_test") {
65  deps = [
66    ":pw_persistent_ram",
67    dir_pw_random,
68  ]
69  sources = [ "persistent_test.cc" ]
70}
71
72pw_test("persistent_buffer_test") {
73  deps = [
74    ":pw_persistent_ram",
75    dir_pw_random,
76  ]
77  sources = [ "persistent_buffer_test.cc" ]
78}
79
80pw_test("flat_file_system_entry_test") {
81  deps = [ ":flat_file_system_entry" ]
82  sources = [ "flat_file_system_entry_test.cc" ]
83}
84
85pw_doc_group("docs") {
86  sources = [ "docs.rst" ]
87  report_deps = [ ":persistent_size" ]
88}
89
90pw_size_diff("persistent_size") {
91  title = "pw::persistent_ram::Persistent"
92
93  binaries = [
94    {
95      target = "size_report:persistent"
96      base = "size_report:persistent_base"
97      label = "Persistent including pw_checksum's CRC16"
98    },
99    {
100      target = "size_report:persistent"
101      base = "size_report:persistent_base_with_crc16"
102      label = "Persistent without pw_checksum's CRC16"
103    },
104  ]
105}
106