• 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
15load("@rules_cc//cc:cc_library.bzl", "cc_library")
16load("@rules_python//sphinxdocs:sphinx_docs_library.bzl", "sphinx_docs_library")
17load("//pw_build:compatibility.bzl", "incompatible_with_mcu")
18
19package(
20    default_visibility = ["//visibility:public"],
21)
22
23licenses(["notice"])
24
25# This target is the backend for //pw_log.
26cc_library(
27    name = "pw_log_basic",
28    hdrs = [
29        "public_overrides/pw_log_backend/log_backend.h",
30    ],
31    strip_include_prefix = "public_overrides",
32    deps = [":extension"],
33)
34
35# This target directly exposes the log_basic.h header. Outside of this package,
36# only depend on it directly if you are using parts of the pw_log_basic
37# interface which are not in the pw_log interface, such as the
38# `pw::log_basic::SetOutput` function.
39cc_library(
40    name = "extension",
41    srcs = [
42        "log_basic.cc",
43    ],
44    hdrs = [
45        "public/pw_log_basic/log_basic.h",
46    ],
47    strip_include_prefix = "public",
48    deps = [
49        ":config",
50        "//pw_log:pw_log.facade",
51        "//pw_preprocessor",
52        "//pw_string:builder",
53        "//pw_sys_io",
54    ],
55)
56
57cc_library(
58    name = "config",
59    hdrs = [
60        "pw_log_basic_private/config.h",
61    ],
62    visibility = ["//visibility:private"],
63    deps = [
64        ":config_override",
65    ],
66)
67
68label_flag(
69    name = "config_override",
70    build_setting_default = "//pw_build:default_module_config",
71)
72
73# The impl of pw_log_basic is an empty library: it's so basic that there's no
74# risk of circular dependencies.
75cc_library(
76    name = "impl",
77)
78
79cc_library(
80    name = "log_string_handler",
81    srcs = [
82        "log_string_handler.cc",
83    ],
84    deps = [
85        ":extension",
86        "//pw_log_string:handler.facade",
87    ],
88)
89
90# This config setting is active if pw_log_basic was selected as the backend for pw_log.
91config_setting(
92    name = "is_active_backend",
93    flag_values = {
94        "//pw_log:backend": ":pw_log_basic",
95    },
96)
97
98sphinx_docs_library(
99    name = "docs",
100    srcs = [
101        "docs.rst",
102    ],
103    prefix = "pw_log_basic/",
104    target_compatible_with = incompatible_with_mcu(),
105)
106