blob: 50f52db511095957cd138088fbcf3516c83da325 [file] [log] [blame]
# Copyright 2020 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")
declare_args() {
# Default configs and dependencies targets provided by the toolchain. These
# are applied to all of the pw_* target types. They are set from a toolchain's
# toolchain_args for cross-toolchain deps, e.g. for
#
# `deps = [ //pw_some_module(//pw_toolchain:not_default) ]`
#
# The default toolchain is never used.
default_configs = []
default_public_deps = []
remove_default_configs = []
# Controls the default visibility of C/C++ libraries and executables
# (pw_source_set, pw_static_library, pw_shared_library pw_executable). This
# can be "*" or a list of paths.
#
# This is useful for limiting usage of Pigweed modules via an explicit
# allowlist. For the GN build to work, pw_build_DEFAULT_VISIBILITY must always
# at least include the Pigweed repository ("$dir_pigweed/*").
#
# Explicitly setting a target's visibility overrides this default.
pw_build_DEFAULT_VISIBILITY = "*"
}
# Combine target-specifc and target-agnostic default variables.
_pw_build_defaults = {
configs = default_configs
public_deps = default_public_deps
# The target-agnostic defaults.
configs += [
"$dir_pw_build:colorize_output",
"$dir_pw_build:debugging",
"$dir_pw_build:reduced_size",
"$dir_pw_build:strict_warnings",
"$dir_pw_build:toolchain_cpp_standard",
"$dir_pw_build:relative_paths",
]
if (pw_build_DEFAULT_VISIBILITY != "*") {
visibility = pw_build_DEFAULT_VISIBILITY
}
}
# One more pass, to remove configs
pw_build_defaults = {
configs = []
forward_variables_from(_pw_build_defaults, "*")
if (remove_default_configs != []) {
# Add them first to ensure they are present to be removed.
configs += remove_default_configs
configs -= remove_default_configs
}
}