blob: 1fac1ad0362a40fdc0f50cbf9ac7a043debf746c [file] [log] [blame]
Alexei Frolov41b32d32019-11-13 17:22:03 -08001# 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
Armando Montanezfb3d3fb2020-06-09 18:12:12 -070015import("//build_overrides/pigweed.gni")
16
Alexei Frolovde3c2a12020-08-31 10:57:25 -070017import("$dir_pw_bloat/bloat.gni")
Alexei Frolovedd2f142020-06-09 19:11:27 -070018import("$dir_pw_build/target_types.gni")
Alexei Frolov41b32d32019-11-13 17:22:03 -080019import("$dir_pw_docgen/docs.gni")
20import("$dir_pw_unit_test/test.gni")
Wyatt Heplerd49f8fe2020-10-15 10:13:47 -070021
Ewout van Bekkumf89f1372021-05-03 11:15:54 -070022config("public_include_path") {
Alexei Frolov41b32d32019-11-13 17:22:03 -080023 include_dirs = [ "public" ]
24}
25
Alexei Frolovedd2f142020-06-09 19:11:27 -070026pw_source_set("pw_result") {
Ewout van Bekkumf89f1372021-05-03 11:15:54 -070027 public_configs = [ ":public_include_path" ]
Ewout van Bekkumd4189682020-07-23 16:17:02 -070028 public_deps = [
29 "$dir_pw_assert",
Wyatt Hepler4298fd02021-03-19 15:08:10 -070030 "$dir_pw_preprocessor",
Ewout van Bekkumd4189682020-07-23 16:17:02 -070031 "$dir_pw_status",
32 ]
Alexei Frolov41b32d32019-11-13 17:22:03 -080033 public = [ "public/pw_result/result.h" ]
Wyatt Hepler36672302021-04-22 09:35:04 -070034 sources = [ "public/pw_result/internal/result_internal.h" ]
Alexei Frolov41b32d32019-11-13 17:22:03 -080035}
36
37pw_test_group("tests") {
38 tests = [ ":result_test" ]
39}
40
41pw_test("result_test") {
Ewout van Bekkum3a260a22021-04-20 13:52:27 -070042 deps = [
43 ":pw_result",
44 dir_pw_status,
45 ]
Wyatt Hepler36672302021-04-22 09:35:04 -070046 sources = [
47 "result_test.cc",
48 "statusor_test.cc",
49 ]
Alexei Frolov41b32d32019-11-13 17:22:03 -080050}
51
52pw_doc_group("docs") {
53 sources = [ "docs.rst" ]
Alexei Frolovde3c2a12020-08-31 10:57:25 -070054 report_deps = [ ":result_size" ]
55}
56
57pw_size_report("result_size") {
58 title = "pw::Result vs. pw::Status and out pointer"
59
60 binaries = [
61 {
62 target = "size_report:result_simple"
63 base = "size_report:pointer_simple"
64 label = "Simple function"
65 },
66 {
67 target = "size_report:result_noinline"
68 base = "size_report:pointer_noinline"
69 label = "Simple function without inlining"
70 },
71 {
72 target = "size_report:result_read"
73 base = "size_report:pointer_read"
74 label = "Returning a larger object (std::span)"
75 },
76 ]
Alexei Frolov41b32d32019-11-13 17:22:03 -080077}