[InstCombine] Signed saturation patterns
[llvm-complete.git] / utils / gn / secondary / libunwind / src / BUILD.gn
blob9b118045b246d5b195eda25ed3a1ea1c1f6fb2fb
1 import("//clang/runtimes.gni")
3 declare_args() {
4   # Build libunwind as a shared library.
5   libunwind_enable_shared = true
7   # Build libunwind as a static library.
8   libunwind_enable_static = true
10   # Do not export any symbols from the static library.
11   libunwind_hermetic_static_library = true
14 unwind_headers = [
15   "../include/libunwind.h",
16   "../include/unwind.h",
18 if (target_os == "mac") {
19   unwind_headers += [
20     # This comment prevents `gn format` from putting the file on the same line
21     # as `sources +=`, for sync_source_lists_from_cmake.py.
22     "../include/mach-o/compact_unwind_encoding.h",
23   ]
26 unwind_sources = [
27   "libunwind.cpp",
28   "Unwind-EHABI.cpp",
29   "Unwind-seh.cpp",
30   "UnwindLevel1.c",
31   "UnwindLevel1-gcc-ext.c",
32   "Unwind-sjlj.c",
33   "UnwindRegistersRestore.S",
34   "UnwindRegistersSave.S",
35   "AddressSpace.hpp",
36   "assembly.h",
37   "CompactUnwinder.hpp",
38   "config.h",
39   "dwarf2.h",
40   "DwarfInstructions.hpp",
41   "DwarfParser.hpp",
42   "libunwind_ext.h",
43   "Registers.hpp",
44   "RWMutex.hpp",
45   "UnwindCursor.hpp",
47 if (target_os == "mac") {
48   unwind_sources += [
49     # This comment prevents `gn format` from putting the file on the same line
50     # as `sources +=`, for sync_source_lists_from_cmake.py.
51     "Unwind_AppleExtras.cpp",
52   ]
55 config("unwind_config") {
56   cflags = []
57   cflags_c = [ "-std=c99" ]
58   cflags_cc = [ "-fno-rtti" ]
59   include_dirs = [ "//libunwind/include" ]
60   if (target_os == "mac") {
61     cflags += [ "-U__STRICT_ANSI__" ]
62   }
65 if (libunwind_enable_shared) {
66   shared_library("unwind_shared") {
67     output_dir = runtimes_dir
68     output_name = "unwind"
69     if (target_os == "linux" || target_os == "mac") {
70       cflags = [ "-fPIC" ]
71       ldflags = [ "-nostdlib++" ]
72       libs = [
73         "dl",
74         "pthread",
75       ]
76     }
77     if (target_os == "mac") {
78       ldflags += [
79         "-compatibility_version 1",
80         "-install_name /usr/lib/libunwind.1.dylib",
81       ]
82     }
83     sources = unwind_sources
84     public = unwind_headers
85     deps = [
86       "//compiler-rt/lib/builtins",
87     ]
88     configs += [ ":unwind_config" ]
89     configs -= [
90       "//llvm/utils/gn/build:no_exceptions",
91       "//llvm/utils/gn/build:no_rtti",
92     ]
93   }
96 if (libunwind_enable_static) {
97   static_library("unwind_static") {
98     output_dir = runtimes_dir
99     output_name = "unwind"
100     complete_static_lib = true
101     configs -= [ "//llvm/utils/gn/build:thin_archive" ]
102     sources = unwind_sources
103     public = unwind_headers
104     if (libunwind_hermetic_static_library) {
105       cflags = [ "-fvisibility=hidden" ]
106       cflags_cc = [ "-fvisibility-global-new-delete-hidden" ]
107       defines = [ "_LIBUNWIND_DISABLE_VISIBILITY_ANNOTATIONS" ]
108     }
109     deps = [
110       "//compiler-rt/lib/builtins",
111     ]
112     configs += [ ":unwind_config" ]
113     configs -= [
114       "//llvm/utils/gn/build:no_exceptions",
115       "//llvm/utils/gn/build:no_rtti",
116     ]
117   }
120 group("src") {
121   deps = []
122   if (libunwind_enable_shared) {
123     deps += [ ":unwind_shared" ]
124   }
125   if (libunwind_enable_static) {
126     deps += [ ":unwind_static" ]
127   }