forked from EstebanBorai/network-interface
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.rs
41 lines (39 loc) · 1.16 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
fn main() {
#[cfg(any(
target_os = "macos",
target_os = "ios",
target_os = "freebsd",
target_os = "openbsd",
target_os = "netbsd",
target_os = "dragonfly"
))]
{
use cc::Build;
use std::path::Path;
const TARGET_MACOS: &str = "macos";
const TARGET_IOS: &str = "ios";
const TARGET_FREEBSD: &str = "freebsd";
const TARGET_OPENBSD: &str = "openbsd";
const TARGET_NETBSD: &str = "netbsd";
const TARGET_DRAGONFLY: &str = "dragonfly";
// check cross-compile target. Only build lladdr.o when actually targeting UNIX.
let target_os = std::env::var("CARGO_CFG_TARGET_OS").unwrap();
if [
TARGET_MACOS,
TARGET_IOS,
TARGET_FREEBSD,
TARGET_OPENBSD,
TARGET_NETBSD,
TARGET_DRAGONFLY,
]
.contains(&target_os.as_str())
{
let path = Path::new("src")
.join("target")
.join("unix")
.join("ffi")
.join("lladdr.c");
Build::new().file(path).compile("ffi");
}
}
}