1 # This file handles building LLVM runtime sub-projects.
3 # Runtimes are different from tools or other drop-in projects because runtimes
4 # should be built with the LLVM toolchain from the build directory. This file is
5 # a first step to formalizing runtime build interfaces.
7 # Setting CMake minimum required version should be at the very top of the file
8 # if this is the entry point.
9 if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
10 cmake_minimum_required(VERSION 3.4.3)
11 project(Runtimes C CXX ASM)
14 # Find all subdirectories containing CMake projects
16 foreach(entry ${entries})
17 if(IS_DIRECTORY ${entry} AND EXISTS ${entry}/CMakeLists.txt)
18 list(APPEND runtimes ${entry})
22 # Side-by-side subprojects layout.
23 set(LLVM_ALL_RUNTIMES "libcxx;libcxxabi;libunwind;compiler-rt")
24 set(LLVM_ENABLE_RUNTIMES "" CACHE STRING
25 "Semicolon-separated list of runtimes to build (${LLVM_ALL_RUNTIMES}), or \"all\".")
26 if(LLVM_ENABLE_RUNTIMES STREQUAL "all" )
27 set(LLVM_ENABLE_RUNTIMES ${LLVM_ALL_RUNTIMES})
29 foreach(proj ${LLVM_ENABLE_RUNTIMES})
30 set(proj_dir "${CMAKE_CURRENT_SOURCE_DIR}/../../${proj}")
31 if(IS_DIRECTORY ${proj_dir} AND EXISTS ${proj_dir}/CMakeLists.txt)
32 list(APPEND runtimes ${proj_dir})
34 message(FATAL_ERROR "LLVM_ENABLE_RUNTIMES requests ${proj} but directory not found: ${proj_dir}")
36 string(TOUPPER "${proj}" canon_name)
37 STRING(REGEX REPLACE "-" "_" canon_name ${canon_name})
38 set(LLVM_EXTERNAL_${canon_name}_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../../${proj}")
41 function(get_compiler_rt_path path)
42 foreach(entry ${runtimes})
43 get_filename_component(projName ${entry} NAME)
44 if("${projName}" MATCHES "compiler-rt")
45 set(${path} ${entry} PARENT_SCOPE)
51 # If this file is acting as a top-level CMake invocation, this code path is
52 # triggered by the external project call for the runtimes target below.
53 if(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_CURRENT_SOURCE_DIR})
55 function(runtime_register_component name)
56 set_property(GLOBAL APPEND PROPERTY SUB_COMPONENTS ${name})
59 cmake_minimum_required(VERSION 3.4.3)
60 project(Runtimes C CXX ASM)
62 # Add the root project's CMake modules, and the LLVM build's modules to the
64 list(INSERT CMAKE_MODULE_PATH 0
65 "${CMAKE_CURRENT_SOURCE_DIR}/../cmake"
66 "${CMAKE_CURRENT_SOURCE_DIR}/../cmake/modules"
67 "${LLVM_LIBRARY_DIR}/cmake/llvm"
70 # Some of the runtimes will conditionally use the compiler-rt sanitizers
71 # to make this work smoothly we ensure that compiler-rt is added first in
72 # the list of sub-projects. This allows other sub-projects to have checks
73 # like `if(TARGET asan)` to enable building with asan.
74 get_compiler_rt_path(compiler_rt_path)
76 list(REMOVE_ITEM runtimes ${compiler_rt_path})
77 if(NOT DEFINED LLVM_BUILD_COMPILER_RT OR LLVM_BUILD_COMPILER_RT)
78 list(INSERT runtimes 0 ${compiler_rt_path})
82 # LLVMConfig.cmake contains a bunch of CMake variables from the LLVM build.
83 # This file is installed as part of LLVM distributions, so this can be used
84 # either from a build directory or an installed LLVM.
87 # Setting these variables will allow the sub-build to put their outputs into
88 # the library and bin directories of the top-level build.
89 set(LLVM_LIBRARY_OUTPUT_INTDIR ${LLVM_LIBRARY_DIR})
90 set(LLVM_RUNTIME_OUTPUT_INTDIR ${LLVM_TOOLS_BINARY_DIR})
92 # This variable makes sure that e.g. llvm-lit is found.
93 set(LLVM_MAIN_SRC_DIR ${LLVM_BUILD_MAIN_SRC_DIR})
94 set(LLVM_CMAKE_PATH ${LLVM_MAIN_SRC_DIR}/cmake/modules)
97 set(LLVM_ENABLE_LIBCXX ON CACHE BOOL "")
100 include(CheckLibraryExists)
101 include(CheckCCompilerFlag)
103 # We don't have libc++ (yet).
104 set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -nostdlib++")
106 # Avoid checking whether the compiler is working.
107 set(LLVM_COMPILER_CHECKED ON)
109 # Enable warnings, otherwise -w gets added to the cflags by HandleLLVMOptions
110 # resulting in unjustified successes by check_cxx_compiler_flag.
111 set(LLVM_ENABLE_WARNINGS ON)
113 # Handle common options used by all runtimes.
115 include(HandleLLVMOptions)
116 include(FindPythonInterp)
118 # Remove the -nostdlib++ option we've added earlier.
119 string(REPLACE "-nostdlib++" "" CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS}")
121 # This can be used to detect whether we're in the runtimes build.
122 set(RUNTIMES_BUILD ON)
124 foreach(entry ${runtimes})
125 get_filename_component(projName ${entry} NAME)
127 # TODO: Clean this up as part of an interface standardization
128 string(REPLACE "-" "_" canon_name ${projName})
129 string(TOUPPER ${canon_name} canon_name)
131 if(LLVM_RUNTIMES_LIBDIR_SUBDIR)
132 set(${canon_name}_LIBDIR_SUBDIR "${LLVM_RUNTIMES_LIBDIR_SUBDIR}" CACHE STRING "" FORCE)
135 # Setting a variable to let sub-projects detect which other projects
136 # will be included under here.
137 set(HAVE_${canon_name} ON)
140 # We do this in two loops so that HAVE_* is set for each runtime before the
141 # other runtimes are added.
142 foreach(entry ${runtimes})
143 get_filename_component(projName ${entry} NAME)
145 # Between each sub-project we want to cache and clear the LIT properties
146 set_property(GLOBAL PROPERTY LLVM_LIT_TESTSUITES)
147 set_property(GLOBAL PROPERTY LLVM_LIT_PARAMS)
148 set_property(GLOBAL PROPERTY LLVM_LIT_DEPENDS)
149 set_property(GLOBAL PROPERTY LLVM_LIT_EXTRA_ARGS)
151 add_subdirectory(${entry} ${projName})
153 get_property(LLVM_LIT_TESTSUITES GLOBAL PROPERTY LLVM_LIT_TESTSUITES)
154 get_property(LLVM_LIT_PARAMS GLOBAL PROPERTY LLVM_LIT_PARAMS)
155 get_property(LLVM_LIT_DEPENDS GLOBAL PROPERTY LLVM_LIT_DEPENDS)
156 get_property(LLVM_LIT_EXTRA_ARGS GLOBAL PROPERTY LLVM_LIT_EXTRA_ARGS)
158 list(APPEND RUNTIMES_LIT_TESTSUITES ${LLVM_LIT_TESTSUITES})
159 list(APPEND RUNTIMES_LIT_PARAMS ${LLVM_LIT_PARAMS})
160 list(APPEND RUNTIMES_LIT_DEPENDS ${LLVM_LIT_DEPENDS})
161 list(APPEND RUNTIMES_LIT_EXTRA_ARGS ${LLVM_LIT_EXTRA_ARGS})
164 if(LLVM_INCLUDE_TESTS)
165 # Add a global check rule now that all subdirectories have been traversed
166 # and we know the total set of lit testsuites.
168 add_lit_target(check-runtimes
169 "Running all regression tests"
170 ${RUNTIMES_LIT_TESTSUITES}
171 PARAMS ${RUNTIMES_LIT_PARAMS}
172 DEPENDS ${RUNTIMES_LIT_DEPENDS}
173 ARGS ${RUNTIMES_LIT_EXTRA_ARGS}
175 add_custom_target(runtimes-test-depends DEPENDS ${RUNTIMES_LIT_DEPENDS})
178 get_property(SUB_COMPONENTS GLOBAL PROPERTY SUB_COMPONENTS)
180 list(REMOVE_DUPLICATES SUB_COMPONENTS)
181 foreach(component ${SUB_COMPONENTS})
182 if(NOT TARGET ${component})
183 message(SEND_ERROR "Missing target for runtime component ${component}!")
187 if(TARGET check-${component})
188 list(APPEND SUB_CHECK_TARGETS check-${component})
191 if(TARGET install-${component})
192 list(APPEND SUB_INSTALL_TARGETS install-${component})
194 if(TARGET install-${component}-stripped)
195 list(APPEND SUB_INSTALL_TARGETS install-${component}-stripped)
199 if(LLVM_RUNTIMES_TARGET)
201 ${CMAKE_CURRENT_SOURCE_DIR}/Components.cmake.in
202 ${LLVM_BINARY_DIR}/runtimes/${LLVM_RUNTIMES_TARGET}/Components.cmake)
205 ${CMAKE_CURRENT_SOURCE_DIR}/Components.cmake.in
206 ${LLVM_BINARY_DIR}/runtimes/Components.cmake)
210 else() # if this is included from LLVM's CMake
211 include(LLVMExternalProjectUtils)
212 if (LLVM_EXTERNAL_LIBCXX_SOURCE_DIR AND "libcxx" IN_LIST LLVM_ENABLE_RUNTIMES)
213 set(LIBCXX_HEADER_DIR ${LLVM_INCLUDE_DIR}/c++/v1/)
214 set(CXX_HEADER_TARGET runtime-libcxx-headers)
215 add_subdirectory(${LLVM_EXTERNAL_LIBCXX_SOURCE_DIR}/include ${CXX_HEADER_TARGET})
218 if(NOT LLVM_BUILD_RUNTIMES)
219 set(EXTRA_ARGS EXCLUDE_FROM_ALL)
222 function(builtin_default_target compiler_rt_path)
223 cmake_parse_arguments(ARG "" "" "DEPENDS" ${ARGN})
225 llvm_ExternalProject_Add(builtins
226 ${compiler_rt_path}/lib/builtins
227 DEPENDS ${ARG_DEPENDS}
228 CMAKE_ARGS -DLLVM_LIBRARY_OUTPUT_INTDIR=${LLVM_LIBRARY_DIR}
229 -DLLVM_RUNTIME_OUTPUT_INTDIR=${LLVM_TOOLS_BINARY_DIR}
230 -DLLVM_DEFAULT_TARGET_TRIPLE=${TARGET_TRIPLE}
231 -DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=ON
232 -DCMAKE_C_COMPILER_TARGET=${TARGET_TRIPLE}
233 -DCMAKE_ASM_COMPILER_TARGET=${TARGET_TRIPLE}
234 -DCMAKE_C_COMPILER_WORKS=ON
235 -DCMAKE_ASM_COMPILER_WORKS=ON
236 PASSTHROUGH_PREFIXES COMPILER_RT
241 function(builtin_register_target compiler_rt_path target)
242 cmake_parse_arguments(ARG "" "" "DEPENDS" ${ARGN})
244 string(REPLACE "-" ";" builtin_target_list ${target})
245 foreach(item ${builtin_target_list})
246 string(TOLOWER "${item}" item_lower)
247 if(item_lower MATCHES "darwin")
248 message(FATAL_ERROR "LLVM_BUILTIN_TARGETS isn't implemented for Darwin platform!")
252 get_cmake_property(variableNames VARIABLES)
253 foreach(variableName ${variableNames})
254 string(FIND "${variableName}" "BUILTINS_${target}" out)
256 string(REPLACE "BUILTINS_${target}_" "" new_name ${variableName})
257 list(APPEND ${target}_extra_args "-D${new_name}=${${variableName}}")
261 llvm_ExternalProject_Add(builtins-${target}
262 ${compiler_rt_path}/lib/builtins
263 DEPENDS ${ARG_DEPENDS}
264 CMAKE_ARGS -DLLVM_LIBRARY_OUTPUT_INTDIR=${LLVM_LIBRARY_DIR}
265 -DLLVM_RUNTIME_OUTPUT_INTDIR=${LLVM_TOOLS_BINARY_DIR}
266 -DLLVM_DEFAULT_TARGET_TRIPLE=${target}
267 -DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=ON
268 -DCMAKE_C_COMPILER_TARGET=${target}
269 -DCMAKE_ASM_COMPILER_TARGET=${target}
270 -DCMAKE_C_COMPILER_WORKS=ON
271 -DCMAKE_ASM_COMPILER_WORKS=ON
272 -DCOMPILER_RT_DEFAULT_TARGET_ONLY=ON
273 ${${target}_extra_args}
274 TOOLCHAIN_TOOLS clang lld llvm-ar llvm-ranlib llvm-nm llvm-objcopy llvm-objdump llvm-strip
279 # If compiler-rt is present we need to build the builtin libraries first. This
280 # is required because the other runtimes need the builtin libraries present
281 # before the just-built compiler can pass the configuration tests.
282 get_compiler_rt_path(compiler_rt_path)
284 if(NOT LLVM_BUILTIN_TARGETS)
285 builtin_default_target(${compiler_rt_path}
286 DEPENDS clang-resource-headers)
288 if("default" IN_LIST LLVM_BUILTIN_TARGETS)
289 builtin_default_target(${compiler_rt_path}
290 DEPENDS clang-resource-headers)
291 list(REMOVE_ITEM LLVM_BUILTIN_TARGETS "default")
293 add_custom_target(builtins)
294 add_custom_target(install-builtins)
295 add_custom_target(install-builtins-stripped)
298 foreach(target ${LLVM_BUILTIN_TARGETS})
299 builtin_register_target(${compiler_rt_path} ${target}
300 DEPENDS clang-resource-headers)
302 add_dependencies(builtins builtins-${target})
303 add_dependencies(install-builtins install-builtins-${target})
304 add_dependencies(install-builtins-stripped install-builtins-${target}-stripped)
308 # We don't need to depend on the builtins if we're building instrumented
309 # because the next stage will use the same compiler used to build this stage.
310 if(NOT LLVM_BUILD_INSTRUMENTED AND CLANG_ENABLE_BOOTSTRAP)
311 add_dependencies(clang-bootstrap-deps builtins)
315 # We create a list the names of all the runtime projects in all uppercase and
316 # with dashes turned to underscores. This gives us the CMake variable prefixes
317 # for all variables that will apply to runtimes.
318 foreach(entry ${runtimes})
319 get_filename_component(projName ${entry} NAME)
320 string(REPLACE "-" "_" canon_name ${projName})
321 string(TOUPPER ${canon_name} canon_name)
322 list(APPEND prefixes ${canon_name})
324 string(FIND ${projName} "lib" LIB_IDX)
326 string(SUBSTRING ${projName} 3 -1 projName)
328 list(APPEND runtime_names ${projName})
331 if(LLVM_RUNTIME_BUILD_ID_LINK_TARGETS)
333 ${CMAKE_CURRENT_SOURCE_DIR}/llvm-strip-link.in
334 ${CMAKE_CURRENT_BINARY_DIR}/llvm-strip-link
339 function(runtime_default_target)
340 cmake_parse_arguments(ARG "" "" "DEPENDS;PREFIXES" ${ARGN})
342 include(${LLVM_BINARY_DIR}/runtimes/Components.cmake OPTIONAL)
343 set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS ${LLVM_BINARY_DIR}/runtimes/Components.cmake)
345 foreach(runtime_name ${runtime_names})
346 list(APPEND extra_targets
348 install-${runtime_name}
349 install-${runtime_name}-stripped)
350 if(LLVM_INCLUDE_TESTS)
351 list(APPEND test_targets check-${runtime_name})
354 foreach(component ${LLVM_RUNTIME_DISTRIBUTION_COMPONENTS})
355 if(NOT ${component} IN_LIST SUB_COMPONENTS)
356 list(APPEND extra_targets ${component} install-${component} install-${component}-stripped)
360 if(LLVM_INCLUDE_TESTS)
361 list(APPEND test_targets runtimes-test-depends check-runtimes)
364 llvm_ExternalProject_Add(runtimes
365 ${CMAKE_CURRENT_SOURCE_DIR}
366 DEPENDS ${ARG_DEPENDS} runtime-libcxx-headers
367 # Builtins were built separately above
368 CMAKE_ARGS -DCOMPILER_RT_BUILD_BUILTINS=Off
369 -DLLVM_INCLUDE_TESTS=${LLVM_INCLUDE_TESTS}
370 -DLLVM_BINARY_DIR=${LLVM_BINARY_DIR}
371 -DLLVM_LIBRARY_DIR=${LLVM_LIBRARY_DIR}
372 -DLLVM_DEFAULT_TARGET_TRIPLE=${TARGET_TRIPLE}
373 -DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=ON
374 -DCMAKE_C_COMPILER_TARGET=${TARGET_TRIPLE}
375 -DCMAKE_CXX_COMPILER_TARGET=${TARGET_TRIPLE}
376 -DCMAKE_ASM_COMPILER_TARGET=${TARGET_TRIPLE}
377 -DCMAKE_C_COMPILER_WORKS=ON
378 -DCMAKE_CXX_COMPILER_WORKS=ON
379 -DCMAKE_ASM_COMPILER_WORKS=ON
380 PASSTHROUGH_PREFIXES LLVM_ENABLE_RUNTIMES
382 EXTRA_TARGETS ${extra_targets}
386 ${SUB_INSTALL_TARGETS}
391 # runtime_register_target(target)
392 # Utility function to register external runtime target.
393 function(runtime_register_target name target)
394 cmake_parse_arguments(ARG "" "" "DEPENDS" ${ARGN})
395 include(${LLVM_BINARY_DIR}/runtimes/${name}/Components.cmake OPTIONAL)
396 set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS ${LLVM_BINARY_DIR}/runtimes/${name}/Components.cmake)
398 set(${name}_deps ${ARG_DEPENDS})
399 if(NOT name STREQUAL target)
400 list(APPEND ${name}_deps runtimes-${target})
403 foreach(runtime_name ${runtime_names})
404 set(${runtime_name}-${name} ${runtime_name})
405 set(install-${runtime_name}-${name} install-${runtime_name})
406 set(install-${runtime_name}-${name}-stripped install-${runtime_name}-stripped)
407 list(APPEND ${name}_extra_targets ${runtime_name}-${name} install-${runtime_name}-${name} install-${runtime_name}-${name}-stripped)
408 if(LLVM_INCLUDE_TESTS)
409 set(check-${runtime_name}-${name} check-${runtime_name} )
410 list(APPEND ${name}_test_targets check-${runtime_name}-${name})
414 foreach(target_name IN LISTS SUB_COMPONENTS SUB_INSTALL_TARGETS)
415 set(${target_name}-${name} ${target_name})
416 list(APPEND ${name}_extra_targets ${target_name}-${name})
419 foreach(component ${LLVM_RUNTIME_DISTRIBUTION_COMPONENTS})
420 set(${component}-${name} ${component})
421 set(install-${component}-${name} ${component})
422 list(APPEND ${name}_extra_targets ${component}-${name} install-${component}-${name})
425 if(LLVM_INCLUDE_TESTS)
426 set(runtimes-test-depends-${name} runtimes-test-depends)
427 set(check-runtimes-${name} check-runtimes)
428 list(APPEND ${name}_test_targets runtimes-test-depends-${name} check-runtimes-${name})
429 foreach(target_name IN LISTS SUB_CHECK_TARGETS)
430 set(${target_name}-${name} ${target_name})
431 list(APPEND ${name}_test_targets ${target_name}-${name})
432 list(APPEND test_targets ${target_name}-${name})
434 set(test_targets "${test_targets}" PARENT_SCOPE)
437 get_cmake_property(variableNames VARIABLES)
438 foreach(variableName ${variableNames})
439 string(FIND "${variableName}" "RUNTIMES_${name}_" out)
441 string(REPLACE "RUNTIMES_${name}_" "" new_name ${variableName})
442 list(APPEND ${name}_extra_args "-D${new_name}=${${variableName}}")
444 string(FIND "${variableName}" "RUNTIMES_${target}_" out)
446 string(REPLACE "RUNTIMES_${target}_" "" new_name ${variableName})
447 list(APPEND ${name}_extra_args "-D${new_name}=${${variableName}}")
451 if(target IN_LIST LLVM_RUNTIME_BUILD_ID_LINK_TARGETS)
452 list(APPEND EXTRA_ARGS STRIP_TOOL ${CMAKE_CURRENT_BINARY_DIR}/llvm-strip-link)
455 llvm_ExternalProject_Add(runtimes-${name}
456 ${CMAKE_CURRENT_SOURCE_DIR}
457 DEPENDS ${${name}_deps} runtime-libcxx-headers
458 # Builtins were built separately above
459 CMAKE_ARGS -DCOMPILER_RT_BUILD_BUILTINS=Off
460 -DLLVM_INCLUDE_TESTS=${LLVM_INCLUDE_TESTS}
461 -DLLVM_BINARY_DIR=${LLVM_BINARY_DIR}
462 -DLLVM_LIBRARY_DIR=${LLVM_LIBRARY_DIR}
463 -DLLVM_DEFAULT_TARGET_TRIPLE=${target}
464 -DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=ON
465 -DCMAKE_C_COMPILER_TARGET=${target}
466 -DCMAKE_CXX_COMPILER_TARGET=${target}
467 -DCMAKE_ASM_COMPILER_TARGET=${target}
468 -DCMAKE_C_COMPILER_WORKS=ON
469 -DCMAKE_CXX_COMPILER_WORKS=ON
470 -DCMAKE_ASM_COMPILER_WORKS=ON
471 -DCOMPILER_RT_DEFAULT_TARGET_ONLY=ON
472 -DLLVM_RUNTIMES_TARGET=${name}
473 ${${name}_extra_args}
474 PASSTHROUGH_PREFIXES LLVM_ENABLE_RUNTIMES
475 TOOLCHAIN_TOOLS clang lld llvm-ar llvm-ranlib llvm-nm llvm-objcopy llvm-objdump llvm-strip
476 EXTRA_TARGETS ${${name}_extra_targets}
477 ${${name}_test_targets}
483 # Create a runtimes target that uses this file as its top-level CMake file.
484 # The runtimes target is a configuration of all the runtime libraries
485 # together in a single CMake invocaiton.
486 if(NOT LLVM_RUNTIME_TARGETS)
487 runtime_default_target(
489 PREFIXES ${prefixes})
491 if("default" IN_LIST LLVM_RUNTIME_TARGETS)
492 runtime_default_target(
494 PREFIXES ${prefixes})
495 list(REMOVE_ITEM LLVM_RUNTIME_TARGETS "default")
497 add_custom_target(runtimes)
498 add_custom_target(runtimes-configure)
499 add_custom_target(install-runtimes)
500 add_custom_target(install-runtimes-stripped)
501 if(LLVM_INCLUDE_TESTS)
502 add_custom_target(check-runtimes)
503 add_custom_target(runtimes-test-depends)
506 if(LLVM_RUNTIME_DISTRIBUTION_COMPONENTS)
507 foreach(component ${LLVM_RUNTIME_DISTRIBUTION_COMPONENTS})
508 add_custom_target(${component})
509 add_custom_target(install-${component})
514 foreach(name ${LLVM_RUNTIME_TARGETS})
515 runtime_register_target(${name} ${name}
518 add_dependencies(runtimes runtimes-${name})
519 add_dependencies(runtimes-configure runtimes-${name}-configure)
520 add_dependencies(install-runtimes install-runtimes-${name})
521 add_dependencies(install-runtimes-stripped install-runtimes-${name}-stripped)
522 if(LLVM_INCLUDE_TESTS)
523 add_dependencies(check-runtimes check-runtimes-${name})
524 add_dependencies(runtimes-test-depends runtimes-test-depends-${name})
528 foreach(multilib ${LLVM_RUNTIME_MULTILIBS})
529 foreach(name ${LLVM_RUNTIME_MULTILIB_${multilib}_TARGETS})
530 runtime_register_target(${name}+${multilib} ${name}
531 DEPENDS runtimes-${name}
532 CMAKE_ARGS -DLLVM_RUNTIMES_PREFIX=${name}/
533 -DLLVM_RUNTIMES_LIBDIR_SUBDIR=${multilib})
534 add_dependencies(runtimes runtimes-${name}+${multilib})
535 add_dependencies(runtimes-configure runtimes-${name}+${multilib}-configure)
536 add_dependencies(install-runtimes install-runtimes-${name}+${multilib})
537 add_dependencies(install-runtimes-stripped install-runtimes-${name}+${multilib}-stripped)
542 # TODO: This is a hack needed because the libcxx headers are copied into the
543 # build directory during configuration. Without that step the clang in the
544 # build directory cannot find the C++ headers in certain configurations.
545 # I need to build a mechanism for runtime projects to provide CMake code
546 # that executes at LLVM configuration time to handle this case.
547 if(NOT LLVM_BUILD_INSTRUMENTED AND CLANG_ENABLE_BOOTSTRAP)
548 add_dependencies(clang-bootstrap-deps runtimes-configure)
551 if(LLVM_INCLUDE_TESTS)
552 set_property(GLOBAL APPEND PROPERTY LLVM_ADDITIONAL_TEST_DEPENDS runtimes-test-depends)
553 set_property(GLOBAL APPEND PROPERTY LLVM_ADDITIONAL_TEST_TARGETS check-runtimes)
555 set(RUNTIMES_TEST_DEPENDS
568 foreach(target ${test_targets} ${SUB_CHECK_TARGETS})
569 add_dependencies(${target} ${RUNTIMES_TEST_DEPENDS})