use anyhow::Result;
use intel_mkl_tool::*;
use std::str::FromStr;
macro_rules! def_mkl_config {
($cfg:literal) => {
#[cfg(feature = $cfg)]
const MKL_CONFIG: &str = $cfg;
};
}
def_mkl_config!("mkl-static-lp64-iomp");
def_mkl_config!("mkl-static-lp64-seq");
def_mkl_config!("mkl-static-ilp64-iomp");
def_mkl_config!("mkl-static-ilp64-seq");
def_mkl_config!("mkl-dynamic-lp64-iomp");
def_mkl_config!("mkl-dynamic-lp64-seq");
def_mkl_config!("mkl-dynamic-ilp64-iomp");
def_mkl_config!("mkl-dynamic-ilp64-seq");
#[cfg(all(
not(feature = "mkl-static-lp64-iomp"),
not(feature = "mkl-static-lp64-seq"),
not(feature = "mkl-static-ilp64-iomp"),
not(feature = "mkl-static-ilp64-seq"),
not(feature = "mkl-dynamic-lp64-iomp"),
not(feature = "mkl-dynamic-lp64-seq"),
not(feature = "mkl-dynamic-ilp64-iomp"),
not(feature = "mkl-dynamic-ilp64-seq"),
))]
const MKL_CONFIG: &str = "mkl-static-ilp64-iomp";
fn main() -> Result<()> {
let cfg = Config::from_str(MKL_CONFIG).unwrap();
if let Ok(lib) = Library::new(cfg) {
lib.print_cargo_metadata()?;
return Ok(());
}
if cfg.link == LinkType::Static {
if cfg!(target_os = "linux") {
let _ = ocipkg::link_package(&format!(
"ghcr.io/rust-math/rust-mkl/linux/{}:2020.1-3038006115",
MKL_CONFIG
));
}
if cfg!(target_os = "windows") {
let _ = ocipkg::link_package(&format!(
"ghcr.io/rust-math/rust-mkl/windows/{}:2022.0-3038006115",
MKL_CONFIG
));
}
}
Ok(())
}