xref: /aosp_15_r20/external/pigweed/pw_assert_log/BUILD.gn (revision 61c4878ac05f98d0ceed94b57d316916de578985)
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
15import("//build_overrides/pigweed.gni")
16
17import("$dir_pw_build/target_types.gni")
18import("$dir_pw_docgen/docs.gni")
19import("$dir_pw_unit_test/test.gni")
20
21config("public_include_path") {
22  include_dirs = [ "public" ]
23}
24
25config("check_backend_overrides") {
26  include_dirs = [ "check_backend_public_overrides" ]
27}
28
29config("assert_backend_overrides") {
30  include_dirs = [ "assert_backend_public_overrides" ]
31}
32
33# This target provides a backend to pw_assert's check facade
34# (PW_CHECK()/PW_CRASH() macros) and assert compatibility C ABI
35# (the pw_assert_HandleFailure() function) via PW_LOG.
36pw_source_set("check_backend") {
37  public_configs = [
38    ":check_backend_overrides",
39    ":public_include_path",
40  ]
41  public_deps = [ "$dir_pw_log" ]
42  public =
43      [ "check_backend_public_overrides/pw_assert_backend/check_backend.h" ]
44  deps = [
45    "$dir_pw_assert:assert_compatibility_backend",
46    "$dir_pw_assert:config",
47    "$dir_pw_assert:facade",
48    "$dir_pw_preprocessor",
49  ]
50  sources = [
51    # TODO: b/235149326 - assert_log.cc implements the assert compatibility
52    #     backend, but nothing for check_backend.
53    "assert_log.cc",
54    "public/pw_assert_log/check_log.h",
55  ]
56}
57
58# TODO: b/235149326 - Remove this deprecated alias.
59group("pw_assert_log") {
60  public_deps = [ ":check_backend" ]
61}
62
63# This backend to pw_assert's PW_ASSERT() macros via PW_LOG. It is intended only
64# for use with PW_LOG backends which are constexpr compatible such as
65# pw_log_android.
66pw_source_set("assert_backend") {
67  public_configs = [
68    ":assert_backend_overrides",
69    ":public_include_path",
70  ]
71  public_deps = [
72    "$dir_pw_log",
73    "$dir_pw_preprocessor",
74  ]
75  public =
76      [ "assert_backend_public_overrides/pw_assert_backend/assert_backend.h" ]
77  sources = [ "public/pw_assert_log/assert_log.h" ]
78}
79
80group("assert_backend.impl") {
81}
82
83group("check_backend.impl") {
84}
85
86# pw_assert_log doesn't have deps with potential circular dependencies, so this
87# impl group can be empty.
88group("pw_assert_log.impl") {
89}
90
91pw_doc_group("docs") {
92  sources = [ "docs.rst" ]
93}
94
95pw_test_group("tests") {
96}
97