[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [51406] trunk/blender/intern/cycles/util/ util_cuda.cpp: Cycles: suppress path to nvcc appearing in the console in cases
Sergey Sharybin
sergey.vfx at gmail.com
Thu Oct 18 15:48:03 CEST 2012
Revision: 51406
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=51406
Author: nazgul
Date: 2012-10-18 13:48:02 +0000 (Thu, 18 Oct 2012)
Log Message:
-----------
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)
Modified Paths:
--------------
trunk/blender/intern/cycles/util/util_cuda.cpp
Modified: trunk/blender/intern/cycles/util/util_cuda.cpp
===================================================================
--- trunk/blender/intern/cycles/util/util_cuda.cpp 2012-10-18 13:20:23 UTC (rev 51405)
+++ trunk/blender/intern/cycles/util/util_cuda.cpp 2012-10-18 13:48:02 UTC (rev 51406)
@@ -17,6 +17,7 @@
*/
#include <stdlib.h>
+#include <stdio.h>
#include "util_cuda.h"
#include "util_debug.h"
@@ -413,8 +414,18 @@
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 "";
More information about the Bf-blender-cvs
mailing list