forked from lightsing/tid-rs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.rs
57 lines (45 loc) · 1.34 KB
/
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
use std::env;
use std::process::Command;
use cc;
fn main() {
println!("cargo:rustc-link-lib=framework=Foundation");
println!("cargo:rustc-link-lib=framework=LocalAuthentication");
println!("cargo:rerun-if-changed=foreign/tid.m");
println!("cargo:rerun-if-changed=foreign/tid.h");
// // FIXME: how to use cc?
cc::Build::new()
.file("foreign/tid.m")
.include("foreign/tid.h")
.pic(true)
.flag("-arch")
.flag("arm64")
.flag("-framework")
.flag("Foundation")
.flag("-framework")
.flag("LocalAuthentication")
.compile("tid");
println!("cargo:rustc-link-lib=static=tid");
/*
let output = env::var("OUT_DIR").unwrap();
Command::new("clang")
.arg(concat!("-I", env!("CARGO_MANIFEST_DIR"), "/foreign"))
.arg("-c")
.arg("-o")
.arg(format!("{}/lib_test.o", output))
.arg(concat!(env!("CARGO_MANIFEST_DIR"), "/foreign/tid.m"))
.arg("-fPIC")
.spawn()
.unwrap()
.wait()
.unwrap();
Command::new("ar")
.arg("r")
.arg(format!("{}/libtest.a", output))
.arg(format!("{}/lib_test.o", output))
.spawn()
.unwrap()
.wait()
.unwrap();
println!("cargo:rustc-link-arg={}/libtest.a", output)
*/
}