2024-05-04 00:22:00 +08:00
|
|
|
#[cfg(not(feature = "cmake"))]
|
2024-09-27 22:54:52 +08:00
|
|
|
fn main() -> std::io::Result<()> {
|
2024-05-04 00:22:00 +08:00
|
|
|
let mut make = cc::Build::new();
|
|
|
|
make.include("include");
|
|
|
|
make.define("A_EXPORTS", None);
|
|
|
|
#[cfg(feature = "float")]
|
|
|
|
make.define("A_SIZE_FLOAT", "4");
|
|
|
|
#[cfg(feature = "static_crt")]
|
|
|
|
make.static_crt(true);
|
2024-09-27 22:54:52 +08:00
|
|
|
|
|
|
|
for entry in std::fs::read_dir("src")? {
|
|
|
|
let path = entry?.path();
|
|
|
|
let extension = path.extension().unwrap();
|
|
|
|
if path.is_file() & extension.eq("c") {
|
|
|
|
make.file(path);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
make.compile("a");
|
|
|
|
Ok(())
|
2024-05-04 00:22:00 +08:00
|
|
|
}
|
|
|
|
#[cfg(feature = "cmake")]
|
2023-03-17 21:35:38 +08:00
|
|
|
fn main() {
|
2024-05-03 23:13:01 +08:00
|
|
|
let mut cmake = cmake::Config::new("");
|
2023-03-17 21:35:38 +08:00
|
|
|
|
2024-05-03 23:13:01 +08:00
|
|
|
cmake.define("BUILD_TESTING", "0");
|
2023-05-10 05:12:00 +08:00
|
|
|
#[cfg(feature = "float")]
|
2024-05-03 23:13:01 +08:00
|
|
|
cmake.define("LIBA_FLOAT", "4");
|
|
|
|
#[cfg(feature = "static_crt")]
|
|
|
|
cmake.static_crt(true);
|
2023-03-17 21:35:38 +08:00
|
|
|
|
2024-05-03 23:13:01 +08:00
|
|
|
let out = cmake.build();
|
2023-03-17 21:35:38 +08:00
|
|
|
let lib = out.join("lib");
|
|
|
|
|
|
|
|
println!("cargo:rustc-link-search=native={}", lib.display());
|
2023-05-30 18:37:33 +08:00
|
|
|
println!("cargo:rustc-link-lib=static=a");
|
2023-03-17 21:35:38 +08:00
|
|
|
}
|