summaryrefslogtreecommitdiff
path: root/runtimes/CMakeLists.txt
diff options
context:
space:
mode:
authorPetr Hosek <phosek@chromium.org>2017-03-24 02:21:11 +0000
committerPetr Hosek <phosek@chromium.org>2017-03-24 02:21:11 +0000
commit85005dd1d4fefd76b8a4a733dfab017fdb73d10e (patch)
tree24865c4ce52e6d7a9c644683a75c698fbacc7235 /runtimes/CMakeLists.txt
parent39c17c7b8984182093ca9dcae9358e2cc5af3097 (diff)
[CMake] Support single target builtins build on Darwin
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. Differential Revision: https://reviews.llvm.org/D30957 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@298678 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'runtimes/CMakeLists.txt')
-rw-r--r--runtimes/CMakeLists.txt15
1 files changed, 14 insertions, 1 deletions
diff --git a/runtimes/CMakeLists.txt b/runtimes/CMakeLists.txt
index 24b7e041d5f..8be1d9e7c52 100644
--- a/runtimes/CMakeLists.txt
+++ b/runtimes/CMakeLists.txt
@@ -61,6 +61,10 @@ if(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_CURRENT_SOURCE_DIR})
# 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)
@@ -153,7 +157,7 @@ else() # if this is included from LLVM's CMake
# 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}
@@ -167,6 +171,14 @@ else() # if this is included from LLVM's CMake
get_cmake_property(variableNames VARIABLES)
add_custom_target(builtins)
foreach(target ${LLVM_BUILTIN_TARGETS})
+ string(REPLACE "-" ";" builtin_target_list ${target})
+ foreach(item ${builtin_target_list})
+ string(TOLOWER "${item}" item_lower)
+ if(item_lower MATCHES "darwin")
+ message(FATAL_ERROR "LLVM_BUILTIN_TARGETS isn't implemented for Darwin platform!")
+ endif()
+ endforeach()
+
foreach(variableName ${variableNames})
if(variableName MATCHES "^BUILTINS_${target}")
string(REPLACE "BUILTINS_${target}_" "" new_name ${variableName})
@@ -183,6 +195,7 @@ else() # if this is included from LLVM's CMake
-DCMAKE_ASM_COMPILER_WORKS=On
-DCOMPILER_RT_DEFAULT_TARGET_ONLY=On
${${target}_extra_args}
+ TOOLCHAIN_TOOLS clang lld llvm-ar llvm-ranlib
PASSTHROUGH_PREFIXES COMPILER_RT
USE_TOOLCHAIN
${EXTRA_ARGS})