1# Copyright 2021 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("@rules_cc//cc:cc_library.bzl", "cc_library") 16load("@rules_license//rules:license.bzl", "license") 17load("@rules_python//sphinxdocs:sphinx_docs_library.bzl", "sphinx_docs_library") 18load("//pw_build:compatibility.bzl", "incompatible_with_mcu") 19 20package( 21 default_applicable_licenses = [":license_fuchsia"], 22 default_visibility = ["//visibility:public"], 23) 24 25license( 26 name = "license_fuchsia", 27 package_name = "Fuchsia (third_party)", 28 license_text = "repo/LICENSE", 29) 30 31exports_files(["repo/LICENSE"]) 32 33# Allows downstream projects to provide an alternative implementation of fit. 34# 35# Intended for projects that depend on both Pigweed and Fuchsia, and want to 36# use the Fuchsia implementation directly to avoid ODR violations. 37label_flag( 38 name = "fit", 39 build_setting_default = ":fit_impl", 40) 41 42cc_library( 43 name = "fit_impl", 44 srcs = [ 45 "repo/sdk/lib/fit/include/lib/fit/internal/compiler.h", 46 "repo/sdk/lib/fit/include/lib/fit/internal/function.h", 47 "repo/sdk/lib/fit/include/lib/fit/internal/result.h", 48 "repo/sdk/lib/fit/include/lib/fit/internal/utility.h", 49 ], 50 hdrs = [ 51 "repo/sdk/lib/fit/include/lib/fit/defer.h", 52 "repo/sdk/lib/fit/include/lib/fit/function.h", 53 "repo/sdk/lib/fit/include/lib/fit/nullable.h", 54 "repo/sdk/lib/fit/include/lib/fit/result.h", 55 "repo/sdk/lib/fit/include/lib/fit/traits.h", 56 ], 57 # TODO: https://pwbug.dev/378564135 - Replacing this with 58 # strip_include_prefix leads to errors when trying to #include internal 59 # headers within this library. 60 includes = ["repo/sdk/lib/fit/include"], 61 deps = [ 62 ":stdcompat", 63 "//pw_assert:assert", 64 "//pw_preprocessor", 65 ], 66) 67 68cc_library( 69 name = "stdcompat", 70 srcs = [ 71 "repo/sdk/lib/stdcompat/include/lib/stdcompat/internal/bit.h", 72 "repo/sdk/lib/stdcompat/include/lib/stdcompat/internal/constructors.h", 73 "repo/sdk/lib/stdcompat/include/lib/stdcompat/internal/exception.h", 74 "repo/sdk/lib/stdcompat/include/lib/stdcompat/internal/functional.h", 75 "repo/sdk/lib/stdcompat/include/lib/stdcompat/internal/storage.h", 76 "repo/sdk/lib/stdcompat/include/lib/stdcompat/internal/type_traits.h", 77 "repo/sdk/lib/stdcompat/include/lib/stdcompat/internal/utility.h", 78 "repo/sdk/lib/stdcompat/include/lib/stdcompat/memory.h", 79 ], 80 hdrs = [ 81 "repo/sdk/lib/stdcompat/include/lib/stdcompat/bit.h", 82 "repo/sdk/lib/stdcompat/include/lib/stdcompat/functional.h", 83 "repo/sdk/lib/stdcompat/include/lib/stdcompat/optional.h", 84 "repo/sdk/lib/stdcompat/include/lib/stdcompat/type_traits.h", 85 "repo/sdk/lib/stdcompat/include/lib/stdcompat/utility.h", 86 "repo/sdk/lib/stdcompat/include/lib/stdcompat/version.h", 87 ], 88 # TODO: https://pwbug.dev/378564135 - Replacing this with 89 # strip_include_prefix leads to errors when trying to #include internal 90 # headers within this library. 91 includes = ["repo/sdk/lib/stdcompat/include"], 92) 93 94sphinx_docs_library( 95 name = "docs", 96 srcs = [ 97 "docs.rst", 98 ], 99 target_compatible_with = incompatible_with_mcu(), 100) 101