xref: /aosp_15_r20/external/pigweed/pw_log_basic/BUILD.gn (revision 61c4878ac05f98d0ceed94b57d316916de578985)
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_unit_test/test.gni")
21
22declare_args() {
23  # The build target that overrides the default configuration options for this
24  # module. This should point to a source set that provides defines through a
25  # public config (which may -include a file or add defines directly).
26  pw_log_basic_CONFIG = pw_build_DEFAULT_MODULE_CONFIG
27}
28
29config("public_include_path") {
30  include_dirs = [ "public" ]
31}
32
33config("backend_config") {
34  include_dirs = [ "public_overrides" ]
35}
36
37# pw_log_basic only provides the backend's interface. The implementation is
38# pulled in through pw_build_LINK_DEPS.
39pw_source_set("pw_log_basic") {
40  public_configs = [
41    ":backend_config",
42    ":public_include_path",
43  ]
44  public = [
45    "public/pw_log_basic/log_basic.h",
46    "public_overrides/pw_log_backend/log_backend.h",
47  ]
48  public_deps = [ dir_pw_preprocessor ]
49}
50
51# The log backend deps that might cause circular dependencies, since
52# pw_log is so ubiquitous. These deps are kept separate so they can be
53# depended on from elsewhere.
54pw_source_set("pw_log_basic.impl") {
55  deps = [
56    ":pw_log_basic",
57    "$dir_pw_log:facade",
58    dir_pw_string,
59    dir_pw_sys_io,
60    pw_log_basic_CONFIG,
61  ]
62
63  # Use emoji log levels if they've been enabled.
64  _use_emoji = getenv("PW_EMOJI")
65  defines = []
66  if (_use_emoji == "1") {
67    defines += [ "PW_EMOJI=1" ]
68  }
69
70  sources = [
71    "log_basic.cc",
72    "pw_log_basic_private/config.h",
73  ]
74}
75
76pw_source_set("log_string_handler") {
77  sources = [ "log_string_handler.cc" ]
78  deps = [
79    ":pw_log_basic",
80    "$dir_pw_log_string:handler.facade",
81  ]
82}
83
84pw_doc_group("docs") {
85  sources = [ "docs.rst" ]
86}
87
88pw_test_group("tests") {
89}
90