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