third_party.pigweed.src/pw_build/defaults.gni
Wyatt Hepler ea55939d82 pw_build: Use -ffile-prefix-map by default
By default, Clang and GCC use file paths directly as provided for debug
symbols and macros like __FILE__. This means that binaries produced on
different machines can be different and may include undesireable info
like usernames.

Clang and GCC provide the -ffile-prefix-map option to strip non-portable
prefixes from filenames. Add a config that applies -ffile-prefix-map to
Pigweed builds by default.

Change-Id: Icd0fc11b70130b1b0e3ec193b1d245c18a2112b8
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/52340
Reviewed-by: Rob Mohr <mohrr@google.com>
Commit-Queue: Wyatt Hepler <hepler@google.com>
2021-07-08 15:13:21 +00:00

57 lines
1.8 KiB
Plaintext

# 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 = []
}
# 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:cpp17",
"$dir_pw_build:relative_paths",
]
public_deps += [ "$dir_pw_polyfill:overrides" ]
}
# 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
}
}