[llvm] 10a7289 - [runtimes] Fix crosscompiling after a7cad6680b4087eff8994f1f99ac40c661a6621f (D97451)

Raul Tambre via llvm-commits llvm-commits at lists.llvm.org
Sat Mar 6 01:35:18 PST 2021


Author: Raul Tambre
Date: 2021-03-06T11:35:14+02:00
New Revision: 10a7289649cfb0352f2222286920d26da22c625f

URL: https://github.com/llvm/llvm-project/commit/10a7289649cfb0352f2222286920d26da22c625f
DIFF: https://github.com/llvm/llvm-project/commit/10a7289649cfb0352f2222286920d26da22c625f.diff

LOG: [runtimes] Fix crosscompiling after a7cad6680b4087eff8994f1f99ac40c661a6621f (D97451)

It moved the logic for CMake target arguments into llvm_ExternalProject_Add().
No handling was added for CMAKE_CROSSCOMPILING, which has a separate set of compiler_args.
This broke crosscompiling, as now the runtimes builds defaulted to the compiler's default.

I've also added passing of CMAKE_ASM_COMPILER, which was missing before although we were passing the triple for it.

Reviewed By: zero9178

Differential Revision: https://reviews.llvm.org/D97855

Added: 
    

Modified: 
    llvm/cmake/modules/LLVMExternalProjectUtils.cmake

Removed: 
    


################################################################################
diff  --git a/llvm/cmake/modules/LLVMExternalProjectUtils.cmake b/llvm/cmake/modules/LLVMExternalProjectUtils.cmake
index 4a53dca47bb1..7c91150ba725 100644
--- a/llvm/cmake/modules/LLVMExternalProjectUtils.cmake
+++ b/llvm/cmake/modules/LLVMExternalProjectUtils.cmake
@@ -211,12 +211,6 @@ function(llvm_ExternalProject_Add name source_dir)
     list(APPEND compiler_args -DCMAKE_STRIP=${ARG_STRIP_TOOL})
   endif()
 
-  if (ARG_TARGET_TRIPLE)
-    list(APPEND compiler_args -DCMAKE_C_COMPILER_TARGET=${ARG_TARGET_TRIPLE})
-    list(APPEND compiler_args -DCMAKE_CXX_COMPILER_TARGET=${ARG_TARGET_TRIPLE})
-    list(APPEND compiler_args -DCMAKE_ASM_COMPILER_TARGET=${ARG_TARGET_TRIPLE})
-  endif()
-
   add_custom_command(
     OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${name}-clobber-stamp
     DEPENDS ${ARG_DEPENDS}
@@ -238,7 +232,8 @@ function(llvm_ExternalProject_Add name source_dir)
   endif()
 
   if(CMAKE_CROSSCOMPILING)
-    set(compiler_args -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
+    set(compiler_args -DCMAKE_ASM_COMPILER=${CMAKE_ASM_COMPILER}
+                      -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
                       -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}
                       -DCMAKE_LINKER=${CMAKE_LINKER}
                       -DCMAKE_AR=${CMAKE_AR}
@@ -279,6 +274,12 @@ function(llvm_ExternalProject_Add name source_dir)
     set(cmake_args ${ARG_CMAKE_ARGS})
   endif()
 
+  if(ARG_TARGET_TRIPLE)
+    list(APPEND compiler_args -DCMAKE_C_COMPILER_TARGET=${ARG_TARGET_TRIPLE})
+    list(APPEND compiler_args -DCMAKE_CXX_COMPILER_TARGET=${ARG_TARGET_TRIPLE})
+    list(APPEND compiler_args -DCMAKE_ASM_COMPILER_TARGET=${ARG_TARGET_TRIPLE})
+  endif()
+
   ExternalProject_Add(${name}
     DEPENDS ${ARG_DEPENDS} llvm-config
     ${name}-clobber


        


More information about the llvm-commits mailing list