blob: 84448c8bb13bce529055a2886a6c44825fede7e9 [file] [log] [blame]
shaneajg9c19db42020-06-11 15:49:51 -04001# 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# gn-format disable
16import("//build_overrides/pigweed.gni")
17
18import("$dir_pw_bloat/bloat.gni")
19import("$dir_pw_build/target_types.gni")
20import("$dir_pw_docgen/docs.gni")
21import("$dir_pw_unit_test/test.gni")
22config("default_config") {
23 include_dirs = [ "public" ]
Wyatt Hepler0158ad72020-06-24 17:41:25 -070024 visibility = [ ":*" ]
shaneajg9c19db42020-06-11 15:49:51 -040025}
26
27pw_source_set("pw_bytes") {
28 public_configs = [ ":default_config" ]
Wyatt Hepler0158ad72020-06-24 17:41:25 -070029 public = [
Wyatt Hepler6b3a6c92020-08-03 10:15:56 -070030 "public/pw_bytes/array.h",
Wyatt Hepler0158ad72020-06-24 17:41:25 -070031 "public/pw_bytes/byte_builder.h",
Wyatt Hepler05ca54c2020-09-02 17:04:59 -070032 "public/pw_bytes/endian.h",
Wyatt Hepler0158ad72020-06-24 17:41:25 -070033 "public/pw_bytes/span.h",
34 ]
shaneajg9c19db42020-06-11 15:49:51 -040035 sources = [ "byte_builder.cc" ]
36 public_deps = [
Wyatt Hepler0158ad72020-06-24 17:41:25 -070037 dir_pw_preprocessor,
38 dir_pw_span,
39 dir_pw_status,
shaneajg9c19db42020-06-11 15:49:51 -040040 ]
41}
42
43pw_test_group("tests") {
Wyatt Hepler6b3a6c92020-08-03 10:15:56 -070044 tests = [
Wyatt Hepler05ca54c2020-09-02 17:04:59 -070045 ":array_test",
Wyatt Hepler6b3a6c92020-08-03 10:15:56 -070046 ":byte_builder_test",
Wyatt Hepler05ca54c2020-09-02 17:04:59 -070047 ":endian_test",
Wyatt Hepler6b3a6c92020-08-03 10:15:56 -070048 ]
shaneajg9c19db42020-06-11 15:49:51 -040049 group_deps = [
50 "$dir_pw_preprocessor:tests",
51 "$dir_pw_span:tests",
52 "$dir_pw_status:tests",
53 ]
54}
55
Wyatt Hepler05ca54c2020-09-02 17:04:59 -070056pw_test("array_test") {
57 deps = [ ":pw_bytes" ]
58 sources = [ "array_test.cc" ]
59}
60
shaneajg9c19db42020-06-11 15:49:51 -040061pw_test("byte_builder_test") {
62 deps = [ ":pw_bytes" ]
63 sources = [ "byte_builder_test.cc" ]
64}
65
Wyatt Hepler05ca54c2020-09-02 17:04:59 -070066pw_test("endian_test") {
Wyatt Hepler6b3a6c92020-08-03 10:15:56 -070067 deps = [ ":pw_bytes" ]
Wyatt Hepler05ca54c2020-09-02 17:04:59 -070068 sources = [ "endian_test.cc" ]
Wyatt Hepler6b3a6c92020-08-03 10:15:56 -070069}
70
shaneajg9c19db42020-06-11 15:49:51 -040071pw_doc_group("docs") {
72 sources = [ "docs.rst" ]
shaneajgf20ef8e2020-06-30 16:15:58 -040073 report_deps = [ ":byte_builder_size_report" ]
74}
75
76pw_size_report("byte_builder_size_report") {
77 title = "Using pw::ByteBuilder"
78
79 binaries = [
80 {
81 target = "size_report:with_byte_builder"
82 base = "size_report:without_byte_builder"
83 label = "Using ByteBuilder vs not using it"
84 },
85 ]
shaneajg9c19db42020-06-11 15:49:51 -040086}