diff options
author | Andrzej Janik <[email protected]> | 2021-08-07 15:29:19 +0200 |
---|---|---|
committer | Andrzej Janik <[email protected]> | 2021-08-07 15:29:19 +0200 |
commit | 3070d983abeae1a8560adca9194ad24d1d6356b4 (patch) | |
tree | 5161587f1277b1b4c244aaaff8ad7005d5401a67 | |
parent | fefdd528d5330a02897c28c19ff083e879533a78 (diff) | |
download | ZLUDA-3070d983abeae1a8560adca9194ad24d1d6356b4.tar.gz ZLUDA-3070d983abeae1a8560adca9194ad24d1d6356b4.zip |
Take path to llvm-spirv from environment
-rw-r--r-- | zluda/src/impl/module.rs | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/zluda/src/impl/module.rs b/zluda/src/impl/module.rs index f6522f8..3635d29 100644 --- a/zluda/src/impl/module.rs +++ b/zluda/src/impl/module.rs @@ -148,11 +148,16 @@ impl SpirvModule { spirv_il: &[u8], ptx_lib: Option<(&'static [u8], &'static [u8])>, ) -> io::Result<Vec<u8>> { + use std::env; let dir = tempfile::tempdir()?; let mut spirv = NamedTempFile::new_in(&dir)?; let llvm = NamedTempFile::new_in(&dir)?; spirv.write_all(spirv_il)?; - let to_llvm_cmd = Command::new(Self::LLVM_SPIRV) + let llvm_spirv_path = match env::var("LLVM_SPIRV") { + Ok(path) => Cow::Owned(path), + Err(_) => Cow::Borrowed(Self::LLVM_SPIRV), + }; + let to_llvm_cmd = Command::new(&*llvm_spirv_path) .arg("-r") .arg("-o") .arg(llvm.path()) |