]> granicus.if.org Git - clang/commitdiff
[CMake] Support cross-compiling with Fuchsia toolchain build
authorPetr Hosek <phosek@chromium.org>
Fri, 16 Nov 2018 04:50:12 +0000 (04:50 +0000)
committerPetr Hosek <phosek@chromium.org>
Fri, 16 Nov 2018 04:50:12 +0000 (04:50 +0000)
When second stage is being cross-compiled for a different platform
we need to build enough of first stage runtimes to get a working
compiler.

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@347026 91177308-0d34-0410-b5e6-96231b3b80d8

cmake/caches/Fuchsia.cmake

index fc7dae8499355fb78cbaa1710be77d63c57df79c..53fff24d8c02f431059702f729008c9155efb4c9 100644 (file)
@@ -1,6 +1,6 @@
 # This file sets up a CMakeCache for a Fuchsia toolchain build.
 
-set(LLVM_TARGETS_TO_BUILD Native CACHE STRING "")
+set(LLVM_TARGETS_TO_BUILD X86;ARM;AArch64 CACHE STRING "")
 
 set(PACKAGE_VENDOR Fuchsia CACHE STRING "")
 
@@ -43,6 +43,37 @@ elseif(UNIX)
   set(LIBCXX_ENABLE_STATIC_ABI_LIBRARY ON CACHE BOOL "")
 endif()
 
+if(BOOTSTRAP_CMAKE_SYSTEM_NAME)
+  set(target "${BOOTSTRAP_CMAKE_CXX_COMPILER_TARGET}")
+  if(STAGE2_LINUX_${target}_SYSROOT)
+    set(BUILTINS_${target}_CMAKE_SYSTEM_NAME Linux CACHE STRING "")
+    set(BUILTINS_${target}_CMAKE_BUILD_TYPE Release CACHE STRING "")
+    set(BUILTINS_${target}_CMAKE_SYSROOT ${STAGE2_LINUX_${target}_SYSROOT} CACHE STRING "")
+    set(LLVM_BUILTIN_TARGETS "${target}" CACHE STRING "")
+
+    set(RUNTIMES_${target}_CMAKE_SYSTEM_NAME Linux CACHE STRING "")
+    set(RUNTIMES_${target}_CMAKE_BUILD_TYPE Release CACHE STRING "")
+    set(RUNTIMES_${target}_CMAKE_SYSROOT ${STAGE2_LINUX_${target}_SYSROOT} CACHE STRING "")
+    set(RUNTIMES_${target}_LLVM_ENABLE_ASSERTIONS ON CACHE BOOL "")
+    set(RUNTIMES_${target}_LIBUNWIND_ENABLE_SHARED OFF CACHE BOOL "")
+    set(RUNTIMES_${target}_LIBUNWIND_USE_COMPILER_RT ON CACHE BOOL "")
+    set(RUNTIMES_${target}_LIBUNWIND_INSTALL_LIBRARY OFF CACHE BOOL "")
+    set(RUNTIMES_${target}_LIBCXXABI_USE_COMPILER_RT ON CACHE BOOL "")
+    set(RUNTIMES_${target}_LIBCXXABI_ENABLE_SHARED OFF CACHE BOOL "")
+    set(RUNTIMES_${target}_LIBCXXABI_USE_LLVM_UNWINDER ON CACHE BOOL "")
+    set(RUNTIMES_${target}_LIBCXXABI_ENABLE_STATIC_UNWINDER ON CACHE BOOL "")
+    set(RUNTIMES_${target}_LIBCXXABI_INSTALL_LIBRARY OFF CACHE BOOL "")
+    set(RUNTIMES_${target}_LIBCXX_USE_COMPILER_RT ON CACHE BOOL "")
+    set(RUNTIMES_${target}_LIBCXX_ENABLE_SHARED OFF CACHE BOOL "")
+    set(RUNTIMES_${target}_LIBCXX_ENABLE_STATIC_ABI_LIBRARY ON CACHE BOOL "")
+    set(RUNTIMES_${target}_LIBCXX_ABI_VERSION 2 CACHE STRING "")
+    set(RUNTIMES_${target}_SANITIZER_CXX_ABI "libc++" CACHE STRING "")
+    set(RUNTIMES_${target}_SANITIZER_CXX_ABI_INTREE ON CACHE BOOL "")
+    set(RUNTIMES_${target}_COMPILER_RT_USE_BUILTINS_LIBRARY ON CACHE BOOL "")
+    set(LLVM_RUNTIME_TARGETS "${target}" CACHE STRING "")
+  endif()
+endif()
+
 set(CLANG_BOOTSTRAP_TARGETS
   check-all
   check-llvm