[DAGCombiner] Add target hook function to decide folding (mul (add x, c1), c2)
[llvm-project.git] / llvm / runtimes / CMakeLists.txt
blobb972933b1f795fe8cb1d3ea1ecdcfc6b6b10c4e2
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.
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.
10 set(LLVM_ALL_RUNTIMES "compiler-rt;libc;libcxx;libcxxabi;libunwind;openmp")
11 set(LLVM_ENABLE_RUNTIMES "" CACHE STRING
12   "Semicolon-separated list of runtimes to build (${LLVM_ALL_RUNTIMES}), or \"all\".")
13 if(LLVM_ENABLE_RUNTIMES STREQUAL "all" )
14   set(LLVM_ENABLE_RUNTIMES ${LLVM_ALL_RUNTIMES})
15 endif()
16 foreach(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}")
26 endforeach()
28 function(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()
36 endfunction()
38 include(LLVMExternalProjectUtils)
40 if(NOT LLVM_BUILD_RUNTIMES)
41   set(EXTRA_ARGS EXCLUDE_FROM_ALL)
42 endif()
44 function(check_apple_target triple builtin_or_runtime)
45   set(error "\
46 compiler-rt for Darwin builds for all platforms and architectures using a \
47 single configuration. Specify only a single darwin triple (e.g. x86_64-apple-darwin) \
48 in your targets list (and not a triple for a specific platform such as macos). \
49 You can use variables such as COMPILER_RT_ENABLE_IOS and DARWIN_ios_ARCHS to \
50 control the specific platforms and architectures to build.")
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()
70 endfunction()
72 function(builtin_default_target compiler_rt_path)
73   cmake_parse_arguments(ARG "" "" "DEPENDS" ${ARGN})
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()
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})
95 endfunction()
97 function(builtin_register_target compiler_rt_path target)
98   cmake_parse_arguments(ARG "" "" "DEPENDS" ${ARGN})
100   check_apple_target(${target} builtin)
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()
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})
126 endfunction()
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.
131 get_compiler_rt_path(compiler_rt_path)
132 if(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()
147     foreach(target ${LLVM_BUILTIN_TARGETS})
148       builtin_register_target(${compiler_rt_path} ${target}
149         DEPENDS clang-resource-headers)
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()
162 endif()
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.
167 foreach(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()
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})
192 endforeach()
194 function(runtime_default_target)
195   cmake_parse_arguments(ARG "" "" "DEPENDS;PREFIXES" ${ARGN})
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)
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()
216   if(LLVM_INCLUDE_TESTS)
217     list(APPEND test_targets runtimes-test-depends check-runtimes)
218   endif()
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()
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})
250 endfunction()
252 # runtime_register_target(target)
253 #   Utility function to register external runtime target.
254 function(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)
259   check_apple_target(${target} runtime)
261   set(${name}_deps ${ARG_DEPENDS})
262   if(NOT name STREQUAL target)
263     list(APPEND ${name}_deps runtimes-${target})
264   endif()
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()
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()
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()
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()
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()
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()
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})
347 endfunction()
349 if(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   if("openmp" IN_LIST LLVM_ENABLE_RUNTIMES)
354     message(STATUS "Adding dependencies opt llvm-link")
355     set(extra_deps opt llvm-link)
356   endif()
357   if(NOT LLVM_RUNTIME_TARGETS)
358     runtime_default_target(
359       DEPENDS ${deps} ${extra_deps}
360       PREFIXES ${prefixes})
361     set(test_targets check-runtimes)
362   else()
363     if("default" IN_LIST LLVM_RUNTIME_TARGETS)
364       runtime_default_target(
365         DEPENDS ${deps} ${extra_deps}
366         PREFIXES ${prefixes})
367       list(REMOVE_ITEM LLVM_RUNTIME_TARGETS "default")
368     else()
369       add_custom_target(runtimes)
370       add_custom_target(runtimes-configure)
371       add_custom_target(install-runtimes)
372       add_custom_target(install-runtimes-stripped)
373       if(LLVM_INCLUDE_TESTS)
374         add_custom_target(check-runtimes)
375         add_custom_target(runtimes-test-depends)
376         set(test_targets "")
377       endif()
378       foreach(runtime_name ${runtime_names})
379         add_custom_target(${runtime_name})
380         add_custom_target(install-${runtime_name})
381         add_custom_target(install-${runtime_name}-stripped)
382       endforeach()
383       if(LLVM_RUNTIME_DISTRIBUTION_COMPONENTS)
384         foreach(component ${LLVM_RUNTIME_DISTRIBUTION_COMPONENTS})
385           add_custom_target(${component})
386           add_custom_target(install-${component})
387           add_custom_target(install-${component}-stripped)
388         endforeach()
389       endif()
390     endif()
392     foreach(name ${LLVM_RUNTIME_TARGETS})
393       runtime_register_target(${name} ${name}
394         DEPENDS ${deps})
396       add_dependencies(runtimes runtimes-${name})
397       add_dependencies(runtimes-configure runtimes-${name}-configure)
398       add_dependencies(install-runtimes install-runtimes-${name})
399       add_dependencies(install-runtimes-stripped install-runtimes-${name}-stripped)
400       if(LLVM_INCLUDE_TESTS)
401         add_dependencies(check-runtimes check-runtimes-${name})
402         add_dependencies(runtimes-test-depends runtimes-test-depends-${name})
403       endif()
404       foreach(runtime_name ${runtime_names})
405         add_dependencies(${runtime_name} ${runtime_name}-${name})
406         add_dependencies(install-${runtime_name} install-${runtime_name}-${name})
407         add_dependencies(install-${runtime_name}-stripped install-${runtime_name}-${name}-stripped)
408       endforeach()
409       foreach(component ${LLVM_RUNTIME_DISTRIBUTION_COMPONENTS})
410         add_dependencies(${component} ${component}-${name})
411         add_dependencies(install-${component} install-${component}-${name})
412         add_dependencies(install-${component}-stripped install-${component}-${name}-stripped)
413       endforeach()
414     endforeach()
416     foreach(multilib ${LLVM_RUNTIME_MULTILIBS})
417       foreach(name ${LLVM_RUNTIME_MULTILIB_${multilib}_TARGETS})
418         runtime_register_target(${name}+${multilib} ${name}
419           DEPENDS runtimes-${name}
420           CMAKE_ARGS -DLLVM_RUNTIMES_PREFIX=${name}/
421                      -DLLVM_RUNTIMES_LIBDIR_SUBDIR=${multilib})
422         add_dependencies(runtimes runtimes-${name}+${multilib})
423         add_dependencies(runtimes-configure runtimes-${name}+${multilib}-configure)
424         add_dependencies(install-runtimes install-runtimes-${name}+${multilib})
425         add_dependencies(install-runtimes-stripped install-runtimes-${name}+${multilib}-stripped)
426         foreach(runtime_name ${runtime_names})
427           add_dependencies(${runtime_name} ${runtime_name}-${name}+${multilib})
428           add_dependencies(install-${runtime_name} install-${runtime_name}-${name}+${multilib})
429           add_dependencies(install-${runtime_name}-stripped install-${runtime_name}-${name}+${multilib}-stripped)
430         endforeach()
431         foreach(component ${LLVM_RUNTIME_DISTRIBUTION_COMPONENTS})
432           add_dependencies(${component} ${component}-${name}+${multilib})
433           add_dependencies(install-${component} install-${component}-${name}+${multilib})
434           add_dependencies(install-${component}-stripped install-${component}-${name}+${multilib}-stripped)
435         endforeach()
436       endforeach()
437     endforeach()
438   endif()
440   if(NOT LLVM_BUILD_INSTRUMENTED AND CLANG_ENABLE_BOOTSTRAP)
441     # TODO: This is a hack needed because the libcxx headers are copied into the
442     # build directory during configuration. Without that step the clang in the
443     # build directory cannot find the C++ headers in certain configurations.
444     # I need to build a mechanism for runtime projects to provide CMake code
445     # that executes at LLVM configuration time to handle this case.
446     add_dependencies(clang-bootstrap-deps runtimes-configure)
447     # We need to add the runtimes as a dependency because compiler-rt can be
448     # built as part of runtimes and we need the profile runtime for PGO
449     add_dependencies(clang-bootstrap-deps runtimes)
450   endif()
452   if(LLVM_INCLUDE_TESTS)
453     set_property(GLOBAL APPEND PROPERTY LLVM_ADDITIONAL_TEST_DEPENDS runtimes-test-depends)
454     set_property(GLOBAL APPEND PROPERTY LLVM_ADDITIONAL_TEST_TARGETS check-runtimes)
456     set(RUNTIMES_TEST_DEPENDS
457         FileCheck
458         count
459         llvm-nm
460         llvm-objdump
461         llvm-xray
462         not
463         obj2yaml
464         sancov
465         sanstats
466         gtest_main
467         gtest
468       )
469     foreach(target ${test_targets} ${SUB_CHECK_TARGETS})
470       add_dependencies(${target} ${RUNTIMES_TEST_DEPENDS})
471     endforeach()
472   endif()
473 endif()