• 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(
16    "//pw_build:pigweed.bzl",
17    "pw_cc_binary",
18    "pw_cc_test",
19    "pw_facade",
20)
21
22package(default_visibility = ["//visibility:public"])
23
24licenses(["notice"])
25
26# TODO: pwbug.dev/328679085 - Remove this alias once no-one uses it.
27alias(
28    name = "facade",
29    actual = ":pw_trace.facade",
30)
31
32pw_facade(
33    name = "pw_trace",
34    hdrs = [
35        "public/pw_trace/internal/trace_internal.h",
36        "public/pw_trace/trace.h",
37    ],
38    backend = ":backend",
39    includes = ["public"],
40    deps = [
41        "//pw_preprocessor",
42    ],
43)
44
45label_flag(
46    name = "backend",
47    build_setting_default = ":backend_multiplexer",
48)
49
50cc_library(
51    name = "backend_multiplexer",
52    visibility = ["@pigweed//targets:__pkg__"],
53    deps = ["//pw_trace:null"],
54)
55
56cc_library(
57    name = "null",
58    hdrs = [
59        "public/pw_trace/internal/null.h",
60        "public_overrides/pw_trace_backend/trace_backend.h",
61    ],
62    includes = [
63        "public",
64        "public_overrides",
65    ],
66    deps = [
67        ":pw_trace.facade",
68        "//pw_preprocessor",
69    ],
70)
71
72pw_cc_test(
73    name = "trace_backend_compile_test",
74    srcs = [
75        "trace_backend_compile_test.cc",
76        "trace_backend_compile_test_c.c",
77    ],
78    deps = [
79        ":pw_trace",
80        "//pw_preprocessor",
81        "//pw_unit_test",
82    ],
83)
84
85pw_cc_test(
86    name = "trace_facade_test",
87    srcs = [
88        "pw_trace_test/fake_backend.h",
89        "pw_trace_test/public_overrides/pw_trace_backend/trace_backend.h",
90        "trace_facade_test.cc",
91    ],
92    includes = [
93        "pw_trace_test",
94        "pw_trace_test/public_overrides",
95    ],
96    deps = [
97        ":pw_trace",
98        "//pw_preprocessor",
99        "//pw_unit_test",
100    ],
101)
102
103pw_cc_test(
104    name = "trace_zero_facade_test",
105    srcs = [
106        "pw_trace_zero/public_overrides/pw_trace_backend/trace_backend.h",
107        "trace_backend_compile_test.cc",
108        "trace_backend_compile_test_c.c",
109    ],
110    includes = [
111        "pw_trace_zero",
112        "pw_trace_zero/public_overrides",
113    ],
114    deps = [
115        ":pw_trace.facade",
116        "//pw_preprocessor",
117        "//pw_unit_test",
118    ],
119)
120
121cc_library(
122    name = "trace_null_test",
123    testonly = True,
124    srcs = [
125        "trace_null_test.cc",
126        "trace_null_test_c.c",
127    ],
128    deps = [
129        ":pw_trace",
130        "//pw_preprocessor",
131        "//pw_unit_test",
132    ],
133)
134
135cc_library(
136    name = "pw_trace_sample_app",
137    srcs = ["example/sample_app.cc"],
138    hdrs = ["example/public/pw_trace/example/sample_app.h"],
139    includes = ["example/public"],
140    # TODO: b/258071921 - Fix puzzling compiler errors
141    tags = ["manual"],
142    deps = [
143        "//pw_ring_buffer",
144        "//pw_trace",
145    ],
146)
147
148pw_cc_binary(
149    name = "trace_example_basic",
150    srcs = ["example/basic.cc"],
151    # TODO: b/258071921 - Fix puzzling compiler errors
152    tags = ["manual"],
153    deps = [
154        ":pw_trace_sample_app",
155        "//pw_log",
156    ],
157)
158