Skip to content

Commit

Permalink
[libc] Only add extra runtime dependencies if the target exists
Browse files Browse the repository at this point in the history
Summary:
If the target for these tools doesn't exist we should simply assume that
they will be provided externally. This allows building `libc` standalone
with an external installation of `clang`.
  • Loading branch information
jhuber6 committed Apr 5, 2023
1 parent c61f45f commit 43d90f3
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
1 change: 0 additions & 1 deletion libc/cmake/modules/prepare_libc_gpu_build.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,5 @@ if(LIBC_GPU_TARGET_ARCHITECTURE_IS_NVPTX)
find_package(CUDAToolkit QUIET)
if(CUDAToolkit_FOUND)
get_filename_component(LIBC_CUDA_ROOT "${CUDAToolkit_BIN_DIR}" DIRECTORY ABSOLUTE)
message(WARNING ${LIBC_CUDA_ROOT})
endif()
endif()
6 changes: 5 additions & 1 deletion llvm/runtimes/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,11 @@ if(runtimes)
message(FATAL_ERROR "libc-hdrgen target missing unexpectedly")
endif()
if(LIBC_GPU_BUILD OR LIBC_GPU_ARCHITECTURES)
list(APPEND extra_deps clang-offload-packager nvptx-arch amdgpu-arch)
foreach(dep clang-offload-packager nvptx-arch amdgpu-arch)
if(TARGET ${dep})
list(APPEND extra_deps ${dep})
endif()
endforeach()
endif()
endif()
if(NOT LLVM_RUNTIME_TARGETS)
Expand Down

0 comments on commit 43d90f3

Please sign in to comment.