|
| 1 | +# Copyright 2013 The Flutter Authors. All rights reserved. |
| 2 | +# Use of this source code is governed by a BSD-style license that can be |
| 3 | +# found in the LICENSE file. |
| 4 | + |
| 5 | +config("libcxxabi_config") { |
| 6 | + common_cc_flags = [ |
| 7 | + "-nostdinc++", |
| 8 | + "-fvisibility=hidden", |
| 9 | + ] |
| 10 | + |
| 11 | + cflags_cc = common_cc_flags |
| 12 | + cflags_objcc = common_cc_flags |
| 13 | + |
| 14 | + include_dirs = [ "include" ] |
| 15 | + |
| 16 | + if (is_ios) { |
| 17 | + ldflags = [ "-Wl,-unexported_symbols_list," + |
| 18 | + rebase_path("lib/new-delete.exp", root_build_dir) ] |
| 19 | + } |
| 20 | +} |
| 21 | + |
| 22 | +source_set("libcxxabi") { |
| 23 | + visibility = [ "../libcxx:*" ] |
| 24 | + |
| 25 | + public_configs = [ ":libcxxabi_config" ] |
| 26 | + |
| 27 | + defines = [ |
| 28 | + "_LIBCPP_BUILDING_LIBRARY", |
| 29 | + "_LIBCXXABI_BUILDING_LIBRARY", |
| 30 | + "LIBCXXABI_SILENT_TERMINATE", |
| 31 | + "_LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS", |
| 32 | + ] |
| 33 | + |
| 34 | + sources = [] |
| 35 | + |
| 36 | + # Compile libcxx ABI using C++11. This replicates the rule in the |
| 37 | + # CMakeLists on the "cxx_abiobjects" target. |
| 38 | + configs -= [ "//build/config/compiler:cxx_version_default" ] |
| 39 | + configs += [ "//build/config/compiler:cxx_version_20" ] |
| 40 | + |
| 41 | + configs += [ "//third_party/libcxx:src_include" ] |
| 42 | + |
| 43 | + # No translation units in the engine are built with exceptions. But, using |
| 44 | + # Objective-C exceptions requires some infrastructure setup for exceptions. |
| 45 | + # Build support for the same in cxxabi on Darwin. |
| 46 | + if (is_mac || is_ios) { |
| 47 | + configs -= [ "//build/config/gcc:no_exceptions" ] |
| 48 | + sources += [ |
| 49 | + "src/cxa_exception.cpp", |
| 50 | + "src/cxa_personality.cpp", |
| 51 | + ] |
| 52 | + } else { |
| 53 | + if (!is_tsan) { |
| 54 | + sources += [ "src/cxa_noexception.cpp" ] |
| 55 | + } |
| 56 | + } |
| 57 | + |
| 58 | + # Third party dependencies may depend on RTTI. Add support for the same in |
| 59 | + # cxxabi. |
| 60 | + configs -= [ "//build/config/compiler:no_rtti" ] |
| 61 | + configs += [ "//build/config/compiler:rtti" ] |
| 62 | + |
| 63 | + sources += [ |
| 64 | + "src/abort_message.cpp", |
| 65 | + "src/cxa_aux_runtime.cpp", |
| 66 | + "src/cxa_default_handlers.cpp", |
| 67 | + "src/cxa_demangle.cpp", |
| 68 | + "src/cxa_exception_storage.cpp", |
| 69 | + "src/cxa_handlers.cpp", |
| 70 | + "src/cxa_vector.cpp", |
| 71 | + "src/cxa_virtual.cpp", |
| 72 | + "src/fallback_malloc.cpp", |
| 73 | + "src/private_typeinfo.cpp", |
| 74 | + "src/stdlib_exception.cpp", |
| 75 | + "src/stdlib_stdexcept.cpp", |
| 76 | + "src/stdlib_typeinfo.cpp", |
| 77 | + ] |
| 78 | + |
| 79 | + if (!(is_tsan && is_linux)) { |
| 80 | + sources += [ "src/cxa_guard.cpp" ] |
| 81 | + } |
| 82 | + |
| 83 | + if (is_fuchsia || (is_posix && !is_apple)) { |
| 84 | + sources += [ "src/cxa_thread_atexit.cpp" ] |
| 85 | + } |
| 86 | +} |
0 commit comments