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", |
| 18 | "pw_cc_test", |
| 19 | ) |
| 20 | |
| 21 | package(default_visibility = ["//visibility:public"]) |
| 22 | |
| 23 | licenses(["notice"]) # Apache License 2.0 |
| 24 | |
| 25 | # TODO(pwbug/101): Need to add support for facades/backends to Bazel. |
| 26 | PW_THREAD_ID_BACKEND = "//pw_thread_stl:id" |
| 27 | PW_THREAD_SLEEP_BACKEND = "//pw_thread_stl:sleep" |
| 28 | PW_THREAD_YIELD_BACKEND = "//pw_thread_stl:yield" |
| 29 | |
| 30 | pw_cc_library( |
| 31 | name = "id_facade", |
| 32 | hdrs = [ |
| 33 | "public/pw_thread/id.h", |
| 34 | ], |
| 35 | includes = ["public"], |
| 36 | deps = [ |
| 37 | PW_THREAD_ID_BACKEND + "_headers", |
| 38 | ], |
| 39 | ) |
| 40 | |
| 41 | pw_cc_library( |
| 42 | name = "id", |
| 43 | deps = [ |
| 44 | ":id_facade", |
| 45 | PW_THREAD_ID_BACKEND + "_headers", |
| 46 | ], |
| 47 | ) |
| 48 | |
| 49 | pw_cc_library( |
| 50 | name = "id_backend", |
| 51 | deps = [ |
| 52 | PW_THREAD_ID_BACKEND, |
| 53 | ], |
| 54 | ) |
| 55 | |
| 56 | pw_cc_library( |
| 57 | name = "sleep_facade", |
| 58 | hdrs = [ |
| 59 | "public/pw_thread/sleep.h", |
| 60 | ], |
| 61 | includes = ["public"], |
| 62 | srcs = [ |
| 63 | "sleep.cc" |
| 64 | ], |
| 65 | deps = [ |
| 66 | PW_THREAD_SLEEP_BACKEND + "_headers", |
| 67 | "//pw_chrono:system_clock", |
| 68 | "//pw_preprocessor", |
| 69 | ], |
| 70 | ) |
| 71 | |
| 72 | pw_cc_library( |
| 73 | name = "sleep", |
| 74 | deps = [ |
| 75 | ":sleep_facade", |
| 76 | PW_THREAD_SLEEP_BACKEND + "_headers", |
| 77 | ], |
| 78 | ) |
| 79 | |
| 80 | pw_cc_library( |
| 81 | name = "sleep_backend", |
| 82 | deps = [ |
| 83 | PW_THREAD_SLEEP_BACKEND, |
| 84 | ], |
| 85 | ) |
| 86 | |
| 87 | pw_cc_library( |
| 88 | name = "yield_facade", |
| 89 | hdrs = [ |
| 90 | "public/pw_thread/yield.h", |
| 91 | ], |
| 92 | includes = ["public"], |
| 93 | srcs = [ |
| 94 | "yield.cc" |
| 95 | ], |
| 96 | deps = [ |
| 97 | PW_THREAD_YIELD_BACKEND + "_headers", |
| 98 | "//pw_preprocessor", |
| 99 | ], |
| 100 | ) |
| 101 | |
| 102 | pw_cc_library( |
| 103 | name = "yield", |
| 104 | deps = [ |
| 105 | ":yield_facade", |
| 106 | PW_THREAD_YIELD_BACKEND + "_headers", |
| 107 | ], |
| 108 | ) |
| 109 | |
| 110 | pw_cc_library( |
| 111 | name = "yield_backend", |
| 112 | deps = [ |
| 113 | PW_THREAD_YIELD_BACKEND, |
| 114 | ], |
| 115 | ) |
| 116 | |
| 117 | pw_cc_test( |
| 118 | name = "id_facade_test", |
| 119 | srcs = [ |
| 120 | "id_facade_test.cc", |
| 121 | ], |
| 122 | deps = [ |
| 123 | ":id", |
| 124 | "//pw_unit_test", |
| 125 | ], |
| 126 | ) |
| 127 | |
| 128 | pw_cc_test( |
| 129 | name = "sleep_facade_test", |
| 130 | srcs = [ |
| 131 | "sleep_facade_test.cc", |
| 132 | "sleep_facade_test_c.c", |
| 133 | ], |
| 134 | deps = [ |
| 135 | ":sleep", |
| 136 | "//pw_chrono:system_clock", |
| 137 | "//pw_preprocessor", |
| 138 | "//pw_unit_test", |
| 139 | ], |
| 140 | ) |
| 141 | |
| 142 | pw_cc_test( |
| 143 | name = "yield_facade_test", |
| 144 | srcs = [ |
| 145 | "yield_facade_test.cc", |
| 146 | "yield_facade_test_c.c", |
| 147 | ], |
| 148 | deps = [ |
| 149 | ":yield", |
| 150 | "//pw_preprocessor", |
| 151 | "//pw_unit_test", |
| 152 | ], |
| 153 | ) |