Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 3febafe

Browse files
authoredSep 6, 2017
Merge pull request #4 from termoshtt/shared_lib
Switch to shared lib
2 parents 91405f1 + 4ef4868 commit 3febafe

File tree

4 files changed

+22
-15
lines changed

4 files changed

+22
-15
lines changed
 

‎Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,5 @@ readme = "README.md"
1212
build = "build.rs"
1313
links = "mkl_intel_ilp64"
1414

15-
[dependencies]
15+
exclude = ["mkl_lib/mkl.tar.xz"]
1616

‎build.rs

Lines changed: 21 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -21,22 +21,31 @@
2121
// SOFTWARE.
2222

2323
use std::env;
24-
use std::path;
24+
use std::path::*;
2525
use std::process::Command;
2626

27+
const MKL_ARCHIVE: &'static str = "mkl.tar.xz";
28+
2729
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)
3243
.status()
3344
.expect("Failed to start decompression (maybe 'tar' is missing?)");
34-
if !st.success() {
35-
panic!("Failed to extract MKL libraries");
36-
}
3745

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");
4251
}

‎mkl_lib/.gitignore

Lines changed: 0 additions & 2 deletions
This file was deleted.

‎mkl_lib/mkl.tar.xz

4.98 MB
Binary file not shown.

0 commit comments

Comments
 (0)
Please sign in to comment.