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 15include($ENV{PW_ROOT}/pw_build/pigweed.cmake) 16 17pw_add_module_config(pw_multisink_CONFIG) 18 19pw_add_library(pw_multisink.config INTERFACE 20 HEADERS 21 public/pw_multisink/config.h 22 PUBLIC_INCLUDES 23 public 24 PUBLIC_DEPS 25 ${pw_multisink_CONFIG} 26) 27 28pw_add_library(pw_multisink STATIC 29 HEADERS 30 public/pw_multisink/multisink.h 31 PUBLIC_INCLUDES 32 public 33 PUBLIC_DEPS 34 pw_bytes 35 pw_containers 36 pw_function 37 pw_multisink.config 38 pw_result 39 pw_ring_buffer 40 pw_status 41 pw_sync.interrupt_spin_lock 42 pw_sync.lock_annotations 43 pw_sync.mutex 44 SOURCES 45 multisink.cc 46 PRIVATE_DEPS 47 pw_assert 48 pw_log 49 pw_varint 50) 51 52pw_add_library(pw_multisink.util STATIC 53 HEADERS 54 public/pw_multisink/util.h 55 PUBLIC_INCLUDES 56 public 57 PUBLIC_DEPS 58 pw_log.protos.pwpb 59 pw_multisink 60 pw_status 61 SOURCES 62 util.cc 63 PRIVATE_DEPS 64 pw_bytes 65 pw_function 66) 67 68pw_add_library(pw_multisink.test_thread INTERFACE 69 HEADERS 70 public/pw_multisink/test_thread.h 71 PUBLIC_INCLUDES 72 public 73 PUBLIC_DEPS 74 pw_thread.thread 75) 76 77# Tests that use threads. 78# To instantiate this test based on a thread backend, create a pw_add_test 79# target that depends on this pw_add_module_library and a pw_add_module_library 80# that provides the implementaiton of pw_multisink.test_thread. See 81# pw_multisink.stl_multisink_test as an example. 82pw_add_library(pw_multisink.multisink_threaded_test STATIC 83 SOURCES 84 multisink_threaded_test.cc 85 PRIVATE_DEPS 86 pw_multisink 87 pw_multisink.test_thread 88 pw_string 89 pw_thread.thread 90 pw_thread.yield 91 pw_unit_test 92) 93 94pw_add_test(pw_multisink.multisink_test 95 SOURCES 96 multisink_test.cc 97 PRIVATE_DEPS 98 pw_function 99 pw_multisink 100 pw_span 101 pw_status 102 GROUPS 103 modules 104 pw_multisink 105) 106 107pw_add_library(pw_multisink.stl_test_thread STATIC 108 SOURCES 109 stl_test_thread.cc 110 PRIVATE_DEPS 111 pw_multisink.test_thread 112 pw_thread.thread 113 pw_thread_stl.thread 114) 115 116if("${pw_thread.thread_BACKEND}" STREQUAL "pw_thread_stl.thread") 117 pw_add_test(pw_multisink.stl_multisink_threaded_test 118 PRIVATE_DEPS 119 pw_span 120 pw_multisink.multisink_threaded_test 121 pw_multisink.stl_test_thread 122 GROUPS 123 modules 124 pw_multisink 125 ) 126endif() 127