blob: 08fd679d8b88eda8a6f4f8dc4633ef1f756dc152 [file] [log] [blame]
Ewout van Bekkum04f12922021-08-05 19:34:52 -07001# 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 = [
31 "public/pw_work_queue/internal/circular_buffer.h",
32 "public/pw_work_queue/work_queue.h",
33 ]
34 public_deps = [
35 "$dir_pw_sync:interrupt_spin_lock",
36 "$dir_pw_sync:lock_annotations",
37 "$dir_pw_sync:thread_notification",
38 "$dir_pw_thread:thread",
39 dir_pw_function,
40 dir_pw_metric,
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 sources = [ "work_queue_test.cc" ]
58 deps = [
59 ":pw_work_queue",
60 ":test_thread",
61 dir_pw_log,
62 dir_pw_unit_test,
63 ]
64}
65
66pw_test_group("tests") {
67 tests = [ ":stl_work_queue_test" ]
68}
69
Rob Mohr4663d472021-09-08 11:29:07 -070070pw_source_set("stl_test_thread") {
71 sources = [ "stl_test_thread.cc" ]
72 deps = [
73 ":test_thread",
74 "$dir_pw_thread:thread",
75 "$dir_pw_thread_stl:thread",
76 ]
Ewout van Bekkum04f12922021-08-05 19:34:52 -070077}
78
79pw_test("stl_work_queue_test") {
80 enable_if = pw_thread_THREAD_BACKEND == "$dir_pw_thread_stl:thread"
81 deps = [
82 ":stl_test_thread",
83 ":work_queue_test",
84 ]
85}
86
87pw_doc_group("docs") {
88 sources = [ "docs.rst" ]
89}