@@ -22,7 +22,24 @@ pub struct Library {
22
22
}
23
23
24
24
impl Library {
25
- /// Try to find MKL using pkg-config
25
+ /// Find MKL using `pkg-config`
26
+ ///
27
+ /// This only use the installed prefix obtained by `pkg-config --variable=prefix`
28
+ ///
29
+ /// ```text
30
+ /// $ pkg-config --variable=prefix mkl-static-lp64-seq
31
+ /// /opt/intel/mkl
32
+ /// ```
33
+ ///
34
+ /// Then pass it to [Self::seek_directory].
35
+ ///
36
+ /// Limitation
37
+ /// -----------
38
+ /// This will not work for `mkl-*-*-iomp` configure since `libiomp5.{a,so}`
39
+ /// will not be found under the prefix directory of MKL.
40
+ /// Please use `$MKLROOT` environment variable for this case,
41
+ /// see [Self::new] for detail.
42
+ ///
26
43
pub fn pkg_config ( config : Config ) -> Result < Option < Self > > {
27
44
if let Ok ( out) = Command :: new ( "pkg-config" )
28
45
. arg ( "--variable=prefix" )
@@ -48,6 +65,8 @@ impl Library {
48
65
/// - This will seek the directory recursively until finding MKL libraries,
49
66
/// but do not follow symbolic links.
50
67
/// - This will not seek directory named `ia32*`
68
+ /// - Retuns `Ok(None)` if `libiomp5.{a,so}` is not found with `mkl-*-*-iomp` configure
69
+ /// even if MKL binaries are found.
51
70
///
52
71
pub fn seek_directory ( config : Config , root_dir : impl AsRef < Path > ) -> Result < Option < Self > > {
53
72
let root_dir = root_dir. as_ref ( ) ;
@@ -268,6 +287,10 @@ mod tests {
268
287
#[ test]
269
288
fn pkg_config ( ) {
270
289
for cfg in Config :: possibles ( ) {
290
+ // pkg-config will not work for `mkl-*-*-iomp` cases
291
+ if cfg. parallel == Threading :: OpenMP {
292
+ continue ;
293
+ }
271
294
let lib = Library :: pkg_config ( cfg) . unwrap ( ) . unwrap ( ) ;
272
295
dbg ! ( lib. version( ) . unwrap( ) ) ;
273
296
}
0 commit comments