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;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(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
48 LLDB_EMBED_PYTHON_HOME
50 LLDB_PYTHON_RELATIVE_PATH
55 CMAKE_FIND_PACKAGE_PREFER_CONFIG
57 CMAKE_MODULE_LINKER_FLAGS
58 CMAKE_SHARED_LINKER_FLAGS
59 CMAKE_EXE_LINKER_FLAGS
64 foreach(variable ${_FUCHSIA_BOOTSTRAP_PASSTHROUGH})
65 get_property(is_value_set CACHE ${variable} PROPERTY VALUE SET)
67 get_property(value CACHE ${variable} PROPERTY VALUE)
68 get_property(type CACHE ${variable} PROPERTY TYPE)
69 set(BOOTSTRAP_${variable} "${value}" CACHE ${type} "")
73 set(CLANG_DEFAULT_CXX_STDLIB libc++ CACHE STRING "")
74 set(CLANG_DEFAULT_LINKER lld CACHE STRING "")
75 set(CLANG_DEFAULT_OBJCOPY llvm-objcopy CACHE STRING "")
76 set(CLANG_DEFAULT_RTLIB compiler-rt CACHE STRING "")
77 set(CLANG_DEFAULT_UNWINDLIB libunwind CACHE STRING "")
78 set(CLANG_ENABLE_ARCMT OFF CACHE BOOL "")
79 set(CLANG_ENABLE_STATIC_ANALYZER OFF CACHE BOOL "")
80 set(CLANG_PLUGIN_SUPPORT OFF CACHE BOOL "")
82 set(ENABLE_LINKER_BUILD_ID ON CACHE BOOL "")
83 set(ENABLE_X86_RELAX_RELOCATIONS ON CACHE BOOL "")
85 set(LLVM_ENABLE_ASSERTIONS ON CACHE BOOL "")
86 set(LLVM_ENABLE_BACKTRACES ON CACHE BOOL "")
87 set(CMAKE_BUILD_TYPE Release CACHE STRING "")
89 set(CMAKE_OSX_DEPLOYMENT_TARGET "10.13" CACHE STRING "")
91 set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded" CACHE STRING "")
95 set(COMPILER_RT_ENABLE_IOS OFF CACHE BOOL "")
96 set(COMPILER_RT_ENABLE_TVOS OFF CACHE BOOL "")
97 set(COMPILER_RT_ENABLE_WATCHOS OFF CACHE BOOL "")
101 set(LIBCXX_ABI_VERSION 2 CACHE STRING "")
102 set(LIBCXX_ENABLE_ABI_LINKER_SCRIPT OFF CACHE BOOL "")
103 set(LIBCXX_ENABLE_SHARED OFF CACHE BOOL "")
104 set(BUILTINS_CMAKE_ARGS -DCMAKE_SYSTEM_NAME=Windows CACHE STRING "")
105 set(RUNTIMES_CMAKE_ARGS -DCMAKE_SYSTEM_NAME=Windows CACHE STRING "")
106 set(LLVM_ENABLE_RUNTIMES "compiler-rt;libcxx" CACHE STRING "")
108 set(LIBUNWIND_ENABLE_SHARED OFF CACHE BOOL "")
109 set(LIBUNWIND_INSTALL_LIBRARY OFF CACHE BOOL "")
110 set(LIBUNWIND_USE_COMPILER_RT ON CACHE BOOL "")
111 set(LIBCXXABI_ENABLE_SHARED OFF CACHE BOOL "")
112 set(LIBCXXABI_ENABLE_STATIC_UNWINDER ON CACHE BOOL "")
113 set(LIBCXXABI_INSTALL_LIBRARY OFF CACHE BOOL "")
114 set(LIBCXXABI_USE_COMPILER_RT ON CACHE BOOL "")
115 set(LIBCXXABI_USE_LLVM_UNWINDER ON CACHE BOOL "")
116 set(LIBCXX_ABI_VERSION 2 CACHE STRING "")
117 set(LIBCXX_ENABLE_SHARED OFF CACHE BOOL "")
118 set(LIBCXX_ENABLE_STATIC_ABI_LIBRARY ON CACHE BOOL "")
119 set(LIBCXX_USE_COMPILER_RT ON CACHE BOOL "")
120 set(LLVM_ENABLE_RUNTIMES "compiler-rt;libcxx;libcxxabi;libunwind" CACHE STRING "")
121 set(RUNTIMES_CMAKE_ARGS "-DCMAKE_OSX_DEPLOYMENT_TARGET=10.13;-DCMAKE_OSX_ARCHITECTURES=arm64|x86_64" CACHE STRING "")
124 if(BOOTSTRAP_CMAKE_SYSTEM_NAME)
125 set(target "${BOOTSTRAP_CMAKE_CXX_COMPILER_TARGET}")
126 if(STAGE2_LINUX_${target}_SYSROOT)
127 set(LLVM_BUILTIN_TARGETS "${target}" CACHE STRING "")
128 set(BUILTINS_${target}_CMAKE_SYSTEM_NAME Linux CACHE STRING "")
129 set(BUILTINS_${target}_CMAKE_BUILD_TYPE Release CACHE STRING "")
130 set(BUILTINS_${target}_CMAKE_SYSROOT ${STAGE2_LINUX_${target}_SYSROOT} CACHE STRING "")
132 set(LLVM_RUNTIME_TARGETS "${target}" CACHE STRING "")
133 set(RUNTIMES_${target}_CMAKE_SYSTEM_NAME Linux CACHE STRING "")
134 set(RUNTIMES_${target}_CMAKE_BUILD_TYPE Release CACHE STRING "")
135 set(RUNTIMES_${target}_CMAKE_SYSROOT ${STAGE2_LINUX_${target}_SYSROOT} CACHE STRING "")
136 set(RUNTIMES_${target}_COMPILER_RT_USE_BUILTINS_LIBRARY ON CACHE BOOL "")
137 set(RUNTIMES_${target}_LIBUNWIND_ENABLE_SHARED OFF CACHE BOOL "")
138 set(RUNTIMES_${target}_LIBUNWIND_USE_COMPILER_RT ON CACHE BOOL "")
139 set(RUNTIMES_${target}_LIBUNWIND_INSTALL_LIBRARY OFF CACHE BOOL "")
140 set(RUNTIMES_${target}_LIBCXXABI_USE_COMPILER_RT ON CACHE BOOL "")
141 set(RUNTIMES_${target}_LIBCXXABI_ENABLE_SHARED OFF CACHE BOOL "")
142 set(RUNTIMES_${target}_LIBCXXABI_USE_LLVM_UNWINDER ON CACHE BOOL "")
143 set(RUNTIMES_${target}_LIBCXXABI_ENABLE_STATIC_UNWINDER ON CACHE BOOL "")
144 set(RUNTIMES_${target}_LIBCXXABI_INSTALL_LIBRARY OFF CACHE BOOL "")
145 set(RUNTIMES_${target}_LIBCXX_USE_COMPILER_RT ON CACHE BOOL "")
146 set(RUNTIMES_${target}_LIBCXX_ENABLE_SHARED OFF CACHE BOOL "")
147 set(RUNTIMES_${target}_LIBCXX_ENABLE_STATIC_ABI_LIBRARY ON CACHE BOOL "")
148 set(RUNTIMES_${target}_LIBCXX_ABI_VERSION 2 CACHE STRING "")
149 set(RUNTIMES_${target}_LLVM_ENABLE_ASSERTIONS OFF CACHE BOOL "")
150 set(RUNTIMES_${target}_LLVM_ENABLE_RUNTIMES "compiler-rt;libcxx;libcxxabi;libunwind" CACHE STRING "")
151 set(RUNTIMES_${target}_SANITIZER_CXX_ABI "libc++" CACHE STRING "")
152 set(RUNTIMES_${target}_SANITIZER_CXX_ABI_INTREE ON CACHE BOOL "")
156 set(BOOTSTRAP_LLVM_ENABLE_LLD ON CACHE BOOL "")
157 set(BOOTSTRAP_LLVM_ENABLE_LTO ON CACHE BOOL "")
159 set(_FUCHSIA_BOOTSTRAP_TARGETS
171 toolchain-distribution
172 install-toolchain-distribution
173 install-toolchain-distribution-stripped
174 install-toolchain-distribution-toolchain
177 if(FUCHSIA_ENABLE_LLDB)
178 list(APPEND _FUCHSIA_ENABLE_PROJECTS lldb)
179 list(APPEND _FUCHSIA_BOOTSTRAP_TARGETS
182 debugger-distribution
183 install-debugger-distribution
184 install-debugger-distribution-stripped
185 install-debugger-distribution-toolchain)
188 set(LLVM_ENABLE_PROJECTS ${_FUCHSIA_ENABLE_PROJECTS} CACHE STRING "")
189 set(CLANG_BOOTSTRAP_TARGETS ${_FUCHSIA_BOOTSTRAP_TARGETS} CACHE STRING "")
191 get_cmake_property(variableNames VARIABLES)
192 foreach(variableName ${variableNames})
193 if(variableName MATCHES "^STAGE2_")
194 string(REPLACE "STAGE2_" "" new_name ${variableName})
195 string(REPLACE ";" "|" value "${${variableName}}")
196 list(APPEND EXTRA_ARGS "-D${new_name}=${value}")
200 # Setup the bootstrap build.
201 set(CLANG_ENABLE_BOOTSTRAP ON CACHE BOOL "")
202 set(CLANG_BOOTSTRAP_EXTRA_DEPS
206 set(CLANG_BOOTSTRAP_CMAKE_ARGS
208 -C ${CMAKE_CURRENT_LIST_DIR}/Fuchsia-stage2.cmake