[PATCH] D85562: [clang] Allow cross-compiling in standalone builds

Isuru Fernando via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Aug 7 15:46:12 PDT 2020


isuruf created this revision.
Herald added subscribers: cfe-commits, mgorny.
Herald added a project: clang.
isuruf requested review of this revision.

Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D85562

Files:
  clang/CMakeLists.txt


Index: clang/CMakeLists.txt
===================================================================
--- clang/CMakeLists.txt
+++ clang/CMakeLists.txt
@@ -115,6 +115,16 @@
   option(LLVM_ENABLE_LIBXML2 "Use libxml2 if available." ON)
 
   include(AddLLVM)
+  if(CMAKE_CROSSCOMPILING)
+    set(LLVM_USE_HOST_TOOLS ON)
+    include(CrossCompile)
+    if (NOT NATIVE_LLVM_DIR)
+      message(FATAL_ERROR
+       "Crosscompiling standalone requires the variable NATIVE_LLVM_DIR
+       for building the native clang-tblgen used during the build process.")
+    endif()
+    llvm_create_cross_target(Clang NATIVE "" Release -DLLVM_DIR=${NATIVE_LLVM_DIR})
+  endif()
   include(TableGen)
   include(HandleLLVMOptions)
   include(VersionFromVCS)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D85562.284075.patch
Type: text/x-patch
Size: 734 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200807/34225073/attachment.bin>


More information about the cfe-commits mailing list