[libc++][Android] BuildKite CI: update Clang and sysroot versions (#116151)
[llvm-project.git] / clang / cmake / caches / Fuchsia-stage2.cmake
blob747d9974828984a1d6aff6b190a96217ae5dd9cc
1 # This file sets up a CMakeCache for the second stage of a Fuchsia toolchain build.
3 option(FUCHSIA_ENABLE_LLDB "Enable LLDB")
5 set(LLVM_TARGETS_TO_BUILD X86;ARM;AArch64;RISCV CACHE STRING "")
7 set(PACKAGE_VENDOR Fuchsia CACHE STRING "")
9 set(_FUCHSIA_ENABLE_PROJECTS "bolt;clang;clang-tools-extra;libc;lld;llvm;polly")
10 set(LLVM_ENABLE_RUNTIMES "compiler-rt;libcxx;libcxxabi;libunwind" CACHE STRING "")
12 set(LLVM_ENABLE_BACKTRACES OFF CACHE BOOL "")
13 set(LLVM_ENABLE_DIA_SDK OFF CACHE BOOL "")
14 set(LLVM_ENABLE_FATLTO ON CACHE BOOL "")
15 set(LLVM_ENABLE_HTTPLIB ON CACHE BOOL "")
16 set(LLVM_ENABLE_LIBCXX ON CACHE BOOL "")
17 set(LLVM_ENABLE_LIBEDIT OFF CACHE BOOL "")
18 set(LLVM_ENABLE_LLD ON CACHE BOOL "")
19 set(LLVM_ENABLE_LTO ON CACHE BOOL "")
20 set(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR ON CACHE BOOL "")
21 set(LLVM_ENABLE_PLUGINS OFF CACHE BOOL "")
22 set(LLVM_ENABLE_UNWIND_TABLES OFF CACHE BOOL "")
23 set(LLVM_ENABLE_Z3_SOLVER OFF CACHE BOOL "")
24 set(LLVM_ENABLE_ZLIB ON CACHE BOOL "")
25 set(LLVM_FORCE_BUILD_RUNTIME ON CACHE BOOL "")
26 set(LLVM_INCLUDE_DOCS OFF CACHE BOOL "")
27 set(LLVM_INCLUDE_EXAMPLES OFF CACHE BOOL "")
28 set(LLVM_LIBC_FULL_BUILD ON CACHE BOOL "")
29 set(LIBC_HDRGEN_ONLY ON CACHE BOOL "")
30 set(LLVM_STATIC_LINK_CXX_STDLIB ON CACHE BOOL "")
31 set(LLVM_USE_RELATIVE_PATHS_IN_FILES ON CACHE BOOL "")
32 set(LLDB_ENABLE_CURSES OFF CACHE BOOL "")
33 set(LLDB_ENABLE_LIBEDIT OFF CACHE BOOL "")
35 if(WIN32)
36   set(FUCHSIA_DISABLE_DRIVER_BUILD ON)
37 endif()
39 if (NOT FUCHSIA_DISABLE_DRIVER_BUILD)
40   set(LLVM_TOOL_LLVM_DRIVER_BUILD ON CACHE BOOL "")
41   set(LLVM_DRIVER_TARGET llvm-driver)
42 endif()
44 set(CLANG_DEFAULT_CXX_STDLIB libc++ CACHE STRING "")
45 set(CLANG_DEFAULT_LINKER lld CACHE STRING "")
46 set(CLANG_DEFAULT_OBJCOPY llvm-objcopy CACHE STRING "")
47 set(CLANG_DEFAULT_RTLIB compiler-rt CACHE STRING "")
48 set(CLANG_DEFAULT_UNWINDLIB libunwind CACHE STRING "")
49 set(CLANG_ENABLE_ARCMT OFF CACHE BOOL "")
50 set(CLANG_ENABLE_STATIC_ANALYZER ON CACHE BOOL "")
51 set(CLANG_PLUGIN_SUPPORT OFF CACHE BOOL "")
53 set(ENABLE_LINKER_BUILD_ID ON CACHE BOOL "")
54 set(ENABLE_X86_RELAX_RELOCATIONS ON CACHE BOOL "")
56 # TODO(#67176): relative-vtables doesn't play well with different default
57 # visibilities. Making everything hidden visibility causes other complications
58 # let's choose default visibility for our entire toolchain.
59 set(CMAKE_C_VISIBILITY_PRESET default CACHE STRING "")
60 set(CMAKE_CXX_VISIBILITY_PRESET default CACHE STRING "")
62 set(CMAKE_BUILD_TYPE Release CACHE STRING "")
63 if (APPLE)
64   set(CMAKE_OSX_DEPLOYMENT_TARGET "10.13" CACHE STRING "")
65 elseif(WIN32)
66   set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded" CACHE STRING "")
67 endif()
69 if(APPLE)
70   list(APPEND BUILTIN_TARGETS "default")
71   list(APPEND RUNTIME_TARGETS "default")
73   set(COMPILER_RT_ENABLE_TVOS OFF CACHE BOOL "")
74   set(COMPILER_RT_ENABLE_WATCHOS OFF CACHE BOOL "")
75   set(COMPILER_RT_USE_BUILTINS_LIBRARY ON CACHE BOOL "")
77   set(LIBUNWIND_ENABLE_SHARED OFF CACHE BOOL "")
78   set(LIBUNWIND_USE_COMPILER_RT ON CACHE BOOL "")
79   set(LIBCXXABI_ENABLE_SHARED OFF CACHE BOOL "")
80   set(LIBCXXABI_ENABLE_STATIC_UNWINDER ON CACHE BOOL "")
81   set(LIBCXXABI_INSTALL_LIBRARY OFF CACHE BOOL "")
82   set(LIBCXXABI_USE_COMPILER_RT ON CACHE BOOL "")
83   set(LIBCXXABI_USE_LLVM_UNWINDER ON CACHE BOOL "")
84   set(LIBCXX_ABI_VERSION 2 CACHE STRING "")
85   set(LIBCXX_ENABLE_SHARED OFF CACHE BOOL "")
86   set(LIBCXX_ENABLE_STATIC_ABI_LIBRARY ON CACHE BOOL "")
87   set(LIBCXX_HARDENING_MODE "none" CACHE STRING "")
88   set(LIBCXX_USE_COMPILER_RT ON CACHE BOOL "")
89   set(RUNTIMES_CMAKE_ARGS "-DCMAKE_OSX_DEPLOYMENT_TARGET=10.13;-DCMAKE_OSX_ARCHITECTURES=arm64|x86_64" CACHE STRING "")
90 endif()
92 if(WIN32 OR LLVM_WINSYSROOT)
93   if((NOT WIN32) AND (NOT LLVM_VFSOVERLAY))
94     message(FATAL_ERROR "LLVM_VFSOVERLAY should be defined.")
95   endif()
96   set(target "x86_64-pc-windows-msvc")
98   if (LLVM_WINSYSROOT)
99     set(WINDOWS_COMPILER_FLAGS
100       -Xclang
101       -ivfsoverlay
102       -Xclang
103       ${LLVM_VFSOVERLAY}
104       # TODO: /winsysroot should be set by HandleLLVMOptions.cmake automatically
105       # but it current has a bug that prevents it from working under cross
106       # compilation. Set this flag manually for now.
107       /winsysroot
108       ${LLVM_WINSYSROOT})
109     string(REPLACE ";" " " WINDOWS_COMPILER_FLAGS "${WINDOWS_COMPILER_FLAGS}")
110     set(WINDOWS_LINK_FLAGS
111       # TODO: lld-link has a bug that it cannot infer the machine type
112       # correctly when /winsysroot is set while Windows libraries search paths
113       # are not explicitly defined.
114       # Explicitly set the machine type for now.
115       /machine:X64
116       /vfsoverlay:${LLVM_VFSOVERLAY}
117       /winsysroot:${LLVM_WINSYSROOT})
118     string(REPLACE ";" " " WINDOWS_LINK_FLAGS "${WINDOWS_LINK_FLAGS}")
119   endif()
121   list(APPEND BUILTIN_TARGETS "${target}")
122   set(BUILTINS_${target}_CMAKE_SYSTEM_NAME Windows CACHE STRING "")
123   set(BUILTINS_${target}_CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING "")
124   set(BUILTINS_${target}_CMAKE_C_FLAGS ${WINDOWS_COMPILER_FLAGS} CACHE STRING "")
125   set(BUILTINS_${target}_CMAKE_CXX_FLAGS ${WINDOWS_COMPILER_FLAGS} CACHE STRING "")
126   set(BUILTINS_${target}_CMAKE_EXE_LINKER_FLAGS ${WINDOWS_LINK_FLAGS} CACHE STRING "")
127   set(BUILTINS_${target}_CMAKE_SHARED_LINKER_FLAGS ${WINDOWS_LINK_FLAGS} CACHE STRING "")
128   set(BUILTINS_${target}_CMAKE_MODULE_LINKER_FLAGS ${WINDOWS_LINK_FLAGS} CACHE STRING "")
130   list(APPEND RUNTIME_TARGETS "${target}")
131   set(RUNTIMES_${target}_CMAKE_SYSTEM_NAME Windows CACHE STRING "")
132   set(RUNTIMES_${target}_CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING "")
133   set(RUNTIMES_${target}_LIBCXX_ABI_VERSION 2 CACHE STRING "")
134   set(RUNTIMES_${target}_LIBCXX_ENABLE_ABI_LINKER_SCRIPT OFF CACHE BOOL "")
135   set(RUNTIMES_${target}_LIBCXX_ENABLE_SHARED OFF CACHE BOOL "")
136   set(RUNTIMES_${target}_LLVM_ENABLE_RUNTIMES "compiler-rt;libcxx" CACHE STRING "")
137   set(RUNTIMES_${target}_CMAKE_C_FLAGS ${WINDOWS_COMPILER_FLAGS} CACHE STRING "")
138   set(RUNTIMES_${target}_CMAKE_CXX_FLAGS ${WINDOWS_COMPILER_FLAGS} CACHE STRING "")
139   set(RUNTIMES_${target}_CMAKE_EXE_LINKER_FLAGS ${WINDOWS_LINK_FLAGS} CACHE STRING "")
140   set(RUNTIMES_${target}_CMAKE_SHARED_LINKER_FLAGS ${WINDOWS_LINK_FLAGS} CACHE STRING "")
141   set(RUNTIMES_${target}_CMAKE_MODULE_LINKER_FLAGS ${WINDOWS_LINK_FLAGS} CACHE STRING "")
142 endif()
144 foreach(target aarch64-unknown-linux-gnu;armv7-unknown-linux-gnueabihf;i386-unknown-linux-gnu;riscv64-unknown-linux-gnu;x86_64-unknown-linux-gnu)
145   if(LINUX_${target}_SYSROOT)
146     # Set the per-target builtins options.
147     list(APPEND BUILTIN_TARGETS "${target}")
148     set(BUILTINS_${target}_CMAKE_SYSTEM_NAME Linux CACHE STRING "")
149     set(BUILTINS_${target}_CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING "")
150     set(BUILTINS_${target}_CMAKE_C_FLAGS "--target=${target}" CACHE STRING "")
151     set(BUILTINS_${target}_CMAKE_CXX_FLAGS "--target=${target}" CACHE STRING "")
152     set(BUILTINS_${target}_CMAKE_ASM_FLAGS "--target=${target}" CACHE STRING "")
153     set(BUILTINS_${target}_CMAKE_SYSROOT ${LINUX_${target}_SYSROOT} CACHE STRING "")
154     set(BUILTINS_${target}_CMAKE_SHARED_LINKER_FLAGS "-fuse-ld=lld" CACHE STRING "")
155     set(BUILTINS_${target}_CMAKE_MODULE_LINKER_FLAGS "-fuse-ld=lld" CACHE STRING "")
156     set(BUILTINS_${target}_CMAKE_EXE_LINKER_FLAG "-fuse-ld=lld" CACHE STRING "")
157     set(BUILTINS_${target}_COMPILER_RT_BUILD_STANDALONE_LIBATOMIC ON CACHE BOOL "")
158     set(BUILTINS_${target}_COMPILER_RT_LIBATOMIC_USE_PTHREAD ON CACHE BOOL "")
160     # Set the per-target runtimes options.
161     list(APPEND RUNTIME_TARGETS "${target}")
162     set(RUNTIMES_${target}_CMAKE_SYSTEM_NAME Linux CACHE STRING "")
163     set(RUNTIMES_${target}_CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING "")
164     set(RUNTIMES_${target}_CMAKE_C_FLAGS "--target=${target}" CACHE STRING "")
165     set(RUNTIMES_${target}_CMAKE_CXX_FLAGS "--target=${target}" CACHE STRING "")
166     set(RUNTIMES_${target}_CMAKE_ASM_FLAGS "--target=${target}" CACHE STRING "")
167     set(RUNTIMES_${target}_CMAKE_SYSROOT ${LINUX_${target}_SYSROOT} CACHE STRING "")
168     set(RUNTIMES_${target}_CMAKE_SHARED_LINKER_FLAGS "-fuse-ld=lld" CACHE STRING "")
169     set(RUNTIMES_${target}_CMAKE_MODULE_LINKER_FLAGS "-fuse-ld=lld" CACHE STRING "")
170     set(RUNTIMES_${target}_CMAKE_EXE_LINKER_FLAGS "-fuse-ld=lld" CACHE STRING "")
171     set(RUNTIMES_${target}_COMPILER_RT_CXX_LIBRARY "libcxx" CACHE STRING "")
172     set(RUNTIMES_${target}_COMPILER_RT_USE_BUILTINS_LIBRARY ON CACHE BOOL "")
173     set(RUNTIMES_${target}_COMPILER_RT_USE_ATOMIC_LIBRARY ON CACHE BOOL "")
174     set(RUNTIMES_${target}_COMPILER_RT_USE_LLVM_UNWINDER ON CACHE BOOL "")
175     set(RUNTIMES_${target}_COMPILER_RT_CAN_EXECUTE_TESTS ON CACHE BOOL "")
176     set(RUNTIMES_${target}_COMPILER_RT_BUILD_STANDALONE_LIBATOMIC ON CACHE BOOL "")
177     set(RUNTIMES_${target}_LIBUNWIND_ENABLE_SHARED OFF CACHE BOOL "")
178     set(RUNTIMES_${target}_LIBUNWIND_USE_COMPILER_RT ON CACHE BOOL "")
179     set(RUNTIMES_${target}_LIBCXXABI_USE_COMPILER_RT ON CACHE BOOL "")
180     set(RUNTIMES_${target}_LIBCXXABI_ENABLE_SHARED OFF CACHE BOOL "")
181     set(RUNTIMES_${target}_LIBCXXABI_USE_LLVM_UNWINDER ON CACHE BOOL "")
182     set(RUNTIMES_${target}_LIBCXXABI_INSTALL_LIBRARY OFF CACHE BOOL "")
183     set(RUNTIMES_${target}_LIBCXX_USE_COMPILER_RT ON CACHE BOOL "")
184     set(RUNTIMES_${target}_LIBCXX_ENABLE_SHARED OFF CACHE BOOL "")
185     set(RUNTIMES_${target}_LIBCXX_ENABLE_STATIC_ABI_LIBRARY ON CACHE BOOL "")
186     set(RUNTIMES_${target}_LIBCXX_ABI_VERSION 2 CACHE STRING "")
187     set(RUNTIMES_${target}_LLVM_ENABLE_ASSERTIONS OFF CACHE BOOL "")
188     set(RUNTIMES_${target}_SANITIZER_CXX_ABI "libc++" CACHE STRING "")
189     set(RUNTIMES_${target}_SANITIZER_CXX_ABI_INTREE ON CACHE BOOL "")
190     set(RUNTIMES_${target}_SANITIZER_TEST_CXX "libc++" CACHE STRING "")
191     set(RUNTIMES_${target}_SANITIZER_TEST_CXX_INTREE ON CACHE BOOL "")
192     set(RUNTIMES_${target}_LLVM_TOOLS_DIR "${CMAKE_BINARY_DIR}/bin" CACHE BOOL "")
193     set(RUNTIMES_${target}_LLVM_ENABLE_RUNTIMES "compiler-rt;libcxx;libcxxabi;libunwind" CACHE STRING "")
195     # Use .build-id link.
196     list(APPEND RUNTIME_BUILD_ID_LINK "${target}")
197   endif()
198 endforeach()
200 if(FUCHSIA_SDK)
201   set(FUCHSIA_aarch64-unknown-fuchsia_NAME arm64)
202   set(FUCHSIA_i386-unknown-fuchsia_NAME x64)
203   set(FUCHSIA_x86_64-unknown-fuchsia_NAME x64)
204   set(FUCHSIA_riscv64-unknown-fuchsia_NAME riscv64)
205   foreach(target i386-unknown-fuchsia;x86_64-unknown-fuchsia;aarch64-unknown-fuchsia;riscv64-unknown-fuchsia)
206     set(FUCHSIA_${target}_COMPILER_FLAGS "--target=${target} -I${FUCHSIA_SDK}/pkg/sync/include -I${FUCHSIA_SDK}/pkg/fdio/include")
207     set(FUCHSIA_${target}_LINKER_FLAGS "-L${FUCHSIA_SDK}/arch/${FUCHSIA_${target}_NAME}/lib")
208     set(FUCHSIA_${target}_SYSROOT "${FUCHSIA_SDK}/arch/${FUCHSIA_${target}_NAME}/sysroot")
209   endforeach()
211   foreach(target i386-unknown-fuchsia;x86_64-unknown-fuchsia;aarch64-unknown-fuchsia;riscv64-unknown-fuchsia)
212     # Set the per-target builtins options.
213     list(APPEND BUILTIN_TARGETS "${target}")
214     set(BUILTINS_${target}_CMAKE_SYSTEM_NAME Fuchsia CACHE STRING "")
215     set(BUILTINS_${target}_CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING "")
216     set(BUILTINS_${target}_CMAKE_ASM_FLAGS ${FUCHSIA_${target}_COMPILER_FLAGS} CACHE STRING "")
217     set(BUILTINS_${target}_CMAKE_C_FLAGS ${FUCHSIA_${target}_COMPILER_FLAGS} CACHE STRING "")
218     set(BUILTINS_${target}_CMAKE_CXX_FLAGS ${FUCHSIA_${target}_COMPILER_FLAGS} CACHE STRING "")
219     set(BUILTINS_${target}_CMAKE_SHARED_LINKER_FLAGS ${FUCHSIA_${target}_LINKER_FLAGS} CACHE STRING "")
220     set(BUILTINS_${target}_CMAKE_MODULE_LINKER_FLAGS ${FUCHSIA_${target}_LINKER_FLAGS} CACHE STRING "")
221     set(BUILTINS_${target}_CMAKE_EXE_LINKER_FLAGS ${FUCHSIA_${target}_LINKER_FLAGS} CACHE STRING "")
222     set(BUILTINS_${target}_CMAKE_SYSROOT ${FUCHSIA_${target}_SYSROOT} CACHE PATH "")
223   endforeach()
225   foreach(target x86_64-unknown-fuchsia;aarch64-unknown-fuchsia;riscv64-unknown-fuchsia)
226     # Set the per-target runtimes options.
227     list(APPEND RUNTIME_TARGETS "${target}")
228     set(RUNTIMES_${target}_CMAKE_SYSTEM_NAME Fuchsia CACHE STRING "")
229     set(RUNTIMES_${target}_CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING "")
230     set(RUNTIMES_${target}_CMAKE_BUILD_WITH_INSTALL_RPATH ON CACHE BOOL "")
231     set(RUNTIMES_${target}_CMAKE_ASM_FLAGS ${FUCHSIA_${target}_COMPILER_FLAGS} CACHE STRING "")
232     set(RUNTIMES_${target}_CMAKE_C_FLAGS ${FUCHSIA_${target}_COMPILER_FLAGS} CACHE STRING "")
233     set(RUNTIMES_${target}_CMAKE_CXX_FLAGS ${FUCHSIA_${target}_COMPILER_FLAGS} CACHE STRING "")
234     set(RUNTIMES_${target}_CMAKE_SHARED_LINKER_FLAGS ${FUCHSIA_${target}_LINKER_FLAGS} CACHE STRING "")
235     set(RUNTIMES_${target}_CMAKE_MODULE_LINKER_FLAGS ${FUCHSIA_${target}_LINKER_FLAGS} CACHE STRING "")
236     set(RUNTIMES_${target}_CMAKE_EXE_LINKER_FLAGS ${FUCHSIA_${target}_LINKER_FLAGS} CACHE STRING "")
237     set(RUNTIMES_${target}_CMAKE_SYSROOT ${FUCHSIA_${target}_SYSROOT} CACHE PATH "")
238     set(RUNTIMES_${target}_COMPILER_RT_CXX_LIBRARY "libcxx" CACHE STRING "")
239     set(RUNTIMES_${target}_COMPILER_RT_USE_BUILTINS_LIBRARY ON CACHE BOOL "")
240     set(RUNTIMES_${target}_COMPILER_RT_USE_LLVM_UNWINDER ON CACHE BOOL "")
241     set(RUNTIMES_${target}_LIBUNWIND_USE_COMPILER_RT ON CACHE BOOL "")
242     set(RUNTIMES_${target}_LIBUNWIND_HIDE_SYMBOLS ON CACHE BOOL "")
243     set(RUNTIMES_${target}_LIBCXXABI_USE_COMPILER_RT ON CACHE BOOL "")
244     set(RUNTIMES_${target}_LIBCXXABI_USE_LLVM_UNWINDER ON CACHE BOOL "")
245     set(RUNTIMES_${target}_LIBCXXABI_HERMETIC_STATIC_LIBRARY ON CACHE BOOL "")
246     set(RUNTIMES_${target}_LIBCXXABI_INSTALL_STATIC_LIBRARY OFF CACHE BOOL "")
247     set(RUNTIMES_${target}_LIBCXX_USE_COMPILER_RT ON CACHE BOOL "")
248     set(RUNTIMES_${target}_LIBCXX_ENABLE_STATIC_ABI_LIBRARY ON CACHE BOOL "")
249     set(RUNTIMES_${target}_LIBCXX_HERMETIC_STATIC_LIBRARY ON CACHE BOOL "")
250     set(RUNTIMES_${target}_LIBCXX_STATICALLY_LINK_ABI_IN_SHARED_LIBRARY OFF CACHE BOOL "")
251     set(RUNTIMES_${target}_LIBCXX_ABI_VERSION 2 CACHE STRING "")
252     set(RUNTIMES_${target}_LLVM_ENABLE_ASSERTIONS OFF CACHE BOOL "")
253     set(RUNTIMES_${target}_LLVM_ENABLE_RUNTIMES "compiler-rt;libcxx;libcxxabi;libunwind" CACHE STRING "")
255     # Compat multilibs.
256     set(RUNTIMES_${target}+compat_LLVM_BUILD_COMPILER_RT OFF CACHE BOOL "")
257     set(RUNTIMES_${target}+compat_LIBCXXABI_ENABLE_EXCEPTIONS OFF CACHE BOOL "")
258     set(RUNTIMES_${target}+compat_LIBCXX_ENABLE_EXCEPTIONS OFF CACHE BOOL "")
259     set(RUNTIMES_${target}+compat_CMAKE_CXX_FLAGS "${FUCHSIA_${target}_COMPILER_FLAGS} -fc++-abi=itanium" CACHE STRING "")
261     set(RUNTIMES_${target}+asan_LLVM_BUILD_COMPILER_RT OFF CACHE BOOL "")
262     set(RUNTIMES_${target}+asan_LLVM_USE_SANITIZER "Address" CACHE STRING "")
263     set(RUNTIMES_${target}+asan_LIBCXXABI_ENABLE_NEW_DELETE_DEFINITIONS OFF CACHE BOOL "")
264     set(RUNTIMES_${target}+asan_LIBCXX_ENABLE_NEW_DELETE_DEFINITIONS OFF CACHE BOOL "")
266     set(RUNTIMES_${target}+noexcept_LLVM_BUILD_COMPILER_RT OFF CACHE BOOL "")
267     set(RUNTIMES_${target}+noexcept_LIBCXXABI_ENABLE_EXCEPTIONS OFF CACHE BOOL "")
268     set(RUNTIMES_${target}+noexcept_LIBCXX_ENABLE_EXCEPTIONS OFF CACHE BOOL "")
270     set(RUNTIMES_${target}+asan+noexcept_LLVM_BUILD_COMPILER_RT OFF CACHE BOOL "")
271     set(RUNTIMES_${target}+asan+noexcept_LLVM_USE_SANITIZER "Address" CACHE STRING "")
272     set(RUNTIMES_${target}+asan+noexcept_LIBCXXABI_ENABLE_NEW_DELETE_DEFINITIONS OFF CACHE BOOL "")
273     set(RUNTIMES_${target}+asan+noexcept_LIBCXX_ENABLE_NEW_DELETE_DEFINITIONS OFF CACHE BOOL "")
274     set(RUNTIMES_${target}+asan+noexcept_LIBCXXABI_ENABLE_EXCEPTIONS OFF CACHE BOOL "")
275     set(RUNTIMES_${target}+asan+noexcept_LIBCXX_ENABLE_EXCEPTIONS OFF CACHE BOOL "")
277     # Use .build-id link.
278     list(APPEND RUNTIME_BUILD_ID_LINK "${target}")
279   endforeach()
281   # HWAsan
282   set(RUNTIMES_aarch64-unknown-fuchsia+hwasan_LLVM_BUILD_COMPILER_RT OFF CACHE BOOL "")
283   set(RUNTIMES_aarch64-unknown-fuchsia+hwasan_LLVM_USE_SANITIZER "HWAddress" CACHE STRING "")
284   set(RUNTIMES_aarch64-unknown-fuchsia+hwasan_LIBCXXABI_ENABLE_NEW_DELETE_DEFINITIONS OFF CACHE BOOL "")
285   set(RUNTIMES_aarch64-unknown-fuchsia+hwasan_LIBCXX_ENABLE_NEW_DELETE_DEFINITIONS OFF CACHE BOOL "")
287   # HWASan+noexcept
288   set(RUNTIMES_aarch64-unknown-fuchsia+hwasan+noexcept_LLVM_BUILD_COMPILER_RT OFF CACHE BOOL "")
289   set(RUNTIMES_aarch64-unknown-fuchsia+hwasan+noexcept_LLVM_USE_SANITIZER "HWAddress" CACHE STRING "")
290   set(RUNTIMES_aarch64-unknown-fuchsia+hwasan+noexcept_LIBCXXABI_ENABLE_NEW_DELETE_DEFINITIONS OFF CACHE BOOL "")
291   set(RUNTIMES_aarch64-unknown-fuchsia+hwasan+noexcept_LIBCXX_ENABLE_NEW_DELETE_DEFINITIONS OFF CACHE BOOL "")
292   set(RUNTIMES_aarch64-unknown-fuchsia+hwasan+noexcept_LIBCXXABI_ENABLE_EXCEPTIONS OFF CACHE BOOL "")
293   set(RUNTIMES_aarch64-unknown-fuchsia+hwasan+noexcept_LIBCXX_ENABLE_EXCEPTIONS OFF CACHE BOOL "")
295   set(LLVM_RUNTIME_MULTILIBS "asan;noexcept;compat;asan+noexcept;hwasan;hwasan+noexcept" CACHE STRING "")
297   set(LLVM_RUNTIME_MULTILIB_asan_TARGETS "x86_64-unknown-fuchsia;aarch64-unknown-fuchsia;riscv64-unknown-fuchsia" CACHE STRING "")
298   set(LLVM_RUNTIME_MULTILIB_noexcept_TARGETS "x86_64-unknown-fuchsia;aarch64-unknown-fuchsia;riscv64-unknown-fuchsia" CACHE STRING "")
299   set(LLVM_RUNTIME_MULTILIB_compat_TARGETS "x86_64-unknown-fuchsia;aarch64-unknown-fuchsia;riscv64-unknown-fuchsia" CACHE STRING "")
300   set(LLVM_RUNTIME_MULTILIB_asan+noexcept_TARGETS "x86_64-unknown-fuchsia;aarch64-unknown-fuchsia;riscv64-unknown-fuchsia" CACHE STRING "")
301   set(LLVM_RUNTIME_MULTILIB_hwasan_TARGETS "aarch64-unknown-fuchsia;riscv64-unknown-fuchsia" CACHE STRING "")
302   set(LLVM_RUNTIME_MULTILIB_hwasan+noexcept_TARGETS "aarch64-unknown-fuchsia;riscv64-unknown-fuchsia" CACHE STRING "")
303 endif()
305 foreach(target armv6m-none-eabi;armv7m-none-eabi;armv8m.main-none-eabi;armv8.1m.main-none-eabi)
306   list(APPEND BUILTIN_TARGETS "${target}")
307   set(BUILTINS_${target}_CMAKE_SYSTEM_NAME Generic CACHE STRING "")
308   set(BUILTINS_${target}_CMAKE_SYSTEM_PROCESSOR arm CACHE STRING "")
309   set(BUILTINS_${target}_CMAKE_SYSROOT "" CACHE STRING "")
310   set(BUILTINS_${target}_CMAKE_BUILD_TYPE MinSizeRel CACHE STRING "")
311   foreach(lang C;CXX;ASM)
312     set(BUILTINS_${target}_CMAKE_${lang}_local_flags "--target=${target} -mthumb")
313     if(${target} STREQUAL "armv8m.main-none-eabi")
314       set(BUILTINS_${target}_CMAKE_${lang}_local_flags "${BUILTINS_${target}_CMAKE_${lang}_local_flags} -mfloat-abi=softfp -march=armv8m.main+fp+dsp -mcpu=cortex-m33" CACHE STRING "")
315     endif()
316     if(${target} STREQUAL "armv8.1m.main-none-eabi")
317       set(BUILTINS_${target}_CMAKE_${lang}_local_flags "${BUILTINS_${target}_CMAKE_${lang}_local_flags} -mfloat-abi=hard -march=armv8.1-m.main+mve.fp+fp.dp -mcpu=cortex-m55" CACHE STRING "")
318     endif()
319     set(BUILTINS_${target}_CMAKE_${lang}_FLAGS "${BUILTINS_${target}_CMAKE_${lang}_local_flags}" CACHE STRING "")
320   endforeach()
321   foreach(type SHARED;MODULE;EXE)
322     set(BUILTINS_${target}_CMAKE_${type}_LINKER_FLAGS "-fuse-ld=lld" CACHE STRING "")
323   endforeach()
324   set(BUILTINS_${target}_COMPILER_RT_BAREMETAL_BUILD ON CACHE BOOL "")
326   list(APPEND RUNTIME_TARGETS "${target}")
327   set(RUNTIMES_${target}_CMAKE_SYSTEM_NAME Generic CACHE STRING "")
328   set(RUNTIMES_${target}_CMAKE_SYSTEM_PROCESSOR arm CACHE STRING "")
329   set(RUNTIMES_${target}_CMAKE_SYSROOT "" CACHE STRING "")
330   set(RUNTIMES_${target}_CMAKE_BUILD_TYPE MinSizeRel CACHE STRING "")
331   set(RUNTIMES_${target}_CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY CACHE STRING "")
332   foreach(lang C;CXX;ASM)
333     # TODO: The preprocessor defines workaround various issues in libc and libc++ integration.
334     # These should be addressed and removed over time.
335     set(RUNTIMES_${target}_CMAKE_${lang}_local_flags "--target=${target} -mthumb -Wno-atomic-alignment \"-Dvfprintf(stream, format, vlist)=vprintf(format, vlist)\" \"-Dfprintf(stream, format, ...)=printf(format)\" \"-Dtimeval=struct timeval{int tv_sec; int tv_usec;}\" \"-Dgettimeofday(tv, tz)\" -D_LIBCPP_PRINT=1")
336     if(${target} STREQUAL "armv8m.main-none-eabi")
337       set(RUNTIMES_${target}_CMAKE_${lang}_local_flags "${RUNTIMES_${target}_CMAKE_${lang}_local_flags} -mfloat-abi=softfp -march=armv8m.main+fp+dsp -mcpu=cortex-m33" CACHE STRING "")
338     endif()
339     if(${target} STREQUAL "armv8.1m.main-none-eabi")
340       set(RUNTIMES_${target}_CMAKE_${lang}_local_flags "${RUNTIMES_${target}_CMAKE_${lang}_local_flags} -mfloat-abi=hard -march=armv8.1-m.main+mve.fp+fp.dp -mcpu=cortex-m55" CACHE STRING "")
341     endif()
342     set(RUNTIMES_${target}_CMAKE_${lang}_FLAGS "${RUNTIMES_${target}_CMAKE_${lang}_local_flags}" CACHE STRING "")
343   endforeach()
344   foreach(type SHARED;MODULE;EXE)
345     set(RUNTIMES_${target}_CMAKE_${type}_LINKER_FLAGS "-fuse-ld=lld" CACHE STRING "")
346   endforeach()
347   set(RUNTIMES_${target}_LLVM_LIBC_FULL_BUILD ON CACHE BOOL "")
348   set(RUNTIMES_${target}_LIBC_ENABLE_USE_BY_CLANG ON CACHE BOOL "")
349   set(RUNTIMES_${target}_LIBC_USE_NEW_HEADER_GEN OFF CACHE BOOL "")
350   set(RUNTIMES_${target}_LIBCXX_ABI_VERSION 2 CACHE STRING "")
351   set(RUNTIMES_${target}_LIBCXX_CXX_ABI none CACHE STRING "")
352   set(RUNTIMES_${target}_LIBCXX_ENABLE_SHARED OFF CACHE BOOL "")
353   set(RUNTIMES_${target}_LIBCXX_ENABLE_STATIC ON CACHE BOOL "")
354   set(RUNTIMES_${target}_LIBCXX_SHARED_OUTPUT_NAME "c++-shared" CACHE STRING "")
355   set(RUNTIMES_${target}_LIBCXX_LIBC "llvm-libc" CACHE STRING "")
356   set(RUNTIMES_${target}_LIBCXX_ENABLE_FILESYSTEM OFF CACHE BOOL "")
357   set(RUNTIMES_${target}_LIBCXX_ENABLE_RANDOM_DEVICE OFF CACHE BOOL "")
358   set(RUNTIMES_${target}_LIBCXX_ENABLE_LOCALIZATION OFF CACHE BOOL "")
359   set(RUNTIMES_${target}_LIBCXX_ENABLE_UNICODE OFF CACHE BOOL "")
360   set(RUNTIMES_${target}_LIBCXX_ENABLE_WIDE_CHARACTERS OFF CACHE BOOL "")
361   set(RUNTIMES_${target}_LIBCXX_ENABLE_EXCEPTIONS OFF CACHE BOOL "")
362   set(RUNTIMES_${target}_LIBCXX_ENABLE_RTTI OFF CACHE BOOL "")
363   set(RUNTIMES_${target}_LIBCXX_ENABLE_THREADS OFF CACHE BOOL "")
364   set(RUNTIMES_${target}_LIBCXX_ENABLE_MONOTONIC_CLOCK OFF CACHE BOOL "")
365   set(RUNTIMES_${target}_LIBCXX_USE_COMPILER_RT ON CACHE BOOL "")
366   set(RUNTIMES_${target}_LLVM_INCLUDE_TESTS OFF CACHE BOOL "")
367   set(RUNTIMES_${target}_LLVM_ENABLE_ASSERTIONS OFF CACHE BOOL "")
368   set(RUNTIMES_${target}_LLVM_ENABLE_RUNTIMES "libc;libcxx" CACHE STRING "")
369 endforeach()
371 foreach(target riscv32-unknown-elf)
372   list(APPEND BUILTIN_TARGETS "${target}")
373   set(BUILTINS_${target}_CMAKE_SYSTEM_NAME Generic CACHE STRING "")
374   set(BUILTINS_${target}_CMAKE_SYSTEM_PROCESSOR RISCV CACHE STRING "")
375   set(BUILTINS_${target}_CMAKE_SYSROOT "" CACHE STRING "")
376   set(BUILTINS_${target}_CMAKE_BUILD_TYPE MinSizeRel CACHE STRING "")
377   foreach(lang C;CXX;ASM)
378     set(BUILTINS_${target}_CMAKE_${lang}_FLAGS "--target=${target} -march=rv32imafc -mabi=ilp32f" CACHE STRING "")
379   endforeach()
380   foreach(type SHARED;MODULE;EXE)
381     set(BUILTINS_${target}_CMAKE_${type}_LINKER_FLAGS "-fuse-ld=lld" CACHE STRING "")
382   endforeach()
383   set(BUILTINS_${target}_COMPILER_RT_BAREMETAL_BUILD ON CACHE BOOL "")
385   list(APPEND RUNTIME_TARGETS "${target}")
386   set(RUNTIMES_${target}_CMAKE_SYSTEM_NAME Generic CACHE STRING "")
387   set(RUNTIMES_${target}_CMAKE_SYSTEM_PROCESSOR RISCV CACHE STRING "")
388   set(RUNTIMES_${target}_CMAKE_SYSROOT "" CACHE STRING "")
389   set(RUNTIMES_${target}_CMAKE_BUILD_TYPE MinSizeRel CACHE STRING "")
390   set(RUNTIMES_${target}_CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY CACHE STRING "")
391   foreach(lang C;CXX;ASM)
392     # TODO: The preprocessor defines workaround various issues in libc and libc++ integration.
393     # These should be addressed and removed over time.
394     set(RUNTIMES_${target}_CMAKE_${lang}_FLAGS "--target=${target} -march=rv32imafc -mabi=ilp32f -Wno-atomic-alignment \"-Dvfprintf(stream, format, vlist)=vprintf(format, vlist)\" \"-Dfprintf(stream, format, ...)=printf(format)\" \"-Dtimeval=struct timeval{int tv_sec; int tv_usec;}\" \"-Dgettimeofday(tv, tz)\" -D_LIBCPP_PRINT=1" CACHE STRING "")
395   endforeach()
396   foreach(type SHARED;MODULE;EXE)
397     set(RUNTIMES_${target}_CMAKE_${type}_LINKER_FLAGS "-fuse-ld=lld" CACHE STRING "")
398   endforeach()
399   set(RUNTIMES_${target}_LLVM_LIBC_FULL_BUILD ON CACHE BOOL "")
400   set(RUNTIMES_${target}_LIBC_ENABLE_USE_BY_CLANG ON CACHE BOOL "")
401   set(RUNTIMES_${target}_LIBC_USE_NEW_HEADER_GEN OFF CACHE BOOL "")
402   set(RUNTIMES_${target}_LIBCXX_ABI_VERSION 2 CACHE STRING "")
403   set(RUNTIMES_${target}_LIBCXX_CXX_ABI none CACHE STRING "")
404   set(RUNTIMES_${target}_LIBCXX_ENABLE_SHARED OFF CACHE BOOL "")
405   set(RUNTIMES_${target}_LIBCXX_ENABLE_STATIC ON CACHE BOOL "")
406   set(RUNTIMES_${target}_LIBCXX_SHARED_OUTPUT_NAME "c++-shared" CACHE STRING "")
407   set(RUNTIMES_${target}_LIBCXX_LIBC "llvm-libc" CACHE STRING "")
408   set(RUNTIMES_${target}_LIBCXX_ENABLE_FILESYSTEM OFF CACHE BOOL "")
409   set(RUNTIMES_${target}_LIBCXX_ENABLE_RANDOM_DEVICE OFF CACHE BOOL "")
410   set(RUNTIMES_${target}_LIBCXX_ENABLE_LOCALIZATION OFF CACHE BOOL "")
411   set(RUNTIMES_${target}_LIBCXX_ENABLE_UNICODE OFF CACHE BOOL "")
412   set(RUNTIMES_${target}_LIBCXX_ENABLE_WIDE_CHARACTERS OFF CACHE BOOL "")
413   set(RUNTIMES_${target}_LIBCXX_ENABLE_EXCEPTIONS OFF CACHE BOOL "")
414   set(RUNTIMES_${target}_LIBCXX_ENABLE_RTTI OFF CACHE BOOL "")
415   set(RUNTIMES_${target}_LIBCXX_ENABLE_THREADS OFF CACHE BOOL "")
416   set(RUNTIMES_${target}_LIBCXX_ENABLE_MONOTONIC_CLOCK OFF CACHE BOOL "")
417   set(RUNTIMES_${target}_LIBCXX_USE_COMPILER_RT ON CACHE BOOL "")
418   set(RUNTIMES_${target}_LLVM_INCLUDE_TESTS OFF CACHE BOOL "")
419   set(RUNTIMES_${target}_LLVM_ENABLE_ASSERTIONS OFF CACHE BOOL "")
420   set(RUNTIMES_${target}_LLVM_ENABLE_RUNTIMES "libc;libcxx" CACHE STRING "")
421 endforeach()
423 set(LLVM_BUILTIN_TARGETS "${BUILTIN_TARGETS}" CACHE STRING "")
424 set(LLVM_RUNTIME_TARGETS "${RUNTIME_TARGETS}" CACHE STRING "")
426 # Setup toolchain.
427 set(LLVM_INSTALL_TOOLCHAIN_ONLY ON CACHE BOOL "")
428 set(LLVM_TOOLCHAIN_TOOLS
429   dsymutil
430   llvm-ar
431   llvm-cov
432   llvm-cxxfilt
433   llvm-debuginfod
434   llvm-debuginfod-find
435   llvm-dlltool
436   ${LLVM_DRIVER_TARGET}
437   llvm-dwarfdump
438   llvm-dwp
439   llvm-ifs
440   llvm-gsymutil
441   llvm-lib
442   llvm-libtool-darwin
443   llvm-lipo
444   llvm-ml
445   llvm-mt
446   llvm-nm
447   llvm-objcopy
448   llvm-objdump
449   llvm-otool
450   llvm-pdbutil
451   llvm-profdata
452   llvm-rc
453   llvm-ranlib
454   llvm-readelf
455   llvm-readobj
456   llvm-size
457   llvm-strings
458   llvm-strip
459   llvm-symbolizer
460   llvm-undname
461   llvm-xray
462   opt-viewer
463   sancov
464   scan-build-py
465   CACHE STRING "")
467 set(LLVM_Toolchain_DISTRIBUTION_COMPONENTS
468   bolt
469   clang
470   lld
471   clang-apply-replacements
472   clang-doc
473   clang-format
474   clang-resource-headers
475   clang-include-fixer
476   clang-refactor
477   clang-scan-deps
478   clang-tidy
479   clangd
480   find-all-symbols
481   builtins
482   runtimes
483   ${LLVM_TOOLCHAIN_TOOLS}
484   CACHE STRING "")
486 set(_FUCHSIA_DISTRIBUTIONS Toolchain)
488 if(FUCHSIA_ENABLE_LLDB)
489   list(APPEND _FUCHSIA_ENABLE_PROJECTS lldb)
490   list(APPEND _FUCHSIA_DISTRIBUTIONS Debugger)
491   set(_FUCHSIA_LLDB_COMPONENTS
492     lldb
493     liblldb
494     lldb-server
495     lldb-argdumper
496     lldb-dap
497   )
498   if(LLDB_ENABLE_PYTHON)
499     list(APPEND _FUCHSIA_LLDB_COMPONENTS lldb-python-scripts)
500   endif()
501   set(LLVM_Debugger_DISTRIBUTION_COMPONENTS ${_FUCHSIA_LLDB_COMPONENTS} CACHE STRING "")
502 endif()
504 set(LLVM_DISTRIBUTIONS ${_FUCHSIA_DISTRIBUTIONS} CACHE STRING "")
505 set(LLVM_ENABLE_PROJECTS ${_FUCHSIA_ENABLE_PROJECTS} CACHE STRING "")