https://github.com/SquallATF created https://github.com/llvm/llvm-project/pull/135299
On Windows platforms, this patch enables detection of the CUDA installation directory by checking the CUDA_PATH environment variable. >From 8d67d96b7ae97bd2866753d7d5dbdff26e4c4200 Mon Sep 17 00:00:00 2001 From: Peiyuan Song <squall...@gmail.com> Date: Fri, 11 Apr 2025 09:45:27 +0800 Subject: [PATCH] [CUDA][Windows] detect installation via CUDA_PATH environment variable On Windows platforms, this patch enables detection of the CUDA installation directory by checking the CUDA_PATH environment variable. --- clang/lib/Driver/ToolChains/Cuda.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/clang/lib/Driver/ToolChains/Cuda.cpp b/clang/lib/Driver/ToolChains/Cuda.cpp index 06b0b0913d24e..f79968bbb5b65 100644 --- a/clang/lib/Driver/ToolChains/Cuda.cpp +++ b/clang/lib/Driver/ToolChains/Cuda.cpp @@ -158,6 +158,11 @@ CudaInstallationDetector::CudaInstallationDetector( Candidates.emplace_back( Args.getLastArgValue(clang::driver::options::OPT_cuda_path_EQ).str()); } else if (HostTriple.isOSWindows()) { + if (std::optional<std::string> CudaPath = + llvm::sys::Process::GetEnv("CUDA_PATH")) { + if (!CudaPath->empty()) + Candidates.emplace_back(std::move(*CudaPath)); + } for (const char *Ver : Versions) Candidates.emplace_back( D.SysRoot + "/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v" + _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits