llvm.org GIT mirror llvm / 85005dd
[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 Petr Hosek 3 years ago
1 changed file(s) with 14 addition(s) and 1 deletion(s). Raw diff Collapse all Expand all
5959
6060 # This variable makes sure that e.g. llvm-lit is found.
6161 set(LLVM_MAIN_SRC_DIR ${LLVM_BUILD_MAIN_SRC_DIR})
62
63 if(APPLE)
64 set(LLVM_ENABLE_LIBCXX ON CACHE BOOL "")
65 endif()
6266
6367 # Handle common options used by all runtimes.
6468 include(AddLLVM)
152156 # is required because the other runtimes need the builtin libraries present
153157 # before the just-built compiler can pass the configuration tests.
154158 if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/compiler-rt)
155 if(APPLE OR NOT LLVM_BUILTIN_TARGETS)
159 if(NOT LLVM_BUILTIN_TARGETS)
156160 llvm_ExternalProject_Add(builtins
157161 ${CMAKE_CURRENT_SOURCE_DIR}/compiler-rt/lib/builtins
158162 CMAKE_ARGS -DLLVM_LIBRARY_OUTPUT_INTDIR=${LLVM_LIBRARY_DIR}
166170 get_cmake_property(variableNames VARIABLES)
167171 add_custom_target(builtins)
168172 foreach(target ${LLVM_BUILTIN_TARGETS})
173 string(REPLACE "-" ";" builtin_target_list ${target})
174 foreach(item ${builtin_target_list})
175 string(TOLOWER "${item}" item_lower)
176 if(item_lower MATCHES "darwin")
177 message(FATAL_ERROR "LLVM_BUILTIN_TARGETS isn't implemented for Darwin platform!")
178 endif()
179 endforeach()
180
169181 foreach(variableName ${variableNames})
170182 if(variableName MATCHES "^BUILTINS_${target}")
171183 string(REPLACE "BUILTINS_${target}_" "" new_name ${variableName})
182194 -DCMAKE_ASM_COMPILER_WORKS=On
183195 -DCOMPILER_RT_DEFAULT_TARGET_ONLY=On
184196 ${${target}_extra_args}
197 TOOLCHAIN_TOOLS clang lld llvm-ar llvm-ranlib
185198 PASSTHROUGH_PREFIXES COMPILER_RT
186199 USE_TOOLCHAIN
187200 ${EXTRA_ARGS})