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 73# This target provides the backend for pw::thread::test::TestThreadContext. 74pw_add_library(pw_thread_stl.test_thread_context INTERFACE 75 HEADERS 76 public/pw_thread_stl/test_thread_context_native.h 77 test_thread_context_public_overrides/pw_thread_backend/test_thread_context_native.h 78 PUBLIC_INCLUDES 79 public 80 test_thread_context_public_overrides 81 PUBLIC_DEPS 82 pw_thread_stl.thread 83 pw_thread.test_thread_context.facade 84) 85 86pw_add_library(pw_thread_stl.test_threads STATIC 87 PUBLIC_DEPS 88 pw_thread.non_portable_test_thread_options 89 SOURCES 90 test_threads.cc 91 PRIVATE_DEPS 92 pw_thread.thread 93) 94 95if(("${pw_thread.thread_BACKEND}" STREQUAL "pw_thread_stl.thread") AND 96 (NOT "${pw_thread.sleep_BACKEND}" STREQUAL "")) 97 pw_add_test(pw_thread_stl.thread_backend_test 98 PRIVATE_DEPS 99 pw_thread_stl.test_threads 100 pw_thread.thread_facade_test 101 GROUPS 102 modules 103 pw_thread_stl 104 ) 105endif() 106