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.
This commit is contained in:
parent
60c643d66a
commit
77e6f2212f
@ -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
|
||||
|
@ -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());
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user