@@ -9,26 +9,36 @@ use std::{
9
9
str:: FromStr ,
10
10
} ;
11
11
12
+ /// A library found in system
12
13
#[ derive( Debug , Clone ) ]
13
- pub enum Entry2 {
14
+ pub enum Library {
14
15
PkgConfig {
15
16
config : Config ,
16
17
lib : pkg_config:: Library ,
17
18
} ,
18
19
Directory {
19
20
config : Config ,
20
- root_dir : PathBuf ,
21
+ /// Directory where `mkl.h` and `mkl_version.h` exists
22
+ include_dir : PathBuf ,
23
+ /// Directory where `libmkl_core.a` or `libmkl_rt.so` exists
24
+ library_dir : PathBuf ,
25
+ /// Directory where `libiomp5.a` or `libiomp5.so` exists
26
+ ///
27
+ /// They are sometimes placed in different position.
28
+ /// Returns `None` if they exist on `library_dir`.
29
+ iomp5_dir : Option < PathBuf > ,
21
30
} ,
22
31
}
23
32
24
- impl Entry2 {
25
- pub fn try_pkg_config ( config : Config ) -> Option < Self > {
33
+ impl Library {
34
+ /// Try to find MKL using pkg-config
35
+ pub fn pkg_config ( config : Config ) -> Option < Self > {
26
36
if let Ok ( lib) = pkg_config:: Config :: new ( )
27
37
. cargo_metadata ( false )
28
38
. env_metadata ( false )
29
39
. probe ( & config. to_string ( ) )
30
40
{
31
- Some ( Entry2 :: PkgConfig { config, lib } )
41
+ Some ( Library :: PkgConfig { config, lib } )
32
42
} else {
33
43
None
34
44
}
@@ -39,24 +49,44 @@ impl Entry2 {
39
49
/// This will seek the directory recursively until finding MKL libraries.
40
50
/// Returns `Ok(None)` if not found. `Err` means IO error while seeking.
41
51
///
42
- pub fn seek_directory ( _config : Config , dir_root : impl AsRef < Path > ) -> Result < Option < Self > > {
43
- let _dir = dir_root. as_ref ( ) ;
52
+ pub fn seek_directory ( config : Config , root_dir : impl AsRef < Path > ) -> Result < Option < Self > > {
44
53
todo ! ( )
45
54
}
46
55
56
+ /// Seek MKL in system
57
+ ///
58
+ /// This try to find installed MKL in following order:
59
+ ///
60
+ /// - Ask to `pkg-config`
61
+ /// - Seek the directory specified by `$MKLROOT` environment variable
62
+ /// - Seek well-known directory
63
+ /// - `/opt/intel` for Linux
64
+ /// - `C:/Program Files (x86)/IntelSWTools/` for Windows
65
+ ///
47
66
pub fn new ( config : Config ) -> Result < Self > {
48
67
todo ! ( )
49
68
}
50
69
51
70
pub fn config ( & self ) -> & Config {
52
71
match self {
53
- Entry2 :: PkgConfig { config, .. } => config,
54
- Entry2 :: Directory { config, .. } => config,
72
+ Library :: PkgConfig { config, .. } => config,
73
+ Library :: Directory { config, .. } => config,
55
74
}
56
75
}
57
76
58
- /// Found MKL version parsed from `mkl_version.h`, e.g. `(2020, 1)`
59
- pub fn version ( & self ) -> ( u32 , u32 ) {
77
+ /// Found MKL version parsed from `mkl_version.h`
78
+ ///
79
+ /// `mkl_version.h` will define
80
+ ///
81
+ /// ```c
82
+ /// #define __INTEL_MKL__ 2020
83
+ /// #define __INTEL_MKL_MINOR__ 0
84
+ /// #define __INTEL_MKL_UPDATE__ 1
85
+ /// ```
86
+ ///
87
+ /// and this corresponds to `(2020, 0, 1)`
88
+ ///
89
+ pub fn version ( & self ) -> ( u32 , u32 , u32 ) {
60
90
todo ! ( )
61
91
}
62
92
}
0 commit comments