• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright 2024 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
15load(
16    "//cc_toolchain:defs.bzl",
17    "pw_cc_feature",
18    "pw_cc_feature_constraint",
19    "pw_cc_feature_set",
20    "pw_cc_flag_set",
21    "pw_cc_mutually_exclusive_category",
22)
23load(":test_features.bzl", "test_features")
24
25package(default_visibility = ["//cc_toolchain/tests:__subpackages__"])
26
27pw_cc_feature(
28    name = "foo",
29    enabled = True,
30    feature_name = "foo",
31    flag_sets = ["//cc_toolchain/tests/flag_sets:foo"],
32)
33
34pw_cc_feature(
35    name = "bar",
36    enabled = True,
37    feature_name = "bar",
38    flag_sets = [
39        "//cc_toolchain/tests/flag_sets:bar",
40        "//cc_toolchain/tests/flag_sets:env",
41    ],
42)
43
44pw_cc_feature(
45    name = "baz",
46    enabled = True,
47    feature_name = "baz",
48    flag_sets = ["//cc_toolchain/tests/flag_sets:baz"],
49)
50
51pw_cc_feature(
52    name = "conflict",
53    enabled = True,
54    feature_name = "foo",
55)
56
57pw_cc_feature_set(
58    name = "foobar",
59    all_of = [
60        ":foo",
61        ":bar",
62    ],
63)
64
65pw_cc_feature(
66    name = "implies",
67    enabled = True,
68    feature_name = "implies",
69    implies = [":foobar"],
70)
71
72pw_cc_feature(
73    name = "requires",
74    enabled = True,
75    feature_name = "requires",
76    requires_any_of = [
77        ":foobar",
78        ":baz",
79    ],
80)
81
82pw_cc_feature(
83    name = "supports_pic",
84    enabled = True,
85    feature_name = "supports_pic",
86    overrides = "//features/well_known:supports_pic",
87)
88
89pw_cc_feature(
90    name = "supports_pic_no_override",
91    enabled = True,
92    feature_name = "supports_pic",
93)
94
95pw_cc_feature(
96    name = "implies_supports_pic",
97    enabled = True,
98    feature_name = "implies_supports_pic",
99    implies = ["//features/well_known:supports_pic"],
100)
101
102pw_cc_feature_constraint(
103    name = "foo_not_baz",
104    all_of = [":foo"],
105    none_of = [":baz"],
106)
107
108pw_cc_feature_constraint(
109    name = "foo_only",
110    all_of = [":foo_not_baz"],
111    none_of = [":bar"],
112)
113
114pw_cc_flag_set(
115    name = "constrained_flags",
116    actions = ["//actions:c_compile"],
117    flags = ["blah"],
118    requires_any_of = [
119        ":foo_not_baz",
120        ":bar",
121    ],
122)
123
124pw_cc_feature(
125    name = "constrained",
126    enabled = True,
127    feature_name = "constrained",
128    flag_sets = [":constrained_flags"],
129)
130
131pw_cc_mutually_exclusive_category(
132    name = "category",
133)
134
135pw_cc_feature(
136    name = "primary_feature",
137    enabled = True,
138    feature_name = "primary_feature",
139    mutually_exclusive = [":category"],
140)
141
142pw_cc_feature(
143    name = "mutex_provider",
144    enabled = True,
145    feature_name = "mutex_provider",
146    mutually_exclusive = [":category"],
147)
148
149pw_cc_feature(
150    name = "mutex_label",
151    enabled = True,
152    feature_name = "mutex_label",
153    mutually_exclusive = [":primary_feature"],
154)
155
156test_features(
157    name = "test_features",
158)
159