1*61c4878aSAndroid Build Coastguard Worker# Copyright 2020 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 Workerinclude($ENV{PW_ROOT}/pw_protobuf_compiler/proto.cmake) 17*61c4878aSAndroid Build Coastguard Worker 18*61c4878aSAndroid Build Coastguard Workerpw_add_module_config(pw_transfer_CONFIG) 19*61c4878aSAndroid Build Coastguard Worker 20*61c4878aSAndroid Build Coastguard Workerpw_add_library(pw_transfer.config INTERFACE 21*61c4878aSAndroid Build Coastguard Worker PUBLIC_DEPS 22*61c4878aSAndroid Build Coastguard Worker ${pw_transfer_CONFIG} 23*61c4878aSAndroid Build Coastguard Worker pw_chrono.system_timer 24*61c4878aSAndroid Build Coastguard Worker HEADERS 25*61c4878aSAndroid Build Coastguard Worker public/pw_transfer/internal/config.h 26*61c4878aSAndroid Build Coastguard Worker PUBLIC_INCLUDES 27*61c4878aSAndroid Build Coastguard Worker public 28*61c4878aSAndroid Build Coastguard Worker) 29*61c4878aSAndroid Build Coastguard Worker 30*61c4878aSAndroid Build Coastguard Workerpw_add_library(pw_transfer STATIC 31*61c4878aSAndroid Build Coastguard Worker HEADERS 32*61c4878aSAndroid Build Coastguard Worker public/pw_transfer/transfer.h 33*61c4878aSAndroid Build Coastguard Worker PUBLIC_INCLUDES 34*61c4878aSAndroid Build Coastguard Worker public 35*61c4878aSAndroid Build Coastguard Worker SOURCES 36*61c4878aSAndroid Build Coastguard Worker transfer.cc 37*61c4878aSAndroid Build Coastguard Worker PUBLIC_DEPS 38*61c4878aSAndroid Build Coastguard Worker pw_assert 39*61c4878aSAndroid Build Coastguard Worker pw_bytes 40*61c4878aSAndroid Build Coastguard Worker pw_result 41*61c4878aSAndroid Build Coastguard Worker pw_status 42*61c4878aSAndroid Build Coastguard Worker pw_stream 43*61c4878aSAndroid Build Coastguard Worker pw_sync.mutex 44*61c4878aSAndroid Build Coastguard Worker pw_transfer.core 45*61c4878aSAndroid Build Coastguard Worker pw_transfer.proto.raw_rpc 46*61c4878aSAndroid Build Coastguard Worker PRIVATE_DEPS 47*61c4878aSAndroid Build Coastguard Worker pw_log 48*61c4878aSAndroid Build Coastguard Worker pw_log.rate_limited 49*61c4878aSAndroid Build Coastguard Worker pw_transfer.proto.pwpb 50*61c4878aSAndroid Build Coastguard Worker) 51*61c4878aSAndroid Build Coastguard Worker 52*61c4878aSAndroid Build Coastguard Workerpw_add_library(pw_transfer.client STATIC 53*61c4878aSAndroid Build Coastguard Worker HEADERS 54*61c4878aSAndroid Build Coastguard Worker public/pw_transfer/client.h 55*61c4878aSAndroid Build Coastguard Worker PUBLIC_INCLUDES 56*61c4878aSAndroid Build Coastguard Worker public 57*61c4878aSAndroid Build Coastguard Worker SOURCES 58*61c4878aSAndroid Build Coastguard Worker client.cc 59*61c4878aSAndroid Build Coastguard Worker PUBLIC_DEPS 60*61c4878aSAndroid Build Coastguard Worker pw_assert 61*61c4878aSAndroid Build Coastguard Worker pw_function 62*61c4878aSAndroid Build Coastguard Worker pw_stream 63*61c4878aSAndroid Build Coastguard Worker pw_transfer.core 64*61c4878aSAndroid Build Coastguard Worker pw_transfer.proto.raw_rpc 65*61c4878aSAndroid Build Coastguard Worker PRIVATE_DEPS 66*61c4878aSAndroid Build Coastguard Worker pw_log 67*61c4878aSAndroid Build Coastguard Worker) 68*61c4878aSAndroid Build Coastguard Worker 69*61c4878aSAndroid Build Coastguard Workerpw_add_library(pw_transfer.core STATIC 70*61c4878aSAndroid Build Coastguard Worker PUBLIC_DEPS 71*61c4878aSAndroid Build Coastguard Worker pw_bytes 72*61c4878aSAndroid Build Coastguard Worker pw_chrono.system_clock 73*61c4878aSAndroid Build Coastguard Worker pw_containers.intrusive_list 74*61c4878aSAndroid Build Coastguard Worker pw_result 75*61c4878aSAndroid Build Coastguard Worker pw_rpc.client 76*61c4878aSAndroid Build Coastguard Worker pw_rpc.raw.client_api 77*61c4878aSAndroid Build Coastguard Worker pw_rpc.raw.server_api 78*61c4878aSAndroid Build Coastguard Worker pw_status 79*61c4878aSAndroid Build Coastguard Worker pw_stream 80*61c4878aSAndroid Build Coastguard Worker pw_sync.binary_semaphore 81*61c4878aSAndroid Build Coastguard Worker pw_sync.timed_thread_notification 82*61c4878aSAndroid Build Coastguard Worker pw_thread.thread_core 83*61c4878aSAndroid Build Coastguard Worker pw_transfer.config 84*61c4878aSAndroid Build Coastguard Worker pw_transfer.proto.pwpb 85*61c4878aSAndroid Build Coastguard Worker HEADERS 86*61c4878aSAndroid Build Coastguard Worker public/pw_transfer/internal/chunk.h 87*61c4878aSAndroid Build Coastguard Worker public/pw_transfer/internal/client_context.h 88*61c4878aSAndroid Build Coastguard Worker public/pw_transfer/internal/context.h 89*61c4878aSAndroid Build Coastguard Worker public/pw_transfer/internal/event.h 90*61c4878aSAndroid Build Coastguard Worker public/pw_transfer/internal/protocol.h 91*61c4878aSAndroid Build Coastguard Worker public/pw_transfer/internal/server_context.h 92*61c4878aSAndroid Build Coastguard Worker SOURCES 93*61c4878aSAndroid Build Coastguard Worker chunk.cc 94*61c4878aSAndroid Build Coastguard Worker client_context.cc 95*61c4878aSAndroid Build Coastguard Worker context.cc 96*61c4878aSAndroid Build Coastguard Worker rate_estimate.cc 97*61c4878aSAndroid Build Coastguard Worker server_context.cc 98*61c4878aSAndroid Build Coastguard Worker transfer_thread.cc 99*61c4878aSAndroid Build Coastguard Worker PRIVATE_DEPS 100*61c4878aSAndroid Build Coastguard Worker pw_log 101*61c4878aSAndroid Build Coastguard Worker pw_log.rate_limited 102*61c4878aSAndroid Build Coastguard Worker pw_protobuf 103*61c4878aSAndroid Build Coastguard Worker pw_varint 104*61c4878aSAndroid Build Coastguard Worker) 105*61c4878aSAndroid Build Coastguard Worker 106*61c4878aSAndroid Build Coastguard Workerpw_proto_library(pw_transfer.proto 107*61c4878aSAndroid Build Coastguard Worker SOURCES 108*61c4878aSAndroid Build Coastguard Worker transfer.proto 109*61c4878aSAndroid Build Coastguard Worker PREFIX 110*61c4878aSAndroid Build Coastguard Worker pw_transfer 111*61c4878aSAndroid Build Coastguard Worker) 112*61c4878aSAndroid Build Coastguard Worker 113*61c4878aSAndroid Build Coastguard Workerpw_add_library(pw_transfer.test_helpers INTERFACE 114*61c4878aSAndroid Build Coastguard Worker HEADERS 115*61c4878aSAndroid Build Coastguard Worker pw_transfer_private/chunk_testing.h 116*61c4878aSAndroid Build Coastguard Worker PUBLIC_DEPS 117*61c4878aSAndroid Build Coastguard Worker pw_transfer.core 118*61c4878aSAndroid Build Coastguard Worker pw_containers 119*61c4878aSAndroid Build Coastguard Worker) 120*61c4878aSAndroid Build Coastguard Worker 121*61c4878aSAndroid Build Coastguard Workerpw_add_library(pw_transfer.atomic_file_transfer_handler STATIC 122*61c4878aSAndroid Build Coastguard Worker PUBLIC_INCLUDES 123*61c4878aSAndroid Build Coastguard Worker public 124*61c4878aSAndroid Build Coastguard Worker HEADERS 125*61c4878aSAndroid Build Coastguard Worker public/pw_transfer/atomic_file_transfer_handler.h 126*61c4878aSAndroid Build Coastguard Worker SOURCES 127*61c4878aSAndroid Build Coastguard Worker atomic_file_transfer_handler.cc 128*61c4878aSAndroid Build Coastguard Worker PUBLIC_DEPS 129*61c4878aSAndroid Build Coastguard Worker pw_transfer.core 130*61c4878aSAndroid Build Coastguard Worker pw_stream.std_file_stream 131*61c4878aSAndroid Build Coastguard Worker PRIVATE_DEPS 132*61c4878aSAndroid Build Coastguard Worker pw_transfer.atomic_file_transfer_handler_internal 133*61c4878aSAndroid Build Coastguard Worker pw_log 134*61c4878aSAndroid Build Coastguard Worker) 135*61c4878aSAndroid Build Coastguard Worker 136*61c4878aSAndroid Build Coastguard Workerpw_add_library(pw_transfer.atomic_file_transfer_handler_internal INTERFACE 137*61c4878aSAndroid Build Coastguard Worker HEADERS 138*61c4878aSAndroid Build Coastguard Worker pw_transfer_private/filename_generator.h 139*61c4878aSAndroid Build Coastguard Worker) 140*61c4878aSAndroid Build Coastguard Worker 141*61c4878aSAndroid Build Coastguard Workerif("${pw_thread.thread_BACKEND}" STREQUAL "pw_thread_stl.thread") 142*61c4878aSAndroid Build Coastguard Worker pw_add_test(pw_transfer.client_test 143*61c4878aSAndroid Build Coastguard Worker SOURCES 144*61c4878aSAndroid Build Coastguard Worker client_test.cc 145*61c4878aSAndroid Build Coastguard Worker PRIVATE_DEPS 146*61c4878aSAndroid Build Coastguard Worker pw_rpc.raw.client_testing 147*61c4878aSAndroid Build Coastguard Worker pw_rpc.test_helpers 148*61c4878aSAndroid Build Coastguard Worker pw_thread.sleep 149*61c4878aSAndroid Build Coastguard Worker pw_thread.thread 150*61c4878aSAndroid Build Coastguard Worker pw_transfer.client 151*61c4878aSAndroid Build Coastguard Worker pw_transfer.test_helpers 152*61c4878aSAndroid Build Coastguard Worker GROUPS 153*61c4878aSAndroid Build Coastguard Worker modules 154*61c4878aSAndroid Build Coastguard Worker pw_transfer 155*61c4878aSAndroid Build Coastguard Worker ) 156*61c4878aSAndroid Build Coastguard Workerendif() 157*61c4878aSAndroid Build Coastguard Worker 158*61c4878aSAndroid Build Coastguard Workerif(("${pw_thread.thread_BACKEND}" STREQUAL "pw_thread_stl.thread") AND 159*61c4878aSAndroid Build Coastguard Worker (${pw_unit_test_BACKEND} STREQUAL "pw_unit_test.light")) 160*61c4878aSAndroid Build Coastguard Worker pw_add_test(pw_transfer.transfer_thread_test 161*61c4878aSAndroid Build Coastguard Worker SOURCES 162*61c4878aSAndroid Build Coastguard Worker transfer_thread_test.cc 163*61c4878aSAndroid Build Coastguard Worker PRIVATE_DEPS 164*61c4878aSAndroid Build Coastguard Worker pw_transfer.proto.raw_rpc 165*61c4878aSAndroid Build Coastguard Worker pw_transfer.core 166*61c4878aSAndroid Build Coastguard Worker pw_transfer 167*61c4878aSAndroid Build Coastguard Worker pw_transfer.test_helpers 168*61c4878aSAndroid Build Coastguard Worker pw_rpc.test_helpers 169*61c4878aSAndroid Build Coastguard Worker pw_rpc.raw.client_testing 170*61c4878aSAndroid Build Coastguard Worker pw_rpc.raw.test_method_context 171*61c4878aSAndroid Build Coastguard Worker pw_thread.thread 172*61c4878aSAndroid Build Coastguard Worker GROUPS 173*61c4878aSAndroid Build Coastguard Worker modules 174*61c4878aSAndroid Build Coastguard Worker pw_transfer 175*61c4878aSAndroid Build Coastguard Worker ) 176*61c4878aSAndroid Build Coastguard Workerendif() 177*61c4878aSAndroid Build Coastguard Worker 178*61c4878aSAndroid Build Coastguard Workerif(("${pw_thread.thread_BACKEND}" STREQUAL "pw_thread_stl.thread") AND 179*61c4878aSAndroid Build Coastguard Worker (NOT "${CMAKE_SYSTEM_NAME}" STREQUAL "Windows")) 180*61c4878aSAndroid Build Coastguard Worker pw_add_test(pw_transfer.chunk_test 181*61c4878aSAndroid Build Coastguard Worker SOURCES 182*61c4878aSAndroid Build Coastguard Worker chunk_test.cc 183*61c4878aSAndroid Build Coastguard Worker PRIVATE_DEPS 184*61c4878aSAndroid Build Coastguard Worker pw_transfer.core 185*61c4878aSAndroid Build Coastguard Worker GROUPS 186*61c4878aSAndroid Build Coastguard Worker modules 187*61c4878aSAndroid Build Coastguard Worker pw_transfer 188*61c4878aSAndroid Build Coastguard Worker ) 189*61c4878aSAndroid Build Coastguard Worker 190*61c4878aSAndroid Build Coastguard Worker pw_add_test(pw_transfer.handler_test 191*61c4878aSAndroid Build Coastguard Worker SOURCES 192*61c4878aSAndroid Build Coastguard Worker handler_test.cc 193*61c4878aSAndroid Build Coastguard Worker PRIVATE_DEPS 194*61c4878aSAndroid Build Coastguard Worker pw_transfer 195*61c4878aSAndroid Build Coastguard Worker GROUPS 196*61c4878aSAndroid Build Coastguard Worker modules 197*61c4878aSAndroid Build Coastguard Worker pw_transfer 198*61c4878aSAndroid Build Coastguard Worker ) 199*61c4878aSAndroid Build Coastguard Worker 200*61c4878aSAndroid Build Coastguard Worker pw_add_test(pw_transfer.atomic_file_transfer_handler_test 201*61c4878aSAndroid Build Coastguard Worker SOURCES 202*61c4878aSAndroid Build Coastguard Worker atomic_file_transfer_handler_test.cc 203*61c4878aSAndroid Build Coastguard Worker PRIVATE_DEPS 204*61c4878aSAndroid Build Coastguard Worker pw_transfer.atomic_file_transfer_handler 205*61c4878aSAndroid Build Coastguard Worker pw_transfer.atomic_file_transfer_handler_internal 206*61c4878aSAndroid Build Coastguard Worker pw_transfer 207*61c4878aSAndroid Build Coastguard Worker pw_random 208*61c4878aSAndroid Build Coastguard Worker pw_string 209*61c4878aSAndroid Build Coastguard Worker GROUPS 210*61c4878aSAndroid Build Coastguard Worker modules 211*61c4878aSAndroid Build Coastguard Worker pw_transfer 212*61c4878aSAndroid Build Coastguard Worker ) 213*61c4878aSAndroid Build Coastguard Workerendif() 214