diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2015-01-31 13:40:09 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2015-02-02 00:02:10 +0300 |
commit | 77e6f2212f4129a2b9160c7042ba81654e849b1e (patch) | |
tree | fc61e342da7ba6e937d7e5aed423bcaffe96a998 /intern | |
parent | 60c643d66af32089b3f8330215b31a9dd4bc3a6d (diff) |
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.
Diffstat (limited to 'intern')
-rw-r--r-- | intern/cycles/device/device_cuda.cpp | 4 | ||||
-rw-r--r-- | intern/cycles/util/util_path.cpp | 23 |
2 files changed, 27 insertions, 0 deletions
diff --git a/intern/cycles/device/device_cuda.cpp b/intern/cycles/device/device_cuda.cpp index 7f2f141bd2f..f6ad6c01893 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 b688033fc9b..a3dbad08e32 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()); |