1*61c4878aSAndroid Build Coastguard Worker# Copyright 2021 The Pigweed Authors 2*61c4878aSAndroid Build Coastguard Worker# 3*61c4878aSAndroid Build Coastguard Worker# Licensed under the Apache License, Version 2.0 (the "License"); you may not 4*61c4878aSAndroid Build Coastguard Worker# use this file except in compliance with the License. You may obtain a copy of 5*61c4878aSAndroid Build Coastguard Worker# the License at 6*61c4878aSAndroid Build Coastguard Worker# 7*61c4878aSAndroid Build Coastguard Worker# https://www.apache.org/licenses/LICENSE-2.0 8*61c4878aSAndroid Build Coastguard Worker# 9*61c4878aSAndroid Build Coastguard Worker# Unless required by applicable law or agreed to in writing, software 10*61c4878aSAndroid Build Coastguard Worker# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 11*61c4878aSAndroid Build Coastguard Worker# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 12*61c4878aSAndroid Build Coastguard Worker# License for the specific language governing permissions and limitations under 13*61c4878aSAndroid Build Coastguard Worker# the License. 14*61c4878aSAndroid Build Coastguard Worker 15*61c4878aSAndroid Build Coastguard Workerinclude($ENV{PW_ROOT}/pw_build/pigweed.cmake) 16*61c4878aSAndroid Build Coastguard Worker 17*61c4878aSAndroid Build Coastguard Workerpw_add_module_config(pw_multisink_CONFIG) 18*61c4878aSAndroid Build Coastguard Worker 19*61c4878aSAndroid Build Coastguard Workerpw_add_library(pw_multisink.config INTERFACE 20*61c4878aSAndroid Build Coastguard Worker HEADERS 21*61c4878aSAndroid Build Coastguard Worker public/pw_multisink/config.h 22*61c4878aSAndroid Build Coastguard Worker PUBLIC_INCLUDES 23*61c4878aSAndroid Build Coastguard Worker public 24*61c4878aSAndroid Build Coastguard Worker PUBLIC_DEPS 25*61c4878aSAndroid Build Coastguard Worker ${pw_multisink_CONFIG} 26*61c4878aSAndroid Build Coastguard Worker) 27*61c4878aSAndroid Build Coastguard Worker 28*61c4878aSAndroid Build Coastguard Workerpw_add_library(pw_multisink STATIC 29*61c4878aSAndroid Build Coastguard Worker HEADERS 30*61c4878aSAndroid Build Coastguard Worker public/pw_multisink/multisink.h 31*61c4878aSAndroid Build Coastguard Worker PUBLIC_INCLUDES 32*61c4878aSAndroid Build Coastguard Worker public 33*61c4878aSAndroid Build Coastguard Worker PUBLIC_DEPS 34*61c4878aSAndroid Build Coastguard Worker pw_bytes 35*61c4878aSAndroid Build Coastguard Worker pw_containers 36*61c4878aSAndroid Build Coastguard Worker pw_function 37*61c4878aSAndroid Build Coastguard Worker pw_multisink.config 38*61c4878aSAndroid Build Coastguard Worker pw_result 39*61c4878aSAndroid Build Coastguard Worker pw_ring_buffer 40*61c4878aSAndroid Build Coastguard Worker pw_status 41*61c4878aSAndroid Build Coastguard Worker pw_sync.interrupt_spin_lock 42*61c4878aSAndroid Build Coastguard Worker pw_sync.lock_annotations 43*61c4878aSAndroid Build Coastguard Worker pw_sync.mutex 44*61c4878aSAndroid Build Coastguard Worker SOURCES 45*61c4878aSAndroid Build Coastguard Worker multisink.cc 46*61c4878aSAndroid Build Coastguard Worker PRIVATE_DEPS 47*61c4878aSAndroid Build Coastguard Worker pw_assert 48*61c4878aSAndroid Build Coastguard Worker pw_log 49*61c4878aSAndroid Build Coastguard Worker pw_varint 50*61c4878aSAndroid Build Coastguard Worker) 51*61c4878aSAndroid Build Coastguard Worker 52*61c4878aSAndroid Build Coastguard Workerpw_add_library(pw_multisink.util STATIC 53*61c4878aSAndroid Build Coastguard Worker HEADERS 54*61c4878aSAndroid Build Coastguard Worker public/pw_multisink/util.h 55*61c4878aSAndroid Build Coastguard Worker PUBLIC_INCLUDES 56*61c4878aSAndroid Build Coastguard Worker public 57*61c4878aSAndroid Build Coastguard Worker PUBLIC_DEPS 58*61c4878aSAndroid Build Coastguard Worker pw_log.protos.pwpb 59*61c4878aSAndroid Build Coastguard Worker pw_multisink 60*61c4878aSAndroid Build Coastguard Worker pw_status 61*61c4878aSAndroid Build Coastguard Worker SOURCES 62*61c4878aSAndroid Build Coastguard Worker util.cc 63*61c4878aSAndroid Build Coastguard Worker PRIVATE_DEPS 64*61c4878aSAndroid Build Coastguard Worker pw_bytes 65*61c4878aSAndroid Build Coastguard Worker pw_function 66*61c4878aSAndroid Build Coastguard Worker) 67*61c4878aSAndroid Build Coastguard Worker 68*61c4878aSAndroid Build Coastguard Workerpw_add_library(pw_multisink.test_thread INTERFACE 69*61c4878aSAndroid Build Coastguard Worker HEADERS 70*61c4878aSAndroid Build Coastguard Worker public/pw_multisink/test_thread.h 71*61c4878aSAndroid Build Coastguard Worker PUBLIC_INCLUDES 72*61c4878aSAndroid Build Coastguard Worker public 73*61c4878aSAndroid Build Coastguard Worker PUBLIC_DEPS 74*61c4878aSAndroid Build Coastguard Worker pw_thread.thread 75*61c4878aSAndroid Build Coastguard Worker) 76*61c4878aSAndroid Build Coastguard Worker 77*61c4878aSAndroid Build Coastguard Worker# Tests that use threads. 78*61c4878aSAndroid Build Coastguard Worker# To instantiate this test based on a thread backend, create a pw_add_test 79*61c4878aSAndroid Build Coastguard Worker# target that depends on this pw_add_module_library and a pw_add_module_library 80*61c4878aSAndroid Build Coastguard Worker# that provides the implementaiton of pw_multisink.test_thread. See 81*61c4878aSAndroid Build Coastguard Worker# pw_multisink.stl_multisink_test as an example. 82*61c4878aSAndroid Build Coastguard Workerpw_add_library(pw_multisink.multisink_threaded_test STATIC 83*61c4878aSAndroid Build Coastguard Worker SOURCES 84*61c4878aSAndroid Build Coastguard Worker multisink_threaded_test.cc 85*61c4878aSAndroid Build Coastguard Worker PRIVATE_DEPS 86*61c4878aSAndroid Build Coastguard Worker pw_multisink 87*61c4878aSAndroid Build Coastguard Worker pw_multisink.test_thread 88*61c4878aSAndroid Build Coastguard Worker pw_string 89*61c4878aSAndroid Build Coastguard Worker pw_thread.thread 90*61c4878aSAndroid Build Coastguard Worker pw_thread.yield 91*61c4878aSAndroid Build Coastguard Worker pw_unit_test 92*61c4878aSAndroid Build Coastguard Worker) 93*61c4878aSAndroid Build Coastguard Worker 94*61c4878aSAndroid Build Coastguard Workerpw_add_test(pw_multisink.multisink_test 95*61c4878aSAndroid Build Coastguard Worker SOURCES 96*61c4878aSAndroid Build Coastguard Worker multisink_test.cc 97*61c4878aSAndroid Build Coastguard Worker PRIVATE_DEPS 98*61c4878aSAndroid Build Coastguard Worker pw_function 99*61c4878aSAndroid Build Coastguard Worker pw_multisink 100*61c4878aSAndroid Build Coastguard Worker pw_span 101*61c4878aSAndroid Build Coastguard Worker pw_status 102*61c4878aSAndroid Build Coastguard Worker GROUPS 103*61c4878aSAndroid Build Coastguard Worker modules 104*61c4878aSAndroid Build Coastguard Worker pw_multisink 105*61c4878aSAndroid Build Coastguard Worker) 106*61c4878aSAndroid Build Coastguard Worker 107*61c4878aSAndroid Build Coastguard Workerpw_add_library(pw_multisink.stl_test_thread STATIC 108*61c4878aSAndroid Build Coastguard Worker SOURCES 109*61c4878aSAndroid Build Coastguard Worker stl_test_thread.cc 110*61c4878aSAndroid Build Coastguard Worker PRIVATE_DEPS 111*61c4878aSAndroid Build Coastguard Worker pw_multisink.test_thread 112*61c4878aSAndroid Build Coastguard Worker pw_thread.thread 113*61c4878aSAndroid Build Coastguard Worker pw_thread_stl.thread 114*61c4878aSAndroid Build Coastguard Worker) 115*61c4878aSAndroid Build Coastguard Worker 116*61c4878aSAndroid Build Coastguard Workerif("${pw_thread.thread_BACKEND}" STREQUAL "pw_thread_stl.thread") 117*61c4878aSAndroid Build Coastguard Worker pw_add_test(pw_multisink.stl_multisink_threaded_test 118*61c4878aSAndroid Build Coastguard Worker PRIVATE_DEPS 119*61c4878aSAndroid Build Coastguard Worker pw_span 120*61c4878aSAndroid Build Coastguard Worker pw_multisink.multisink_threaded_test 121*61c4878aSAndroid Build Coastguard Worker pw_multisink.stl_test_thread 122*61c4878aSAndroid Build Coastguard Worker GROUPS 123*61c4878aSAndroid Build Coastguard Worker modules 124*61c4878aSAndroid Build Coastguard Worker pw_multisink 125*61c4878aSAndroid Build Coastguard Worker ) 126*61c4878aSAndroid Build Coastguard Workerendif() 127