blob: 24bb882afeb324775b9e46e845110530eb204641 [file] [log] [blame]
Ewout van Bekkum749342b2021-01-19 14:53:19 -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
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")
20
21config("public_include_path") {
22 include_dirs = [ "public" ]
23 visibility = [ ":*" ]
24}
25
26config("backend_config") {
27 include_dirs = [ "public_overrides" ]
28 visibility = [ ":*" ]
29}
30
31# This target provides the backend for pw::thread::Id & pw::this_thread::get_id.
32pw_source_set("id") {
33 public_configs = [
34 ":public_include_path",
35 ":backend_config",
36 ]
37 public_deps = [
38 "$dir_pw_interrupt:context",
39 "$dir_pw_third_party/freertos",
40 ]
41 public = [
42 "public/pw_thread_freertos/id_inline.h",
43 "public/pw_thread_freertos/id_native.h",
44 "public_overrides/pw_thread_backend/id_inline.h",
45 "public_overrides/pw_thread_backend/id_native.h",
46 ]
47 deps = [ "$dir_pw_thread:id.facade" ]
48}
49
50# This target provides the backend for pw::this_thread::sleep_{for,until}.
51pw_source_set("sleep") {
52 public_configs = [
53 ":public_include_path",
54 ":backend_config",
55 ]
56 public = [
57 "public/pw_thread_freertos/sleep_inline.h",
58 "public_overrides/pw_thread_backend/sleep_inline.h",
59 ]
60 public_deps = [ "$dir_pw_chrono:system_clock" ]
61 sources = [ "sleep.cc" ]
62 deps = [
63 "$dir_pw_assert",
64 "$dir_pw_chrono_freertos:system_clock",
65 "$dir_pw_third_party/freertos",
66 "$dir_pw_thread:id",
67 "$dir_pw_thread:sleep.facade",
68 ]
69 assert(pw_chrono_SYSTEM_CLOCK_BACKEND == "" ||
70 pw_chrono_SYSTEM_CLOCK_BACKEND ==
71 "$dir_pw_chrono_freertos:system_clock",
72 "The FreeRTOS pw::this_thread::sleep_{for,until} backend only works " +
73 "with the FreeRTOS pw::chrono::SystemClock backend " +
74 "(pw_chrono_SYSTEM_CLOCK_BACKEND = " +
75 "\"$dir_pw_chrono_freertos:system_clock\")")
76}
77
78# This target provides the backend for pw::this_thread::yield.
79pw_source_set("yield") {
80 public_configs = [
81 ":public_include_path",
82 ":backend_config",
83 ]
84 public = [
85 "public/pw_thread_freertos/yield_inline.h",
86 "public_overrides/pw_thread_backend/yield_inline.h",
87 ]
88 public_deps = [
89 "$dir_pw_assert",
90 "$dir_pw_third_party/freertos",
91 "$dir_pw_thread:id",
92 ]
93 deps = [ "$dir_pw_thread:yield.facade" ]
94}
95
96pw_doc_group("docs") {
97 sources = [ "docs.rst" ]
98}