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