[Bf-blender-cvs] [77e6f22] master: Cycles: Allow paths customization via environment variables
Sergey Sharybin
noreply at git.blender.org
Sun Feb 1 22:02:26 CET 2015
Commit: 77e6f2212f4129a2b9160c7042ba81654e849b1e
Author: Sergey Sharybin
Date: Sat Jan 31 15:40:09 2015 +0500
Branches: master
https://developer.blender.org/rB77e6f2212f4129a2b9160c7042ba81654e849b1e
Cycles: Allow paths customization via environment variables
This is for development and test environment setup only, not for
regular users usage hence no mentioning in the man page needed.
===================================================================
M intern/cycles/device/device_cuda.cpp
M intern/cycles/util/util_path.cpp
===================================================================
diff --git a/intern/cycles/device/device_cuda.cpp b/intern/cycles/device/device_cuda.cpp
index 7f2f141..f6ad6c0 100644
--- a/intern/cycles/device/device_cuda.cpp
+++ b/intern/cycles/device/device_cuda.cpp
@@ -282,6 +282,10 @@ public:
if(experimental)
command += " -D__KERNEL_CUDA_EXPERIMENTAL__";
+ if(getenv("CYCLES_CUDA_EXTRA_CFLAGS")) {
+ command += string(" ") + getenv("CYCLES_CUDA_EXTRA_CFLAGS");
+ }
+
#ifdef WITH_CYCLES_DEBUG
command += " -D__KERNEL_DEBUG__";
#endif
diff --git a/intern/cycles/util/util_path.cpp b/intern/cycles/util/util_path.cpp
index b688033..a3dbad0 100644
--- a/intern/cycles/util/util_path.cpp
+++ b/intern/cycles/util/util_path.cpp
@@ -49,6 +49,25 @@ static string from_boost(const boost::filesystem::path& path)
return path.string().c_str();
}
+static char *path_specials(const string& sub)
+{
+ static bool env_init = false;
+ static char *env_shader_path;
+ static char *env_kernel_path;
+ if(!env_init) {
+ env_shader_path = getenv("CYCLES_SHADER_PATH");
+ env_kernel_path = getenv("CYCLES_KERNEL_PATH");
+ env_init = true;
+ }
+ if(env_shader_path != NULL && sub == "shader") {
+ return env_shader_path;
+ }
+ else if(env_shader_path != NULL && sub == "kernel") {
+ return env_kernel_path;
+ }
+ return NULL;
+}
+
void path_init(const string& path, const string& user_path)
{
cached_path = path;
@@ -62,6 +81,10 @@ void path_init(const string& path, const string& user_path)
string path_get(const string& sub)
{
+ char *special = path_specials(sub);
+ if(special != NULL)
+ return special;
+
if(cached_path == "")
cached_path = path_dirname(Sysutil::this_program_path());
More information about the Bf-blender-cvs
mailing list