blob: 0555a089af4ae1d05b87bc2cc44d17ac0fa61629 [file] [log] [blame]
Ewout van Bekkume3b56032020-12-22 12:00:18 -08001# Copyright 2020 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
15load(
16 "//pw_build:pigweed.bzl",
17 "pw_cc_library",
Ewout van Bekkum0f3901e2020-12-22 12:00:18 -080018 "pw_cc_test",
Ewout van Bekkume3b56032020-12-22 12:00:18 -080019)
Nathaniel Broughc2d57812021-04-18 22:52:00 +080020load(
21 "//pw_build:selects.bzl",
22 "TARGET_COMPATIBLE_WITH_HOST_SELECT",
23)
Ewout van Bekkume3b56032020-12-22 12:00:18 -080024
25package(default_visibility = ["//visibility:public"])
26
27licenses(["notice"]) # Apache License 2.0
28
29pw_cc_library(
30 name = "id_headers",
31 hdrs = [
32 "public/pw_thread_stl/id_inline.h",
33 "public/pw_thread_stl/id_native.h",
34 "public_overrides/pw_thread_backend/id_inline.h",
35 "public_overrides/pw_thread_backend/id_native.h",
36 ],
37 includes = [
38 "public",
39 "public_overrides",
40 ],
Nathaniel Broughc2d57812021-04-18 22:52:00 +080041 target_compatible_with = select(TARGET_COMPATIBLE_WITH_HOST_SELECT),
Ewout van Bekkume3b56032020-12-22 12:00:18 -080042)
43
44pw_cc_library(
45 name = "id",
Nathaniel Broughc2d57812021-04-18 22:52:00 +080046 target_compatible_with = select(TARGET_COMPATIBLE_WITH_HOST_SELECT),
Ewout van Bekkume3b56032020-12-22 12:00:18 -080047 deps = [
48 ":id_headers",
49 "//pw_thread:id_facade",
50 ],
51)
52
53pw_cc_library(
54 name = "sleep_headers",
55 hdrs = [
56 "public/pw_thread_stl/sleep_inline.h",
57 "public_overrides/pw_thread_backend/sleep_inline.h",
58 ],
59 includes = [
60 "public",
61 "public_overrides",
62 ],
Nathaniel Broughc2d57812021-04-18 22:52:00 +080063 target_compatible_with = select(TARGET_COMPATIBLE_WITH_HOST_SELECT),
Ewout van Bekkume3b56032020-12-22 12:00:18 -080064 deps = [
65 "//pw_chrono:system_clock",
66 ],
67)
68
69pw_cc_library(
70 name = "sleep",
Nathaniel Broughc2d57812021-04-18 22:52:00 +080071 target_compatible_with = select(TARGET_COMPATIBLE_WITH_HOST_SELECT),
Ewout van Bekkume3b56032020-12-22 12:00:18 -080072 deps = [
73 ":sleep_headers",
74 "//pw_chrono:system_clock",
75 "//pw_thread:sleep_facade",
76 ],
77)
78
79pw_cc_library(
Ewout van Bekkum0f3901e2020-12-22 12:00:18 -080080 name = "thread_headers",
81 hdrs = [
82 "public/pw_thread_stl/options.h",
83 "public/pw_thread_stl/thread_inline.h",
84 "public/pw_thread_stl/thread_native.h",
85 "public_overrides/pw_thread_backend/thread_inline.h",
86 "public_overrides/pw_thread_backend/thread_native.h",
87 ],
88 includes = [
89 "public",
90 "public_overrides",
91 ],
Nathaniel Broughc2d57812021-04-18 22:52:00 +080092 target_compatible_with = select(TARGET_COMPATIBLE_WITH_HOST_SELECT),
Ewout van Bekkum0f3901e2020-12-22 12:00:18 -080093)
94
95pw_cc_library(
96 name = "thread",
Nathaniel Broughc2d57812021-04-18 22:52:00 +080097 target_compatible_with = select(TARGET_COMPATIBLE_WITH_HOST_SELECT),
Ewout van Bekkum0f3901e2020-12-22 12:00:18 -080098 deps = [
99 ":thread_headers",
100 "//pw_thread:thread_facade",
101 ],
102)
103
104pw_cc_library(
105 name = "test_threads",
Ewout van Bekkum0f3901e2020-12-22 12:00:18 -0800106 srcs = [
107 "test_threads.cc",
Nathaniel Brougha1113be2021-03-07 09:05:41 +0800108 ],
Nathaniel Broughc2d57812021-04-18 22:52:00 +0800109 target_compatible_with = select(TARGET_COMPATIBLE_WITH_HOST_SELECT),
Nathaniel Brougha1113be2021-03-07 09:05:41 +0800110 deps = [
111 "//pw_thread:test_threads_header",
112 "//pw_thread:thread_facade",
113 ],
Ewout van Bekkum0f3901e2020-12-22 12:00:18 -0800114)
115
116pw_cc_test(
117 name = "thread_backend_test",
Nathaniel Broughc2d57812021-04-18 22:52:00 +0800118 target_compatible_with = select(TARGET_COMPATIBLE_WITH_HOST_SELECT),
Ewout van Bekkum0f3901e2020-12-22 12:00:18 -0800119 deps = [
Ewout van Bekkum0f3901e2020-12-22 12:00:18 -0800120 ":test_threads",
Nathaniel Brougha1113be2021-03-07 09:05:41 +0800121 "//pw_thread:thread_facade_test",
122 ],
Ewout van Bekkum0f3901e2020-12-22 12:00:18 -0800123)
124
125pw_cc_library(
Ewout van Bekkume3b56032020-12-22 12:00:18 -0800126 name = "yield_headers",
127 hdrs = [
128 "public/pw_thread_stl/yield_inline.h",
129 "public_overrides/pw_thread_backend/yield_inline.h",
130 ],
131 includes = [
132 "public",
133 "public_overrides",
134 ],
Nathaniel Broughc2d57812021-04-18 22:52:00 +0800135 target_compatible_with = select(TARGET_COMPATIBLE_WITH_HOST_SELECT),
Ewout van Bekkume3b56032020-12-22 12:00:18 -0800136)
137
138pw_cc_library(
139 name = "yield",
Nathaniel Broughc2d57812021-04-18 22:52:00 +0800140 target_compatible_with = select(TARGET_COMPATIBLE_WITH_HOST_SELECT),
Ewout van Bekkume3b56032020-12-22 12:00:18 -0800141 deps = [
142 ":yield_headers",
143 "//pw_thread:yield_facade",
144 ],
145)