• 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_docgen/docs.gni")
18import("$dir_pw_unit_test/test.gni")
19import("arm_gcc/toolchains.gni")
20import("generate_toolchain.gni")
21import("host_clang/toolchains.gni")
22import("host_gcc/toolchains.gni")
23
24# For each of the toolchains below, the toolchain GNI file has the corresponding
25# configs. This allows BUILDCONFIG.gn to set default target values on "flat"
26# lists of configs, i.e. not nested. This in turn allows individual targets
27# fine-grained control over which default configs they wise to override.
28
29# Generate ARM GCC toolchains
30generate_toolchains("arm_gcc_suite") {
31  toolchains = pw_toolchain_arm_gcc_list
32}
33
34# Generate Host GCC toolchains
35generate_toolchains("host_gcc_suite") {
36  toolchains = pw_toolchain_host_gcc_list
37}
38
39# Generate Host Clang toolchains
40generate_toolchains("host_clang_suite") {
41  toolchains = pw_toolchain_host_clang_list
42}
43
44config("public_include_path") {
45  include_dirs = [ "public" ]
46}
47
48group("builtins") {
49  deps = [ "$dir_pw_third_party/llvm_builtins" ]
50}
51
52pw_doc_group("docs") {
53  sources = [
54    "bazel.rst",
55    "docs.rst",
56    "gn.rst",
57  ]
58  inputs = [ "globals_test.cc" ]
59}
60
61pw_source_set("constexpr_tag") {
62  public_configs = [ ":public_include_path" ]
63  public = [ "public/pw_toolchain/constexpr_tag.h" ]
64}
65
66pw_source_set("no_destructor") {
67  public_configs = [ ":public_include_path" ]
68  public = [ "public/pw_toolchain/no_destructor.h" ]
69  public_deps = [ dir_pw_polyfill ]
70}
71
72pw_source_set("globals") {
73  public_configs = [ ":public_include_path" ]
74  public = [ "public/pw_toolchain/globals.h" ]
75}
76
77pw_source_set("infinite_loop") {
78  public_configs = [ ":public_include_path" ]
79  public = [ "public/pw_toolchain/infinite_loop.h" ]
80  public_deps = [ dir_pw_preprocessor ]
81}
82
83pw_source_set("sibling_cast") {
84  public_configs = [ ":public_include_path" ]
85  public = [ "public/pw_toolchain/internal/sibling_cast.h" ]
86  visibility = [ "$dir_pigweed/*" ]
87}
88
89pw_test("sibling_cast_test") {
90  sources = [ "sibling_cast_test.cc" ]
91  deps = [ ":sibling_cast" ]
92  negative_compilation_tests = true
93}
94
95config("wrap_abort_config") {
96  ldflags = [ "-Wl,--wrap=abort" ]
97  visibility = [ ":*" ]
98}
99
100pw_source_set("wrap_abort") {
101  all_dependent_configs = [ ":wrap_abort_config" ]
102  sources = [ "wrap_abort.cc" ]
103  deps = [ dir_pw_assert ]
104}
105
106pw_test_group("tests") {
107  tests = [
108    ":globals_test",
109    ":no_destructor_test",
110    ":sibling_cast_test",
111    ":infinite_loop_test",
112  ]
113}
114
115pw_test("no_destructor_test") {
116  sources = [ "no_destructor_test.cc" ]
117  deps = [
118    ":no_destructor",
119    dir_pw_assert,
120    dir_pw_polyfill,
121  ]
122}
123
124pw_test("globals_test") {
125  sources = [ "globals_test.cc" ]
126  deps = [
127    ":globals",
128    dir_pw_assert,
129    dir_pw_polyfill,
130  ]
131}
132
133pw_test("infinite_loop_test") {
134  sources = [
135    "infinite_loop_test.cc",
136    "infinite_loop_test_c.c",
137  ]
138  deps = [ ":infinite_loop" ]
139}
140