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.thread.facade 29) 30 31# This target provides the backend for pw::Thread with joining capability. 32pw_add_library(pw_thread_stl.thread INTERFACE 33 HEADERS 34 public/pw_thread_stl/options.h 35 public/pw_thread_stl/thread_inline.h 36 public/pw_thread_stl/thread_native.h 37 thread_public_overrides/pw_thread_backend/thread_inline.h 38 thread_public_overrides/pw_thread_backend/thread_native.h 39 PUBLIC_INCLUDES 40 public 41 thread_public_overrides 42 PUBLIC_DEPS 43 pw_thread.thread.facade 44) 45 46 47# This target provides the backend for pw::this_thread::sleep_{for,until}. 48pw_add_library(pw_thread_stl.sleep INTERFACE 49 HEADERS 50 public/pw_thread_stl/sleep_inline.h 51 sleep_public_overrides/pw_thread_backend/sleep_inline.h 52 PUBLIC_INCLUDES 53 public 54 sleep_public_overrides 55 PUBLIC_DEPS 56 pw_chrono.system_clock 57 pw_thread.sleep.facade 58) 59 60# This target provides the backend for pw::this_thread::yield. 61pw_add_library(pw_thread_stl.yield INTERFACE 62 HEADERS 63 public/pw_thread_stl/yield_inline.h 64 yield_public_overrides/pw_thread_backend/yield_inline.h 65 PUBLIC_INCLUDES 66 public 67 yield_public_overrides 68 PUBLIC_DEPS 69 pw_thread.yield.facade 70) 71 72# This target provides the backend for pw::thread::test::TestThreadContext. 73pw_add_library(pw_thread_stl.test_thread_context INTERFACE 74 HEADERS 75 public/pw_thread_stl/test_thread_context_native.h 76 test_thread_context_public_overrides/pw_thread_backend/test_thread_context_native.h 77 PUBLIC_INCLUDES 78 public 79 test_thread_context_public_overrides 80 PUBLIC_DEPS 81 pw_thread_stl.thread 82 pw_thread.test_thread_context.facade 83) 84 85pw_add_library(pw_thread_stl.test_threads STATIC 86 PUBLIC_DEPS 87 pw_thread.non_portable_test_thread_options 88 SOURCES 89 test_threads.cc 90 PRIVATE_DEPS 91 pw_thread.thread 92) 93 94pw_add_library(pw_thread_stl.thread_iteration STATIC 95 PRIVATE_DEPS 96 pw_status 97 SOURCES 98 thread_iteration.cc 99 PUBLIC_DEPS 100 pw_thread.thread_iteration.facade 101) 102 103if(("${pw_thread.thread_BACKEND}" STREQUAL "pw_thread_stl.thread") AND 104 (NOT "${pw_thread.sleep_BACKEND}" STREQUAL "")) 105 pw_add_test(pw_thread_stl.thread_backend_test 106 PRIVATE_DEPS 107 pw_thread_stl.test_threads 108 pw_thread.thread_facade_test 109 GROUPS 110 modules 111 pw_thread_stl 112 ) 113endif() 114