[clang] [CUDA][Windows] detect installation via CUDA_PATH environment variable (PR #135299)
via cfe-commits
cfe-commits at lists.llvm.org
Thu Apr 10 19:34:37 PDT 2025
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-clang-driver
Author: None (SquallATF)
<details>
<summary>Changes</summary>
On Windows platforms, this patch enables detection of the CUDA installation directory by checking the CUDA_PATH environment variable.
---
Full diff: https://github.com/llvm/llvm-project/pull/135299.diff
1 Files Affected:
- (modified) clang/lib/Driver/ToolChains/Cuda.cpp (+5)
``````````diff
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" +
``````````
</details>
https://github.com/llvm/llvm-project/pull/135299
More information about the cfe-commits
mailing list