-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.rs
More file actions
39 lines (35 loc) · 1.13 KB
/
build.rs
File metadata and controls
39 lines (35 loc) · 1.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
use make_cmd::make;
use std::{
env,
path::{Path, PathBuf},
};
fn main() {
let slicot_dir = PathBuf::from("SLICOT-Reference/");
let slicot_build_dir = Path::new(&env::var("OUT_DIR").unwrap())
.join("slicot_build")
.to_str()
.unwrap()
.to_string();
let make_args: Vec<String> = vec![
"-j8".to_string(),
format!("BUILD_DIR={slicot_build_dir}").to_string(),
];
let status = make()
.current_dir(&slicot_dir)
.args(make_args)
.status()
.expect("Failed to build make");
if !status.success() {
if cfg!(target_os = "windows") {
println!(
"cargo:warning=Control Systems Torbox has not been tested on windows. You are likely to have issues with compiling SLICOT."
)
}
println!("cargo:warning=Failed to compile SLICOT library");
panic!("Failed to build SLICOT")
}
println!("cargo:rustc-link-search={slicot_build_dir}");
println!("cargo:rustc-link-lib=static=slicot");
println!("cargo:rustc-link-lib=static=lpkaux");
println!("cargo:rustc-link-lib=gfortran");
}