-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.rs
More file actions
31 lines (24 loc) · 706 Bytes
/
build.rs
File metadata and controls
31 lines (24 loc) · 706 Bytes
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
use std::path::PathBuf;
const SRC_FOLDER: &'static str = "src";
const C_FOLDER: &'static str = "C";
pub struct BuildableCFile {
pub path: PathBuf,
pub name: String
}
impl From<(&str, &str)> for BuildableCFile {
fn from((filename, name): (&str, &str)) -> Self {
BuildableCFile {
path: PathBuf::from(SRC_FOLDER).join(C_FOLDER).join(filename),
name: name.to_string()
}
}
}
fn build_c_file(buildabe_c_file: BuildableCFile) {
cc::Build::new()
.file(buildabe_c_file.path)
.compile(&buildabe_c_file.name);
}
fn main() {
build_c_file(("append.c", "append").into());
build_c_file(("date_prefix.c", "date_prefix").into());
}