xref: /aosp_15_r20/external/pigweed/pw_status/BUILD.gn (revision 61c4878ac05f98d0ceed94b57d316916de578985)
1# Copyright 2019 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/module_config.gni")
18import("$dir_pw_build/target_types.gni")
19import("$dir_pw_docgen/docs.gni")
20import("$dir_pw_unit_test/test.gni")
21
22declare_args() {
23  # The build target that overrides the default configuration options for this
24  # module. This should point to a source set that provides defines through a
25  # public config (which may -include a file or add defines directly).
26  pw_status_CONFIG = pw_build_DEFAULT_MODULE_CONFIG
27}
28
29config("public_include_path") {
30  include_dirs = [ "public" ]
31  visibility = [ ":*" ]
32}
33
34pw_source_set("pw_status") {
35  public_configs = [ ":public_include_path" ]
36  public_deps = [ pw_status_CONFIG ]
37  public = [
38    "public/pw_status/status.h",
39    "public/pw_status/status_with_size.h",
40    "public/pw_status/try.h",
41  ]
42  sources = [
43    "public/pw_status/internal/config.h",
44    "status.cc",
45  ]
46}
47
48config("check_if_used_config") {
49  defines = [ "PW_STATUS_CFG_CHECK_IF_USED=1" ]
50  visibility = [ ":*" ]
51}
52
53# Use this for pw_status_CONFIG to require pw::Status objects to be used.
54pw_source_set("check_if_used") {
55  public_configs = [ ":check_if_used_config" ]
56}
57
58pw_test_group("tests") {
59  tests = [
60    ":status_test",
61    ":status_with_size_test",
62    ":try_test",
63  ]
64}
65
66pw_test("status_test") {
67  deps = [ ":pw_status" ]
68  sources = [
69    "status_test.cc",
70    "status_test_c.c",
71  ]
72}
73
74pw_test("status_with_size_test") {
75  deps = [ ":pw_status" ]
76  sources = [ "status_with_size_test.cc" ]
77}
78
79pw_test("try_test") {
80  deps = [ ":pw_status" ]
81  sources = [ "try_test.cc" ]
82}
83
84pw_doc_group("docs") {
85  inputs = [ "Kconfig" ]
86  sources = [
87    "docs.rst",
88    "guide.rst",
89    "reference.rst",
90  ]
91}
92