-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.rs
42 lines (35 loc) · 1.01 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
#[cfg(unix)]
fn main() {
println!("cargo:rustc-link-lib=dylib=ncurses");
}
#[cfg(windows)]
fn main() {
let mut build = cc::Build::new();
// This puts all the `*.c` files we can find into the build.
for res_dir_entry in std::fs::read_dir("pdcurses_win32").unwrap() {
if let Ok(dir_entry) = res_dir_entry {
if let Ok(file_type) = dir_entry.file_type() {
if file_type.is_file() {
let path = dir_entry.path();
if let Some(os_str_ref) = path.extension() {
if os_str_ref.to_str() == Some("c") {
build.file(path);
}
}
}
}
}
}
build
.include("pdcurses_win32")
.define("PDC_WIDE", Some("Y"))
.define("PDC_FORCE_UTF8", Some("Y"))
.define("PDC_RGB", Some("Y"));
build.compile("pdcurses");
println!("cargo:rustc-link-lib=static=pdcurses");
println!("cargo:rustc-link-lib=dylib=user32");
}
#[cfg(not(any(unix, windows)))]
fn main() {
panic!("yacurses only knows how to build for unix and windows.");
}