diff options
author | Alex Langford <apl@fb.com> | 2019-01-25 19:38:21 +0000 |
---|---|---|
committer | Alex Langford <apl@fb.com> | 2019-01-25 19:38:21 +0000 |
commit | 165ea58798b2f51180a44ae734d8da8a06abf81a (patch) | |
tree | 411ebd1f1e53e72656d11a9532585355b74c0db6 | |
parent | d849f8fd8f836d727baf5e543c7b3a95e7ba6dc7 (diff) | |
download | bcm5719-llvm-165ea58798b2f51180a44ae734d8da8a06abf81a.tar.gz bcm5719-llvm-165ea58798b2f51180a44ae734d8da8a06abf81a.zip |
[CMake] Use llvm-tblgen from NATIVE LLVM build when cross-compiling
Summary:
When cross-compiling LLDB, we want to use llvm-tblgen built for the
host, not the target.
Reviewers: compnerd, sgraenitz
Subscribers: mgorny, lldb-commits
Differential Revision: https://reviews.llvm.org/D57194
llvm-svn: 352235
-rw-r--r-- | lldb/cmake/modules/LLDBStandalone.cmake | 27 |
1 files changed, 25 insertions, 2 deletions
diff --git a/lldb/cmake/modules/LLDBStandalone.cmake b/lldb/cmake/modules/LLDBStandalone.cmake index 48517a0ed62..25da1b81015 100644 --- a/lldb/cmake/modules/LLDBStandalone.cmake +++ b/lldb/cmake/modules/LLDBStandalone.cmake @@ -25,8 +25,31 @@ if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR) set(LLVM_BINARY_DIR ${LLVM_BUILD_BINARY_DIR} CACHE PATH "Path to LLVM build tree") set(LLVM_EXTERNAL_LIT ${LLVM_TOOLS_BINARY_DIR}/llvm-lit CACHE PATH "Path to llvm-lit") - find_program(LLVM_TABLEGEN_EXE "llvm-tblgen" ${LLVM_TOOLS_BINARY_DIR} - NO_DEFAULT_PATH) + if(CMAKE_CROSSCOMPILING) + set(LLVM_NATIVE_BUILD "${LLDB_PATH_TO_LLVM_BUILD}/NATIVE") + if (NOT EXISTS "${LLVM_NATIVE_BUILD}") + message(FATAL_ERROR + "Attempting to cross-compile LLDB standalone but no native LLVM build + found. Please cross-compile LLVM as well.") + endif() + + if (CMAKE_HOST_SYSTEM_NAME MATCHES "Windows") + set(HOST_EXECUTABLE_SUFFIX ".exe") + endif() + + if (NOT CMAKE_CONFIGURATION_TYPES) + set(LLVM_TABLEGEN_EXE + "${LLVM_NATIVE_BUILD}/bin/llvm-tblgen${HOST_EXECUTABLE_SUFFIX}") + else() + # NOTE: LLVM NATIVE build is always built Release, as is specified in + # CrossCompile.cmake + set(LLVM_TABLEGEN_EXE + "${LLVM_NATIVE_BUILD}/Release/bin/llvm-tblgen${HOST_EXECUTABLE_SUFFIX}") + endif() + else() + find_program(LLVM_TABLEGEN_EXE "llvm-tblgen" ${LLVM_TOOLS_BINARY_DIR} + NO_DEFAULT_PATH) + endif() # They are used as destination of target generators. set(LLVM_RUNTIME_OUTPUT_INTDIR ${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/bin) |