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