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 find_package(LLVM PATHS "${LLVM_BINARY_DIR}" NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH)
64 # Add the root project's CMake modules, and the LLVM build's modules to the
66 list(INSERT CMAKE_MODULE_PATH 0
67 "${CMAKE_CURRENT_SOURCE_DIR}/../cmake"
68 "${CMAKE_CURRENT_SOURCE_DIR}/../cmake/modules"
71 # Some of the runtimes will conditionally use the compiler-rt sanitizers
72 # to make this work smoothly we ensure that compiler-rt is added first in
73 # the list of sub-projects. This allows other sub-projects to have checks
74 # like `if(TARGET asan)` to enable building with asan.
75 get_compiler_rt_path(compiler_rt_path)
77 list(REMOVE_ITEM runtimes ${compiler_rt_path})
78 if(NOT DEFINED LLVM_BUILD_COMPILER_RT OR LLVM_BUILD_COMPILER_RT)
79 list(INSERT runtimes 0 ${compiler_rt_path})
83 # Setting these variables will allow the sub-build to put their outputs into
84 # the library and bin directories of the top-level build.
85 set(LLVM_LIBRARY_OUTPUT_INTDIR ${LLVM_LIBRARY_DIR})
86 set(LLVM_RUNTIME_OUTPUT_INTDIR ${LLVM_TOOLS_BINARY_DIR})
88 # This variable makes sure that e.g. llvm-lit is found.
89 set(LLVM_MAIN_SRC_DIR ${LLVM_BUILD_MAIN_SRC_DIR})
90 set(LLVM_CMAKE_PATH ${LLVM_MAIN_SRC_DIR}/cmake/modules)
92 # This variable is used by individual runtimes to locate LLVM files.
93 set(LLVM_PATH ${LLVM_BUILD_MAIN_SRC_DIR})
96 set(LLVM_ENABLE_LIBCXX ON CACHE BOOL "")
99 include(CheckLibraryExists)
100 include(CheckCCompilerFlag)
102 # We don't have libc++ (yet).
103 set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -nostdlib++")
105 # Avoid checking whether the compiler is working.
106 set(LLVM_COMPILER_CHECKED ON)
108 # Enable warnings, otherwise -w gets added to the cflags by HandleLLVMOptions
109 # resulting in unjustified successes by check_cxx_compiler_flag.
110 set(LLVM_ENABLE_WARNINGS ON)
112 # Handle common options used by all runtimes.
114 include(HandleLLVMOptions)
115 include(FindPythonInterp)
117 # Remove the -nostdlib++ option we've added earlier.
118 string(REPLACE "-nostdlib++" "" CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS}")
120 # Use libtool instead of ar if you are both on an Apple host, and targeting Apple.
121 if(CMAKE_HOST_APPLE AND APPLE)
125 # This can be used to detect whether we're in the runtimes build.
126 set(RUNTIMES_BUILD ON)
128 foreach(entry ${runtimes})
129 get_filename_component(projName ${entry} NAME)
131 # TODO: Clean this up as part of an interface standardization
132 string(REPLACE "-" "_" canon_name ${projName})
133 string(TOUPPER ${canon_name} canon_name)
135 # The subdirectories need to treat this as standalone builds. D57992 tried
136 # to get rid of this, but the runtimes treat *_STANDALONE_BUILD=OFF as if
137 # llvm & clang are configured in the same CMake, and setup dependencies
138 # against their targets.
139 set(${canon_name}_STANDALONE_BUILD ON)
141 if(LLVM_RUNTIMES_LIBDIR_SUBDIR)
142 set(${canon_name}_LIBDIR_SUBDIR "${LLVM_RUNTIMES_LIBDIR_SUBDIR}" CACHE STRING "" FORCE)
145 # Setting a variable to let sub-projects detect which other projects
146 # will be included under here.
147 set(HAVE_${canon_name} ON)
150 # We do this in two loops so that HAVE_* is set for each runtime before the
151 # other runtimes are added.
152 foreach(entry ${runtimes})
153 get_filename_component(projName ${entry} NAME)
155 # Between each sub-project we want to cache and clear the LIT properties
156 set_property(GLOBAL PROPERTY LLVM_LIT_TESTSUITES)
157 set_property(GLOBAL PROPERTY LLVM_LIT_PARAMS)
158 set_property(GLOBAL PROPERTY LLVM_LIT_DEPENDS)
159 set_property(GLOBAL PROPERTY LLVM_LIT_EXTRA_ARGS)
161 add_subdirectory(${entry} ${projName})
163 get_property(LLVM_LIT_TESTSUITES GLOBAL PROPERTY LLVM_LIT_TESTSUITES)
164 get_property(LLVM_LIT_PARAMS GLOBAL PROPERTY LLVM_LIT_PARAMS)
165 get_property(LLVM_LIT_DEPENDS GLOBAL PROPERTY LLVM_LIT_DEPENDS)
166 get_property(LLVM_LIT_EXTRA_ARGS GLOBAL PROPERTY LLVM_LIT_EXTRA_ARGS)
168 list(APPEND RUNTIMES_LIT_TESTSUITES ${LLVM_LIT_TESTSUITES})
169 list(APPEND RUNTIMES_LIT_PARAMS ${LLVM_LIT_PARAMS})
170 list(APPEND RUNTIMES_LIT_DEPENDS ${LLVM_LIT_DEPENDS})
171 list(APPEND RUNTIMES_LIT_EXTRA_ARGS ${LLVM_LIT_EXTRA_ARGS})
174 if(LLVM_INCLUDE_TESTS)
175 # Add a global check rule now that all subdirectories have been traversed
176 # and we know the total set of lit testsuites.
178 add_lit_target(check-runtimes
179 "Running all regression tests"
180 ${RUNTIMES_LIT_TESTSUITES}
181 PARAMS ${RUNTIMES_LIT_PARAMS}
182 DEPENDS ${RUNTIMES_LIT_DEPENDS}
183 ARGS ${RUNTIMES_LIT_EXTRA_ARGS}
185 add_custom_target(runtimes-test-depends DEPENDS ${RUNTIMES_LIT_DEPENDS})
188 get_property(SUB_COMPONENTS GLOBAL PROPERTY SUB_COMPONENTS)
190 list(REMOVE_DUPLICATES SUB_COMPONENTS)
191 foreach(component ${SUB_COMPONENTS})
192 if(NOT TARGET ${component})
193 message(SEND_ERROR "Missing target for runtime component ${component}!")
197 if(TARGET check-${component})
198 list(APPEND SUB_CHECK_TARGETS check-${component})
201 if(TARGET install-${component})
202 list(APPEND SUB_INSTALL_TARGETS install-${component})
204 if(TARGET install-${component}-stripped)
205 list(APPEND SUB_INSTALL_TARGETS install-${component}-stripped)
209 if(LLVM_RUNTIMES_TARGET)
211 ${CMAKE_CURRENT_SOURCE_DIR}/Components.cmake.in
212 ${LLVM_BINARY_DIR}/runtimes/${LLVM_RUNTIMES_TARGET}/Components.cmake)
215 ${CMAKE_CURRENT_SOURCE_DIR}/Components.cmake.in
216 ${LLVM_BINARY_DIR}/runtimes/Components.cmake)
220 else() # if this is included from LLVM's CMake
221 include(LLVMExternalProjectUtils)
222 if (LLVM_EXTERNAL_LIBCXX_SOURCE_DIR AND "libcxx" IN_LIST LLVM_ENABLE_RUNTIMES)
223 # This looks wrong, but libcxx's build actually wants the header dir to be
224 # the root build dir, not the include directory.
225 set(LIBCXX_HEADER_DIR ${LLVM_BINARY_DIR})
226 set(CXX_HEADER_TARGET runtime-libcxx-headers)
227 add_subdirectory(${LLVM_EXTERNAL_LIBCXX_SOURCE_DIR}/include ${CXX_HEADER_TARGET})
230 if(NOT LLVM_BUILD_RUNTIMES)
231 set(EXTRA_ARGS EXCLUDE_FROM_ALL)
234 function(builtin_default_target compiler_rt_path)
235 cmake_parse_arguments(ARG "" "" "DEPENDS" ${ARGN})
237 llvm_ExternalProject_Add(builtins
238 ${compiler_rt_path}/lib/builtins
239 DEPENDS ${ARG_DEPENDS}
240 CMAKE_ARGS -DLLVM_LIBRARY_OUTPUT_INTDIR=${LLVM_LIBRARY_DIR}
241 -DLLVM_RUNTIME_OUTPUT_INTDIR=${LLVM_TOOLS_BINARY_DIR}
242 -DLLVM_DEFAULT_TARGET_TRIPLE=${TARGET_TRIPLE}
243 -DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=ON
244 -DCMAKE_C_COMPILER_TARGET=${TARGET_TRIPLE}
245 -DCMAKE_ASM_COMPILER_TARGET=${TARGET_TRIPLE}
246 -DCMAKE_C_COMPILER_WORKS=ON
247 -DCMAKE_ASM_COMPILER_WORKS=ON
248 PASSTHROUGH_PREFIXES COMPILER_RT
253 function(builtin_register_target compiler_rt_path target)
254 cmake_parse_arguments(ARG "" "" "DEPENDS" ${ARGN})
256 string(REPLACE "-" ";" builtin_target_list ${target})
257 foreach(item ${builtin_target_list})
258 string(TOLOWER "${item}" item_lower)
259 if(item_lower MATCHES "darwin")
260 message(FATAL_ERROR "LLVM_BUILTIN_TARGETS isn't implemented for Darwin platform!")
264 get_cmake_property(variableNames VARIABLES)
265 foreach(variableName ${variableNames})
266 string(FIND "${variableName}" "BUILTINS_${target}" out)
268 string(REPLACE "BUILTINS_${target}_" "" new_name ${variableName})
269 list(APPEND ${target}_extra_args "-D${new_name}=${${variableName}}")
273 llvm_ExternalProject_Add(builtins-${target}
274 ${compiler_rt_path}/lib/builtins
275 DEPENDS ${ARG_DEPENDS}
276 CMAKE_ARGS -DLLVM_LIBRARY_OUTPUT_INTDIR=${LLVM_LIBRARY_DIR}
277 -DLLVM_RUNTIME_OUTPUT_INTDIR=${LLVM_TOOLS_BINARY_DIR}
278 -DLLVM_DEFAULT_TARGET_TRIPLE=${target}
279 -DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=ON
280 -DCMAKE_C_COMPILER_TARGET=${target}
281 -DCMAKE_ASM_COMPILER_TARGET=${target}
282 -DCMAKE_C_COMPILER_WORKS=ON
283 -DCMAKE_ASM_COMPILER_WORKS=ON
284 -DCOMPILER_RT_DEFAULT_TARGET_ONLY=ON
285 ${${target}_extra_args}
286 TOOLCHAIN_TOOLS clang lld llvm-ar llvm-ranlib llvm-nm llvm-objcopy llvm-objdump llvm-strip
291 # If compiler-rt is present we need to build the builtin libraries first. This
292 # is required because the other runtimes need the builtin libraries present
293 # before the just-built compiler can pass the configuration tests.
294 get_compiler_rt_path(compiler_rt_path)
296 if(NOT LLVM_BUILTIN_TARGETS)
297 builtin_default_target(${compiler_rt_path}
298 DEPENDS clang-resource-headers)
300 if("default" IN_LIST LLVM_BUILTIN_TARGETS)
301 builtin_default_target(${compiler_rt_path}
302 DEPENDS clang-resource-headers)
303 list(REMOVE_ITEM LLVM_BUILTIN_TARGETS "default")
305 add_custom_target(builtins)
306 add_custom_target(install-builtins)
307 add_custom_target(install-builtins-stripped)
310 foreach(target ${LLVM_BUILTIN_TARGETS})
311 builtin_register_target(${compiler_rt_path} ${target}
312 DEPENDS clang-resource-headers)
314 add_dependencies(builtins builtins-${target})
315 add_dependencies(install-builtins install-builtins-${target})
316 add_dependencies(install-builtins-stripped install-builtins-${target}-stripped)
320 # We don't need to depend on the builtins if we're building instrumented
321 # because the next stage will use the same compiler used to build this stage.
322 if(NOT LLVM_BUILD_INSTRUMENTED AND CLANG_ENABLE_BOOTSTRAP)
323 add_dependencies(clang-bootstrap-deps builtins)
327 # We create a list the names of all the runtime projects in all uppercase and
328 # with dashes turned to underscores. This gives us the CMake variable prefixes
329 # for all variables that will apply to runtimes.
330 foreach(entry ${runtimes})
331 get_filename_component(projName ${entry} NAME)
332 string(REPLACE "-" "_" canon_name ${projName})
333 string(TOUPPER ${canon_name} canon_name)
334 list(APPEND prefixes ${canon_name})
336 string(FIND ${projName} "lib" LIB_IDX)
338 string(SUBSTRING ${projName} 3 -1 projName)
340 list(APPEND runtime_names ${projName})
343 if(LLVM_RUNTIME_BUILD_ID_LINK_TARGETS)
345 ${CMAKE_CURRENT_SOURCE_DIR}/llvm-strip-link.in
346 ${CMAKE_CURRENT_BINARY_DIR}/llvm-strip-link
351 function(runtime_default_target)
352 cmake_parse_arguments(ARG "" "" "DEPENDS;PREFIXES" ${ARGN})
354 include(${LLVM_BINARY_DIR}/runtimes/Components.cmake OPTIONAL)
355 set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS ${LLVM_BINARY_DIR}/runtimes/Components.cmake)
357 foreach(runtime_name ${runtime_names})
358 list(APPEND extra_targets
360 install-${runtime_name}
361 install-${runtime_name}-stripped)
362 if(LLVM_INCLUDE_TESTS)
363 list(APPEND test_targets check-${runtime_name})
366 foreach(component ${LLVM_RUNTIME_DISTRIBUTION_COMPONENTS})
367 if(NOT ${component} IN_LIST SUB_COMPONENTS)
368 list(APPEND extra_targets ${component} install-${component} install-${component}-stripped)
372 if(LLVM_INCLUDE_TESTS)
373 list(APPEND test_targets runtimes-test-depends check-runtimes)
376 llvm_ExternalProject_Add(runtimes
377 ${CMAKE_CURRENT_SOURCE_DIR}
378 DEPENDS ${ARG_DEPENDS} ${CXX_HEADER_TARGET}
379 # Builtins were built separately above
380 CMAKE_ARGS -DCOMPILER_RT_BUILD_BUILTINS=Off
381 -DLLVM_INCLUDE_TESTS=${LLVM_INCLUDE_TESTS}
382 -DLLVM_DEFAULT_TARGET_TRIPLE=${TARGET_TRIPLE}
383 -DLLVM_ENABLE_PROJECTS_USED=${LLVM_ENABLE_PROJECTS_USED}
384 -DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=ON
385 -DCMAKE_C_COMPILER_TARGET=${TARGET_TRIPLE}
386 -DCMAKE_CXX_COMPILER_TARGET=${TARGET_TRIPLE}
387 -DCMAKE_ASM_COMPILER_TARGET=${TARGET_TRIPLE}
388 -DCMAKE_C_COMPILER_WORKS=ON
389 -DCMAKE_CXX_COMPILER_WORKS=ON
390 -DCMAKE_ASM_COMPILER_WORKS=ON
391 PASSTHROUGH_PREFIXES LLVM_ENABLE_RUNTIMES
393 EXTRA_TARGETS ${extra_targets}
397 ${SUB_INSTALL_TARGETS}
402 # runtime_register_target(target)
403 # Utility function to register external runtime target.
404 function(runtime_register_target name target)
405 cmake_parse_arguments(ARG "" "" "DEPENDS" ${ARGN})
406 include(${LLVM_BINARY_DIR}/runtimes/${name}/Components.cmake OPTIONAL)
407 set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS ${LLVM_BINARY_DIR}/runtimes/${name}/Components.cmake)
409 set(${name}_deps ${ARG_DEPENDS})
410 if(NOT name STREQUAL target)
411 list(APPEND ${name}_deps runtimes-${target})
414 foreach(runtime_name ${runtime_names})
415 set(${runtime_name}-${name} ${runtime_name})
416 set(install-${runtime_name}-${name} install-${runtime_name})
417 set(install-${runtime_name}-${name}-stripped install-${runtime_name}-stripped)
418 list(APPEND ${name}_extra_targets ${runtime_name}-${name} install-${runtime_name}-${name} install-${runtime_name}-${name}-stripped)
419 if(LLVM_INCLUDE_TESTS)
420 set(check-${runtime_name}-${name} check-${runtime_name} )
421 list(APPEND ${name}_test_targets check-${runtime_name}-${name})
425 foreach(target_name IN LISTS SUB_COMPONENTS SUB_INSTALL_TARGETS)
426 set(${target_name}-${name} ${target_name})
427 list(APPEND ${name}_extra_targets ${target_name}-${name})
430 foreach(component ${LLVM_RUNTIME_DISTRIBUTION_COMPONENTS})
431 set(${component}-${name} ${component})
432 set(install-${component}-${name} ${component})
433 list(APPEND ${name}_extra_targets ${component}-${name} install-${component}-${name})
436 if(LLVM_INCLUDE_TESTS)
437 set(runtimes-test-depends-${name} runtimes-test-depends)
438 set(check-runtimes-${name} check-runtimes)
439 list(APPEND ${name}_test_targets runtimes-test-depends-${name} check-runtimes-${name})
440 foreach(target_name IN LISTS SUB_CHECK_TARGETS)
441 set(${target_name}-${name} ${target_name})
442 list(APPEND ${name}_test_targets ${target_name}-${name})
443 list(APPEND test_targets ${target_name}-${name})
445 set(test_targets "${test_targets}" PARENT_SCOPE)
448 get_cmake_property(variableNames VARIABLES)
449 foreach(variableName ${variableNames})
450 string(FIND "${variableName}" "RUNTIMES_${name}_" out)
452 string(REPLACE "RUNTIMES_${name}_" "" new_name ${variableName})
453 list(APPEND ${name}_extra_args "-D${new_name}=${${variableName}}")
455 string(FIND "${variableName}" "RUNTIMES_${target}_" out)
457 string(REPLACE "RUNTIMES_${target}_" "" new_name ${variableName})
458 list(APPEND ${name}_extra_args "-D${new_name}=${${variableName}}")
462 if(target IN_LIST LLVM_RUNTIME_BUILD_ID_LINK_TARGETS)
463 list(APPEND EXTRA_ARGS STRIP_TOOL ${CMAKE_CURRENT_BINARY_DIR}/llvm-strip-link)
466 llvm_ExternalProject_Add(runtimes-${name}
467 ${CMAKE_CURRENT_SOURCE_DIR}
468 DEPENDS ${${name}_deps} ${CXX_HEADER_TARGET}
469 # Builtins were built separately above
470 CMAKE_ARGS -DCOMPILER_RT_BUILD_BUILTINS=Off
471 -DLLVM_INCLUDE_TESTS=${LLVM_INCLUDE_TESTS}
472 -DLLVM_DEFAULT_TARGET_TRIPLE=${target}
473 -DLLVM_ENABLE_PROJECTS_USED=${LLVM_ENABLE_PROJECTS_USED}
474 -DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=ON
475 -DCMAKE_C_COMPILER_TARGET=${target}
476 -DCMAKE_CXX_COMPILER_TARGET=${target}
477 -DCMAKE_ASM_COMPILER_TARGET=${target}
478 -DCMAKE_C_COMPILER_WORKS=ON
479 -DCMAKE_CXX_COMPILER_WORKS=ON
480 -DCMAKE_ASM_COMPILER_WORKS=ON
481 -DCOMPILER_RT_DEFAULT_TARGET_ONLY=ON
482 -DLLVM_RUNTIMES_TARGET=${name}
483 ${${name}_extra_args}
484 PASSTHROUGH_PREFIXES LLVM_ENABLE_RUNTIMES
485 TOOLCHAIN_TOOLS clang lld llvm-ar llvm-ranlib llvm-nm llvm-objcopy llvm-objdump llvm-strip
486 EXTRA_TARGETS ${${name}_extra_targets}
487 ${${name}_test_targets}
493 # Create a runtimes target that uses this file as its top-level CMake file.
494 # The runtimes target is a configuration of all the runtime libraries
495 # together in a single CMake invocaiton.
496 if(NOT LLVM_RUNTIME_TARGETS)
497 runtime_default_target(
499 PREFIXES ${prefixes})
501 if("default" IN_LIST LLVM_RUNTIME_TARGETS)
502 runtime_default_target(
504 PREFIXES ${prefixes})
505 list(REMOVE_ITEM LLVM_RUNTIME_TARGETS "default")
507 add_custom_target(runtimes)
508 add_custom_target(runtimes-configure)
509 add_custom_target(install-runtimes)
510 add_custom_target(install-runtimes-stripped)
511 if(LLVM_INCLUDE_TESTS)
512 add_custom_target(check-runtimes)
513 add_custom_target(runtimes-test-depends)
516 if(LLVM_RUNTIME_DISTRIBUTION_COMPONENTS)
517 foreach(component ${LLVM_RUNTIME_DISTRIBUTION_COMPONENTS})
518 add_custom_target(${component})
519 add_custom_target(install-${component})
524 foreach(name ${LLVM_RUNTIME_TARGETS})
525 runtime_register_target(${name} ${name}
528 add_dependencies(runtimes runtimes-${name})
529 add_dependencies(runtimes-configure runtimes-${name}-configure)
530 add_dependencies(install-runtimes install-runtimes-${name})
531 add_dependencies(install-runtimes-stripped install-runtimes-${name}-stripped)
532 if(LLVM_INCLUDE_TESTS)
533 add_dependencies(check-runtimes check-runtimes-${name})
534 add_dependencies(runtimes-test-depends runtimes-test-depends-${name})
538 foreach(multilib ${LLVM_RUNTIME_MULTILIBS})
539 foreach(name ${LLVM_RUNTIME_MULTILIB_${multilib}_TARGETS})
540 runtime_register_target(${name}+${multilib} ${name}
541 DEPENDS runtimes-${name}
542 CMAKE_ARGS -DLLVM_RUNTIMES_PREFIX=${name}/
543 -DLLVM_RUNTIMES_LIBDIR_SUBDIR=${multilib})
544 add_dependencies(runtimes runtimes-${name}+${multilib})
545 add_dependencies(runtimes-configure runtimes-${name}+${multilib}-configure)
546 add_dependencies(install-runtimes install-runtimes-${name}+${multilib})
547 add_dependencies(install-runtimes-stripped install-runtimes-${name}+${multilib}-stripped)
552 # TODO: This is a hack needed because the libcxx headers are copied into the
553 # build directory during configuration. Without that step the clang in the
554 # build directory cannot find the C++ headers in certain configurations.
555 # I need to build a mechanism for runtime projects to provide CMake code
556 # that executes at LLVM configuration time to handle this case.
557 if(NOT LLVM_BUILD_INSTRUMENTED AND CLANG_ENABLE_BOOTSTRAP)
558 add_dependencies(clang-bootstrap-deps runtimes-configure)
561 if(LLVM_INCLUDE_TESTS)
562 set_property(GLOBAL APPEND PROPERTY LLVM_ADDITIONAL_TEST_DEPENDS runtimes-test-depends)
563 set_property(GLOBAL APPEND PROPERTY LLVM_ADDITIONAL_TEST_TARGETS check-runtimes)
565 set(RUNTIMES_TEST_DEPENDS
578 foreach(target ${test_targets} ${SUB_CHECK_TARGETS})
579 add_dependencies(${target} ${RUNTIMES_TEST_DEPENDS})