diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2012-10-18 17:48:02 +0400 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2012-10-18 17:48:02 +0400 |
commit | b861f8c3f82110de414f30e401163d23ede738eb (patch) | |
tree | d53fdc413c8a699720c82e22b41dfadc83ef373d /intern | |
parent | 92219991789557648bb187efa5823b941bdbfc90 (diff) |
Cycles: suppress path to nvcc appearing in the console in cases
cuda toolkit is installed to different place than /usr/local/cuda
(i.e. happens when using cuda toolkit from repository)
Diffstat (limited to 'intern')
-rw-r--r-- | intern/cycles/util/util_cuda.cpp | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/intern/cycles/util/util_cuda.cpp b/intern/cycles/util/util_cuda.cpp index 2960022fd8d..2716f00e173 100644 --- a/intern/cycles/util/util_cuda.cpp +++ b/intern/cycles/util/util_cuda.cpp @@ -17,6 +17,7 @@ */ #include <stdlib.h> +#include <stdio.h> #include "util_cuda.h" #include "util_debug.h" @@ -413,8 +414,18 @@ string cuCompilerPath() return nvcc; #ifndef _WIN32 - if(system("which nvcc") == 0) - return "nvcc"; + { + FILE *handle = popen("which nvcc", "r"); + if(handle) { + char buffer[4096] = {0}; + int len = fread(buffer, 1, sizeof(buffer) - 1, handle); + buffer[len] = '\0'; + pclose(handle); + + if(buffer[0]) + return "nvcc"; + } + } #endif return ""; |