[MIParser] Set RegClassOrRegBank during instruction parsing
[llvm-complete.git] / utils / gn / secondary / libcxxabi / src / BUILD.gn
blobd84d57d0d71a133cb38598767822f692c2bd2873
1 import("//clang/runtimes.gni")
3 declare_args() {
4   # Use exceptions.
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
20 cxxabi_headers = [
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",
26 cxxabi_sources = [
27   # C++ABI files
28   "cxa_aux_runtime.cpp",
29   "cxa_default_handlers.cpp",
30   "cxa_demangle.cpp",
31   "cxa_exception_storage.cpp",
32   "cxa_guard.cpp",
33   "cxa_handlers.cpp",
34   "cxa_unexpected.cpp",
35   "cxa_vector.cpp",
36   "cxa_virtual.cpp",
38   # C++ STL files
39   "stdlib_exception.cpp",
40   "stdlib_stdexcept.cpp",
41   "stdlib_typeinfo.cpp",
43   # Internal files
44   "abort_message.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) {
52   cxxabi_sources += [
53     "cxa_exception.cpp",
54     "cxa_personality.cpp",
55   ]
56 } else {
57   cxxabi_sources += [
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",
61   ]
63 if (target_os == "linux" || target_os == "fuchsia") {
64   cxxabi_sources += [
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",
68   ]
71 config("cxxabi_config") {
72   include_dirs = [
73     "//libcxxabi/include",
74     "//libcxx/include",
75   ]
76   cflags_cc = [ "-nostdinc++" ]
77   defines = [ "_LIBCXXABI_BUILDING_LIBRARY" ]
78   if (target_os == "win") {
79     defines += [ "_LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS" ]
80   }
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") {
88       cflags = [ "-fPIC" ]
89       ldflags = [ "-nostdlib++" ]
90       libs = [
91         "dl",
92         "pthread",
93       ]
94     }
95     sources = cxxabi_sources
96     public = cxxabi_headers
97     deps = [
98       "//compiler-rt/lib/builtins",
99       "//libunwind/src:unwind_shared",
100     ]
101     configs += [ ":cxxabi_config" ]
102     configs -= [
103       "//llvm/utils/gn/build:no_exceptions",
104       "//llvm/utils/gn/build:no_rtti",
105     ]
106   }
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" ]
121       }
122       defines = [
123         "_LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS",
124         "_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS",
125       ]
126     }
127     deps = [
128       "//compiler-rt/lib/builtins",
129       "//libunwind/src:unwind_static",
130     ]
131     configs += [ ":cxxabi_config" ]
132     configs -= [
133       "//llvm/utils/gn/build:no_exceptions",
134       "//llvm/utils/gn/build:no_rtti",
135     ]
136   }
139 group("src") {
140   deps = []
141   if (libcxxabi_enable_shared) {
142     deps += [ ":cxxabi_shared" ]
143   }
144   if (libcxxabi_enable_static) {
145     deps += [ ":cxxabi_static" ]
146   }