Fix for x86_64 build fail
[platform/upstream/connectedhomeip.git] / third_party / pigweed / repo / pw_chrono / BUILD.gn
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 import("//build_overrides/pigweed.gni")
16
17 import("$dir_pw_build/facade.gni")
18 import("$dir_pw_chrono/backend.gni")
19 import("$dir_pw_docgen/docs.gni")
20 import("$dir_pw_unit_test/test.gni")
21
22 config("public_include_path") {
23   include_dirs = [ "public" ]
24   visibility = [ ":*" ]
25 }
26
27 pw_source_set("epoch") {
28   public = [ "public/pw_chrono/epoch.h" ]
29   public_configs = [ ":public_include_path" ]
30 }
31
32 pw_facade("system_clock") {
33   backend = pw_chrono_SYSTEM_CLOCK_BACKEND
34   public_configs = [ ":public_include_path" ]
35   public = [
36     "public/pw_chrono/internal/system_clock_macros.h",
37     "public/pw_chrono/system_clock.h",
38   ]
39   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.
47 pw_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",
52     "$dir_pw_sync:spin_lock",
53   ]
54 }
55
56 pw_test_group("tests") {
57   tests = [
58     ":simulated_system_clock_test",
59     ":system_clock_facade_test",
60   ]
61 }
62
63 pw_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
69 pw_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
82 pw_doc_group("docs") {
83   sources = [ "docs.rst" ]
84 }