Wyatt Hepler | cb725c1 | 2020-05-01 11:05:01 -0700 | [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 | |
Armando Montanez | fb3d3fb | 2020-06-09 18:12:12 -0700 | [diff] [blame] | 15 | import("//build_overrides/pigweed.gni") |
| 16 | |
Wyatt Hepler | 21ab0f4 | 2021-03-15 09:38:11 -0700 | [diff] [blame] | 17 | import("$dir_pw_build/module_config.gni") |
Alexei Frolov | edd2f14 | 2020-06-09 19:11:27 -0700 | [diff] [blame] | 18 | import("$dir_pw_build/target_types.gni") |
Wyatt Hepler | cb725c1 | 2020-05-01 11:05:01 -0700 | [diff] [blame] | 19 | import("$dir_pw_docgen/docs.gni") |
Armando Montanez | 72b9385 | 2020-11-10 15:33:22 -0800 | [diff] [blame] | 20 | import("$dir_pw_log/backend.gni") |
Alexei Frolov | 4c0428a | 2020-06-10 10:46:04 -0700 | [diff] [blame] | 21 | import("$dir_pw_tokenizer/backend.gni") |
Wyatt Hepler | cb725c1 | 2020-05-01 11:05:01 -0700 | [diff] [blame] | 22 | import("$dir_pw_unit_test/test.gni") |
Wyatt Hepler | d49f8fe | 2020-10-15 10:13:47 -0700 | [diff] [blame] | 23 | |
Wyatt Hepler | 21ab0f4 | 2021-03-15 09:38:11 -0700 | [diff] [blame] | 24 | declare_args() { |
| 25 | # The build target that overrides the default configuration options for this |
| 26 | # module. This should point to a source set that provides defines through a |
| 27 | # public config (which may -include a file or add defines directly). |
| 28 | pw_log_tokenized_CONFIG = pw_build_DEFAULT_MODULE_CONFIG |
| 29 | } |
| 30 | |
Ewout van Bekkum | 38f20f7 | 2021-05-12 13:18:22 -0700 | [diff] [blame] | 31 | config("public_include_path") { |
Wyatt Hepler | cb725c1 | 2020-05-01 11:05:01 -0700 | [diff] [blame] | 32 | include_dirs = [ "public" ] |
Wyatt Hepler | 6736887 | 2020-07-30 16:55:38 -0700 | [diff] [blame] | 33 | visibility = [ ":*" ] |
Wyatt Hepler | cb725c1 | 2020-05-01 11:05:01 -0700 | [diff] [blame] | 34 | } |
| 35 | |
| 36 | config("backend_config") { |
| 37 | include_dirs = [ "public_overrides" ] |
Wyatt Hepler | 6736887 | 2020-07-30 16:55:38 -0700 | [diff] [blame] | 38 | visibility = [ ":*" ] |
Wyatt Hepler | cb725c1 | 2020-05-01 11:05:01 -0700 | [diff] [blame] | 39 | } |
| 40 | |
Ewout van Bekkum | eac9440 | 2021-05-07 16:58:42 -0700 | [diff] [blame] | 41 | # This target provides the backend for pw_log. |
Alexei Frolov | edd2f14 | 2020-06-09 19:11:27 -0700 | [diff] [blame] | 42 | pw_source_set("pw_log_tokenized") { |
Ewout van Bekkum | eac9440 | 2021-05-07 16:58:42 -0700 | [diff] [blame] | 43 | public_configs = [ |
Ewout van Bekkum | eac9440 | 2021-05-07 16:58:42 -0700 | [diff] [blame] | 44 | ":backend_config", |
Ewout van Bekkum | 38f20f7 | 2021-05-12 13:18:22 -0700 | [diff] [blame] | 45 | ":public_include_path", |
Ewout van Bekkum | eac9440 | 2021-05-07 16:58:42 -0700 | [diff] [blame] | 46 | ] |
Wyatt Hepler | cb725c1 | 2020-05-01 11:05:01 -0700 | [diff] [blame] | 47 | public_deps = [ |
| 48 | "$dir_pw_log:facade", |
Wyatt Hepler | e0575f7 | 2020-10-16 10:47:03 -0700 | [diff] [blame] | 49 | "$dir_pw_tokenizer:global_handler_with_payload.facade", |
Wyatt Hepler | cb725c1 | 2020-05-01 11:05:01 -0700 | [diff] [blame] | 50 | dir_pw_preprocessor, |
Wyatt Hepler | 21ab0f4 | 2021-03-15 09:38:11 -0700 | [diff] [blame] | 51 | pw_log_tokenized_CONFIG, |
Wyatt Hepler | cb725c1 | 2020-05-01 11:05:01 -0700 | [diff] [blame] | 52 | ] |
Wyatt Hepler | 21ab0f4 | 2021-03-15 09:38:11 -0700 | [diff] [blame] | 53 | public = [ |
| 54 | "public/pw_log_tokenized/config.h", |
| 55 | "public/pw_log_tokenized/log_tokenized.h", |
Ewout van Bekkum | 38f20f7 | 2021-05-12 13:18:22 -0700 | [diff] [blame] | 56 | "public_overrides/pw_log_backend/log_backend.h", |
Wyatt Hepler | 21ab0f4 | 2021-03-15 09:38:11 -0700 | [diff] [blame] | 57 | ] |
Wyatt Hepler | 6736887 | 2020-07-30 16:55:38 -0700 | [diff] [blame] | 58 | } |
| 59 | |
Ewout van Bekkum | eac9440 | 2021-05-07 16:58:42 -0700 | [diff] [blame] | 60 | # The log backend deps that might cause circular dependencies, since |
| 61 | # pw_log is so ubiquitous. These deps are kept separate so they can be |
| 62 | # depended on from elsewhere. |
| 63 | pw_source_set("pw_log_tokenized.impl") { |
Ewout van Bekkum | 38f20f7 | 2021-05-12 13:18:22 -0700 | [diff] [blame] | 64 | deps = [ |
| 65 | ":pw_log_tokenized", |
| 66 | "$dir_pw_tokenizer:global_handler_with_payload", |
| 67 | ] |
Ewout van Bekkum | eac9440 | 2021-05-07 16:58:42 -0700 | [diff] [blame] | 68 | } |
| 69 | |
Wyatt Hepler | 91659f2 | 2020-11-03 12:36:26 -0800 | [diff] [blame] | 70 | # This target provides a backend for pw_tokenizer that encodes tokenized logs as |
| 71 | # Base64, encodes them into HDLC frames, and writes them over sys_io. |
| 72 | pw_source_set("base64_over_hdlc") { |
Ewout van Bekkum | 38f20f7 | 2021-05-12 13:18:22 -0700 | [diff] [blame] | 73 | public_configs = [ ":public_include_path" ] |
Wyatt Hepler | 91659f2 | 2020-11-03 12:36:26 -0800 | [diff] [blame] | 74 | public = [ "public/pw_log_tokenized/base64_over_hdlc.h" ] |
| 75 | sources = [ "base64_over_hdlc.cc" ] |
| 76 | deps = [ |
Alexei Frolov | d3e5cb7 | 2021-01-08 13:08:45 -0800 | [diff] [blame] | 77 | "$dir_pw_hdlc:encoder", |
Alexei Frolov | 1a5381d | 2021-03-02 16:58:46 -0800 | [diff] [blame] | 78 | "$dir_pw_stream:sys_io_stream", |
Wyatt Hepler | 91659f2 | 2020-11-03 12:36:26 -0800 | [diff] [blame] | 79 | "$dir_pw_tokenizer:base64", |
| 80 | "$dir_pw_tokenizer:global_handler_with_payload.facade", |
| 81 | ] |
| 82 | } |
| 83 | |
Wyatt Hepler | cb725c1 | 2020-05-01 11:05:01 -0700 | [diff] [blame] | 84 | pw_test_group("tests") { |
Armando Montanez | 72b9385 | 2020-11-10 15:33:22 -0800 | [diff] [blame] | 85 | tests = [ ":log_tokenized_test" ] |
Wyatt Hepler | cb725c1 | 2020-05-01 11:05:01 -0700 | [diff] [blame] | 86 | } |
| 87 | |
Wyatt Hepler | 21ab0f4 | 2021-03-15 09:38:11 -0700 | [diff] [blame] | 88 | pw_test("log_tokenized_test") { |
Wyatt Hepler | cb725c1 | 2020-05-01 11:05:01 -0700 | [diff] [blame] | 89 | sources = [ "test.cc" ] |
Wyatt Hepler | 21ab0f4 | 2021-03-15 09:38:11 -0700 | [diff] [blame] | 90 | deps = [ ":pw_log_tokenized" ] |
Wyatt Hepler | cb725c1 | 2020-05-01 11:05:01 -0700 | [diff] [blame] | 91 | } |
| 92 | |
| 93 | pw_doc_group("docs") { |
| 94 | sources = [ "docs.rst" ] |
Wyatt Hepler | 8f4a096 | 2021-03-11 16:39:21 -0800 | [diff] [blame] | 95 | other_deps = [ "py" ] |
Wyatt Hepler | cb725c1 | 2020-05-01 11:05:01 -0700 | [diff] [blame] | 96 | } |