forked from Macchina-CLI/libmacchina
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.rs
32 lines (26 loc) · 837 Bytes
/
build.rs
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
use std::env;
#[cfg(feature = "version")]
fn commit_hash() {
use vergen::{Config, ShaKind};
let mut config = Config::default();
*config.git_mut().sha_kind_mut() = ShaKind::Short;
if let Err(e) = vergen::vergen(config) {
eprintln!("{}", e);
}
}
fn build_macos() {
println!("cargo:rustc-link-lib=framework=Foundation");
println!("cargo:rustc-link-lib=framework=IOKit");
println!("cargo:rustc-link-lib=framework=CoreVideo");
println!("cargo:rustc-link-search=framework=/System/Library/PrivateFrameworks");
println!("cargo:rustc-link-lib=framework=DisplayServices");
}
fn main() {
match env::var("CARGO_CFG_TARGET_OS").as_ref().map(|x| &**x) {
Ok("macos") => build_macos(),
Ok("netbsd") => {}
_ => {}
}
#[cfg(feature = "version")]
commit_hash()
}