[llvm] [CMake] Simplify building of bolt-optimized clang for distribution builds (PR #117772)

Tom Stellard via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 26 22:06:29 PST 2024


https://github.com/tstellar updated https://github.com/llvm/llvm-project/pull/117772

>From 99e42cff2ae12cd45d39f1de95c14b89a4f7aa6e Mon Sep 17 00:00:00 2001
From: Tom Stellard <tstellar at redhat.com>
Date: Tue, 26 Nov 2024 14:24:27 +0000
Subject: [PATCH 1/2] [CMake] Simplify building of bolt-optimized clang for
 distribution builds

Currently if you want to do a distribution build (i.e. using
LLVM_DISTIRIBUTION_COMPONENTS) with a bolt-optimized clang, then
you need to pass two separate targets to ninja like this:

ninja -C build clang-bolt distribiution

This patch simplifies this workflow so that you can do a
distribution build with a bolt-optimized build with just a single target:

ninja -C build distribution
---
 llvm/cmake/modules/LLVMDistributionSupport.cmake | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/llvm/cmake/modules/LLVMDistributionSupport.cmake b/llvm/cmake/modules/LLVMDistributionSupport.cmake
index 03c67735702318..a4e341713393f7 100644
--- a/llvm/cmake/modules/LLVMDistributionSupport.cmake
+++ b/llvm/cmake/modules/LLVMDistributionSupport.cmake
@@ -276,6 +276,11 @@ function(llvm_distribution_add_targets)
       # This happens for example if a target is an INTERFACE target.
       if(TARGET ${target})
         add_dependencies(${distribution_target} ${target})
+	# Add a special case for bolt-optimized clang.  This will ensure that the
+	# bolt optimized clang is built with the rest of the distribution.
+	if (target STREQUAL "clang" AND TARGET clang-bolt)
+	  add_dependencies(${distribution_target} clang-bolt)
+	endif()
       endif()
 
       if(TARGET install-${target})

>From ae1ab733b03a533bf933432d12dd736ca48be226 Mon Sep 17 00:00:00 2001
From: Tom Stellard <tstellar at redhat.com>
Date: Wed, 27 Nov 2024 06:00:03 +0000
Subject: [PATCH 2/2] Add clang-bolt dependency to install targets

---
 llvm/cmake/modules/LLVMDistributionSupport.cmake | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/llvm/cmake/modules/LLVMDistributionSupport.cmake b/llvm/cmake/modules/LLVMDistributionSupport.cmake
index a4e341713393f7..fe19db8515e266 100644
--- a/llvm/cmake/modules/LLVMDistributionSupport.cmake
+++ b/llvm/cmake/modules/LLVMDistributionSupport.cmake
@@ -280,6 +280,8 @@ function(llvm_distribution_add_targets)
 	# bolt optimized clang is built with the rest of the distribution.
 	if (target STREQUAL "clang" AND TARGET clang-bolt)
 	  add_dependencies(${distribution_target} clang-bolt)
+	  add_dependencies(install-${distribution_target} clang-bolt)
+	  add_dependencies(install-${distribution_target}-stripped clang-bolt)
 	endif()
       endif()
 



More information about the llvm-commits mailing list