CMakeLists.txt revision 3125de9e3048bc505344053d3518cccab7ee6897
1# First, add the subdirectories which contain feature-based runtime libraries
2# and several convenience helper libraries.
3
4# Don't build sanitizers in the bootstrap build.
5if(LLVM_USE_SANITIZER STREQUAL "")
6  # AddressSanitizer is supported on Linux and Mac OS X.
7  # 32-bit Windows support is experimental.
8  if(CMAKE_SYSTEM_NAME MATCHES "Darwin|Linux")
9    set(SUPPORTS_BUILDING_ASAN TRUE)
10  elseif(CMAKE_SYSTEM_NAME MATCHES "Windows" AND CMAKE_SIZEOF_VOID_P EQUAL 4)
11    set(SUPPORTS_BUILDING_ASAN TRUE)
12  else()
13    set(SUPPORTS_BUILDING_ASAN FALSE)
14  endif()
15  if(SUPPORTS_BUILDING_ASAN)
16    add_subdirectory(asan)
17    add_subdirectory(interception)
18    add_subdirectory(sanitizer_common)
19  endif()
20  if(CMAKE_SYSTEM_NAME MATCHES "Darwin|Linux" AND NOT ANDROID)
21    # LSan, UBsan and profile can be built on Mac OS and Linux.
22    add_subdirectory(lsan)
23    add_subdirectory(profile)
24    add_subdirectory(ubsan)
25  endif()
26  if(CMAKE_SYSTEM_NAME MATCHES "Linux" AND NOT ANDROID)
27    # ThreadSanitizer and MemorySanitizer are supported on Linux only.
28    add_subdirectory(tsan)
29    add_subdirectory(msan)
30    add_subdirectory(msandr)
31    add_subdirectory(dfsan)
32  endif()
33endif()
34
35# The top-level lib directory contains a large amount of C code which provides
36# generic implementations of the core runtime library along with optimized
37# architecture-specific code in various subdirectories.
38
39set(GENERIC_SOURCES
40  absvdi2.c
41  absvsi2.c
42  absvti2.c
43  adddf3.c
44  addsf3.c
45  addvdi3.c
46  addvsi3.c
47  addvti3.c
48  apple_versioning.c
49  ashldi3.c
50  ashlti3.c
51  ashrdi3.c
52  ashrti3.c
53  # FIXME: atomic.c may only be compiled if host compiler understands _Atomic
54  # atomic.c
55  clear_cache.c
56  clzdi2.c
57  clzsi2.c
58  clzti2.c
59  cmpdi2.c
60  cmpti2.c
61  comparedf2.c
62  comparesf2.c
63  ctzdi2.c
64  ctzsi2.c
65  ctzti2.c
66  divdc3.c
67  divdf3.c
68  divdi3.c
69  divmoddi4.c
70  divmodsi4.c
71  divsc3.c
72  divsf3.c
73  divsi3.c
74  divti3.c
75  divxc3.c
76  enable_execute_stack.c
77  eprintf.c
78  extendsfdf2.c
79  ffsdi2.c
80  ffsti2.c
81  fixdfdi.c
82  fixdfsi.c
83  fixdfti.c
84  fixsfdi.c
85  fixsfsi.c
86  fixsfti.c
87  fixunsdfdi.c
88  fixunsdfsi.c
89  fixunsdfti.c
90  fixunssfdi.c
91  fixunssfsi.c
92  fixunssfti.c
93  fixunsxfdi.c
94  fixunsxfsi.c
95  fixunsxfti.c
96  fixxfdi.c
97  fixxfti.c
98  floatdidf.c
99  floatdisf.c
100  floatdixf.c
101  floatsidf.c
102  floatsisf.c
103  floattidf.c
104  floattisf.c
105  floattixf.c
106  floatundidf.c
107  floatundisf.c
108  floatundixf.c
109  floatunsidf.c
110  floatunsisf.c
111  floatuntidf.c
112  floatuntisf.c
113  floatuntixf.c
114  gcc_personality_v0.c
115  int_util.c
116  lshrdi3.c
117  lshrti3.c
118  moddi3.c
119  modsi3.c
120  modti3.c
121  muldc3.c
122  muldf3.c
123  muldi3.c
124  mulodi4.c
125  mulosi4.c
126  muloti4.c
127  mulsc3.c
128  mulsf3.c
129  multi3.c
130  mulvdi3.c
131  mulvsi3.c
132  mulvti3.c
133  mulxc3.c
134  negdf2.c
135  negdi2.c
136  negsf2.c
137  negti2.c
138  negvdi2.c
139  negvsi2.c
140  negvti2.c
141  paritydi2.c
142  paritysi2.c
143  parityti2.c
144  popcountdi2.c
145  popcountsi2.c
146  popcountti2.c
147  powidf2.c
148  powisf2.c
149  powitf2.c
150  powixf2.c
151  subdf3.c
152  subsf3.c
153  subvdi3.c
154  subvsi3.c
155  subvti3.c
156  trampoline_setup.c
157  truncdfsf2.c
158  ucmpdi2.c
159  ucmpti2.c
160  udivdi3.c
161  udivmoddi4.c
162  udivmodsi4.c
163  udivmodti4.c
164  udivsi3.c
165  udivti3.c
166  umoddi3.c
167  umodsi3.c
168  umodti3.c
169  )
170
171set(x86_64_SOURCES
172  x86_64/floatdidf.c
173  x86_64/floatdisf.c
174  x86_64/floatdixf.c
175  x86_64/floatundidf.S
176  x86_64/floatundisf.S
177  x86_64/floatundixf.S
178  ${GENERIC_SOURCES})
179
180set(i386_SOURCES
181  i386/ashldi3.S
182  i386/ashrdi3.S
183  i386/divdi3.S
184  i386/floatdidf.S
185  i386/floatdisf.S
186  i386/floatdixf.S
187  i386/floatundidf.S
188  i386/floatundisf.S
189  i386/floatundixf.S
190  i386/lshrdi3.S
191  i386/moddi3.S
192  i386/muldi3.S
193  i386/udivdi3.S
194  i386/umoddi3.S
195  ${GENERIC_SOURCES})
196
197if (NOT WIN32)
198  foreach(arch x86_64 i386)
199    if(CAN_TARGET_${arch})
200      add_compiler_rt_static_runtime(clang_rt.${arch} ${arch}
201        SOURCES ${${arch}_SOURCES}
202        CFLAGS "-std=c99")
203    endif()
204  endforeach()
205endif()
206
207# Generate configs for running lit and unit tests.
208configure_lit_site_cfg(
209  ${CMAKE_CURRENT_SOURCE_DIR}/lit.common.configured.in
210  ${CMAKE_CURRENT_BINARY_DIR}/lit.common.configured)
211
212configure_lit_site_cfg(
213  ${CMAKE_CURRENT_SOURCE_DIR}/lit.common.unit.configured.in
214  ${CMAKE_CURRENT_BINARY_DIR}/lit.common.unit.configured)
215
216