blob: 33176db5d6c5e3c038ed38c2c9d4e7a5c9bcbb8f [file] [log] [blame]
Ewout van Bekkum3c61ae92020-10-30 15:52:25 -07001# 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_unit_test/test.gni")
21
22config("public_include_path") {
23 include_dirs = [ "public" ]
24 visibility = [ ":*" ]
25}
26
27pw_source_set("epoch") {
28 public = [ "public/pw_chrono/epoch.h" ]
29 public_configs = [ ":public_include_path" ]
30}
31
32pw_facade("system_clock") {
33 backend = pw_chrono_SYSTEM_CLOCK_BACKEND
34 public_configs = [ ":public_include_path" ]
Ewout van Bekkum830d5d12021-01-28 18:58:03 -080035 public = [
36 "public/pw_chrono/internal/system_clock_macros.h",
37 "public/pw_chrono/system_clock.h",
38 ]
Ewout van Bekkum3c61ae92020-10-30 15:52:25 -070039 public_deps = [
40 ":epoch",
41 "$dir_pw_preprocessor",
42 ]
43 sources = [ "system_clock.cc" ]
44}
45
46# Dependency injectable implementation of pw::chrono::SystemClock::Interface.
47pw_source_set("simulated_system_clock") {
48 public_configs = [ ":public_include_path" ]
49 public = [ "public/pw_chrono/simulated_system_clock.h" ]
50 public_deps = [
51 ":system_clock",
Ewout van Bekkumda2a62d2021-03-12 11:34:47 -080052 "$dir_pw_sync:interrupt_spin_lock",
Ewout van Bekkum3c61ae92020-10-30 15:52:25 -070053 ]
54}
55
56pw_test_group("tests") {
57 tests = [
58 ":simulated_system_clock_test",
59 ":system_clock_facade_test",
60 ]
61}
62
63pw_test("simulated_system_clock_test") {
64 enable_if = pw_chrono_SYSTEM_CLOCK_BACKEND != ""
65 sources = [ "simulated_system_clock_test.cc" ]
66 deps = [ ":simulated_system_clock" ]
67}
68
69pw_test("system_clock_facade_test") {
70 enable_if = pw_chrono_SYSTEM_CLOCK_BACKEND != ""
71 sources = [
72 "system_clock_facade_test.cc",
73 "system_clock_facade_test_c.c",
74 ]
75 deps = [
76 ":system_clock",
77 "$dir_pw_preprocessor",
78 pw_chrono_SYSTEM_CLOCK_BACKEND,
79 ]
80}
81
82pw_doc_group("docs") {
83 sources = [ "docs.rst" ]
84}