[PATCH] D30957: [CMake] Support single target builtins build on Darwin

Petr Hosek via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 14 15:28:52 PDT 2017


phosek created this revision.
Herald added a subscriber: mgorny.

This change allows cross-compiling compiler-rt builtins for multiple targets as part of runtimes on Darwin. This functionality is already supported on other platforms.


Repository:
  rL LLVM

https://reviews.llvm.org/D30957

Files:
  cmake/modules/LLVMExternalProjectUtils.cmake
  runtimes/CMakeLists.txt


Index: runtimes/CMakeLists.txt
===================================================================
--- runtimes/CMakeLists.txt
+++ runtimes/CMakeLists.txt
@@ -61,6 +61,10 @@
   # This variable makes sure that e.g. llvm-lit is found.
   set(LLVM_MAIN_SRC_DIR ${LLVM_BUILD_MAIN_SRC_DIR})
 
+  if(APPLE)
+   set(LLVM_ENABLE_LIBCXX ON CACHE BOOL "")
+  endif()
+
   # Handle common options used by all runtimes.
   include(AddLLVM)
   include(HandleLLVMOptions)
@@ -149,7 +153,7 @@
   # is required because the other runtimes need the builtin libraries present
   # before the just-built compiler can pass the configuration tests.
   if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/compiler-rt)
-    if(APPLE OR NOT LLVM_BUILTIN_TARGETS)
+    if(NOT LLVM_BUILTIN_TARGETS)
       llvm_ExternalProject_Add(builtins
                                ${CMAKE_CURRENT_SOURCE_DIR}/compiler-rt/lib/builtins
                                CMAKE_ARGS -DLLVM_LIBRARY_OUTPUT_INTDIR=${LLVM_LIBRARY_DIR}
Index: cmake/modules/LLVMExternalProjectUtils.cmake
===================================================================
--- cmake/modules/LLVMExternalProjectUtils.cmake
+++ cmake/modules/LLVMExternalProjectUtils.cmake
@@ -28,7 +28,7 @@
 #   CMAKE_ARGS arguments...
 #     Optional cmake arguments to pass when configuring the project
 #   TOOLCHAIN_TOOLS targets...
-#     Targets for toolchain tools (defaults to clang;lld)
+#     Targets for toolchain tools (defaults to clang;lld;llvm-ar;llvm-ranlib)
 #   DEPENDS targets...
 #     Targets that this project depends on
 #   EXTRA_TARGETS targets...
@@ -44,10 +44,7 @@
     ${ARGN})
   canonicalize_tool_name(${name} nameCanon)
   if(NOT ARG_TOOLCHAIN_TOOLS)
-    set(ARG_TOOLCHAIN_TOOLS clang lld)
-    if(NOT APPLE AND NOT WIN32)
-      list(APPEND ARG_TOOLCHAIN_TOOLS llvm-ar llvm-ranlib)
-    endif()
+    set(ARG_TOOLCHAIN_TOOLS clang lld llvm-ar llvm-ranlib)
   endif()
   foreach(tool ${ARG_TOOLCHAIN_TOOLS})
     if(TARGET ${tool})


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D30957.91784.patch
Type: text/x-patch
Size: 1968 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170314/f3f36011/attachment.bin>


More information about the llvm-commits mailing list