Ewout van Bekkum | e3b5603 | 2020-12-22 12:00:18 -0800 | [diff] [blame] | 1 | # 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 | |
| 15 | load( |
| 16 | "//pw_build:pigweed.bzl", |
| 17 | "pw_cc_library", |
Ewout van Bekkum | 0f3901e | 2020-12-22 12:00:18 -0800 | [diff] [blame] | 18 | "pw_cc_test", |
Ewout van Bekkum | e3b5603 | 2020-12-22 12:00:18 -0800 | [diff] [blame] | 19 | ) |
Nathaniel Brough | c2d5781 | 2021-04-18 22:52:00 +0800 | [diff] [blame] | 20 | load( |
| 21 | "//pw_build:selects.bzl", |
| 22 | "TARGET_COMPATIBLE_WITH_HOST_SELECT", |
| 23 | ) |
Ewout van Bekkum | e3b5603 | 2020-12-22 12:00:18 -0800 | [diff] [blame] | 24 | |
| 25 | package(default_visibility = ["//visibility:public"]) |
| 26 | |
| 27 | licenses(["notice"]) # Apache License 2.0 |
| 28 | |
| 29 | pw_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 Brough | c2d5781 | 2021-04-18 22:52:00 +0800 | [diff] [blame] | 41 | target_compatible_with = select(TARGET_COMPATIBLE_WITH_HOST_SELECT), |
Ewout van Bekkum | e3b5603 | 2020-12-22 12:00:18 -0800 | [diff] [blame] | 42 | ) |
| 43 | |
| 44 | pw_cc_library( |
| 45 | name = "id", |
Nathaniel Brough | c2d5781 | 2021-04-18 22:52:00 +0800 | [diff] [blame] | 46 | target_compatible_with = select(TARGET_COMPATIBLE_WITH_HOST_SELECT), |
Ewout van Bekkum | e3b5603 | 2020-12-22 12:00:18 -0800 | [diff] [blame] | 47 | deps = [ |
| 48 | ":id_headers", |
| 49 | "//pw_thread:id_facade", |
| 50 | ], |
| 51 | ) |
| 52 | |
| 53 | pw_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 Brough | c2d5781 | 2021-04-18 22:52:00 +0800 | [diff] [blame] | 63 | target_compatible_with = select(TARGET_COMPATIBLE_WITH_HOST_SELECT), |
Ewout van Bekkum | e3b5603 | 2020-12-22 12:00:18 -0800 | [diff] [blame] | 64 | deps = [ |
| 65 | "//pw_chrono:system_clock", |
| 66 | ], |
| 67 | ) |
| 68 | |
| 69 | pw_cc_library( |
| 70 | name = "sleep", |
Nathaniel Brough | c2d5781 | 2021-04-18 22:52:00 +0800 | [diff] [blame] | 71 | target_compatible_with = select(TARGET_COMPATIBLE_WITH_HOST_SELECT), |
Ewout van Bekkum | e3b5603 | 2020-12-22 12:00:18 -0800 | [diff] [blame] | 72 | deps = [ |
| 73 | ":sleep_headers", |
| 74 | "//pw_chrono:system_clock", |
| 75 | "//pw_thread:sleep_facade", |
| 76 | ], |
| 77 | ) |
| 78 | |
| 79 | pw_cc_library( |
Ewout van Bekkum | 0f3901e | 2020-12-22 12:00:18 -0800 | [diff] [blame] | 80 | 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 Brough | c2d5781 | 2021-04-18 22:52:00 +0800 | [diff] [blame] | 92 | target_compatible_with = select(TARGET_COMPATIBLE_WITH_HOST_SELECT), |
Ewout van Bekkum | 0f3901e | 2020-12-22 12:00:18 -0800 | [diff] [blame] | 93 | ) |
| 94 | |
| 95 | pw_cc_library( |
| 96 | name = "thread", |
Nathaniel Brough | c2d5781 | 2021-04-18 22:52:00 +0800 | [diff] [blame] | 97 | target_compatible_with = select(TARGET_COMPATIBLE_WITH_HOST_SELECT), |
Ewout van Bekkum | 0f3901e | 2020-12-22 12:00:18 -0800 | [diff] [blame] | 98 | deps = [ |
| 99 | ":thread_headers", |
| 100 | "//pw_thread:thread_facade", |
| 101 | ], |
| 102 | ) |
| 103 | |
| 104 | pw_cc_library( |
| 105 | name = "test_threads", |
Ewout van Bekkum | 0f3901e | 2020-12-22 12:00:18 -0800 | [diff] [blame] | 106 | srcs = [ |
| 107 | "test_threads.cc", |
Nathaniel Brough | a1113be | 2021-03-07 09:05:41 +0800 | [diff] [blame] | 108 | ], |
Nathaniel Brough | c2d5781 | 2021-04-18 22:52:00 +0800 | [diff] [blame] | 109 | target_compatible_with = select(TARGET_COMPATIBLE_WITH_HOST_SELECT), |
Nathaniel Brough | a1113be | 2021-03-07 09:05:41 +0800 | [diff] [blame] | 110 | deps = [ |
| 111 | "//pw_thread:test_threads_header", |
| 112 | "//pw_thread:thread_facade", |
| 113 | ], |
Ewout van Bekkum | 0f3901e | 2020-12-22 12:00:18 -0800 | [diff] [blame] | 114 | ) |
| 115 | |
| 116 | pw_cc_test( |
| 117 | name = "thread_backend_test", |
Nathaniel Brough | c2d5781 | 2021-04-18 22:52:00 +0800 | [diff] [blame] | 118 | target_compatible_with = select(TARGET_COMPATIBLE_WITH_HOST_SELECT), |
Ewout van Bekkum | 0f3901e | 2020-12-22 12:00:18 -0800 | [diff] [blame] | 119 | deps = [ |
Ewout van Bekkum | 0f3901e | 2020-12-22 12:00:18 -0800 | [diff] [blame] | 120 | ":test_threads", |
Nathaniel Brough | a1113be | 2021-03-07 09:05:41 +0800 | [diff] [blame] | 121 | "//pw_thread:thread_facade_test", |
| 122 | ], |
Ewout van Bekkum | 0f3901e | 2020-12-22 12:00:18 -0800 | [diff] [blame] | 123 | ) |
| 124 | |
| 125 | pw_cc_library( |
Ewout van Bekkum | e3b5603 | 2020-12-22 12:00:18 -0800 | [diff] [blame] | 126 | 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 Brough | c2d5781 | 2021-04-18 22:52:00 +0800 | [diff] [blame] | 135 | target_compatible_with = select(TARGET_COMPATIBLE_WITH_HOST_SELECT), |
Ewout van Bekkum | e3b5603 | 2020-12-22 12:00:18 -0800 | [diff] [blame] | 136 | ) |
| 137 | |
| 138 | pw_cc_library( |
| 139 | name = "yield", |
Nathaniel Brough | c2d5781 | 2021-04-18 22:52:00 +0800 | [diff] [blame] | 140 | target_compatible_with = select(TARGET_COMPATIBLE_WITH_HOST_SELECT), |
Ewout van Bekkum | e3b5603 | 2020-12-22 12:00:18 -0800 | [diff] [blame] | 141 | deps = [ |
| 142 | ":yield_headers", |
| 143 | "//pw_thread:yield_facade", |
| 144 | ], |
| 145 | ) |