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("libc++.gni") 16 17 config("config") { 18 if (use_custom_libcxx) { 19 defines = [ 20 "_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS", 21 "_LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS", 22 ] 23 cflags_cc = [ 24 "-nostdinc++", 25 "-isystem" + rebase_path("$libcxx_prefix/include", root_build_dir), 26 "-isystem" + rebase_path("$libcxxabi_prefix/include", root_build_dir), 27 ] 28 29 # In theory here we want just -nostdlib++ to avoid linking both libc++ and 30 # libstdc++. Unfortunately the -nostdlib++ switch is available only in 31 # bleeding edge versions of clang. So, in order to get rid of libstdc++ 32 # we have to remove all libs and then re-add the core ones like libc. 33 ldflags = [ "-nodefaultlibs" ] 34 libs = [ 35 "c", # libc: the core C library. 36 "m", # libm: math library. 37 "dl", # libdl: dynamic linking. 38 "gcc_eh", # gcc exception handling, required by libunwind. 39 ] 40 } 41 } 42 43 group("deps") { 44 if (use_custom_libcxx) { 45 public_deps = [ 46 "//buildtools:libc++", 47 ] 48 } 49 } 50