blob: a89054d2ebad95c25ac687af61d30a4cbc593a63 [file] [log] [blame]
Wyatt Heplercb725c12020-05-01 11:05:01 -07001# 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 Montanezfb3d3fb2020-06-09 18:12:12 -070015import("//build_overrides/pigweed.gni")
16
Wyatt Hepler21ab0f42021-03-15 09:38:11 -070017import("$dir_pw_build/module_config.gni")
Alexei Frolovedd2f142020-06-09 19:11:27 -070018import("$dir_pw_build/target_types.gni")
Wyatt Heplercb725c12020-05-01 11:05:01 -070019import("$dir_pw_docgen/docs.gni")
Armando Montanez72b93852020-11-10 15:33:22 -080020import("$dir_pw_log/backend.gni")
Alexei Frolov4c0428a2020-06-10 10:46:04 -070021import("$dir_pw_tokenizer/backend.gni")
Wyatt Heplercb725c12020-05-01 11:05:01 -070022import("$dir_pw_unit_test/test.gni")
Wyatt Heplerd49f8fe2020-10-15 10:13:47 -070023
Wyatt Hepler21ab0f42021-03-15 09:38:11 -070024declare_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 Bekkum38f20f72021-05-12 13:18:22 -070031config("public_include_path") {
Wyatt Heplercb725c12020-05-01 11:05:01 -070032 include_dirs = [ "public" ]
Wyatt Hepler67368872020-07-30 16:55:38 -070033 visibility = [ ":*" ]
Wyatt Heplercb725c12020-05-01 11:05:01 -070034}
35
36config("backend_config") {
37 include_dirs = [ "public_overrides" ]
Wyatt Hepler67368872020-07-30 16:55:38 -070038 visibility = [ ":*" ]
Wyatt Heplercb725c12020-05-01 11:05:01 -070039}
40
Ewout van Bekkumeac94402021-05-07 16:58:42 -070041# This target provides the backend for pw_log.
Alexei Frolovedd2f142020-06-09 19:11:27 -070042pw_source_set("pw_log_tokenized") {
Ewout van Bekkumeac94402021-05-07 16:58:42 -070043 public_configs = [
Ewout van Bekkumeac94402021-05-07 16:58:42 -070044 ":backend_config",
Ewout van Bekkum38f20f72021-05-12 13:18:22 -070045 ":public_include_path",
Ewout van Bekkumeac94402021-05-07 16:58:42 -070046 ]
Wyatt Heplercb725c12020-05-01 11:05:01 -070047 public_deps = [
48 "$dir_pw_log:facade",
Wyatt Heplere0575f72020-10-16 10:47:03 -070049 "$dir_pw_tokenizer:global_handler_with_payload.facade",
Wyatt Heplercb725c12020-05-01 11:05:01 -070050 dir_pw_preprocessor,
Wyatt Hepler21ab0f42021-03-15 09:38:11 -070051 pw_log_tokenized_CONFIG,
Wyatt Heplercb725c12020-05-01 11:05:01 -070052 ]
Wyatt Hepler21ab0f42021-03-15 09:38:11 -070053 public = [
54 "public/pw_log_tokenized/config.h",
55 "public/pw_log_tokenized/log_tokenized.h",
Ewout van Bekkum38f20f72021-05-12 13:18:22 -070056 "public_overrides/pw_log_backend/log_backend.h",
Wyatt Hepler21ab0f42021-03-15 09:38:11 -070057 ]
Wyatt Hepler67368872020-07-30 16:55:38 -070058}
59
Ewout van Bekkumeac94402021-05-07 16:58:42 -070060# 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.
63pw_source_set("pw_log_tokenized.impl") {
Ewout van Bekkum38f20f72021-05-12 13:18:22 -070064 deps = [
65 ":pw_log_tokenized",
66 "$dir_pw_tokenizer:global_handler_with_payload",
67 ]
Ewout van Bekkumeac94402021-05-07 16:58:42 -070068}
69
Wyatt Hepler91659f22020-11-03 12:36:26 -080070# 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.
72pw_source_set("base64_over_hdlc") {
Ewout van Bekkum38f20f72021-05-12 13:18:22 -070073 public_configs = [ ":public_include_path" ]
Wyatt Hepler91659f22020-11-03 12:36:26 -080074 public = [ "public/pw_log_tokenized/base64_over_hdlc.h" ]
75 sources = [ "base64_over_hdlc.cc" ]
76 deps = [
Alexei Frolovd3e5cb72021-01-08 13:08:45 -080077 "$dir_pw_hdlc:encoder",
Alexei Frolov1a5381d2021-03-02 16:58:46 -080078 "$dir_pw_stream:sys_io_stream",
Wyatt Hepler91659f22020-11-03 12:36:26 -080079 "$dir_pw_tokenizer:base64",
80 "$dir_pw_tokenizer:global_handler_with_payload.facade",
81 ]
82}
83
Wyatt Heplercb725c12020-05-01 11:05:01 -070084pw_test_group("tests") {
Armando Montanez72b93852020-11-10 15:33:22 -080085 tests = [ ":log_tokenized_test" ]
Wyatt Heplercb725c12020-05-01 11:05:01 -070086}
87
Wyatt Hepler21ab0f42021-03-15 09:38:11 -070088pw_test("log_tokenized_test") {
Wyatt Heplercb725c12020-05-01 11:05:01 -070089 sources = [ "test.cc" ]
Wyatt Hepler21ab0f42021-03-15 09:38:11 -070090 deps = [ ":pw_log_tokenized" ]
Wyatt Heplercb725c12020-05-01 11:05:01 -070091}
92
93pw_doc_group("docs") {
94 sources = [ "docs.rst" ]
Wyatt Hepler8f4a0962021-03-11 16:39:21 -080095 other_deps = [ "py" ]
Wyatt Heplercb725c12020-05-01 11:05:01 -070096}