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.thread_core 91 pw_thread.yield 92 pw_unit_test 93) 94 95pw_add_test(pw_multisink.multisink_test 96 SOURCES 97 multisink_test.cc 98 PRIVATE_DEPS 99 pw_function 100 pw_multisink 101 pw_span 102 pw_status 103 GROUPS 104 modules 105 pw_multisink 106) 107 108pw_add_library(pw_multisink.stl_test_thread STATIC 109 SOURCES 110 stl_test_thread.cc 111 PRIVATE_DEPS 112 pw_multisink.test_thread 113 pw_thread.thread 114 pw_thread_stl.thread 115) 116 117if("${pw_thread.thread_BACKEND}" STREQUAL "pw_thread_stl.thread") 118 pw_add_test(pw_multisink.stl_multisink_threaded_test 119 PRIVATE_DEPS 120 pw_span 121 pw_multisink.multisink_threaded_test 122 pw_multisink.stl_test_thread 123 GROUPS 124 modules 125 pw_multisink 126 ) 127endif() 128