diff options
author | Nathan Sidwell <nathan@acm.org> | 2023-04-20 15:22:18 -0400 |
---|---|---|
committer | Nathan Sidwell <nathan@acm.org> | 2023-04-21 13:07:04 -0400 |
commit | f84ac48f1e83d52c476d9df496722394c5393d23 (patch) | |
tree | 98fc94b08a80d1a849b1fe46afda97a5e3b74c84 /bolt/CMakeLists.txt | |
parent | eca7698a979ebc2338c075d63ac52c4c21b19cb1 (diff) | |
download | llvm-f84ac48f1e83d52c476d9df496722394c5393d23.zip llvm-f84ac48f1e83d52c476d9df496722394c5393d23.tar.gz llvm-f84ac48f1e83d52c476d9df496722394c5393d23.tar.bz2 |
[BOLT] Add BOLT_TARGETS_TO_BUILD
Adds BOLT_TARGETS_TO_BUILD, which defaults to the intersection of
X86;AArch64 and LLVM_TARGETS_TO_BUILD, but allows configuration to
alter that -- for instance omitting one of those two targets even if
llvm supports both.
Reviewed By: rafauler
Differential Revision: https://reviews.llvm.org/D148847
Diffstat (limited to 'bolt/CMakeLists.txt')
-rw-r--r-- | bolt/CMakeLists.txt | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/bolt/CMakeLists.txt b/bolt/CMakeLists.txt index 01ed186..875a5cd 100644 --- a/bolt/CMakeLists.txt +++ b/bolt/CMakeLists.txt @@ -4,11 +4,35 @@ set(BOLT_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}) set(BOLT_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}) set(CMAKE_CXX_STANDARD 17) +# Determine default set of targets to build -- the intersection of +# those BOLT supports and those LLVM is targeting. +set(BOLT_TARGETS_TO_BUILD_all "AArch64;X86") +set(BOLT_TARGETS_TO_BUILD_default) +foreach (tgt ${BOLT_TARGETS_TO_BUILD_all}) + if (tgt IN_LIST LLVM_TARGETS_TO_BUILD) + list(APPEND BOLT_TARGETS_TO_BUILD_default ${tgt}) + endif() +endforeach() + +# Allow the user to specify the BOLT targets, and then check that LLVM +# is indeed targeting those. +set(BOLT_TARGETS_TO_BUILD "${BOLT_TARGETS_TO_BUILD_default}" + CACHE STRING "Targets for BOLT to support.") +if (NOT BOLT_TARGETS_TO_BUILD) + message(FATAL_ERROR "BOLT enabled but BOLT_TARGETS_TO_BUILD is empty") +endif() +foreach (tgt ${BOLT_TARGETS_TO_BUILD}) + if (NOT tgt IN_LIST LLVM_TARGETS_TO_BUILD) + message(FATAL_ERROR "BOLT target '${tgt}' is not in LLVM_TARGETS_TO_BUILD") + endif() + message(STATUS "Targeting ${tgt} in llvm-bolt") +endforeach() + set(BOLT_ENABLE_RUNTIME_default OFF) if (CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64" AND (CMAKE_SYSTEM_NAME STREQUAL "Linux" OR CMAKE_SYSTEM_NAME STREQUAL "Darwin") - AND "X86" IN_LIST LLVM_TARGETS_TO_BUILD) + AND "X86" IN_LIST BOLT_TARGETS_TO_BUILD) set(BOLT_ENABLE_RUNTIME_default ON) endif() option(BOLT_ENABLE_RUNTIME "Enable BOLT runtime" ${BOLT_ENABLE_RUNTIME_default}) |