[clang] 0430324 - [Fuchsia] Add FUCHSIA_USE_MULTIPLE_DISTRIBUTIONS.

Daniel Thornburgh via cfe-commits cfe-commits at lists.llvm.org
Fri Mar 24 16:05:05 PDT 2023


Author: Daniel Thornburgh
Date: 2023-03-24T16:04:59-07:00
New Revision: 0430324289f2f0206a03a124b86eece8d007b09e

URL: https://github.com/llvm/llvm-project/commit/0430324289f2f0206a03a124b86eece8d007b09e
DIFF: https://github.com/llvm/llvm-project/commit/0430324289f2f0206a03a124b86eece8d007b09e.diff

LOG: [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

Added: 
    

Modified: 
    clang/cmake/caches/Fuchsia-stage2.cmake
    clang/cmake/caches/Fuchsia.cmake

Removed: 
    


################################################################################
diff  --git a/clang/cmake/caches/Fuchsia-stage2.cmake b/clang/cmake/caches/Fuchsia-stage2.cmake
index 037cb67e82189..b3fa2b941a54c 100644
--- a/clang/cmake/caches/Fuchsia-stage2.cmake
+++ b/clang/cmake/caches/Fuchsia-stage2.cmake
@@ -1,5 +1,8 @@
 # This file sets up a CMakeCache for the second stage of a Fuchsia toolchain build.
 
+option(FUCHSIA_USE_MULTIPLE_DISTRIBUTIONS "Use multiple distributions")
+option(FUCHSIA_ENABLE_LLDB "Enable LLDB")
+
 set(LLVM_TARGETS_TO_BUILD X86;ARM;AArch64;RISCV CACHE STRING "")
 
 set(PACKAGE_VENDOR Fuchsia CACHE STRING "")
@@ -326,7 +329,7 @@ set(LLVM_TOOLCHAIN_TOOLS
   scan-build-py
   CACHE STRING "")
 
-set(_FUCHSIA_DISTRIBUTION_COMPONENTS
+set(LLVM_Toolchain_DISTRIBUTION_COMPONENTS
   clang
   lld
   clang-apply-replacements
@@ -341,13 +344,31 @@ set(_FUCHSIA_DISTRIBUTION_COMPONENTS
   find-all-symbols
   builtins
   runtimes
-  ${LLVM_TOOLCHAIN_TOOLS})
+  ${LLVM_TOOLCHAIN_TOOLS}
+  CACHE STRING "")
+
+if(FUCHSIA_USE_MULTIPLE_DISTRIBUTIONS)
+  set(_FUCHSIA_DISTRIBUTIONS Toolchain)
+else()
+  set(LLVM_DISTRIBUTION_COMPONENTS ${LLVM_Toolchain_DISTRIBUTION_COMPONENTS} CACHE STRING "")
+endif()
 
-set(FUCHSIA_ENABLE_LLDB OFF CACHE BOOL "Enable LLDB")
 if(FUCHSIA_ENABLE_LLDB)
+  if(NOT FUCHSIA_USE_MULTIPLE_DISTRIBUTIONS)
+    message(FATAL_ERROR "FUCHSIA_ENABLE_LLDB requires FUCHSIA_USE_MULTIPLE_DISTRIBUTIONS.")
+  endif()
   list(APPEND _FUCHSIA_ENABLE_PROJECTS lldb)
-  list(APPEND _FUCHSIA_DISTRIBUTION_COMPONENTS lldb liblldb lldb-server lldb-argdumper)
+  list(APPEND _FUCHSIA_DISTRIBUTIONS Debugger)
+  set(LLVM_Debugger_DISTRIBUTION_COMPONENTS
+    lldb
+    liblldb
+    lldb-server
+    lldb-argdumper
+    CACHE STRING "")
+endif()
+
+if(FUCHSIA_USE_MULTIPLE_DISTRIBUTIONS)
+  set(LLVM_DISTRIBUTIONS ${_FUCHSIA_DISTRIBUTIONS} CACHE STRING "")
 endif()
 
 set(LLVM_ENABLE_PROJECTS ${_FUCHSIA_ENABLE_PROJECTS} CACHE STRING "")
-set(LLVM_DISTRIBUTION_COMPONENTS ${_FUCHSIA_DISTRIBUTION_COMPONENTS} CACHE STRING "")

diff  --git a/clang/cmake/caches/Fuchsia.cmake b/clang/cmake/caches/Fuchsia.cmake
index 03b96dde7fe86..40c2a2af71edd 100644
--- a/clang/cmake/caches/Fuchsia.cmake
+++ b/clang/cmake/caches/Fuchsia.cmake
@@ -1,5 +1,8 @@
 # This file sets up a CMakeCache for a Fuchsia toolchain build.
 
+option(FUCHSIA_USE_MULTIPLE_DISTRIBUTIONS "Use multiple distributions")
+option(FUCHSIA_ENABLE_LLDB "Enable LLDB")
+
 set(LLVM_TARGETS_TO_BUILD X86;ARM;AArch64;RISCV CACHE STRING "")
 
 set(PACKAGE_VENDOR Fuchsia CACHE STRING "")
@@ -33,6 +36,7 @@ set(_FUCHSIA_BOOTSTRAP_PASSTHROUGH
   CURL_ROOT
   OpenSSL_ROOT
   FUCHSIA_ENABLE_LLDB
+  FUCHSIA_USE_MULTIPLE_DISTRIBUTIONS
   LLDB_ENABLE_CURSES
   LLDB_ENABLE_LIBEDIT
   CMAKE_FIND_PACKAGE_PREFER_CONFIG
@@ -156,17 +160,33 @@ set(_FUCHSIA_BOOTSTRAP_TARGETS
   llvm-test-depends
   test-suite
   test-depends
-  distribution
-  install-distribution
-  install-distribution-stripped
-  install-distribution-toolchain
   clang)
 
-set(FUCHSIA_ENABLE_LLDB OFF CACHE BOOL "Enable LLDB")
+if(FUCHSIA_USE_MULTIPLE_DISTRIBUTIONS)
+  list(APPEND _FUCHSIA_BOOTSTRAP_TARGETS
+    toolchain-distribution
+    install-toolchain-distribution
+    install-toolchain-distribution-stripped
+    install-toolchain-distribution-toolchain)
+else()
+  list(APPEND _FUCHSIA_BOOTSTRAP_TARGETS
+    distribution
+    install-distribution
+    install-distribution-stripped
+    install-distribution-toolchain)
+endif()
+
 if(FUCHSIA_ENABLE_LLDB)
   list(APPEND _FUCHSIA_ENABLE_PROJECTS lldb)
-  list(APPEND _FUCHSIA_BOOTSTRAP_TARGETS check-lldb lldb-test-depends)
+  list(APPEND _FUCHSIA_BOOTSTRAP_TARGETS
+    check-lldb
+    lldb-test-depends
+    debugger-distribution
+    install-debugger-distribution
+    install-debugger-distribution-stripped
+    install-debugger-distribution-toolchain)
 endif()
+
 set(LLVM_ENABLE_PROJECTS ${_FUCHSIA_ENABLE_PROJECTS} CACHE STRING "")
 set(CLANG_BOOTSTRAP_TARGETS ${_FUCHSIA_BOOTSTRAP_TARGETS} CACHE STRING "")
 


        


More information about the cfe-commits mailing list