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