Home | History | Annotate | Download | only in libc++
      1 # Copyright (C) 2017 The Android Open Source Project
      2 #
      3 # Licensed under the Apache License, Version 2.0 (the "License");
      4 # you may not use this file except in compliance with the License.
      5 # You may obtain a copy of the License at
      6 #
      7 #      http://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,
     11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     12 # See the License for the specific language governing permissions and
     13 # limitations under the License.
     14 
     15 import("//gn/standalone/sanitizers/sanitizers.gni")
     16 import("//gn/standalone/wasm.gni")
     17 
     18 declare_args() {
     19   # Background:
     20   # there are mainly two C++ libraries around in the world: (i) GNU's
     21   # libstdc++ and LLVM's libc++ (aka libcxx). By default Linux provides libstdc++
     22   # (even building with clang on Linux uses that by default) while Mac and
     23   # Android switched to libcxx.
     24   # buildtools/libcxx(abi) contains a fixed version of the libcxx, the same one
     25   # that Chrome uses on most production configurations (% lagging catching up
     26   # with our DEPS).
     27   # The variable use_custom_libcxx tells our build system to prefer the
     28   # aforementioned copy to the system one.
     29   #
     30   # Now, there are two reasons for using the checked in copy of libcxx:
     31   # 1) LLVM sanitizers require that the c++ library is built from sources,
     32   #    because they need to be instrumented with -fsanitize as well (see
     33   #    https://github.com/google/sanitizers/wiki/MemorySanitizerLibcxxHowTo).
     34   #    On top of this, they also require that the c++ library is dynamically
     35   #    linked to prevent duplicate symbol errors when linking (see Chrome's
     36   #    build/config/c++/c++.gni)
     37   # 2) The libstdc++ situation is too wild on Linux. Modern debian distros are
     38   #    fine but Ubuntu Trusty still ships a libstdc++ that doesn't fully
     39   #    support C++11. Hence we enable this flag on Linux by default.
     40   #    We still retain libstdc++ coverage on the Travis bots by overriding
     41   #    use_custom_libcxx=false when we target a modern library (see the
     42   #    GCC7 target in .travis.yml).
     43   use_custom_libcxx = is_linux && is_clang && !is_wasm
     44   custom_libcxx_is_static = !using_sanitizer
     45 }
     46 
     47 libcxx_prefix = "//buildtools/libcxx"
     48 libcxxabi_prefix = "//buildtools/libcxxabi"
     49