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
58 LLDB_EMBED_PYTHON_HOME
60 LLDB_PYTHON_RELATIVE_PATH
68 CMAKE_FIND_PACKAGE_PREFER_CONFIG
74 foreach(variable ${_FUCHSIA_BOOTSTRAP_PASSTHROUGH})
75 get_property(is_value_set CACHE ${variable} PROPERTY 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} "")
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 "")
99 set(CMAKE_OSX_DEPLOYMENT_TARGET "10.13" CACHE STRING "")
101 set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded" CACHE STRING "")
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 "")
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 "")
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 "")
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 "")
167 set(BOOTSTRAP_LLVM_ENABLE_LLD ON CACHE BOOL "")
168 set(BOOTSTRAP_LLVM_ENABLE_LTO ON CACHE BOOL "")
170 set(_FUCHSIA_BOOTSTRAP_TARGETS
182 toolchain-distribution
183 install-toolchain-distribution
184 install-toolchain-distribution-stripped
185 install-toolchain-distribution-toolchain
188 if(FUCHSIA_ENABLE_LLDB)
189 list(APPEND _FUCHSIA_ENABLE_PROJECTS lldb)
190 list(APPEND _FUCHSIA_BOOTSTRAP_TARGETS
193 debugger-distribution
194 install-debugger-distribution
195 install-debugger-distribution-stripped
196 install-debugger-distribution-toolchain)
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}")
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
220 set(CLANG_BOOTSTRAP_CMAKE_ARGS
222 -C ${CMAKE_CURRENT_LIST_DIR}/Fuchsia-stage2.cmake