1 # Copyright 2020 The Pigweed Authors
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
7 # https://www.apache.org/licenses/LICENSE-2.0
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
15 import("//build_overrides/pigweed.gni")
17 # See https://github.com/google/sanitizers
18 config("sanitize_address") {
19 cflags = [ "-fsanitize=address" ]
23 config("sanitize_memory") {
24 cflags = [ "-fsanitize=memory" ]
28 config("sanitize_undefined") {
29 cflags = [ "-fsanitize=undefined" ]
33 config("sanitize_coverage") {
35 "-fprofile-instr-generate",
41 # Locate XCode's sysroot for Clang.
42 config("xcode_sysroot") {
43 if (current_os == "mac") {
44 _xcode_sysroot = exec_script("$dir_pw_build/py/pw_build/exec.py",
51 cflags = [ "--sysroot=$_xcode_sysroot" ]
56 # The CIPD provided Clang/LLVM toolchain must link against the matched
57 # libc++ which is also from CIPD. However, by default, Clang on Mac (but
58 # not on Linux) will fall back to the system libc++, which is
59 # incompatible due to an ABI change.
61 # Pull the appropriate pathd from our Pigweed env setup.
62 config("no_system_libcpp") {
63 if (current_os == "mac") {
64 install_dir = getenv("PW_PIGWEED_CIPD_INSTALL_DIR")
65 assert(install_dir != "",
66 "You forgot to activate the Pigweed environment; " +
67 "did you source pw_env_setup/setup.sh?")
69 # Force dropping the system libc++
72 # Use the libc++ from CIPD.
73 getenv("PW_PIGWEED_CIPD_INSTALL_DIR") + "/lib/libc++.a",