|
21 | 21 | // SOFTWARE.
|
22 | 22 |
|
23 | 23 | use std::env;
|
24 |
| -use std::path; |
| 24 | +use std::path::*; |
25 | 25 | use std::process::Command;
|
26 | 26 |
|
| 27 | +const MKL_ARCHIVE: &'static str = "mkl.tar.xz"; |
| 28 | + |
27 | 29 | fn main() {
|
28 |
| - let mkl_dir = path::Path::new(&env::var("CARGO_MANIFEST_DIR").unwrap()).join("mkl_lib"); |
29 |
| - let st = Command::new("tar") |
30 |
| - .args(&["Jxvf", "mkl.tar.xz"]) |
31 |
| - .current_dir(&mkl_dir) |
| 30 | + let out_dir = PathBuf::from(env::var("OUT_DIR").unwrap()); |
| 31 | + let oid = "fa01d7dfb31f2ebedb59f2654fb85f4c0badce33"; |
| 32 | + let uri = format!("https://github.com/termoshtt/rust-intel-mkl/raw/{}/mkl_lib/{}", |
| 33 | + oid, |
| 34 | + MKL_ARCHIVE); |
| 35 | + Command::new("wget") |
| 36 | + .args(&["-q", &uri, "-O", MKL_ARCHIVE]) |
| 37 | + .current_dir(&out_dir) |
| 38 | + .status() |
| 39 | + .expect("Failed to start download (maybe 'wget' is missing?)"); |
| 40 | + Command::new("tar") |
| 41 | + .args(&["Jxvf", MKL_ARCHIVE]) |
| 42 | + .current_dir(&out_dir) |
32 | 43 | .status()
|
33 | 44 | .expect("Failed to start decompression (maybe 'tar' is missing?)");
|
34 |
| - if !st.success() { |
35 |
| - panic!("Failed to extract MKL libraries"); |
36 |
| - } |
37 | 45 |
|
38 |
| - println!("cargo:rustc-link-lib=static=mkl_intel_ilp64"); |
39 |
| - println!("cargo:rustc-link-lib=static=mkl_intel_thread"); |
40 |
| - println!("cargo:rustc-link-lib=static=iomp5"); |
41 |
| - println!("cargo:rustc-link-search=native={}", mkl_dir.display()); |
| 46 | + println!("cargo:rustc-link-search={}", out_dir.display()); |
| 47 | + println!("cargo:rustc-link-lib=dylib=mkl_intel_lp64"); |
| 48 | + println!("cargo:rustc-link-lib=dylib=mkl_gnu_thread"); |
| 49 | + println!("cargo:rustc-link-lib=dylib=mkl_core"); |
| 50 | + println!("cargo:rustc-link-lib=dylib=gomp"); |
42 | 51 | }
|
0 commit comments