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_function, 38 dir_pw_metric, 39 dir_pw_span, 40 dir_pw_status, 41 ] 42 sources = [ "work_queue.cc" ] 43} 44 45pw_source_set("test_thread") { 46 public_configs = [ ":public_include_path" ] 47 public = [ "public/pw_work_queue/test_thread.h" ] 48 public_deps = [ "$dir_pw_thread:thread" ] 49} 50 51# To instantiate this test based on a selected thread backend to provide 52# test_thread you can create a pw_test target which depends on this 53# pw_source_set and a pw_source_set which provides the implementation of 54# test_thread. See ":stl_work_queue_test" as an example. 55pw_source_set("work_queue_test") { 56 testonly = pw_unit_test_TESTONLY 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 70pw_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 ] 77} 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} 90