[PATCH] D114601: Read path to CUDA from env. variable CUDA_PATH on Windows

Mojca Miklavec via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Nov 25 08:27:16 PST 2021


mojca updated this revision to Diff 389811.

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D114601/new/

https://reviews.llvm.org/D114601

Files:
  clang/lib/Driver/ToolChains/Cuda.cpp


Index: clang/lib/Driver/ToolChains/Cuda.cpp
===================================================================
--- clang/lib/Driver/ToolChains/Cuda.cpp
+++ clang/lib/Driver/ToolChains/Cuda.cpp
@@ -134,10 +134,11 @@
     Candidates.emplace_back(
         Args.getLastArgValue(clang::driver::options::OPT_cuda_path_EQ).str());
   } else if (HostTriple.isOSWindows()) {
-    for (const char *Ver : Versions)
-      Candidates.emplace_back(
-          D.SysRoot + "/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v" +
-          Ver);
+    if (Optional<std::string> CudaPathValue =
+            llvm::sys::Process::GetEnv("CUDA_PATH")) {
+      StringRef CudaPath = *CudaPathValue;
+      Candidates.emplace_back(CudaPath.str());
+    }
   } else {
     if (!Args.hasArg(clang::driver::options::OPT_cuda_path_ignore_env)) {
       // Try to find ptxas binary. If the executable is located in a directory


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D114601.389811.patch
Type: text/x-patch
Size: 902 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20211125/4806d98a/attachment.bin>


More information about the cfe-commits mailing list