[llvm] 43d90f3 - [libc] Only add extra runtime dependencies if the target exists
Joseph Huber via llvm-commits
llvm-commits at lists.llvm.org
Wed Apr 5 13:31:49 PDT 2023
Author: Joseph Huber
Date: 2023-04-05T15:31:38-05:00
New Revision: 43d90f3056f91198169505eb2c8ccf47f384b877
URL: https://github.com/llvm/llvm-project/commit/43d90f3056f91198169505eb2c8ccf47f384b877
DIFF: https://github.com/llvm/llvm-project/commit/43d90f3056f91198169505eb2c8ccf47f384b877.diff
LOG: [libc] Only add extra runtime dependencies if the target exists
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`.
Added:
Modified:
libc/cmake/modules/prepare_libc_gpu_build.cmake
llvm/runtimes/CMakeLists.txt
Removed:
################################################################################
diff --git a/libc/cmake/modules/prepare_libc_gpu_build.cmake b/libc/cmake/modules/prepare_libc_gpu_build.cmake
index 9e0ce79ce565..21851285c624 100644
--- a/libc/cmake/modules/prepare_libc_gpu_build.cmake
+++ b/libc/cmake/modules/prepare_libc_gpu_build.cmake
@@ -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()
diff --git a/llvm/runtimes/CMakeLists.txt b/llvm/runtimes/CMakeLists.txt
index d47a2d5ee7e3..8cf436536309 100644
--- a/llvm/runtimes/CMakeLists.txt
+++ b/llvm/runtimes/CMakeLists.txt
@@ -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)
More information about the llvm-commits
mailing list