1 import("//clang/runtimes.gni")
5 libcxxabi_enable_exceptions = true
7 # Build libc++abi with definitions for operator new/delete.
8 libcxxabi_enable_new_delete_definitions = true
10 # Build libcxxabi as a shared library.
11 libcxxabi_enable_shared = true
13 # Build libcxxabi as a static library.
14 libcxxabi_enable_static = true
16 # Do not export any symbols from the static library.
17 libcxxabi_hermetic_static_library = true
21 # This comment prevents `gn format` from putting the file on the same line
22 # as `sources +=`, for sync_source_lists_from_cmake.py.
23 "../include/cxxabi.h",
28 "cxa_aux_runtime.cpp",
29 "cxa_default_handlers.cpp",
31 "cxa_exception_storage.cpp",
39 "stdlib_exception.cpp",
40 "stdlib_stdexcept.cpp",
41 "stdlib_typeinfo.cpp",
45 "fallback_malloc.cpp",
46 "private_typeinfo.cpp",
48 if (libcxxabi_enable_new_delete_definitions) {
49 cxxabi_sources += [ "stdlib_new_delete.cpp" ]
51 if (libcxxabi_enable_exceptions) {
54 "cxa_personality.cpp",
58 # This comment prevents `gn format` from putting the file on the same line
59 # as `sources +=`, for sync_source_lists_from_cmake.py.
60 "cxa_noexception.cpp",
63 if (target_os == "linux" || target_os == "fuchsia") {
65 # This comment prevents `gn format` from putting the file on the same line
66 # as `sources +=`, for sync_source_lists_from_cmake.py.
67 "cxa_thread_atexit.cpp",
71 config("cxxabi_config") {
73 "//libcxxabi/include",
76 cflags_cc = [ "-nostdinc++" ]
77 defines = [ "_LIBCXXABI_BUILDING_LIBRARY" ]
78 if (target_os == "win") {
79 defines += [ "_LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS" ]
83 if (libcxxabi_enable_shared) {
84 shared_library("cxxabi_shared") {
85 output_dir = runtimes_dir
86 output_name = "c++abi"
87 if (target_os == "linux" || target_os == "mac") {
89 ldflags = [ "-nostdlib++" ]
95 sources = cxxabi_sources
96 public = cxxabi_headers
98 "//compiler-rt/lib/builtins",
99 "//libunwind/src:unwind_shared",
101 configs += [ ":cxxabi_config" ]
103 "//llvm/utils/gn/build:no_exceptions",
104 "//llvm/utils/gn/build:no_rtti",
109 if (libcxxabi_enable_static) {
110 static_library("cxxabi_static") {
111 output_dir = runtimes_dir
112 output_name = "c++abi"
113 complete_static_lib = true
114 configs -= [ "//llvm/utils/gn/build:thin_archive" ]
115 sources = cxxabi_sources
116 public = cxxabi_headers
117 if (libcxxabi_hermetic_static_library) {
118 cflags = [ "-fvisibility=hidden" ]
119 if (libcxxabi_enable_new_delete_definitions) {
120 cflags_cc = [ "-fvisibility-global-new-delete-hidden" ]
123 "_LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS",
124 "_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS",
128 "//compiler-rt/lib/builtins",
129 "//libunwind/src:unwind_static",
131 configs += [ ":cxxabi_config" ]
133 "//llvm/utils/gn/build:no_exceptions",
134 "//llvm/utils/gn/build:no_rtti",
141 if (libcxxabi_enable_shared) {
142 deps += [ ":cxxabi_shared" ]
144 if (libcxxabi_enable_static) {
145 deps += [ ":cxxabi_static" ]