[Clang][CMake] Set up distribution target for Clang-BOLT

Provide a way to install usable BOLT-optimized Clang
(clang + resource headers) using
`ninja clang-bolt install-distribution` with BOLT.cmake cache file
or `ninja stage2-clang-bolt stage2-install-distribution`
with BOLT-PGO.cmake cache file.

Reviewed By: phosek

Differential Revision: https://reviews.llvm.org/D140565
This commit is contained in:
Amir Ayupov 2023-02-07 15:05:34 -08:00
parent 985f7ff632
commit 42129deaa6
2 changed files with 14 additions and 1 deletions

View File

@ -2,10 +2,16 @@ set(LLVM_ENABLE_PROJECTS "bolt;clang;lld" CACHE STRING "")
set(CLANG_BOOTSTRAP_TARGETS
stage2-clang-bolt
stage2-distribution
stage2-install-distribution
CACHE STRING "")
set(BOOTSTRAP_CLANG_BOOTSTRAP_TARGETS
clang-bolt
distribution
install-distribution
CACHE STRING "")
set(PGO_BUILD_CONFIGURATION ${CMAKE_CURRENT_LIST_DIR}/BOLT.cmake CACHE STRING "")
set(PGO_BUILD_CONFIGURATION
${CMAKE_CURRENT_LIST_DIR}/BOLT.cmake
CACHE STRING "")
include(${CMAKE_CURRENT_LIST_DIR}/PGO.cmake)

View File

@ -8,6 +8,13 @@ set(CLANG_BOLT_INSTRUMENT_EXTRA_CMAKE_FLAGS "" CACHE STRING "")
set(LLVM_ENABLE_PROJECTS "bolt;clang" CACHE STRING "")
set(LLVM_TARGETS_TO_BUILD Native CACHE STRING "")
# setup toolchain
set(LLVM_INSTALL_TOOLCHAIN_ONLY ON CACHE BOOL "")
set(LLVM_DISTRIBUTION_COMPONENTS
clang
clang-resource-headers
CACHE STRING "")
# Disable function splitting enabled by default in GCC8+
if("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fno-reorder-blocks-and-partition")