Skip to content

Commit 0430324

Browse files
committed
[Fuchsia] Add FUCHSIA_USE_MULTIPLE_DISTRIBUTIONS.
This flag causes the toolchain distribution to be built using LLVM CMake's multiple distribution feature. The distribution* family of CMake targets would be replaced with the toolchain-distribution* family. This shouldn't otherwise affect the semantics of the build, but it sets up the ability to split out the LLDB build from the main distribution used by Fuchsia. Reviewed By: phosek Differential Revision: https://reviews.llvm.org/D146665
1 parent 755285f commit 0430324

File tree

2 files changed

+52
-11
lines changed

2 files changed

+52
-11
lines changed

clang/cmake/caches/Fuchsia-stage2.cmake

Lines changed: 26 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
# This file sets up a CMakeCache for the second stage of a Fuchsia toolchain build.
22

3+
option(FUCHSIA_USE_MULTIPLE_DISTRIBUTIONS "Use multiple distributions")
4+
option(FUCHSIA_ENABLE_LLDB "Enable LLDB")
5+
36
set(LLVM_TARGETS_TO_BUILD X86;ARM;AArch64;RISCV CACHE STRING "")
47

58
set(PACKAGE_VENDOR Fuchsia CACHE STRING "")
@@ -326,7 +329,7 @@ set(LLVM_TOOLCHAIN_TOOLS
326329
scan-build-py
327330
CACHE STRING "")
328331

329-
set(_FUCHSIA_DISTRIBUTION_COMPONENTS
332+
set(LLVM_Toolchain_DISTRIBUTION_COMPONENTS
330333
clang
331334
lld
332335
clang-apply-replacements
@@ -341,13 +344,31 @@ set(_FUCHSIA_DISTRIBUTION_COMPONENTS
341344
find-all-symbols
342345
builtins
343346
runtimes
344-
${LLVM_TOOLCHAIN_TOOLS})
347+
${LLVM_TOOLCHAIN_TOOLS}
348+
CACHE STRING "")
349+
350+
if(FUCHSIA_USE_MULTIPLE_DISTRIBUTIONS)
351+
set(_FUCHSIA_DISTRIBUTIONS Toolchain)
352+
else()
353+
set(LLVM_DISTRIBUTION_COMPONENTS ${LLVM_Toolchain_DISTRIBUTION_COMPONENTS} CACHE STRING "")
354+
endif()
345355

346-
set(FUCHSIA_ENABLE_LLDB OFF CACHE BOOL "Enable LLDB")
347356
if(FUCHSIA_ENABLE_LLDB)
357+
if(NOT FUCHSIA_USE_MULTIPLE_DISTRIBUTIONS)
358+
message(FATAL_ERROR "FUCHSIA_ENABLE_LLDB requires FUCHSIA_USE_MULTIPLE_DISTRIBUTIONS.")
359+
endif()
348360
list(APPEND _FUCHSIA_ENABLE_PROJECTS lldb)
349-
list(APPEND _FUCHSIA_DISTRIBUTION_COMPONENTS lldb liblldb lldb-server lldb-argdumper)
361+
list(APPEND _FUCHSIA_DISTRIBUTIONS Debugger)
362+
set(LLVM_Debugger_DISTRIBUTION_COMPONENTS
363+
lldb
364+
liblldb
365+
lldb-server
366+
lldb-argdumper
367+
CACHE STRING "")
368+
endif()
369+
370+
if(FUCHSIA_USE_MULTIPLE_DISTRIBUTIONS)
371+
set(LLVM_DISTRIBUTIONS ${_FUCHSIA_DISTRIBUTIONS} CACHE STRING "")
350372
endif()
351373

352374
set(LLVM_ENABLE_PROJECTS ${_FUCHSIA_ENABLE_PROJECTS} CACHE STRING "")
353-
set(LLVM_DISTRIBUTION_COMPONENTS ${_FUCHSIA_DISTRIBUTION_COMPONENTS} CACHE STRING "")

clang/cmake/caches/Fuchsia.cmake

Lines changed: 26 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
# This file sets up a CMakeCache for a Fuchsia toolchain build.
22

3+
option(FUCHSIA_USE_MULTIPLE_DISTRIBUTIONS "Use multiple distributions")
4+
option(FUCHSIA_ENABLE_LLDB "Enable LLDB")
5+
36
set(LLVM_TARGETS_TO_BUILD X86;ARM;AArch64;RISCV CACHE STRING "")
47

58
set(PACKAGE_VENDOR Fuchsia CACHE STRING "")
@@ -33,6 +36,7 @@ set(_FUCHSIA_BOOTSTRAP_PASSTHROUGH
3336
CURL_ROOT
3437
OpenSSL_ROOT
3538
FUCHSIA_ENABLE_LLDB
39+
FUCHSIA_USE_MULTIPLE_DISTRIBUTIONS
3640
LLDB_ENABLE_CURSES
3741
LLDB_ENABLE_LIBEDIT
3842
CMAKE_FIND_PACKAGE_PREFER_CONFIG
@@ -156,17 +160,33 @@ set(_FUCHSIA_BOOTSTRAP_TARGETS
156160
llvm-test-depends
157161
test-suite
158162
test-depends
159-
distribution
160-
install-distribution
161-
install-distribution-stripped
162-
install-distribution-toolchain
163163
clang)
164164

165-
set(FUCHSIA_ENABLE_LLDB OFF CACHE BOOL "Enable LLDB")
165+
if(FUCHSIA_USE_MULTIPLE_DISTRIBUTIONS)
166+
list(APPEND _FUCHSIA_BOOTSTRAP_TARGETS
167+
toolchain-distribution
168+
install-toolchain-distribution
169+
install-toolchain-distribution-stripped
170+
install-toolchain-distribution-toolchain)
171+
else()
172+
list(APPEND _FUCHSIA_BOOTSTRAP_TARGETS
173+
distribution
174+
install-distribution
175+
install-distribution-stripped
176+
install-distribution-toolchain)
177+
endif()
178+
166179
if(FUCHSIA_ENABLE_LLDB)
167180
list(APPEND _FUCHSIA_ENABLE_PROJECTS lldb)
168-
list(APPEND _FUCHSIA_BOOTSTRAP_TARGETS check-lldb lldb-test-depends)
181+
list(APPEND _FUCHSIA_BOOTSTRAP_TARGETS
182+
check-lldb
183+
lldb-test-depends
184+
debugger-distribution
185+
install-debugger-distribution
186+
install-debugger-distribution-stripped
187+
install-debugger-distribution-toolchain)
169188
endif()
189+
170190
set(LLVM_ENABLE_PROJECTS ${_FUCHSIA_ENABLE_PROJECTS} CACHE STRING "")
171191
set(CLANG_BOOTSTRAP_TARGETS ${_FUCHSIA_BOOTSTRAP_TARGETS} CACHE STRING "")
172192

0 commit comments

Comments
 (0)