Skip to content

Commit ad64159

Browse files
committed
Seek MKLROOT and /opt/intel/mkl
1 parent 68841d9 commit ad64159

File tree

1 file changed

+17
-2
lines changed

1 file changed

+17
-2
lines changed

intel-mkl-tool/src/entry.rs

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,8 @@ impl Targets {
3636
self.0.iter().any(|(_key, value)| value.is_some())
3737
}
3838

39-
fn seek(&mut self, dir: &Path) {
39+
fn seek<P: AsRef<Path>>(&mut self, dir: P) {
40+
let dir = dir.as_ref();
4041
for (key, value) in &mut self.0 {
4142
if dir.join(key).exists() {
4243
value.get_or_insert(dir.canonicalize().unwrap());
@@ -95,10 +96,24 @@ impl Entry {
9596
}
9697
}
9798

98-
// XDG_DATA_HOME
99+
// $XDG_DATA_HOME/intel-mkl-tool
99100
let path = xdg_home_path().join(config.name());
100101
targets.seek(&path);
101102

103+
// $MKLROOT
104+
let mkl_root = std::env::var("MKLROOT").map(|path| PathBuf::from(path));
105+
if let Ok(path) = mkl_root {
106+
if path.exists() {
107+
targets.seek(path.join("lib/intel64"));
108+
}
109+
}
110+
111+
// /opt/intel/mkl
112+
let opt_mkl = PathBuf::from("/opt/intel/mkl");
113+
if opt_mkl.exists() {
114+
targets.seek(opt_mkl.join("lib/intel64"));
115+
}
116+
102117
if targets.found_any() {
103118
return Ok(Self { config, targets });
104119
} else {

0 commit comments

Comments
 (0)