| # Copyright 2026 The Pigweed Authors |
| # |
| # Licensed under the Apache License, Version 2.0 (the "License"); you may not |
| # use this file except in compliance with the License. You may obtain a copy of |
| # the License at |
| # |
| # https://www.apache.org/licenses/LICENSE-2.0 |
| # |
| # Unless required by applicable law or agreed to in writing, software |
| # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT |
| # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the |
| # License for the specific language governing permissions and limitations under |
| # the License. |
| |
| import("//build_overrides/pigweed.gni") |
| import("$dir_pw_build/target_types.gni") |
| import("$dir_pw_unit_test/test.gni") |
| import("pw_cc_enum_source_set.gni") |
| |
| config("public_include_path") { |
| include_dirs = [ "public" ] |
| visibility = [ ":*" ] |
| } |
| |
| config("private_include_path") { |
| include_dirs = [ "private" ] |
| visibility = [ ":*" ] |
| } |
| |
| config("public_generate_include_path") { |
| include_dirs = [ "public_generate" ] |
| visibility = [ ":*" ] |
| } |
| |
| pw_source_set("_generate_internal_do_not_use") { |
| public = [ "public_generate/pw_enum/generate.h" ] |
| public_configs = [ ":public_generate_include_path" ] |
| public_deps = [ "$dir_pw_preprocessor" ] |
| } |
| |
| pw_source_set("pw_enum") { |
| public_configs = [ ":public_include_path" ] |
| public = [ "public/pw_enum/to_string.h" ] |
| } |
| |
| pw_test("to_string_test") { |
| deps = [ ":pw_enum" ] |
| sources = [ "to_string_test.cc" ] |
| } |
| |
| pw_cc_enum_source_set("base_enum") { |
| enum_headers = [ "private/pw_enum_private/base_enum.h" ] |
| include_dirs = [ "private" ] |
| visibility = [ ":*" ] |
| } |
| |
| # DOCSTAG: [pw_enum-basic-gn] |
| pw_cc_enum_source_set("basic_enum") { |
| enum_headers = [ "private/pw_enum_private/basic_enum.h" ] |
| public_deps = [ ":base_enum" ] |
| include_dirs = [ "private" ] |
| } |
| |
| # DOCSTAG: [pw_enum-basic-gn] |
| |
| pw_cc_enum_source_set("complex_enum") { |
| enum_headers = [ "private/pw_enum_private/complex_enum.h" ] |
| include_dirs = [ "private" ] |
| visibility = [ ":*" ] |
| } |
| |
| pw_cc_enum_source_set("standalone_enum") { |
| enum_headers = [ "private/pw_enum_private/standalone_enum.h" ] |
| include_dirs = [ "private" ] |
| visibility = [ ":*" ] |
| } |
| |
| pw_source_set("test_dep_lib") { |
| public = [ "private/pw_enum_private/test_dep_lib.h" ] |
| public_configs = [ ":private_include_path" ] |
| visibility = [ ":*" ] |
| } |
| |
| pw_cc_enum_source_set("enum_with_deps") { |
| enum_headers = [ "private/pw_enum_private/enum_with_deps.h" ] |
| public_deps = [ ":test_dep_lib" ] |
| include_dirs = [ "private" ] |
| visibility = [ ":*" ] |
| } |
| |
| pw_test("enum_test") { |
| sources = [ "enum_test.cc" ] |
| deps = [ |
| ":basic_enum", |
| ":complex_enum", |
| ":enum_with_deps", |
| ":pw_enum", |
| ":standalone_enum", |
| "$dir_pw_log", |
| "$dir_pw_log:args", |
| "$dir_pw_tokenizer", |
| "$dir_pw_unit_test:constexpr", |
| ] |
| enable_if = host_os != "win" |
| } |
| |
| pw_test_group("tests") { |
| tests = [ |
| ":enum_test", |
| ":to_string_test", |
| ] |
| } |