File tree Expand file tree Collapse file tree 2 files changed +14
-10
lines changed Expand file tree Collapse file tree 2 files changed +14
-10
lines changed Original file line number Diff line number Diff line change @@ -34,8 +34,15 @@ fn main() -> Fallible<()> {
34
34
intel_mkl_tool:: download ( & path) ?;
35
35
}
36
36
Opt :: Seek { } => {
37
- let paths = intel_mkl_tool:: seek ( ) . ok_or ( err_msg ( "MKL not found" ) ) ?;
38
- println ! ( "{}" , paths. display( ) ) ;
37
+ if let Some ( path) = intel_mkl_tool:: seek_pkg_config ( ) {
38
+ println ! ( "{}" , path. display( ) ) ;
39
+ return Ok ( ( ) ) ;
40
+ }
41
+ if let Some ( path) = intel_mkl_tool:: seek_home ( ) {
42
+ println ! ( "{}" , path. display( ) ) ;
43
+ return Ok ( ( ) ) ;
44
+ }
45
+ bail ! ( "Intel-MKL not found." ) ;
39
46
}
40
47
}
41
48
Ok ( ( ) )
Original file line number Diff line number Diff line change @@ -34,20 +34,17 @@ pub fn home_library_path() -> PathBuf {
34
34
dirs:: data_local_dir ( ) . unwrap ( ) . join ( "intel-mkl-tool" )
35
35
}
36
36
37
- /// Seek MKL library from
38
- ///
39
- /// 1. pkg-config
40
- /// 2. `$XDG_DATA_HOME/intel-mkl-tool`
41
- ///
42
- /// returns `None` if not found.
43
- ///
44
- pub fn seek ( ) -> Option < PathBuf > {
37
+ pub fn seek_pkg_config ( ) -> Option < PathBuf > {
45
38
if let Ok ( lib) = pkg_config:: probe_library ( "mkl-dynamic-lp64-iomp" ) {
46
39
if lib. libs . len ( ) > 1 {
47
40
warn ! ( "Found {} MKL libraries. Use first found." , lib. libs. len( ) )
48
41
}
49
42
return Some ( PathBuf :: from ( lib. libs [ 0 ] . clone ( ) ) ) ;
50
43
}
44
+ None
45
+ }
46
+
47
+ pub fn seek_home ( ) -> Option < PathBuf > {
51
48
let home_lib = home_library_path ( ) ;
52
49
if home_lib. is_dir ( ) {
53
50
return Some ( home_lib) ;
You can’t perform that action at this time.
0 commit comments