[OpenMP] Add tool dependencies in runtimes mode
authorJoseph Huber <jhuber6@vols.utk.edu>
Wed, 5 Apr 2023 19:24:34 +0000 (14:24 -0500)
committerJoseph Huber <jhuber6@vols.utk.edu>
Wed, 5 Apr 2023 20:14:48 +0000 (15:14 -0500)
The OpenMP offloading device runtime depends on multiple tools. We
should ensure that these tools are build before invoking the OpenMP
build.

Reviewed By: tra

Differential Revision: https://reviews.llvm.org/D147654

llvm/runtimes/CMakeLists.txt

index b9e1f32..d47a2d5 100644 (file)
@@ -361,12 +361,11 @@ if(runtimes)
   # together in a single CMake invocation.
   set(extra_deps "")
   if("openmp" IN_LIST LLVM_ENABLE_RUNTIMES)
-    if(TARGET opt)
-      list(APPEND extra_deps opt)
-    endif()
-    if(TARGET llvm-link)
-      list(APPEND extra_deps llvm-link)
-    endif()
+    foreach(dep opt llvm-link llvm-extract clang clang-offload-packager)
+      if(TARGET ${dep} AND OPENMP_ENABLE_LIBOMPTARGET)
+        list(APPEND extra_deps ${dep})
+      endif()
+    endforeach()
   endif()
   if("libc" IN_LIST LLVM_ENABLE_RUNTIMES AND 
       (LLVM_LIBC_FULL_BUILD OR LIBC_GPU_BUILD OR LIBC_GPU_ARCHITECTURES))