• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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
15import("//build_overrides/pigweed.gni")
16
17import("$dir_pw_build/module_config.gni")
18import("$dir_pw_build/target_types.gni")
19import("$dir_pw_docgen/docs.gni")
20import("$dir_pw_log/backend.gni")
21import("$dir_pw_tokenizer/backend.gni")
22import("$dir_pw_unit_test/test.gni")
23
24declare_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
31config("public_include_path") {
32  include_dirs = [ "public" ]
33  visibility = [ ":*" ]
34}
35
36config("backend_config") {
37  include_dirs = [ "public_overrides" ]
38  visibility = [ ":*" ]
39}
40
41# This target provides the backend for pw_log.
42pw_source_set("pw_log_tokenized") {
43  public_configs = [
44    ":backend_config",
45    ":public_include_path",
46  ]
47  public_deps = [
48    ":config",
49    ":metadata",
50    "$dir_pw_tokenizer:global_handler_with_payload.facade",
51  ]
52  public = [
53    "public/pw_log_tokenized/log_tokenized.h",
54    "public_overrides/pw_log_backend/log_backend.h",
55  ]
56}
57
58pw_source_set("metadata") {
59  public_configs = [ ":public_include_path" ]
60  public_deps = [ ":config" ]
61  public = [ "public/pw_log_tokenized/metadata.h" ]
62}
63
64pw_source_set("config") {
65  public_configs = [ ":public_include_path" ]
66  public_deps = [
67    "$dir_pw_log:facade",
68    pw_log_tokenized_CONFIG,
69  ]
70  public = [ "public/pw_log_tokenized/config.h" ]
71}
72
73# The log backend deps that might cause circular dependencies, since
74# pw_log is so ubiquitous. These deps are kept separate so they can be
75# depended on from elsewhere.
76pw_source_set("pw_log_tokenized.impl") {
77  deps = [
78    ":pw_log_tokenized",
79    "$dir_pw_tokenizer:global_handler_with_payload",
80  ]
81}
82
83# This target provides a backend for pw_tokenizer that encodes tokenized logs as
84# Base64, encodes them into HDLC frames, and writes them over sys_io.
85pw_source_set("base64_over_hdlc") {
86  public_configs = [ ":public_include_path" ]
87  public = [ "public/pw_log_tokenized/base64_over_hdlc.h" ]
88  sources = [ "base64_over_hdlc.cc" ]
89  deps = [
90    "$dir_pw_hdlc:encoder",
91    "$dir_pw_stream:sys_io_stream",
92    "$dir_pw_tokenizer:base64",
93    "$dir_pw_tokenizer:global_handler_with_payload.facade",
94  ]
95}
96
97pw_test_group("tests") {
98  tests = [
99    ":log_tokenized_test",
100    ":metadata_test",
101  ]
102}
103
104pw_test("log_tokenized_test") {
105  sources = [
106    "log_tokenized_test.cc",
107    "log_tokenized_test_c.c",
108    "pw_log_tokenized_private/test_utils.h",
109  ]
110  deps = [
111    ":pw_log_tokenized",
112    dir_pw_preprocessor,
113  ]
114}
115
116pw_test("metadata_test") {
117  sources = [ "metadata_test.cc" ]
118  deps = [ ":metadata" ]
119}
120
121pw_doc_group("docs") {
122  sources = [ "docs.rst" ]
123  other_deps = [ "py" ]
124}
125