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 17# This target provides the backend for pw::thread::Id & pw::this_thread::get_id. 18pw_add_library(pw_thread_stl.id INTERFACE 19 HEADERS 20 public/pw_thread_stl/id_inline.h 21 public/pw_thread_stl/id_native.h 22 id_public_overrides/pw_thread_backend/id_inline.h 23 id_public_overrides/pw_thread_backend/id_native.h 24 PUBLIC_INCLUDES 25 public 26 id_public_overrides 27 PUBLIC_DEPS 28 pw_thread.id.facade 29) 30 31# This target provides the backend for pw::thread::Thread with joining 32# joining capability. 33pw_add_library(pw_thread_stl.thread INTERFACE 34 HEADERS 35 public/pw_thread_stl/options.h 36 public/pw_thread_stl/thread_inline.h 37 public/pw_thread_stl/thread_native.h 38 thread_public_overrides/pw_thread_backend/thread_inline.h 39 thread_public_overrides/pw_thread_backend/thread_native.h 40 PUBLIC_INCLUDES 41 public 42 thread_public_overrides 43 PUBLIC_DEPS 44 pw_thread.thread.facade 45) 46 47 48# This target provides the backend for pw::this_thread::sleep_{for,until}. 49pw_add_library(pw_thread_stl.sleep INTERFACE 50 HEADERS 51 public/pw_thread_stl/sleep_inline.h 52 sleep_public_overrides/pw_thread_backend/sleep_inline.h 53 PUBLIC_INCLUDES 54 public 55 sleep_public_overrides 56 PUBLIC_DEPS 57 pw_chrono.system_clock 58 pw_thread.sleep.facade 59) 60 61# This target provides the backend for pw::this_thread::yield. 62pw_add_library(pw_thread_stl.yield INTERFACE 63 HEADERS 64 public/pw_thread_stl/yield_inline.h 65 yield_public_overrides/pw_thread_backend/yield_inline.h 66 PUBLIC_INCLUDES 67 public 68 yield_public_overrides 69 PUBLIC_DEPS 70 pw_thread.yield.facade 71) 72 73pw_add_library(pw_thread_stl.test_threads STATIC 74 PUBLIC_DEPS 75 pw_thread.test_threads 76 SOURCES 77 test_threads.cc 78 PRIVATE_DEPS 79 pw_thread.thread 80) 81 82if(("${pw_thread.thread_BACKEND}" STREQUAL "pw_thread_stl.thread") AND 83 (NOT "${pw_thread.sleep_BACKEND}" STREQUAL "")) 84 pw_add_test(pw_thread_stl.thread_backend_test 85 PRIVATE_DEPS 86 pw_thread_stl.test_threads 87 pw_thread.thread_facade_test 88 GROUPS 89 modules 90 pw_thread_stl 91 ) 92endif() 93