blob: 4e765482792f1a872ee59291ca6013215579d74c [file] [log] [blame]
Ewout van Bekkum8b72a572021-03-09 08:53:39 -08001# Copyright 2021 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
15import("//build_overrides/pigweed.gni")
16
17import("$dir_pw_build/target_types.gni")
18import("$dir_pw_chrono/backend.gni")
19import("$dir_pw_docgen/docs.gni")
20import("$dir_pw_thread/backend.gni")
21
22config("public_include_path") {
23 include_dirs = [ "public" ]
24 visibility = [ ":*" ]
25}
26
27config("backend_config") {
28 include_dirs = [ "public_overrides" ]
29 visibility = [ ":*" ]
30}
31
32# This target provides the backend for pw::thread::Id.
33pw_source_set("id") {
34 public_configs = [
35 ":public_include_path",
36 ":backend_config",
37 ]
38 public_deps = [
39 "$dir_pw_assert",
40 "$dir_pw_interrupt:context",
41 "$dir_pw_third_party/embos",
42 ]
43 public = [
44 "public/pw_thread_embos/id_inline.h",
45 "public/pw_thread_embos/id_native.h",
46 "public_overrides/pw_thread_backend/id_inline.h",
47 "public_overrides/pw_thread_backend/id_native.h",
48 ]
49 deps = [ "$dir_pw_thread:id.facade" ]
50}
51
52if (pw_chrono_SYSTEM_CLOCK_BACKEND != "" && pw_thread_SLEEP_BACKEND != "") {
53 # This target provides the backend for pw::thread::sleep_{for,until}.
54 pw_source_set("sleep") {
55 public_configs = [
56 ":public_include_path",
57 ":backend_config",
58 ]
59 public = [
60 "public/pw_thread_embos/sleep_inline.h",
61 "public_overrides/pw_thread_backend/sleep_inline.h",
62 ]
63 public_deps = [ "$dir_pw_chrono:system_clock" ]
64 sources = [ "sleep.cc" ]
65 deps = [
66 "$dir_pw_assert",
67 "$dir_pw_chrono_embos:system_clock",
68 "$dir_pw_third_party/embos",
69 "$dir_pw_thread:id",
70 "$dir_pw_thread:sleep.facade",
71 ]
72 assert(pw_thread_OVERRIDE_SYSTEM_CLOCK_BACKEND_CHECK ||
73 pw_chrono_SYSTEM_CLOCK_BACKEND ==
74 "$dir_pw_chrono_embos:system_clock",
75 "The embOS pw::thread::sleep_{for,until} backend only works with " +
76 "the embOS pw::chrono::SystemClock backend.")
77 }
78}
79
80# This target provides the backend for pw::thread::yield.
81pw_source_set("yield") {
82 public_configs = [
83 ":public_include_path",
84 ":backend_config",
85 ]
86 public = [
87 "public/pw_thread_embos/yield_inline.h",
88 "public_overrides/pw_thread_backend/yield_inline.h",
89 ]
90 public_deps = [
91 "$dir_pw_assert",
92 "$dir_pw_third_party/embos",
93 "$dir_pw_thread:id",
94 ]
95 deps = [ "$dir_pw_thread:yield.facade" ]
96}
97
98pw_doc_group("docs") {
99 sources = [ "docs.rst" ]
100}