blob: 85b51236e4006373ec02589f3f35ebddd7e9cbf6 [file]
# 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.
load("@rules_cc//cc:cc_library.bzl", "cc_library")
load("@rules_python//sphinxdocs:sphinx_docs_library.bzl", "sphinx_docs_library")
load("//pw_build:compatibility.bzl", "incompatible_with_mcu")
load("//pw_enum:pw_cc_enum_library.bzl", "pw_cc_enum_library")
load("//pw_unit_test:pw_cc_test.bzl", "pw_cc_test")
package(default_visibility = ["//visibility:private"])
cc_library(
name = "pw_enum",
hdrs = ["public/pw_enum/to_string.h"],
strip_include_prefix = "public",
visibility = ["//visibility:public"],
)
cc_library(
name = "_generate_internal_do_not_use",
hdrs = ["public_generate/pw_enum/generate.h"],
strip_include_prefix = "public_generate",
visibility = ["//visibility:public"],
deps = ["//pw_preprocessor"],
)
pw_cc_test(
name = "to_string_test",
srcs = ["to_string_test.cc"],
deps = [
":pw_enum",
],
)
pw_cc_enum_library(
name = "base_enum",
enum_headers = ["private/pw_enum_private/base_enum.h"],
strip_include_prefix = "private",
)
# DOCSTAG: [pw_enum-basic-bazel]
pw_cc_enum_library(
name = "basic_enum",
enum_headers = ["private/pw_enum_private/basic_enum.h"],
strip_include_prefix = "private",
deps = [":base_enum"],
)
# DOCSTAG: [pw_enum-basic-bazel]
pw_cc_enum_library(
name = "complex_enum",
testonly = True,
enum_headers = ["private/pw_enum_private/complex_enum.h"],
strip_include_prefix = "private",
)
pw_cc_enum_library(
name = "standalone_enum",
testonly = True,
enum_headers = ["private/pw_enum_private/standalone_enum.h"],
strip_include_prefix = "private",
)
cc_library(
name = "test_dep_lib",
testonly = True,
hdrs = ["private/pw_enum_private/test_dep_lib.h"],
strip_include_prefix = "private",
)
pw_cc_enum_library(
name = "enum_with_deps",
testonly = True,
enum_headers = ["private/pw_enum_private/enum_with_deps.h"],
strip_include_prefix = "private",
deps = [":test_dep_lib"],
)
pw_cc_test(
name = "enum_test",
srcs = [
"enum_test.cc",
],
features = ["-fmodules-strict-decluse"],
deps = [
":basic_enum",
":complex_enum",
":enum_with_deps",
":pw_enum",
":standalone_enum",
"//pw_log:args",
"//pw_tokenizer",
"//pw_unit_test:constexpr",
],
)
filegroup(
name = "doxygen",
srcs = [
"public/pw_enum/to_string.h",
"public_generate/pw_enum/generate.h",
],
visibility = ["//visibility:public"],
)
sphinx_docs_library(
name = "docs",
srcs = [
"BUILD.bazel",
"BUILD.gn",
"CMakeLists.txt",
"docs.rst",
"//pw_enum/examples:docs_sources",
],
prefix = "pw_enum/",
target_compatible_with = incompatible_with_mcu(),
visibility = ["//visibility:public"],
)