Skip to content

Commit

Permalink
[runtimes] Fix OpenMP dependencies (#85977)
Browse files Browse the repository at this point in the history
When building the OpenMP runtime with libomptarget support, the runtimes
configure step needs to have a dependency on various tools, in
particular opt, so that cmake configure checks yield the correct
results.

This did not work correctly, as the dependencies were only added if the
OPENMP_ENABLE_LIBOMPTARGET was set - but that variable is only set by
the openmp/CMakeLists.txt file, which isn't even parsed during the
initial cmake run (in fact, it is only parsed when executing the
runtimes configure step itself, but then it is too late).

Fixed by just adding those dependencies always.

In addition, the list of dependencies collected in ${extra_deps},
including those required for OpenMP, was only actually used when
configuring runtimes for the default set of targets - when the user
specifies a non-default LLVM_RUNTIME_TARGETS, those extra dependencies
were ignored (with the exception of ${hdrgen_deps}).

Fixed by passing the full ${extra_deps} in this case as well.

Fixes: #85933
  • Loading branch information
uweigand committed Mar 21, 2024
1 parent cb07194 commit e8cf175
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions llvm/runtimes/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -435,7 +435,7 @@ if(runtimes)
list(APPEND extra_deps "flang-new")
endif()
foreach(dep opt llvm-link llvm-extract clang clang-offload-packager)
if(TARGET ${dep} AND OPENMP_ENABLE_LIBOMPTARGET)
if(TARGET ${dep})
list(APPEND extra_deps ${dep})
endif()
endforeach()
Expand Down Expand Up @@ -531,7 +531,7 @@ if(runtimes)
check_apple_target(${name} runtime)

runtime_register_target(${name}
DEPENDS ${builtins_dep_name} ${hdrgen_deps}
DEPENDS ${builtins_dep_name} ${extra_deps}
CMAKE_ARGS -DLLVM_DEFAULT_TARGET_TRIPLE=${name} ${libc_cmake_args}
EXTRA_ARGS TARGET_TRIPLE ${name})
endforeach()
Expand Down

0 comments on commit e8cf175

Please sign in to comment.