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_library",
19    "pw_cc_test",
20)
21
22package(default_visibility = ["//visibility:public"])
23
24licenses(["notice"])  # Apache License 2.0
25
26# TODO(pwbug/101): Need to add support for facades/backends to Bazel.
27
28pw_cc_library(
29    name = "facade",
30    hdrs = [
31        "public/pw_trace/trace.h",
32        "public/pw_trace/internal/trace_internal.h",
33    ],
34    includes = ["public"],
35    deps = [
36        "//pw_preprocessor",
37    ],
38)
39
40pw_cc_library(
41    name = "pw_trace",
42    deps = [
43        ":facade",
44    ],
45)
46
47pw_cc_library(
48    name = "backend",
49    deps = [],
50)
51
52pw_cc_test(
53    name = "trace_backend_compile_test",
54    srcs = [
55        "trace_backend_compile_test.cc",
56        "trace_backend_compile_test_c.c",
57    ],
58    deps = [
59        ":backend",
60        ":facade",
61        ":pw_trace",
62        "//pw_preprocessor",
63        "//pw_unit_test",
64    ],
65)
66
67pw_cc_test(
68    name = "trace_facade_test",
69    srcs = [
70        "trace_facade_test.cc",
71        "pw_trace_test/fake_backend.h",
72        "pw_trace_test/public_overrides/pw_trace_backend/trace_backend.h",
73    ],
74    includes = [
75        "pw_trace_test",
76        "pw_trace_test/public_overrides"
77    ],
78    deps = [
79        ":backend",
80        ":facade",
81        ":pw_trace",
82        "//pw_preprocessor",
83        "//pw_unit_test",
84    ],
85)
86
87pw_cc_library(
88    name = "pw_trace_sample_app",
89    srcs = [ "example/sample_app.cc" ],
90    includes = [ "example/public" ],
91    deps = [ "//pw_trace" ],
92    hdrs = [ "example/public/pw_trace/example/sample_app.h" ]
93)
94
95pw_cc_binary(
96    name = "trace_example_basic",
97    deps = [
98        ":pw_trace_sample_app",
99        "//pw_log"
100    ],
101    srcs = [ "example/basic.cc" ]
102)