1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-26 04:32:44 +01:00

build: use clang-cl for runtimes when targeting Windows

When targeting Windows and building a runtime (subproject) prefer to use
`clang-cl` rather than the `clang` driver.  This allows us to cross-compile
runtimes for the Windows environment from Linux.

llvm-svn: 361072
This commit is contained in:
Saleem Abdulrasool 2019-05-17 20:09:06 +00:00
parent a6523f1436
commit 0866c6522b

View File

@ -104,14 +104,29 @@ function(llvm_ExternalProject_Add name source_dir)
endforeach()
endforeach()
foreach(arg ${ARG_CMAKE_ARGS})
if(arg MATCHES "^-DCMAKE_SYSTEM_NAME=")
string(REGEX REPLACE "^-DCMAKE_SYSTEM_NAME=(.*)$" "\\1" _cmake_system_name "${arg}")
endif()
endforeach()
if(ARG_USE_TOOLCHAIN AND NOT CMAKE_CROSSCOMPILING)
if(CLANG_IN_TOOLCHAIN)
if(_cmake_system_name STREQUAL Windows)
set(compiler_args -DCMAKE_C_COMPILER=${LLVM_RUNTIME_OUTPUT_INTDIR}/clang-cl
-DCMAKE_CXX_COMPILER=${LLVM_RUNTIME_OUTPUT_INTDIR}/clang-cl)
else()
set(compiler_args -DCMAKE_C_COMPILER=${LLVM_RUNTIME_OUTPUT_INTDIR}/clang
-DCMAKE_CXX_COMPILER=${LLVM_RUNTIME_OUTPUT_INTDIR}/clang++)
endif()
endif()
if(lld IN_LIST TOOLCHAIN_TOOLS)
if(_cmake_system_name STREQUAL Windows)
list(APPEND compiler_args -DCMAKE_LINKER=${LLVM_RUNTIME_OUTPUT_INTDIR}/lld-link)
else()
list(APPEND compiler_args -DCMAKE_LINKER=${LLVM_RUNTIME_OUTPUT_INTDIR}/ld.lld)
endif()
endif()
if(llvm-ar IN_LIST TOOLCHAIN_TOOLS)
list(APPEND compiler_args -DCMAKE_AR=${LLVM_RUNTIME_OUTPUT_INTDIR}/llvm-ar)
endif()