• 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("@rules_cc//cc:cc_library.bzl", "cc_library")
16load("@rules_python//sphinxdocs:sphinx_docs_library.bzl", "sphinx_docs_library")
17load("//pw_build:compatibility.bzl", "incompatible_with_mcu")
18load("//pw_build:pw_facade.bzl", "pw_facade")
19
20package(default_visibility = ["//visibility:public"])
21
22licenses(["notice"])
23
24# Note: to avoid circular dependencies, this target only includes the headers
25# for pw_assert_basic. The source file and its dependencies are in the separate
26# ":impl" target.
27#
28# If you point //pw_assert:backend to //pw_assert_basic, then
29# //pw_assert:backend_impl should point to //pw_assert_basic:impl.
30cc_library(
31    name = "pw_assert_basic",
32    hdrs = [
33        "public_overrides/pw_assert_backend/check_backend.h",
34    ],
35    strip_include_prefix = "public_overrides",
36    deps = [
37        ":pw_assert_basic_impl",
38    ],
39)
40
41cc_library(
42    name = "pw_assert_basic_impl",
43    hdrs = [
44        "public/pw_assert_basic/assert_basic.h",
45    ],
46    strip_include_prefix = "public",
47    visibility = ["//visibility:private"],
48    deps = [
49        ":handler.facade",
50        "//pw_assert:assert_compatibility_backend",
51        "//pw_preprocessor",
52    ],
53)
54
55pw_facade(
56    name = "handler",
57    hdrs = [
58        "public/pw_assert_basic/handler.h",
59    ],
60    backend = ":handler_backend",
61    strip_include_prefix = "public",
62    deps = [
63        "//pw_preprocessor",
64    ],
65)
66
67label_flag(
68    name = "handler_backend",
69    build_setting_default = ":pw_assert_basic_handler",
70)
71
72cc_library(
73    name = "impl",
74    srcs = [
75        "assert_basic.cc",
76    ],
77    deps = [
78        ":handler",
79        ":pw_assert_basic",
80        "//pw_assert:check.facade",
81        "//pw_assert:config",
82        "//pw_preprocessor",
83    ],
84    # Other libraries may not always depend on this library, even if it is
85    # necessary at link time.
86    alwayslink = 1,
87)
88
89cc_library(
90    name = "pw_assert_basic_handler",
91    srcs = [
92        "basic_handler.cc",
93    ],
94    implementation_deps = [
95        "//pw_assert:config",
96        "//pw_preprocessor",
97        "//pw_string:builder",
98        "//pw_sys_io",
99        "//pw_toolchain:infinite_loop",
100    ],
101    deps = [":handler.facade"],
102    # Other libraries may not always depend on this library, even if it is
103    # necessary at link time.
104    alwayslink = 1,
105)
106
107sphinx_docs_library(
108    name = "docs",
109    srcs = [
110        "docs.rst",
111    ],
112    prefix = "pw_assert_basic/",
113    target_compatible_with = incompatible_with_mcu(),
114)
115