xref: /aosp_15_r20/external/pigweed/pw_assert_basic/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/facade.gni")
18import("$dir_pw_build/target_types.gni")
19import("$dir_pw_docgen/docs.gni")
20import("$dir_pw_unit_test/test.gni")
21import("backend.gni")
22
23config("public_include_path") {
24  include_dirs = [ "public" ]
25  visibility = [ ":*" ]
26}
27
28config("backend_config") {
29  include_dirs = [ "public_overrides" ]
30  visibility = [ ":*" ]
31}
32
33pw_facade("handler") {
34  backend = pw_assert_basic_HANDLER_BACKEND
35  public_configs = [ ":public_include_path" ]
36  public_deps = [ "$dir_pw_preprocessor" ]
37  public = [ "public/pw_assert_basic/handler.h" ]
38}
39
40# TODO: b/235149326 - This backend implements pw_assert's check backend and the
41# temporary compatibility C ABI (pw_assert_HandleFailure()).
42#
43# pw_assert_basic only provides the backend's interface. The implementation is
44# pulled in through pw_build_LINK_DEPS.
45pw_source_set("pw_assert_basic") {
46  public_configs = [
47    ":backend_config",
48    ":public_include_path",
49  ]
50  public = [
51    "public/pw_assert_basic/assert_basic.h",
52    "public_overrides/pw_assert_backend/check_backend.h",
53  ]
54  public_deps = [ ":handler.facade" ]
55}
56
57# The assert backend deps that might cause circular dependencies, since
58# pw_assert is so ubiquitous. These deps are kept separate so they can be
59# depended on from elsewhere.
60pw_source_set("pw_assert_basic.impl") {
61  deps = [
62    ":handler",
63    "$dir_pw_assert:assert_compatibility_backend",
64    "$dir_pw_assert:config",
65  ]
66  sources = [ "assert_basic.cc" ]
67}
68
69# A basic handler backend using pw_sys_io.
70pw_source_set("basic_handler") {
71  # Turn off GN check since this target intentionally leaves out deps to avoid
72  # circular dependencies.
73  check_includes = false
74
75  # Depend on the include path instead of the library to avoid circular deps.
76  configs = [
77    "$dir_pw_string:public_include_path",
78    "$dir_pw_result:public_include_path",
79  ]
80  deps = [
81    ":handler.facade",
82    "$dir_pw_assert:config",
83    "$dir_pw_preprocessor",
84    "$dir_pw_string:builder",
85    "$dir_pw_sys_io",
86  ]
87  sources = [ "basic_handler.cc" ]
88}
89
90pw_doc_group("docs") {
91  sources = [ "docs.rst" ]
92}
93
94pw_test_group("tests") {
95}
96