blob: a478ea21eb5471a4af6ebe05e0aeba179be6bffb [file] [log] [blame]
Keir Mierleaf5e3582019-12-30 13:11:05 -08001# 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
Armando Montanezf1f41102020-11-02 15:58:39 -080017import("$dir_pw_build/module_config.gni")
Alexei Frolovedd2f142020-06-09 19:11:27 -070018import("$dir_pw_build/target_types.gni")
Armando Montanez0054a9b2020-03-13 13:06:24 -070019import("$dir_pw_docgen/docs.gni")
Wyatt Heplerd49f8fe2020-10-15 10:13:47 -070020
Armando Montanezf1f41102020-11-02 15:58:39 -080021declare_args() {
22 # The build target that overrides the default configuration options for this
23 # module. This should point to a source set that provides defines through a
24 # public config (which may -include a file or add defines directly).
25 pw_log_basic_CONFIG = pw_build_DEFAULT_MODULE_CONFIG
26}
27
Ewout van Bekkumeac94402021-05-07 16:58:42 -070028config("public_include_path") {
Keir Mierleaf5e3582019-12-30 13:11:05 -080029 include_dirs = [ "public" ]
30}
31
32config("backend_config") {
33 include_dirs = [ "public_overrides" ]
34}
35
Ewout van Bekkumeac94402021-05-07 16:58:42 -070036# pw_log_basic only provides the backend's interface. The implementation is
37# pulled in through pw_build_LINK_DEPS.
Alexei Frolov4c0428a2020-06-10 10:46:04 -070038pw_source_set("pw_log_basic") {
39 public_configs = [
40 ":backend_config",
Ewout van Bekkumeac94402021-05-07 16:58:42 -070041 ":public_include_path",
Alexei Frolov4c0428a2020-06-10 10:46:04 -070042 ]
Ewout van Bekkumeac94402021-05-07 16:58:42 -070043 public = [
44 "public/pw_log_basic/log_basic.h",
45 "public_overrides/pw_log_backend/log_backend.h",
46 ]
Wyatt Heplerecdcf582020-05-04 09:43:20 -070047 public_deps = [ dir_pw_preprocessor ]
Ewout van Bekkum38f20f72021-05-12 13:18:22 -070048}
Ewout van Bekkumeac94402021-05-07 16:58:42 -070049
Ewout van Bekkum38f20f72021-05-12 13:18:22 -070050# The log backend deps that might cause circular dependencies, since
51# pw_log is so ubiquitous. These deps are kept separate so they can be
52# depended on from elsewhere.
53pw_source_set("pw_log_basic.impl") {
Keir Mierleaf5e3582019-12-30 13:11:05 -080054 deps = [
Ewout van Bekkum38f20f72021-05-12 13:18:22 -070055 ":pw_log_basic",
Keir Mierleaf5e3582019-12-30 13:11:05 -080056 "$dir_pw_log:facade",
Wyatt Heplerecdcf582020-05-04 09:43:20 -070057 dir_pw_string,
58 dir_pw_sys_io,
Armando Montanezf1f41102020-11-02 15:58:39 -080059 pw_log_basic_CONFIG,
Keir Mierleaf5e3582019-12-30 13:11:05 -080060 ]
Armando Montaneza1065b92020-03-19 12:36:31 -070061
62 # Use emoji log levels if they've been enabled.
63 _use_emoji = getenv("PW_EMOJI")
64 defines = []
65 if (_use_emoji == "1") {
66 defines += [ "PW_EMOJI=1" ]
67 }
68
Armando Montanezf1f41102020-11-02 15:58:39 -080069 sources = [
70 "log_basic.cc",
71 "pw_log_basic_private/config.h",
72 ]
Keir Mierleaf5e3582019-12-30 13:11:05 -080073}
Armando Montanez0054a9b2020-03-13 13:06:24 -070074
75pw_doc_group("docs") {
76 sources = [ "docs.rst" ]
77}