• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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
15import("//build_overrides/pigweed.gni")
16
17import("$dir_pw_build/facade.gni")
18import("$dir_pw_chrono/backend.gni")
19import("$dir_pw_docgen/docs.gni")
20import("$dir_pw_protobuf_compiler/proto.gni")
21import("$dir_pw_unit_test/test.gni")
22
23config("public_include_path") {
24  include_dirs = [ "public" ]
25  visibility = [ ":*" ]
26}
27
28pw_source_set("epoch") {
29  public = [ "public/pw_chrono/epoch.h" ]
30  public_configs = [ ":public_include_path" ]
31}
32
33pw_facade("system_clock") {
34  backend = pw_chrono_SYSTEM_CLOCK_BACKEND
35  public_configs = [ ":public_include_path" ]
36  public = [
37    "public/pw_chrono/internal/system_clock_macros.h",
38    "public/pw_chrono/system_clock.h",
39  ]
40  public_deps = [
41    ":epoch",
42    "$dir_pw_preprocessor",
43  ]
44  sources = [ "system_clock.cc" ]
45}
46
47pw_facade("system_timer") {
48  backend = pw_chrono_SYSTEM_TIMER_BACKEND
49  public_configs = [ ":public_include_path" ]
50  public = [ "public/pw_chrono/system_timer.h" ]
51  public_deps = [
52    ":system_clock",
53    "$dir_pw_function",
54  ]
55}
56
57# Dependency injectable implementation of pw::chrono::SystemClock::Interface.
58pw_source_set("simulated_system_clock") {
59  public_configs = [ ":public_include_path" ]
60  public = [ "public/pw_chrono/simulated_system_clock.h" ]
61  public_deps = [
62    ":system_clock",
63    "$dir_pw_sync:interrupt_spin_lock",
64  ]
65}
66
67pw_test_group("tests") {
68  tests = [
69    ":simulated_system_clock_test",
70    ":system_clock_facade_test",
71    ":system_timer_facade_test",
72  ]
73}
74
75pw_test("simulated_system_clock_test") {
76  enable_if = pw_chrono_SYSTEM_CLOCK_BACKEND != ""
77  sources = [ "simulated_system_clock_test.cc" ]
78  deps = [ ":simulated_system_clock" ]
79}
80
81pw_test("system_clock_facade_test") {
82  enable_if = pw_chrono_SYSTEM_CLOCK_BACKEND != ""
83  sources = [
84    "system_clock_facade_test.cc",
85    "system_clock_facade_test_c.c",
86  ]
87  deps = [
88    ":system_clock",
89    "$dir_pw_preprocessor",
90    pw_chrono_SYSTEM_CLOCK_BACKEND,
91  ]
92}
93
94pw_test("system_timer_facade_test") {
95  enable_if = pw_chrono_SYSTEM_TIMER_BACKEND != ""
96  sources = [ "system_timer_facade_test.cc" ]
97  deps = [
98    ":system_timer",
99    "$dir_pw_sync:thread_notification",
100    pw_chrono_SYSTEM_TIMER_BACKEND,
101  ]
102}
103
104pw_proto_library("protos") {
105  sources = [ "chrono.proto" ]
106  prefix = "pw_chrono_protos"
107}
108
109pw_doc_group("docs") {
110  sources = [ "docs.rst" ]
111}
112