xref: /aosp_15_r20/external/perfetto/gn/standalone/libc++/BUILD.gn (revision 6dbdd20afdafa5e3ca9b8809fa73465d530080dc)
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
15import("libc++.gni")
16
17config("config") {
18  if (use_custom_libcxx) {
19    defines = [
20      "_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS",
21      "_LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS",
22    ]
23    if (is_debug) {
24      # Enable "lightweight" assertions in libc++ (e.g. bounds checking, empty
25      # optional dereferencing etc) with _LIBCPP_ENABLE_ASSERTIONS but do not
26      # enable iterator debugging with _LIBCPP_DEBUG (which can be very
27      # expensive).
28      defines += [ "_LIBCPP_ENABLE_ASSERTIONS=1" ]
29      defines += [ "_LIBCPP_DEBUG=0" ]
30    }
31    cflags_cc = [
32      "-nostdinc++",
33      "-isystem" + rebase_path("$libcxx_prefix/include", root_build_dir),
34      "-isystem" + rebase_path("$libcxxabi_prefix/include", root_build_dir),
35    ]
36    include_dirs = [ "//buildtools/libcxx_config" ]
37
38    # Avoid linking both libc++ and libstdc++.
39    ldflags = [ "-nostdlib++" ]
40    libs = [ "dl" ]  # libdl: dynamic linking.
41  }
42}
43
44group("deps") {
45  if (use_custom_libcxx) {
46    public_deps = [ "//buildtools:libc++" ]
47  }
48}
49