1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2025-01-31 12:41:49 +01:00

Fix CMake LLVM_TARGETS_TO_BUILD "Native" option to work with JIT

LLVM_TARGETS_TO_BUILD accepts both "host" or "Native" for auto-selecting
the target from the environment. However the way "Native" was plumbed
would lead to the JIT environment being disabled. This patch is making
"Native" works just as "host".

Reviewed By: rnk

Differential Revision: https://reviews.llvm.org/D95837
This commit is contained in:
Mehdi Amini 2021-02-02 18:47:10 +00:00
parent 50cb792dae
commit 63a3fb08ab
2 changed files with 9 additions and 11 deletions

View File

@ -669,10 +669,6 @@ set(LLVM_PROFDATA_FILE "" CACHE FILEPATH
# first cmake run
include(config-ix)
string(REPLACE "Native" ${LLVM_NATIVE_ARCH}
LLVM_TARGETS_TO_BUILD "${LLVM_TARGETS_TO_BUILD}")
list(REMOVE_DUPLICATES LLVM_TARGETS_TO_BUILD)
# By default, we target the host, but this can be overridden at CMake
# invocation time.
set(LLVM_DEFAULT_TARGET_TRIPLE "${LLVM_HOST_TRIPLE}" CACHE STRING

View File

@ -453,13 +453,15 @@ else ()
message(FATAL_ERROR "Unknown architecture ${LLVM_NATIVE_ARCH}")
endif ()
# If build targets includes "host", then replace with native architecture.
list(FIND LLVM_TARGETS_TO_BUILD "host" idx)
if( NOT idx LESS 0 )
list(REMOVE_AT LLVM_TARGETS_TO_BUILD ${idx})
list(APPEND LLVM_TARGETS_TO_BUILD ${LLVM_NATIVE_ARCH})
list(REMOVE_DUPLICATES LLVM_TARGETS_TO_BUILD)
endif()
# If build targets includes "host" or "Native", then replace with native architecture.
foreach (NATIVE_KEYWORD host Native)
list(FIND LLVM_TARGETS_TO_BUILD ${NATIVE_KEYWORD} idx)
if( NOT idx LESS 0 )
list(REMOVE_AT LLVM_TARGETS_TO_BUILD ${idx})
list(APPEND LLVM_TARGETS_TO_BUILD ${LLVM_NATIVE_ARCH})
list(REMOVE_DUPLICATES LLVM_TARGETS_TO_BUILD)
endif()
endforeach()
list(FIND LLVM_TARGETS_TO_BUILD ${LLVM_NATIVE_ARCH} NATIVE_ARCH_IDX)
if (NATIVE_ARCH_IDX EQUAL -1)