-
Notifications
You must be signed in to change notification settings - Fork 4
/
build.rs
86 lines (82 loc) · 2.72 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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
/// Call to update `mega65/libc/bindings.rs` with
/// ~~~
/// cargo build --lib --release
/// rustfmt src/mega65/libc/bindings.rs
/// ~~~
/// Call to update mega65/libc/bindings.rs
#[cfg(feature = "mega65")]
fn _make_mega65_libc_bindings() {
bindgen::Builder::default()
.header("src/mega65/libc/conio.h")
.header("src/mega65/libc/debug.h")
.header("src/mega65/libc/dirent.h")
.header("src/mega65/libc/fileio.h")
.header("src/mega65/libc/hal.h")
.header("src/mega65/libc/memory.h")
.header("src/mega65/libc/random.h")
.header("src/mega65/libc/sdcard.h")
.header("src/mega65/libc/targets.h")
.header("src/mega65/libc/tests.h")
.header("src/mega65/libc/time.h")
.parse_callbacks(Box::new(bindgen::CargoCallbacks::new()))
.ctypes_prefix("::core::ffi")
.use_core()
.derive_default(true)
.generate()
.unwrap()
.write_to_file("src/mega65/libc/bindings.rs")
.expect("Couldn't write bindings!");
}
/// update cbm kernal bindings
fn _make_cbm_kernal_bindings() {
bindgen::Builder::default()
.header("cbm.h") // from llvm-mos-sdk/mos-targets/commodore/cbm.h
.parse_callbacks(Box::new(bindgen::CargoCallbacks::new()))
.ctypes_prefix("::core::ffi")
.use_core()
.derive_default(true)
.generate()
.unwrap()
.write_to_file("src/cbm_kernal.rs")
.expect("Couldn't write bindings!");
}
#[cfg(feature = "docs-rs")]
fn main() {} // Skip the script when the doc is building
#[cfg(not(feature = "docs-rs"))]
fn main() {
//_make_mega65_libc_bindings();
//_make_cbm_kernal_bindings();
#[cfg(feature = "c64")]
cc::Build::new()
.compiler("clang")
.target("mos-c64")
.file("src/irq.c")
.compile("irq");
#[cfg(feature = "mega65")]
cc::Build::new()
.compiler("clang")
.target("mos-mega65")
.include("src/mega65/libc")
.include("/usr/local/mos-platform/common/include")
.files([
"src/mega65/libc/conio.c",
"src/mega65/libc/debug.c",
"src/mega65/libc/dirent.s",
"src/mega65/libc/example.c",
"src/mega65/libc/fat32.c",
"src/mega65/libc/fileio.s",
"src/mega65/libc/hal.c",
"src/mega65/libc/memory.c",
"src/mega65/libc/mouse.c",
"src/mega65/libc/random.c",
"src/mega65/libc/sdcard.c",
"src/mega65/libc/targets.c",
"src/mega65/libc/tests.c",
"src/mega65/libc/time.c",
"src/mega65/random.c",
])
.flag("-mcpu=mos45gs02")
.flag("-w")
.flag("-Os")
.compile("mega65libc");
}