• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright 2021 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_thread/backend.gni")
21import("$dir_pw_unit_test/test.gni")
22
23config("public_include_path") {
24  include_dirs = [ "public" ]
25  visibility = [ ":*" ]
26}
27
28pw_source_set("pw_work_queue") {
29  public_configs = [ ":public_include_path" ]
30  public = [ "public/pw_work_queue/work_queue.h" ]
31  public_deps = [
32    "$dir_pw_containers:inline_queue",
33    "$dir_pw_sync:interrupt_spin_lock",
34    "$dir_pw_sync:lock_annotations",
35    "$dir_pw_sync:thread_notification",
36    "$dir_pw_thread:thread",
37    "$dir_pw_thread:thread_core",
38    dir_pw_function,
39    dir_pw_metric,
40    dir_pw_span,
41    dir_pw_status,
42  ]
43  sources = [ "work_queue.cc" ]
44}
45
46pw_source_set("test_thread") {
47  public_configs = [ ":public_include_path" ]
48  public = [ "public/pw_work_queue/test_thread.h" ]
49  public_deps = [ "$dir_pw_thread:thread" ]
50}
51
52# To instantiate this test based on a selected thread backend to provide
53# test_thread you can create a pw_test target which depends on this
54# pw_source_set and a pw_source_set which provides the implementation of
55# test_thread. See ":stl_work_queue_test" as an example.
56pw_source_set("work_queue_test") {
57  testonly = pw_unit_test_TESTONLY
58  sources = [ "work_queue_test.cc" ]
59  deps = [
60    ":pw_work_queue",
61    ":test_thread",
62    dir_pw_log,
63    dir_pw_unit_test,
64  ]
65}
66
67pw_test_group("tests") {
68  tests = [ ":stl_work_queue_test" ]
69}
70
71pw_source_set("stl_test_thread") {
72  sources = [ "stl_test_thread.cc" ]
73  deps = [
74    ":test_thread",
75    "$dir_pw_thread:thread",
76    "$dir_pw_thread_stl:thread",
77  ]
78}
79
80pw_test("stl_work_queue_test") {
81  enable_if = pw_thread_THREAD_BACKEND == "$dir_pw_thread_stl:thread"
82  deps = [
83    ":stl_test_thread",
84    ":work_queue_test",
85  ]
86}
87
88pw_doc_group("docs") {
89  sources = [ "docs.rst" ]
90}
91