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_TERMINFO OFF CACHE BOOL "")
16 set(LLVM_ENABLE_UNWIND_TABLES OFF CACHE BOOL "")
17 set(LLVM_ENABLE_Z3_SOLVER OFF CACHE BOOL "")
18 set(LLVM_ENABLE_ZLIB OFF CACHE BOOL "")
19 set(LLVM_INCLUDE_DOCS OFF CACHE BOOL "")
20 set(LLVM_INCLUDE_EXAMPLES OFF CACHE BOOL "")
21 set(LIBC_HDRGEN_ONLY ON CACHE BOOL "")
22 set(LLVM_USE_RELATIVE_PATHS_IN_FILES ON CACHE BOOL "")
23 set(LLDB_ENABLE_CURSES OFF CACHE BOOL "")
24 set(LLDB_ENABLE_LIBEDIT OFF CACHE BOOL "")
26 # Passthrough stage1 flags to stage1.
27 set(_FUCHSIA_BOOTSTRAP_PASSTHROUGH
65 LLDB_EMBED_PYTHON_HOME
67 LLDB_PYTHON_RELATIVE_PATH
72 CMAKE_FIND_PACKAGE_PREFER_CONFIG
74 CMAKE_MODULE_LINKER_FLAGS
75 CMAKE_SHARED_LINKER_FLAGS
76 CMAKE_EXE_LINKER_FLAGS
81 foreach(variable ${_FUCHSIA_BOOTSTRAP_PASSTHROUGH})
82 get_property(is_value_set CACHE ${variable} PROPERTY VALUE SET)
84 get_property(value CACHE ${variable} PROPERTY VALUE)
85 get_property(type CACHE ${variable} PROPERTY TYPE)
86 set(BOOTSTRAP_${variable} "${value}" CACHE ${type} "")
90 set(CLANG_DEFAULT_CXX_STDLIB libc++ CACHE STRING "")
91 set(CLANG_DEFAULT_LINKER lld CACHE STRING "")
92 set(CLANG_DEFAULT_OBJCOPY llvm-objcopy CACHE STRING "")
93 set(CLANG_DEFAULT_RTLIB compiler-rt CACHE STRING "")
94 set(CLANG_DEFAULT_UNWINDLIB libunwind CACHE STRING "")
95 set(CLANG_ENABLE_ARCMT OFF CACHE BOOL "")
96 set(CLANG_ENABLE_STATIC_ANALYZER OFF CACHE BOOL "")
97 set(CLANG_PLUGIN_SUPPORT OFF CACHE BOOL "")
99 set(ENABLE_LINKER_BUILD_ID ON CACHE BOOL "")
100 set(ENABLE_X86_RELAX_RELOCATIONS ON CACHE BOOL "")
102 set(LLVM_ENABLE_ASSERTIONS ON CACHE BOOL "")
103 set(LLVM_ENABLE_BACKTRACES ON CACHE BOOL "")
104 set(CMAKE_BUILD_TYPE Release CACHE STRING "")
106 set(CMAKE_OSX_DEPLOYMENT_TARGET "10.13" CACHE STRING "")
108 set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded" CACHE STRING "")
112 set(COMPILER_RT_ENABLE_IOS OFF CACHE BOOL "")
113 set(COMPILER_RT_ENABLE_TVOS OFF CACHE BOOL "")
114 set(COMPILER_RT_ENABLE_WATCHOS OFF CACHE BOOL "")
118 set(LIBCXX_ABI_VERSION 2 CACHE STRING "")
119 set(LIBCXX_ENABLE_ABI_LINKER_SCRIPT OFF CACHE BOOL "")
120 set(LIBCXX_ENABLE_SHARED OFF CACHE BOOL "")
121 set(BUILTINS_CMAKE_ARGS -DCMAKE_SYSTEM_NAME=Windows CACHE STRING "")
122 set(RUNTIMES_CMAKE_ARGS -DCMAKE_SYSTEM_NAME=Windows CACHE STRING "")
123 set(LLVM_ENABLE_RUNTIMES "compiler-rt;libcxx" CACHE STRING "")
125 set(LIBUNWIND_ENABLE_SHARED OFF CACHE BOOL "")
126 set(LIBUNWIND_INSTALL_LIBRARY OFF CACHE BOOL "")
127 set(LIBUNWIND_USE_COMPILER_RT ON CACHE BOOL "")
128 set(LIBCXXABI_ENABLE_SHARED OFF CACHE BOOL "")
129 set(LIBCXXABI_ENABLE_STATIC_UNWINDER ON CACHE BOOL "")
130 set(LIBCXXABI_INSTALL_LIBRARY OFF CACHE BOOL "")
131 set(LIBCXXABI_USE_COMPILER_RT ON CACHE BOOL "")
132 set(LIBCXXABI_USE_LLVM_UNWINDER ON CACHE BOOL "")
133 set(LIBCXX_ABI_VERSION 2 CACHE STRING "")
134 set(LIBCXX_ENABLE_SHARED OFF CACHE BOOL "")
135 set(LIBCXX_ENABLE_STATIC_ABI_LIBRARY ON CACHE BOOL "")
136 set(LIBCXX_HARDENING_MODE "none" CACHE STRING "")
137 set(LIBCXX_USE_COMPILER_RT ON CACHE BOOL "")
138 set(LLVM_ENABLE_RUNTIMES "compiler-rt;libcxx;libcxxabi;libunwind" CACHE STRING "")
139 set(RUNTIMES_CMAKE_ARGS "-DCMAKE_OSX_DEPLOYMENT_TARGET=10.13;-DCMAKE_OSX_ARCHITECTURES=arm64|x86_64" CACHE STRING "")
142 if(BOOTSTRAP_CMAKE_SYSTEM_NAME)
143 set(target "${BOOTSTRAP_CMAKE_CXX_COMPILER_TARGET}")
144 if(STAGE2_LINUX_${target}_SYSROOT)
145 set(LLVM_BUILTIN_TARGETS "${target}" CACHE STRING "")
146 set(BUILTINS_${target}_CMAKE_SYSTEM_NAME Linux CACHE STRING "")
147 set(BUILTINS_${target}_CMAKE_BUILD_TYPE Release CACHE STRING "")
148 set(BUILTINS_${target}_CMAKE_SYSROOT ${STAGE2_LINUX_${target}_SYSROOT} CACHE STRING "")
150 set(LLVM_RUNTIME_TARGETS "${target}" CACHE STRING "")
151 set(RUNTIMES_${target}_CMAKE_SYSTEM_NAME Linux CACHE STRING "")
152 set(RUNTIMES_${target}_CMAKE_BUILD_TYPE Release CACHE STRING "")
153 set(RUNTIMES_${target}_CMAKE_SYSROOT ${STAGE2_LINUX_${target}_SYSROOT} CACHE STRING "")
154 set(RUNTIMES_${target}_COMPILER_RT_USE_BUILTINS_LIBRARY ON CACHE BOOL "")
155 set(RUNTIMES_${target}_LIBUNWIND_ENABLE_SHARED OFF CACHE BOOL "")
156 set(RUNTIMES_${target}_LIBUNWIND_USE_COMPILER_RT ON CACHE BOOL "")
157 set(RUNTIMES_${target}_LIBUNWIND_INSTALL_LIBRARY OFF CACHE BOOL "")
158 set(RUNTIMES_${target}_LIBCXXABI_USE_COMPILER_RT ON CACHE BOOL "")
159 set(RUNTIMES_${target}_LIBCXXABI_ENABLE_SHARED OFF CACHE BOOL "")
160 set(RUNTIMES_${target}_LIBCXXABI_USE_LLVM_UNWINDER ON CACHE BOOL "")
161 set(RUNTIMES_${target}_LIBCXXABI_ENABLE_STATIC_UNWINDER ON CACHE BOOL "")
162 set(RUNTIMES_${target}_LIBCXXABI_INSTALL_LIBRARY OFF CACHE BOOL "")
163 set(RUNTIMES_${target}_LIBCXX_USE_COMPILER_RT ON CACHE BOOL "")
164 set(RUNTIMES_${target}_LIBCXX_ENABLE_SHARED OFF CACHE BOOL "")
165 set(RUNTIMES_${target}_LIBCXX_ENABLE_STATIC_ABI_LIBRARY ON CACHE BOOL "")
166 set(RUNTIMES_${target}_LIBCXX_ABI_VERSION 2 CACHE STRING "")
167 set(RUNTIMES_${target}_LLVM_ENABLE_ASSERTIONS OFF CACHE BOOL "")
168 set(RUNTIMES_${target}_LLVM_ENABLE_RUNTIMES "compiler-rt;libcxx;libcxxabi;libunwind" CACHE STRING "")
169 set(RUNTIMES_${target}_SANITIZER_CXX_ABI "libc++" CACHE STRING "")
170 set(RUNTIMES_${target}_SANITIZER_CXX_ABI_INTREE ON CACHE BOOL "")
174 set(BOOTSTRAP_LLVM_ENABLE_LLD ON CACHE BOOL "")
175 set(BOOTSTRAP_LLVM_ENABLE_LTO ON CACHE BOOL "")
177 set(_FUCHSIA_BOOTSTRAP_TARGETS
189 toolchain-distribution
190 install-toolchain-distribution
191 install-toolchain-distribution-stripped
192 install-toolchain-distribution-toolchain
195 if(FUCHSIA_ENABLE_LLDB)
196 list(APPEND _FUCHSIA_ENABLE_PROJECTS lldb)
197 list(APPEND _FUCHSIA_BOOTSTRAP_TARGETS
200 debugger-distribution
201 install-debugger-distribution
202 install-debugger-distribution-stripped
203 install-debugger-distribution-toolchain)
206 set(LLVM_ENABLE_PROJECTS ${_FUCHSIA_ENABLE_PROJECTS} CACHE STRING "")
207 set(CLANG_BOOTSTRAP_TARGETS ${_FUCHSIA_BOOTSTRAP_TARGETS} CACHE STRING "")
209 get_cmake_property(variableNames VARIABLES)
210 foreach(variableName ${variableNames})
211 if(variableName MATCHES "^STAGE2_")
212 string(REPLACE "STAGE2_" "" new_name ${variableName})
213 string(REPLACE ";" "|" value "${${variableName}}")
214 list(APPEND EXTRA_ARGS "-D${new_name}=${value}")
218 # TODO: This is a temporary workaround until we figure out the right solution.
219 set(BOOTSTRAP_LLVM_ENABLE_RUNTIMES "compiler-rt;libcxx;libcxxabi;libunwind" CACHE STRING "")
221 # Setup the bootstrap build.
222 set(CLANG_ENABLE_BOOTSTRAP ON CACHE BOOL "")
223 set(CLANG_BOOTSTRAP_EXTRA_DEPS
227 set(CLANG_BOOTSTRAP_CMAKE_ARGS
229 -C ${CMAKE_CURRENT_LIST_DIR}/Fuchsia-stage2.cmake