Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / clang / cmake / caches / Fuchsia.cmake
blob9c68be0bfe54b699dfb6b9fa623c7c7475ed60f3
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
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_TERMINFO
37   LLVM_ENABLE_LIBEDIT
38   CURL_ROOT
39   OpenSSL_ROOT
40   httplib_ROOT
41   CursesAndPanel_ROOT
42   Terminfo_ROOT
43   LibEdit_ROOT
44   FUCHSIA_ENABLE_LLDB
45   LLDB_ENABLE_CURSES
46   LLDB_ENABLE_LIBEDIT
47   LLDB_ENABLE_PYTHON
48   LLDB_EMBED_PYTHON_HOME
49   LLDB_PYTHON_HOME
50   LLDB_PYTHON_RELATIVE_PATH
51   Python3_EXECUTABLE
52   Python3_LIBRARIES
53   Python3_INCLUDE_DIRS
54   Python3_RPATH
55   CMAKE_FIND_PACKAGE_PREFER_CONFIG
56   CMAKE_SYSROOT
57   CMAKE_MODULE_LINKER_FLAGS
58   CMAKE_SHARED_LINKER_FLAGS
59   CMAKE_EXE_LINKER_FLAGS
60   LLVM_WINSYSROOT
61   LLVM_VFSOVERLAY
64 foreach(variable ${_FUCHSIA_BOOTSTRAP_PASSTHROUGH})
65   get_property(is_value_set CACHE ${variable} PROPERTY VALUE SET)
66   if(${is_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} "")
70   endif()
71 endforeach()
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 "")
88 if(APPLE)
89   set(CMAKE_OSX_DEPLOYMENT_TARGET "10.13" CACHE STRING "")
90 elseif(WIN32)
91   set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded" CACHE STRING "")
92 endif()
94 if(APPLE)
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 "")
98 endif()
100 if(WIN32)
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 "")
107 else()
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 "")
122 endif()
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 "")
153   endif()
154 endif()
156 set(BOOTSTRAP_LLVM_ENABLE_LLD ON CACHE BOOL "")
157 set(BOOTSTRAP_LLVM_ENABLE_LTO ON CACHE BOOL "")
159 set(_FUCHSIA_BOOTSTRAP_TARGETS
160   check-all
161   check-clang
162   check-lld
163   check-llvm
164   check-polly
165   llvm-config
166   clang-test-depends
167   lld-test-depends
168   llvm-test-depends
169   test-suite
170   test-depends
171   toolchain-distribution
172   install-toolchain-distribution
173   install-toolchain-distribution-stripped
174   install-toolchain-distribution-toolchain
175   clang)
177 if(FUCHSIA_ENABLE_LLDB)
178   list(APPEND _FUCHSIA_ENABLE_PROJECTS lldb)
179   list(APPEND _FUCHSIA_BOOTSTRAP_TARGETS
180     check-lldb
181     lldb-test-depends
182     debugger-distribution
183     install-debugger-distribution
184     install-debugger-distribution-stripped
185     install-debugger-distribution-toolchain)
186 endif()
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}")
197   endif()
198 endforeach()
200 # Setup the bootstrap build.
201 set(CLANG_ENABLE_BOOTSTRAP ON CACHE BOOL "")
202 set(CLANG_BOOTSTRAP_EXTRA_DEPS
203   builtins
204   runtimes
205   CACHE STRING "")
206 set(CLANG_BOOTSTRAP_CMAKE_ARGS
207   ${EXTRA_ARGS}
208   -C ${CMAKE_CURRENT_LIST_DIR}/Fuchsia-stage2.cmake
209   CACHE STRING "")