xref: /openbsd/gnu/llvm/llvm/runtimes/CMakeLists.txt (revision 73471bf0)
1# TODO: This file assumes the Clang toolchain so it'd be better if it lived in
2# Clang, except there already is clang/runtime directory which contains
3# similar although simpler functionality. We should figure out how to merge
4# the two files.
5
6# TODO: Selecting runtimes should be always performed inside the runtimes
7# build, see runtimes/CMakeLists.txt, except that we currently check whether
8# compiler-rt is being built to determine whether to first build builtins
9# or not so we need that information in this file as well.
10set(LLVM_ALL_RUNTIMES "compiler-rt;libc;libcxx;libcxxabi;libunwind;openmp")
11set(LLVM_ENABLE_RUNTIMES "" CACHE STRING
12  "Semicolon-separated list of runtimes to build (${LLVM_ALL_RUNTIMES}), or \"all\".")
13if(LLVM_ENABLE_RUNTIMES STREQUAL "all" )
14  set(LLVM_ENABLE_RUNTIMES ${LLVM_ALL_RUNTIMES})
15endif()
16foreach(proj ${LLVM_ENABLE_RUNTIMES})
17  set(proj_dir "${CMAKE_CURRENT_SOURCE_DIR}/../../${proj}")
18  if(IS_DIRECTORY ${proj_dir} AND EXISTS ${proj_dir}/CMakeLists.txt)
19    list(APPEND runtimes ${proj_dir})
20  else()
21    message(FATAL_ERROR "LLVM_ENABLE_RUNTIMES requests ${proj} but directory not found: ${proj_dir}")
22  endif()
23  string(TOUPPER "${proj}" canon_name)
24  STRING(REGEX REPLACE "-" "_" canon_name ${canon_name})
25  set(LLVM_EXTERNAL_${canon_name}_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../../${proj}")
26endforeach()
27
28function(get_compiler_rt_path path)
29  foreach(entry ${runtimes})
30    get_filename_component(projName ${entry} NAME)
31    if("${projName}" MATCHES "compiler-rt")
32      set(${path} ${entry} PARENT_SCOPE)
33      return()
34    endif()
35  endforeach()
36endfunction()
37
38include(LLVMExternalProjectUtils)
39
40if(NOT LLVM_BUILD_RUNTIMES)
41  set(EXTRA_ARGS EXCLUDE_FROM_ALL)
42endif()
43
44function(check_apple_target triple builtin_or_runtime)
45  set(error "\
46compiler-rt for Darwin builds for all platforms and architectures using a \
47single configuration. Specify only a single darwin triple (e.g. x86_64-apple-darwin) \
48in your targets list (and not a triple for a specific platform such as macos). \
49You can use variables such as COMPILER_RT_ENABLE_IOS and DARWIN_ios_ARCHS to \
50control the specific platforms and architectures to build.")
51
52  set(seen_property ${builtin_or_runtime}_darwin_triple_seen)
53  string(REPLACE "-" ";" triple_components ${triple})
54  foreach(component ${triple_components})
55    string(TOLOWER "${component}" component_lower)
56    if(component_lower MATCHES "^darwin")
57      get_property(darwin_triple_seen GLOBAL PROPERTY ${seen_property})
58      if(darwin_triple_seen)
59        message(FATAL_ERROR "${error}")
60      endif()
61      set_property(GLOBAL PROPERTY ${seen_property} YES)
62      if(NOT RUNTIMES_BUILD_ALLOW_DARWIN)
63        message(FATAL_ERROR "\
64${error} Set RUNTIMES_BUILD_ALLOW_DARWIN to allow a single darwin triple.")
65      endif()
66    elseif(component_lower MATCHES "^ios|^macos|^tvos|^watchos")
67      message(FATAL_ERROR "${error}")
68    endif()
69  endforeach()
70endfunction()
71
72function(builtin_default_target compiler_rt_path)
73  cmake_parse_arguments(ARG "" "" "DEPENDS" ${ARGN})
74
75  set(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR_default ON)
76  # AIX should fold 32-bit & 64-bit arch libraries into a single archive.
77  if (TARGET_TRIPLE MATCHES "aix")
78    set(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR_default OFF)
79  endif()
80
81  llvm_ExternalProject_Add(builtins
82                           ${compiler_rt_path}/lib/builtins
83                           DEPENDS ${ARG_DEPENDS}
84                           CMAKE_ARGS -DLLVM_LIBRARY_OUTPUT_INTDIR=${LLVM_LIBRARY_DIR}
85                                      -DLLVM_RUNTIME_OUTPUT_INTDIR=${LLVM_TOOLS_BINARY_DIR}
86                                      -DLLVM_DEFAULT_TARGET_TRIPLE=${TARGET_TRIPLE}
87                                      -DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=${LLVM_ENABLE_PER_TARGET_RUNTIME_DIR_default}
88                                      -DCMAKE_C_COMPILER_WORKS=ON
89                                      -DCMAKE_ASM_COMPILER_WORKS=ON
90                                      ${BUILTINS_CMAKE_ARGS}
91                           PASSTHROUGH_PREFIXES COMPILER_RT
92                           USE_TOOLCHAIN
93                           TARGET_TRIPLE ${TARGET_TRIPLE}
94                           ${EXTRA_ARGS})
95endfunction()
96
97function(builtin_register_target compiler_rt_path target)
98  cmake_parse_arguments(ARG "" "" "DEPENDS" ${ARGN})
99
100  check_apple_target(${target} builtin)
101
102  get_cmake_property(variableNames VARIABLES)
103  foreach(variableName ${variableNames})
104    string(FIND "${variableName}" "BUILTINS_${target}" out)
105    if("${out}" EQUAL 0)
106      string(REPLACE "BUILTINS_${target}_" "" new_name ${variableName})
107      string(REPLACE ";" "|" new_value "${${variableName}}")
108      list(APPEND ${target}_extra_args "-D${new_name}=${new_value}")
109    endif()
110  endforeach()
111
112  llvm_ExternalProject_Add(builtins-${target}
113                           ${compiler_rt_path}/lib/builtins
114                           DEPENDS ${ARG_DEPENDS}
115                           CMAKE_ARGS -DLLVM_LIBRARY_OUTPUT_INTDIR=${LLVM_LIBRARY_DIR}
116                                      -DLLVM_RUNTIME_OUTPUT_INTDIR=${LLVM_TOOLS_BINARY_DIR}
117                                      -DLLVM_DEFAULT_TARGET_TRIPLE=${target}
118                                      -DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=ON
119                                      -DCMAKE_C_COMPILER_WORKS=ON
120                                      -DCMAKE_ASM_COMPILER_WORKS=ON
121                                      -DCOMPILER_RT_DEFAULT_TARGET_ONLY=ON
122                                      ${${target}_extra_args}
123                           USE_TOOLCHAIN
124                           TARGET_TRIPLE ${target}
125                           ${EXTRA_ARGS})
126endfunction()
127
128# If compiler-rt is present we need to build the builtin libraries first. This
129# is required because the other runtimes need the builtin libraries present
130# before the just-built compiler can pass the configuration tests.
131get_compiler_rt_path(compiler_rt_path)
132if(compiler_rt_path)
133  if(NOT LLVM_BUILTIN_TARGETS)
134    builtin_default_target(${compiler_rt_path}
135      DEPENDS clang-resource-headers)
136  else()
137    if("default" IN_LIST LLVM_BUILTIN_TARGETS)
138      builtin_default_target(${compiler_rt_path}
139        DEPENDS clang-resource-headers)
140      list(REMOVE_ITEM LLVM_BUILTIN_TARGETS "default")
141    else()
142      add_custom_target(builtins)
143      add_custom_target(install-builtins)
144      add_custom_target(install-builtins-stripped)
145    endif()
146
147    foreach(target ${LLVM_BUILTIN_TARGETS})
148      builtin_register_target(${compiler_rt_path} ${target}
149        DEPENDS clang-resource-headers)
150
151      add_dependencies(builtins builtins-${target})
152      add_dependencies(install-builtins install-builtins-${target})
153      add_dependencies(install-builtins-stripped install-builtins-${target}-stripped)
154    endforeach()
155  endif()
156  set(deps builtins)
157  # We don't need to depend on the builtins if we're building instrumented
158  # because the next stage will use the same compiler used to build this stage.
159  if(NOT LLVM_BUILD_INSTRUMENTED AND CLANG_ENABLE_BOOTSTRAP)
160    add_dependencies(clang-bootstrap-deps builtins)
161  endif()
162endif()
163
164# We create a list the names of all the runtime projects in all uppercase and
165# with dashes turned to underscores. This gives us the CMake variable prefixes
166# for all variables that will apply to runtimes.
167foreach(entry ${runtimes})
168  get_filename_component(projName ${entry} NAME)
169  if(projName STREQUAL "libc")
170    # For now, we will use the name "llvmlibc" for the libc project as it is
171    # not a full libc yet. Also, if we leave it as is, the "lib" prefix gets
172    # stripped below and the targets endup having the name "c", "check-c" etc.
173    set(projName "llvmlibc")
174  endif()
175  string(REPLACE "-" "_" canon_name ${projName})
176  string(TOUPPER ${canon_name} canon_name)
177  list(APPEND prefixes ${canon_name})
178  if (${canon_name} STREQUAL "OPENMP")
179    list(APPEND prefixes "LIBOMP" "LIBOMPTARGET")
180  endif()
181  # Many compiler-rt options start with SANITIZER_ rather than COMPILER_RT_,
182  # so when compiler-rt is enabled, consider both.
183  if(canon_name STREQUAL "COMPILER_RT")
184    list(APPEND prefixes SANITIZER)
185  endif()
186
187  string(FIND ${projName} "lib" LIB_IDX)
188  if(LIB_IDX EQUAL 0)
189    string(SUBSTRING ${projName} 3 -1 projName)
190  endif()
191  list(APPEND runtime_names ${projName})
192endforeach()
193
194function(runtime_default_target)
195  cmake_parse_arguments(ARG "" "" "DEPENDS;PREFIXES" ${ARGN})
196
197  include(${LLVM_BINARY_DIR}/runtimes/Components.cmake OPTIONAL)
198  set(SUB_CHECK_TARGETS ${SUB_CHECK_TARGETS} PARENT_SCOPE)
199  set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS ${LLVM_BINARY_DIR}/runtimes/Components.cmake)
200
201  foreach(runtime_name ${runtime_names})
202    list(APPEND extra_targets
203      ${runtime_name}
204      install-${runtime_name}
205      install-${runtime_name}-stripped)
206    if(LLVM_INCLUDE_TESTS)
207      list(APPEND test_targets check-${runtime_name})
208    endif()
209  endforeach()
210  foreach(component ${LLVM_RUNTIME_DISTRIBUTION_COMPONENTS})
211    if(NOT ${component} IN_LIST SUB_COMPONENTS)
212      list(APPEND extra_targets ${component} install-${component} install-${component}-stripped)
213    endif()
214  endforeach()
215
216  if(LLVM_INCLUDE_TESTS)
217    list(APPEND test_targets runtimes-test-depends check-runtimes)
218  endif()
219
220  set(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR_default ON)
221  # AIX should fold 32-bit & 64-bit arch libraries into a single archive.
222  if (TARGET_TRIPLE MATCHES "aix")
223    set(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR_default OFF)
224  endif()
225
226  llvm_ExternalProject_Add(runtimes
227                           ${CMAKE_CURRENT_SOURCE_DIR}/../../runtimes
228                           DEPENDS ${ARG_DEPENDS}
229                           # Builtins were built separately above
230                           CMAKE_ARGS -DCOMPILER_RT_BUILD_BUILTINS=Off
231                                      -DLLVM_INCLUDE_TESTS=${LLVM_INCLUDE_TESTS}
232                                      -DLLVM_DEFAULT_TARGET_TRIPLE=${TARGET_TRIPLE}
233                                      -DLLVM_ENABLE_PROJECTS_USED=${LLVM_ENABLE_PROJECTS_USED}
234                                      -DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=${LLVM_ENABLE_PER_TARGET_RUNTIME_DIR_default}
235                                      -DLLVM_BUILD_TOOLS=${LLVM_BUILD_TOOLS}
236                                      -DCMAKE_C_COMPILER_WORKS=ON
237                                      -DCMAKE_CXX_COMPILER_WORKS=ON
238                                      -DCMAKE_ASM_COMPILER_WORKS=ON
239                                      ${RUNTIMES_CMAKE_ARGS}
240                           PASSTHROUGH_PREFIXES LLVM_ENABLE_RUNTIMES
241                                                ${ARG_PREFIXES}
242                           EXTRA_TARGETS ${extra_targets}
243                                         ${test_targets}
244                                         ${SUB_COMPONENTS}
245                                         ${SUB_CHECK_TARGETS}
246                                         ${SUB_INSTALL_TARGETS}
247                           USE_TOOLCHAIN
248                           TARGET_TRIPLE ${TARGET_TRIPLE}
249                           ${EXTRA_ARGS})
250endfunction()
251
252# runtime_register_target(target)
253#   Utility function to register external runtime target.
254function(runtime_register_target name target)
255  cmake_parse_arguments(ARG "" "" "DEPENDS;CMAKE_ARGS" ${ARGN})
256  include(${LLVM_BINARY_DIR}/runtimes/${name}/Components.cmake OPTIONAL)
257  set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS ${LLVM_BINARY_DIR}/runtimes/${name}/Components.cmake)
258
259  check_apple_target(${target} runtime)
260
261  set(${name}_deps ${ARG_DEPENDS})
262  if(NOT name STREQUAL target)
263    list(APPEND ${name}_deps runtimes-${target})
264  endif()
265
266  foreach(runtime_name ${runtime_names})
267    set(${runtime_name}-${name} ${runtime_name})
268    set(install-${runtime_name}-${name} install-${runtime_name})
269    set(install-${runtime_name}-${name}-stripped install-${runtime_name}-stripped)
270    list(APPEND ${name}_extra_targets ${runtime_name}-${name} install-${runtime_name}-${name} install-${runtime_name}-${name}-stripped)
271    if(LLVM_INCLUDE_TESTS)
272      set(check-${runtime_name}-${name} check-${runtime_name} )
273      list(APPEND ${name}_test_targets check-${runtime_name}-${name})
274    endif()
275  endforeach()
276
277  foreach(target_name IN LISTS SUB_COMPONENTS SUB_INSTALL_TARGETS)
278    set(${target_name}-${name} ${target_name})
279    list(APPEND ${name}_extra_targets ${target_name}-${name})
280  endforeach()
281
282  foreach(component ${LLVM_RUNTIME_DISTRIBUTION_COMPONENTS})
283    set(${component}-${name} ${component})
284    set(install-${component}-${name} install-${component})
285    set(install-${component}-${name}-stripped install-${component}-stripped)
286    list(APPEND ${name}_extra_targets ${component}-${name} install-${component}-${name} install-${component}-${name}-stripped)
287  endforeach()
288
289  if(LLVM_INCLUDE_TESTS)
290    set(runtimes-test-depends-${name} runtimes-test-depends)
291    set(check-runtimes-${name} check-runtimes)
292    list(APPEND ${name}_test_targets runtimes-test-depends-${name} check-runtimes-${name})
293    foreach(target_name IN LISTS SUB_CHECK_TARGETS)
294      set(${target_name}-${name} ${target_name})
295      list(APPEND ${name}_test_targets ${target_name}-${name})
296      list(APPEND test_targets ${target_name}-${name})
297    endforeach()
298    set(test_targets "${test_targets}" PARENT_SCOPE)
299  endif()
300
301  set(${name}_extra_args ${ARG_CMAKE_ARGS})
302  get_cmake_property(variableNames VARIABLES)
303  foreach(variableName ${variableNames})
304    string(FIND "${variableName}" "RUNTIMES_${target}_" out)
305    if("${out}" EQUAL 0)
306      string(REPLACE "RUNTIMES_${target}_" "" new_name ${variableName})
307      string(REPLACE ";" "|" new_value "${${variableName}}")
308      list(APPEND ${name}_extra_args "-D${new_name}=${new_value}")
309    endif()
310  endforeach()
311  if(NOT "${name}" STREQUAL "${target}")
312    foreach(variableName ${variableNames})
313      string(FIND "${variableName}" "RUNTIMES_${name}_" out)
314      if("${out}" EQUAL 0)
315        string(REPLACE "RUNTIMES_${name}_" "" new_name ${variableName})
316        string(REPLACE ";" "|" new_value "${${variableName}}")
317        list(APPEND ${name}_extra_args "-D${new_name}=${new_value}")
318      endif()
319    endforeach()
320  endif()
321
322  if(NOT RUNTIMES_${name}_LLVM_ENABLE_RUNTIMES AND NOT RUNTIMES_${target}_LLVM_ENABLE_RUNTIMES)
323    string(REPLACE ";" "|" LLVM_ENABLE_RUNTIMES_PASSTHROUGH "${LLVM_ENABLE_RUNTIMES}")
324    list(APPEND ${name}_extra_args -DLLVM_ENABLE_RUNTIMES=${LLVM_ENABLE_RUNTIMES_PASSTHROUGH})
325  endif()
326
327  llvm_ExternalProject_Add(runtimes-${name}
328                           ${CMAKE_CURRENT_SOURCE_DIR}/../../runtimes
329                           DEPENDS ${${name}_deps}
330                           # Builtins were built separately above
331                           CMAKE_ARGS -DCOMPILER_RT_BUILD_BUILTINS=Off
332                                      -DLLVM_INCLUDE_TESTS=${LLVM_INCLUDE_TESTS}
333                                      -DLLVM_DEFAULT_TARGET_TRIPLE=${target}
334                                      -DLLVM_ENABLE_PROJECTS_USED=${LLVM_ENABLE_PROJECTS_USED}
335                                      -DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=ON
336                                      -DCMAKE_C_COMPILER_WORKS=ON
337                                      -DCMAKE_CXX_COMPILER_WORKS=ON
338                                      -DCMAKE_ASM_COMPILER_WORKS=ON
339                                      -DCOMPILER_RT_DEFAULT_TARGET_ONLY=ON
340                                      -DLLVM_RUNTIMES_TARGET=${name}
341                                      ${${name}_extra_args}
342                           EXTRA_TARGETS ${${name}_extra_targets}
343                                         ${${name}_test_targets}
344                           USE_TOOLCHAIN
345                           TARGET_TRIPLE ${target}
346                           ${EXTRA_ARGS})
347endfunction()
348
349if(runtimes)
350  # Create a runtimes target that uses this file as its top-level CMake file.
351  # The runtimes target is a configuration of all the runtime libraries
352  # together in a single CMake invocaiton.
353  set(extra_deps "")
354  if("openmp" IN_LIST LLVM_ENABLE_RUNTIMES)
355    if(TARGET opt)
356      list(APPEND extra_deps opt)
357    endif()
358    if(TARGET llvm-link)
359      list(APPEND extra_deps llvm-link)
360    endif()
361  endif()
362  if(NOT LLVM_RUNTIME_TARGETS)
363    runtime_default_target(
364      DEPENDS ${deps} ${extra_deps}
365      PREFIXES ${prefixes})
366    set(test_targets check-runtimes)
367  else()
368    if("default" IN_LIST LLVM_RUNTIME_TARGETS)
369      runtime_default_target(
370        DEPENDS ${deps} ${extra_deps}
371        PREFIXES ${prefixes})
372      list(REMOVE_ITEM LLVM_RUNTIME_TARGETS "default")
373    else()
374      add_custom_target(runtimes)
375      add_custom_target(runtimes-configure)
376      add_custom_target(install-runtimes)
377      add_custom_target(install-runtimes-stripped)
378      if(LLVM_INCLUDE_TESTS)
379        add_custom_target(check-runtimes)
380        add_custom_target(runtimes-test-depends)
381        set(test_targets "")
382      endif()
383      foreach(runtime_name ${runtime_names})
384        add_custom_target(${runtime_name})
385        add_custom_target(install-${runtime_name})
386        add_custom_target(install-${runtime_name}-stripped)
387      endforeach()
388      if(LLVM_RUNTIME_DISTRIBUTION_COMPONENTS)
389        foreach(component ${LLVM_RUNTIME_DISTRIBUTION_COMPONENTS})
390          add_custom_target(${component})
391          add_custom_target(install-${component})
392          add_custom_target(install-${component}-stripped)
393        endforeach()
394      endif()
395    endif()
396
397    foreach(name ${LLVM_RUNTIME_TARGETS})
398      runtime_register_target(${name} ${name}
399        DEPENDS ${deps})
400
401      add_dependencies(runtimes runtimes-${name})
402      add_dependencies(runtimes-configure runtimes-${name}-configure)
403      add_dependencies(install-runtimes install-runtimes-${name})
404      add_dependencies(install-runtimes-stripped install-runtimes-${name}-stripped)
405      if(LLVM_INCLUDE_TESTS)
406        add_dependencies(check-runtimes check-runtimes-${name})
407        add_dependencies(runtimes-test-depends runtimes-test-depends-${name})
408      endif()
409      foreach(runtime_name ${runtime_names})
410        add_dependencies(${runtime_name} ${runtime_name}-${name})
411        add_dependencies(install-${runtime_name} install-${runtime_name}-${name})
412        add_dependencies(install-${runtime_name}-stripped install-${runtime_name}-${name}-stripped)
413      endforeach()
414      foreach(component ${LLVM_RUNTIME_DISTRIBUTION_COMPONENTS})
415        add_dependencies(${component} ${component}-${name})
416        add_dependencies(install-${component} install-${component}-${name})
417        add_dependencies(install-${component}-stripped install-${component}-${name}-stripped)
418      endforeach()
419    endforeach()
420
421    foreach(multilib ${LLVM_RUNTIME_MULTILIBS})
422      foreach(name ${LLVM_RUNTIME_MULTILIB_${multilib}_TARGETS})
423        runtime_register_target(${name}+${multilib} ${name}
424          DEPENDS runtimes-${name}
425          CMAKE_ARGS -DLLVM_RUNTIMES_PREFIX=${name}/
426                     -DLLVM_RUNTIMES_LIBDIR_SUBDIR=${multilib})
427        add_dependencies(runtimes runtimes-${name}+${multilib})
428        add_dependencies(runtimes-configure runtimes-${name}+${multilib}-configure)
429        add_dependencies(install-runtimes install-runtimes-${name}+${multilib})
430        add_dependencies(install-runtimes-stripped install-runtimes-${name}+${multilib}-stripped)
431        foreach(runtime_name ${runtime_names})
432          add_dependencies(${runtime_name} ${runtime_name}-${name}+${multilib})
433          add_dependencies(install-${runtime_name} install-${runtime_name}-${name}+${multilib})
434          add_dependencies(install-${runtime_name}-stripped install-${runtime_name}-${name}+${multilib}-stripped)
435        endforeach()
436        foreach(component ${LLVM_RUNTIME_DISTRIBUTION_COMPONENTS})
437          add_dependencies(${component} ${component}-${name}+${multilib})
438          add_dependencies(install-${component} install-${component}-${name}+${multilib})
439          add_dependencies(install-${component}-stripped install-${component}-${name}+${multilib}-stripped)
440        endforeach()
441      endforeach()
442    endforeach()
443  endif()
444
445  if(NOT LLVM_BUILD_INSTRUMENTED AND CLANG_ENABLE_BOOTSTRAP)
446    # TODO: This is a hack needed because the libcxx headers are copied into the
447    # build directory during configuration. Without that step the clang in the
448    # build directory cannot find the C++ headers in certain configurations.
449    # I need to build a mechanism for runtime projects to provide CMake code
450    # that executes at LLVM configuration time to handle this case.
451    add_dependencies(clang-bootstrap-deps runtimes-configure)
452    # We need to add the runtimes as a dependency because compiler-rt can be
453    # built as part of runtimes and we need the profile runtime for PGO
454    add_dependencies(clang-bootstrap-deps runtimes)
455  endif()
456
457  if(LLVM_INCLUDE_TESTS)
458    set_property(GLOBAL APPEND PROPERTY LLVM_ADDITIONAL_TEST_DEPENDS runtimes-test-depends)
459    set_property(GLOBAL APPEND PROPERTY LLVM_ADDITIONAL_TEST_TARGETS check-runtimes)
460
461    set(RUNTIMES_TEST_DEPENDS
462        FileCheck
463        count
464        llvm-nm
465        llvm-objdump
466        llvm-xray
467        not
468        obj2yaml
469        sancov
470        sanstats
471        gtest_main
472        gtest
473      )
474    foreach(target ${test_targets} ${SUB_CHECK_TARGETS})
475      add_dependencies(${target} ${RUNTIMES_TEST_DEPENDS})
476    endforeach()
477  endif()
478endif()
479