Taylor Cramer | 096c152 | 2023-07-25 18:44:16 +0000 | [diff] [blame] | 1 | # Copyright 2023 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 | |
| 15 | import("//build_overrides/pigweed.gni") |
| 16 | |
| 17 | import("$dir_pw_bloat/bloat.gni") |
| 18 | import("$dir_pw_build/target_types.gni") |
| 19 | import("$dir_pw_thread/backend.gni") |
| 20 | import("$dir_pw_toolchain/subtoolchain.gni") |
| 21 | |
| 22 | config("public_include_path") { |
| 23 | include_dirs = [ "public" ] |
| 24 | } |
| 25 | |
| 26 | pw_source_set("base") { |
| 27 | public = [ "public/pw_async_bench/base.h" ] |
| 28 | sources = [ "base.cc" ] |
| 29 | public_configs = [ ":public_include_path" ] |
| 30 | public_deps = [ |
| 31 | "$dir_pw_async:dispatcher", |
| 32 | "$dir_pw_async:task", |
| 33 | ] |
| 34 | } |
| 35 | |
| 36 | pw_source_set("callback") { |
| 37 | public = [ |
| 38 | "public/pw_async_bench/callback.h", |
| 39 | "public/pw_async_bench/callback_echo.h", |
| 40 | "public/pw_async_bench/callback_impl.h", |
| 41 | ] |
| 42 | sources = [ |
| 43 | "callback.cc", |
| 44 | "callback_echo.cc", |
| 45 | "callback_impl.cc", |
| 46 | ] |
| 47 | public_configs = [ ":public_include_path" ] |
| 48 | public_deps = [ |
| 49 | ":base", |
| 50 | "$dir_pw_async:heap_dispatcher", |
| 51 | "$dir_pw_result", |
| 52 | "$dir_pw_status", |
| 53 | ] |
| 54 | } |
| 55 | |
| 56 | pw_executable("callback_executable") { |
| 57 | sources = [ "callback_executable.cc" ] |
| 58 | deps = [ |
| 59 | ":callback", |
| 60 | "$dir_pw_async_basic:dispatcher", |
| 61 | "$dir_pw_bloat:bloat_this_binary", |
| 62 | "$dir_pw_result", |
| 63 | "$dir_pw_status", |
| 64 | "$dir_pw_thread:thread", |
| 65 | ] |
| 66 | } |
| 67 | |
| 68 | pw_source_set("bivariant") { |
| 69 | public = [ "public/pw_async_bench/bivariant.h" ] |
| 70 | sources = [] |
| 71 | } |
| 72 | |
| 73 | pw_source_set("poll") { |
| 74 | public = [ |
| 75 | "public/pw_async_bench/poll.h", |
| 76 | "public/pw_async_bench/poll_echo.h", |
| 77 | "public/pw_async_bench/poll_impl.h", |
| 78 | ] |
| 79 | sources = [ |
| 80 | "poll.cc", |
| 81 | "poll_echo.cc", |
| 82 | "poll_impl.cc", |
| 83 | ] |
| 84 | public_configs = [ ":public_include_path" ] |
| 85 | public_deps = [ |
| 86 | ":base", |
| 87 | ":bivariant", |
| 88 | "$dir_pw_result", |
| 89 | ] |
| 90 | } |
| 91 | |
| 92 | pw_executable("poll_executable") { |
| 93 | sources = [ "poll_executable.cc" ] |
| 94 | deps = [ |
| 95 | ":bivariant", |
| 96 | ":poll", |
| 97 | "$dir_pw_async_basic:dispatcher", |
| 98 | "$dir_pw_bloat:bloat_this_binary", |
| 99 | "$dir_pw_result", |
| 100 | "$dir_pw_status", |
| 101 | "$dir_pw_thread:thread", |
| 102 | ] |
| 103 | } |
| 104 | |
| 105 | executable("empty_base") { |
| 106 | sources = [ "empty_main.cc" ] |
| 107 | } |
| 108 | |
| 109 | # This target currently causes `pw bloat` to fail because there are too |
| 110 | # many differences between the two executables and the `empty_base`. |
| 111 | # |
| 112 | # pw_size_diff("callback_to_poll_diff") { |
| 113 | # base = ":empty_base" |
| 114 | # data_sources = "symbols,segments" |
| 115 | # binaries = [ |
| 116 | # { |
| 117 | # target = ":callback_executable" |
| 118 | # label = "Echo using callbacks" |
| 119 | # }, |
| 120 | # { |
| 121 | # target = ":poll_executable" |
| 122 | # label = "Echo using poll" |
| 123 | # }, |
| 124 | # ] |
| 125 | # } |
| 126 | |
| 127 | pw_size_diff("callback_to_poll_diff") { |
| 128 | base = ":callback_executable" |
| 129 | data_sources = "symbols,segments" |
| 130 | binaries = [ |
| 131 | { |
| 132 | target = ":poll_executable" |
| 133 | label = "Echo using poll" |
| 134 | }, |
| 135 | ] |
| 136 | } |
| 137 | |
| 138 | group("size_benchmarks") { |
| 139 | deps = [ |
| 140 | ":callback_executable", |
| 141 | ":callback_to_poll_diff", |
| 142 | ":poll_executable", |
| 143 | ] |
| 144 | } |