1# Copyright 2022 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 15include($ENV{PW_ROOT}/pw_build/pigweed.cmake) 16 17pw_add_library(pw_work_queue STATIC 18 HEADERS 19 public/pw_work_queue/work_queue.h 20 PUBLIC_INCLUDES 21 public 22 PUBLIC_DEPS 23 pw_containers.inline_queue 24 pw_sync.interrupt_spin_lock 25 pw_sync.lock_annotations 26 pw_sync.thread_notification 27 pw_thread.thread 28 pw_thread.thread_core 29 pw_function 30 pw_metric 31 pw_span 32 pw_status 33 SOURCES 34 work_queue.cc 35) 36 37pw_add_library(pw_work_queue.test_thread INTERFACE 38 HEADERS 39 public/pw_work_queue/test_thread.h 40 PUBLIC_INCLUDES 41 public 42 PUBLIC_DEPS 43 pw_thread.thread 44) 45 46# To instantiate this test based on a selected thread backend to provide 47# test_thread you can create a pw_add_test which depends on this 48# pw_add_library and a pw_add_library which provides the implementation of 49# test_thread. See pw_work_queue.stl_work_queue_test as an example. 50pw_add_library(pw_work_queue.work_queue_test STATIC 51 SOURCES 52 work_queue_test.cc 53 PRIVATE_DEPS 54 pw_work_queue 55 pw_work_queue.test_thread 56 pw_log 57 pw_unit_test 58) 59 60pw_add_library(pw_work_queue.stl_test_thread STATIC 61 SOURCES 62 stl_test_thread.cc 63 PRIVATE_DEPS 64 pw_work_queue.test_thread 65 pw_thread.thread 66 pw_thread_stl.thread 67) 68 69if("${pw_thread.thread_BACKEND}" STREQUAL "pw_thread_stl.thread") 70 pw_add_test(pw_work_queue.stl_work_queue_test 71 PRIVATE_DEPS 72 pw_work_queue.stl_test_thread 73 pw_work_queue.work_queue_test 74 GROUPS 75 modules 76 pw_work_queue 77 ) 78endif() 79