shaneajg | 9c19db4 | 2020-06-11 15:49:51 -0400 | [diff] [blame] | 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 | |
shaneajg | 9c19db4 | 2020-06-11 15:49:51 -0400 | [diff] [blame] | 15 | import("//build_overrides/pigweed.gni") |
| 16 | |
| 17 | import("$dir_pw_bloat/bloat.gni") |
| 18 | import("$dir_pw_build/target_types.gni") |
| 19 | import("$dir_pw_docgen/docs.gni") |
| 20 | import("$dir_pw_unit_test/test.gni") |
Wyatt Hepler | d49f8fe | 2020-10-15 10:13:47 -0700 | [diff] [blame] | 21 | |
shaneajg | 9c19db4 | 2020-06-11 15:49:51 -0400 | [diff] [blame] | 22 | config("default_config") { |
| 23 | include_dirs = [ "public" ] |
Wyatt Hepler | 0158ad7 | 2020-06-24 17:41:25 -0700 | [diff] [blame] | 24 | visibility = [ ":*" ] |
shaneajg | 9c19db4 | 2020-06-11 15:49:51 -0400 | [diff] [blame] | 25 | } |
| 26 | |
| 27 | pw_source_set("pw_bytes") { |
| 28 | public_configs = [ ":default_config" ] |
Wyatt Hepler | 0158ad7 | 2020-06-24 17:41:25 -0700 | [diff] [blame] | 29 | public = [ |
Wyatt Hepler | 6b3a6c9 | 2020-08-03 10:15:56 -0700 | [diff] [blame] | 30 | "public/pw_bytes/array.h", |
Wyatt Hepler | 0158ad7 | 2020-06-24 17:41:25 -0700 | [diff] [blame] | 31 | "public/pw_bytes/byte_builder.h", |
Wyatt Hepler | 05ca54c | 2020-09-02 17:04:59 -0700 | [diff] [blame] | 32 | "public/pw_bytes/endian.h", |
Wyatt Hepler | 0158ad7 | 2020-06-24 17:41:25 -0700 | [diff] [blame] | 33 | "public/pw_bytes/span.h", |
| 34 | ] |
shaneajg | 9c19db4 | 2020-06-11 15:49:51 -0400 | [diff] [blame] | 35 | sources = [ "byte_builder.cc" ] |
| 36 | public_deps = [ |
Wyatt Hepler | 0158ad7 | 2020-06-24 17:41:25 -0700 | [diff] [blame] | 37 | dir_pw_preprocessor, |
Wyatt Hepler | 0158ad7 | 2020-06-24 17:41:25 -0700 | [diff] [blame] | 38 | dir_pw_status, |
shaneajg | 9c19db4 | 2020-06-11 15:49:51 -0400 | [diff] [blame] | 39 | ] |
| 40 | } |
| 41 | |
| 42 | pw_test_group("tests") { |
Wyatt Hepler | 6b3a6c9 | 2020-08-03 10:15:56 -0700 | [diff] [blame] | 43 | tests = [ |
Wyatt Hepler | 05ca54c | 2020-09-02 17:04:59 -0700 | [diff] [blame] | 44 | ":array_test", |
Wyatt Hepler | 6b3a6c9 | 2020-08-03 10:15:56 -0700 | [diff] [blame] | 45 | ":byte_builder_test", |
Wyatt Hepler | 05ca54c | 2020-09-02 17:04:59 -0700 | [diff] [blame] | 46 | ":endian_test", |
Wyatt Hepler | 6b3a6c9 | 2020-08-03 10:15:56 -0700 | [diff] [blame] | 47 | ] |
shaneajg | 9c19db4 | 2020-06-11 15:49:51 -0400 | [diff] [blame] | 48 | group_deps = [ |
| 49 | "$dir_pw_preprocessor:tests", |
shaneajg | 9c19db4 | 2020-06-11 15:49:51 -0400 | [diff] [blame] | 50 | "$dir_pw_status:tests", |
| 51 | ] |
| 52 | } |
| 53 | |
Wyatt Hepler | 05ca54c | 2020-09-02 17:04:59 -0700 | [diff] [blame] | 54 | pw_test("array_test") { |
| 55 | deps = [ ":pw_bytes" ] |
| 56 | sources = [ "array_test.cc" ] |
| 57 | } |
| 58 | |
shaneajg | 9c19db4 | 2020-06-11 15:49:51 -0400 | [diff] [blame] | 59 | pw_test("byte_builder_test") { |
| 60 | deps = [ ":pw_bytes" ] |
| 61 | sources = [ "byte_builder_test.cc" ] |
| 62 | } |
| 63 | |
Wyatt Hepler | 05ca54c | 2020-09-02 17:04:59 -0700 | [diff] [blame] | 64 | pw_test("endian_test") { |
Wyatt Hepler | 6b3a6c9 | 2020-08-03 10:15:56 -0700 | [diff] [blame] | 65 | deps = [ ":pw_bytes" ] |
Wyatt Hepler | 05ca54c | 2020-09-02 17:04:59 -0700 | [diff] [blame] | 66 | sources = [ "endian_test.cc" ] |
Wyatt Hepler | 6b3a6c9 | 2020-08-03 10:15:56 -0700 | [diff] [blame] | 67 | } |
| 68 | |
shaneajg | 9c19db4 | 2020-06-11 15:49:51 -0400 | [diff] [blame] | 69 | pw_doc_group("docs") { |
| 70 | sources = [ "docs.rst" ] |
shaneajg | f20ef8e | 2020-06-30 16:15:58 -0400 | [diff] [blame] | 71 | report_deps = [ ":byte_builder_size_report" ] |
| 72 | } |
| 73 | |
| 74 | pw_size_report("byte_builder_size_report") { |
| 75 | title = "Using pw::ByteBuilder" |
| 76 | |
| 77 | binaries = [ |
| 78 | { |
| 79 | target = "size_report:with_byte_builder" |
| 80 | base = "size_report:without_byte_builder" |
| 81 | label = "Using ByteBuilder vs not using it" |
| 82 | }, |
| 83 | ] |
shaneajg | 9c19db4 | 2020-06-11 15:49:51 -0400 | [diff] [blame] | 84 | } |