xref: /aosp_15_r20/external/pigweed/pw_async2/examples/BUILD.gn (revision 61c4878ac05f98d0ceed94b57d316916de578985)
1# Copyright 2024 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_async2/backend.gni")
18import("$dir_pw_toolchain/traits.gni")
19import("$dir_pw_unit_test/test.gni")
20
21if (pw_toolchain_CXX_STANDARD >= pw_toolchain_STANDARD.CXX20) {
22  pw_test("basic") {
23    enable_if = pw_async2_DISPATCHER_BACKEND != ""
24    deps = [
25      "$dir_pw_allocator:testing",
26      "$dir_pw_async2:coro",
27      "$dir_pw_async2:dispatcher",
28    ]
29    sources = [ "basic.cc" ]
30  }
31
32  pw_test("coro_blinky_loop") {
33    enable_if = pw_async2_DISPATCHER_BACKEND != ""
34    sources = [ "coro_blinky_loop.cc" ]
35    deps = [
36      "$dir_pw_allocator:testing",
37      "$dir_pw_async2:coro",
38      "$dir_pw_async2:dispatcher",
39      "$dir_pw_async2:simulated_time_provider",
40      "$dir_pw_async2:time_provider",
41      "$dir_pw_chrono:system_clock",
42    ]
43  }
44
45  pw_test("once_send_recv") {
46    enable_if = pw_async2_DISPATCHER_BACKEND != ""
47    deps = [
48      "$dir_pw_allocator:testing",
49      "$dir_pw_async2:coro",
50      "$dir_pw_async2:dispatcher",
51      "$dir_pw_async2:once_sender",
52    ]
53    sources = [ "once_send_recv.cc" ]
54  }
55}
56
57pw_test_group("examples") {
58  tests = []
59  if (pw_toolchain_CXX_STANDARD >= pw_toolchain_STANDARD.CXX20) {
60    tests += [
61      ":basic",
62      ":coro_blinky_loop",
63      ":once_send_recv",
64    ]
65  }
66}
67