[libc++][Android] BuildKite CI: update Clang and sysroot versions (#116151)
[llvm-project.git] / clang / cmake / caches / Fuchsia.cmake
blob2d2dcb9ae6798d1b83100314f63b2d222d2116a8
1 # This file sets up a CMakeCache for 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")
11 set(LLVM_ENABLE_DIA_SDK OFF CACHE BOOL "")
12 set(LLVM_ENABLE_LIBEDIT OFF CACHE BOOL "")
13 set(LLVM_ENABLE_LIBXML2 OFF CACHE BOOL "")
14 set(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR ON CACHE BOOL "")
15 set(LLVM_ENABLE_UNWIND_TABLES OFF CACHE BOOL "")
16 set(LLVM_ENABLE_Z3_SOLVER OFF CACHE BOOL "")
17 set(LLVM_ENABLE_ZLIB OFF CACHE BOOL "")
18 set(LLVM_INCLUDE_DOCS OFF CACHE BOOL "")
19 set(LLVM_INCLUDE_EXAMPLES OFF CACHE BOOL "")
20 set(LIBC_HDRGEN_ONLY ON CACHE BOOL "")
21 set(LLVM_USE_RELATIVE_PATHS_IN_FILES ON CACHE BOOL "")
22 set(LLDB_ENABLE_CURSES OFF CACHE BOOL "")
23 set(LLDB_ENABLE_LIBEDIT OFF CACHE BOOL "")
25 # Passthrough stage1 flags to stage1.
26 set(_FUCHSIA_BOOTSTRAP_PASSTHROUGH
27   LLVM_ENABLE_ZLIB
28   ZLIB_INCLUDE_DIR
29   ZLIB_LIBRARY
30   LLVM_ENABLE_ZSTD
31   zstd_DIR
32   LLVM_ENABLE_LIBXML2
33   LibXml2_ROOT
34   LLVM_ENABLE_CURL
35   LLVM_ENABLE_HTTPLIB
36   LLVM_ENABLE_LIBEDIT
37   CURL_ROOT
38   OpenSSL_ROOT
39   httplib_ROOT
41   # Deprecated
42   CursesAndPanel_ROOT
44   CURSES_INCLUDE_DIRS
45   CURSES_LIBRARIES
46   PANEL_LIBRARIES
48   # Deprecated
49   LibEdit_ROOT
51   LibEdit_INCLUDE_DIRS
52   LibEdit_LIBRARIES
54   FUCHSIA_ENABLE_LLDB
55   LLDB_ENABLE_CURSES
56   LLDB_ENABLE_LIBEDIT
57   LLDB_ENABLE_PYTHON
58   LLDB_EMBED_PYTHON_HOME
59   LLDB_PYTHON_HOME
60   LLDB_PYTHON_RELATIVE_PATH
61   LLDB_TEST_USER_ARGS
62   Python3_EXECUTABLE
63   Python3_LIBRARIES
64   Python3_INCLUDE_DIRS
65   Python3_RPATH
66   SWIG_DIR
67   SWIG_EXECUTABLE
68   CMAKE_FIND_PACKAGE_PREFER_CONFIG
69   CMAKE_SYSROOT
70   LLVM_WINSYSROOT
71   LLVM_VFSOVERLAY
74 foreach(variable ${_FUCHSIA_BOOTSTRAP_PASSTHROUGH})
75   get_property(is_value_set CACHE ${variable} PROPERTY VALUE SET)
76   if(${is_value_set})
77     get_property(value CACHE ${variable} PROPERTY VALUE)
78     get_property(type CACHE ${variable} PROPERTY TYPE)
79     set(BOOTSTRAP_${variable} "${value}" CACHE ${type} "")
80   endif()
81 endforeach()
83 set(CLANG_DEFAULT_CXX_STDLIB libc++ CACHE STRING "")
84 set(CLANG_DEFAULT_LINKER lld CACHE STRING "")
85 set(CLANG_DEFAULT_OBJCOPY llvm-objcopy CACHE STRING "")
86 set(CLANG_DEFAULT_RTLIB compiler-rt CACHE STRING "")
87 set(CLANG_DEFAULT_UNWINDLIB libunwind CACHE STRING "")
88 set(CLANG_ENABLE_ARCMT OFF CACHE BOOL "")
89 set(CLANG_ENABLE_STATIC_ANALYZER OFF CACHE BOOL "")
90 set(CLANG_PLUGIN_SUPPORT OFF CACHE BOOL "")
92 set(ENABLE_LINKER_BUILD_ID ON CACHE BOOL "")
93 set(ENABLE_X86_RELAX_RELOCATIONS ON CACHE BOOL "")
95 set(LLVM_ENABLE_ASSERTIONS ON CACHE BOOL "")
96 set(LLVM_ENABLE_BACKTRACES ON CACHE BOOL "")
97 set(CMAKE_BUILD_TYPE Release CACHE STRING "")
98 if(APPLE)
99   set(CMAKE_OSX_DEPLOYMENT_TARGET "10.13" CACHE STRING "")
100 elseif(WIN32)
101   set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded" CACHE STRING "")
102 endif()
104 if(APPLE)
105   set(COMPILER_RT_ENABLE_IOS OFF CACHE BOOL "")
106   set(COMPILER_RT_ENABLE_TVOS OFF CACHE BOOL "")
107   set(COMPILER_RT_ENABLE_WATCHOS OFF CACHE BOOL "")
108 endif()
110 if(WIN32)
111   set(LIBCXX_ABI_VERSION 2 CACHE STRING "")
112   set(LIBCXX_ENABLE_ABI_LINKER_SCRIPT OFF CACHE BOOL "")
113   set(LIBCXX_ENABLE_SHARED OFF CACHE BOOL "")
114   set(BUILTINS_CMAKE_ARGS -DCMAKE_SYSTEM_NAME=Windows CACHE STRING "")
115   set(RUNTIMES_CMAKE_ARGS -DCMAKE_SYSTEM_NAME=Windows CACHE STRING "")
116   set(LLVM_ENABLE_RUNTIMES "compiler-rt;libcxx" CACHE STRING "")
117 else()
118   set(LIBUNWIND_ENABLE_SHARED OFF CACHE BOOL "")
119   set(LIBUNWIND_INSTALL_LIBRARY OFF CACHE BOOL "")
120   set(LIBUNWIND_USE_COMPILER_RT ON CACHE BOOL "")
121   set(LIBCXXABI_ENABLE_SHARED OFF CACHE BOOL "")
122   set(LIBCXXABI_ENABLE_STATIC_UNWINDER ON CACHE BOOL "")
123   set(LIBCXXABI_INSTALL_LIBRARY OFF CACHE BOOL "")
124   set(LIBCXXABI_USE_COMPILER_RT ON CACHE BOOL "")
125   set(LIBCXXABI_USE_LLVM_UNWINDER ON CACHE BOOL "")
126   set(LIBCXX_ABI_VERSION 2 CACHE STRING "")
127   set(LIBCXX_ENABLE_SHARED OFF CACHE BOOL "")
128   set(LIBCXX_ENABLE_STATIC_ABI_LIBRARY ON CACHE BOOL "")
129   set(LIBCXX_HARDENING_MODE "none" CACHE STRING "")
130   set(LIBCXX_USE_COMPILER_RT ON CACHE BOOL "")
131   set(LLVM_ENABLE_RUNTIMES "compiler-rt;libcxx;libcxxabi;libunwind" CACHE STRING "")
132   set(RUNTIMES_CMAKE_ARGS "-DCMAKE_OSX_DEPLOYMENT_TARGET=10.13;-DCMAKE_OSX_ARCHITECTURES=arm64|x86_64" CACHE STRING "")
133 endif()
135 if(BOOTSTRAP_CMAKE_SYSTEM_NAME)
136   set(target "${BOOTSTRAP_CMAKE_CXX_COMPILER_TARGET}")
137   if(STAGE2_LINUX_${target}_SYSROOT)
138     set(LLVM_BUILTIN_TARGETS "${target}" CACHE STRING "")
139     set(BUILTINS_${target}_CMAKE_SYSTEM_NAME Linux CACHE STRING "")
140     set(BUILTINS_${target}_CMAKE_BUILD_TYPE Release CACHE STRING "")
141     set(BUILTINS_${target}_CMAKE_SYSROOT ${STAGE2_LINUX_${target}_SYSROOT} CACHE STRING "")
143     set(LLVM_RUNTIME_TARGETS "${target}" CACHE STRING "")
144     set(RUNTIMES_${target}_CMAKE_SYSTEM_NAME Linux CACHE STRING "")
145     set(RUNTIMES_${target}_CMAKE_BUILD_TYPE Release CACHE STRING "")
146     set(RUNTIMES_${target}_CMAKE_SYSROOT ${STAGE2_LINUX_${target}_SYSROOT} CACHE STRING "")
147     set(RUNTIMES_${target}_COMPILER_RT_USE_BUILTINS_LIBRARY ON CACHE BOOL "")
148     set(RUNTIMES_${target}_LIBUNWIND_ENABLE_SHARED OFF CACHE BOOL "")
149     set(RUNTIMES_${target}_LIBUNWIND_USE_COMPILER_RT ON CACHE BOOL "")
150     set(RUNTIMES_${target}_LIBUNWIND_INSTALL_LIBRARY OFF CACHE BOOL "")
151     set(RUNTIMES_${target}_LIBCXXABI_USE_COMPILER_RT ON CACHE BOOL "")
152     set(RUNTIMES_${target}_LIBCXXABI_ENABLE_SHARED OFF CACHE BOOL "")
153     set(RUNTIMES_${target}_LIBCXXABI_USE_LLVM_UNWINDER ON CACHE BOOL "")
154     set(RUNTIMES_${target}_LIBCXXABI_ENABLE_STATIC_UNWINDER ON CACHE BOOL "")
155     set(RUNTIMES_${target}_LIBCXXABI_INSTALL_LIBRARY OFF CACHE BOOL "")
156     set(RUNTIMES_${target}_LIBCXX_USE_COMPILER_RT ON CACHE BOOL "")
157     set(RUNTIMES_${target}_LIBCXX_ENABLE_SHARED OFF CACHE BOOL "")
158     set(RUNTIMES_${target}_LIBCXX_ENABLE_STATIC_ABI_LIBRARY ON CACHE BOOL "")
159     set(RUNTIMES_${target}_LIBCXX_ABI_VERSION 2 CACHE STRING "")
160     set(RUNTIMES_${target}_LLVM_ENABLE_ASSERTIONS OFF CACHE BOOL "")
161     set(RUNTIMES_${target}_LLVM_ENABLE_RUNTIMES "compiler-rt;libcxx;libcxxabi;libunwind" CACHE STRING "")
162     set(RUNTIMES_${target}_SANITIZER_CXX_ABI "libc++" CACHE STRING "")
163     set(RUNTIMES_${target}_SANITIZER_CXX_ABI_INTREE ON CACHE BOOL "")
164   endif()
165 endif()
167 set(BOOTSTRAP_LLVM_ENABLE_LLD ON CACHE BOOL "")
168 set(BOOTSTRAP_LLVM_ENABLE_LTO ON CACHE BOOL "")
170 set(_FUCHSIA_BOOTSTRAP_TARGETS
171   check-all
172   check-clang
173   check-lld
174   check-llvm
175   check-polly
176   llvm-config
177   clang-test-depends
178   lld-test-depends
179   llvm-test-depends
180   test-suite
181   test-depends
182   toolchain-distribution
183   install-toolchain-distribution
184   install-toolchain-distribution-stripped
185   install-toolchain-distribution-toolchain
186   clang)
188 if(FUCHSIA_ENABLE_LLDB)
189   list(APPEND _FUCHSIA_ENABLE_PROJECTS lldb)
190   list(APPEND _FUCHSIA_BOOTSTRAP_TARGETS
191     check-lldb
192     lldb-test-depends
193     debugger-distribution
194     install-debugger-distribution
195     install-debugger-distribution-stripped
196     install-debugger-distribution-toolchain)
197 endif()
199 set(LLVM_ENABLE_PROJECTS ${_FUCHSIA_ENABLE_PROJECTS} CACHE STRING "")
200 set(CLANG_BOOTSTRAP_TARGETS ${_FUCHSIA_BOOTSTRAP_TARGETS} CACHE STRING "")
202 get_cmake_property(variableNames VARIABLES)
203 foreach(variableName ${variableNames})
204   if(variableName MATCHES "^STAGE2_")
205     string(REPLACE "STAGE2_" "" new_name ${variableName})
206     string(REPLACE ";" "|" value "${${variableName}}")
207     list(APPEND EXTRA_ARGS "-D${new_name}=${value}")
208   endif()
209 endforeach()
211 # TODO: This is a temporary workaround until we figure out the right solution.
212 set(BOOTSTRAP_LLVM_ENABLE_RUNTIMES "compiler-rt;libcxx;libcxxabi;libunwind" CACHE STRING "")
214 # Setup the bootstrap build.
215 set(CLANG_ENABLE_BOOTSTRAP ON CACHE BOOL "")
216 set(CLANG_BOOTSTRAP_EXTRA_DEPS
217   builtins
218   runtimes
219   CACHE STRING "")
220 set(CLANG_BOOTSTRAP_CMAKE_ARGS
221   ${EXTRA_ARGS}
222   -C ${CMAKE_CURRENT_LIST_DIR}/Fuchsia-stage2.cmake
223   CACHE STRING "")