Playing with build script
This commit is contained in:
parent
fac14c9449
commit
ff662f0828
@ -8,3 +8,8 @@ edition = "2018"
|
|||||||
|
|
||||||
[build-dependencies]
|
[build-dependencies]
|
||||||
cc = "1.0.47"
|
cc = "1.0.47"
|
||||||
|
|
||||||
|
#[build]
|
||||||
|
#rustflags = ["-C", "link-args=-L/usr/include/slang.h,--verbose"]
|
||||||
|
#rustflags = ["-C", "link-arg=-L/usr/include/slang.h,-Wl,--verbose", "-Z", "print-link-args"]
|
||||||
|
|
||||||
|
39
build.rs
39
build.rs
@ -1,6 +1,7 @@
|
|||||||
|
|
||||||
use cc::Build;
|
use cc::Build;
|
||||||
use std::path::Path;
|
use std::path::{PathBuf, Path};
|
||||||
|
use std::fs::{ReadDir, read_dir};
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
println!("Running build script");
|
println!("Running build script");
|
||||||
@ -8,8 +9,36 @@ fn main() {
|
|||||||
let most_src = Path::new("vendor/most-5.1.0/src");
|
let most_src = Path::new("vendor/most-5.1.0/src");
|
||||||
println!("Most src path: {}", most_src.display());
|
println!("Most src path: {}", most_src.display());
|
||||||
|
|
||||||
Build::new()
|
let c_files: Vec<PathBuf> = read_dir(most_src).unwrap()
|
||||||
.files(most_src)
|
.into_iter()
|
||||||
.include(most_src)
|
.filter(|entry| {
|
||||||
.compile("most");
|
let path = entry.as_ref().unwrap().path();
|
||||||
|
match path.file_name() {
|
||||||
|
Some(s) if s.to_string_lossy() == "chkslang.c" => return false,
|
||||||
|
//Some(s) if s.to_string_lossy() == "main.c" => return false,
|
||||||
|
_ => ()
|
||||||
|
};
|
||||||
|
match path.extension() {
|
||||||
|
Some(ref s) if s.to_string_lossy() == "c" => true,
|
||||||
|
_ => false
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.map(|entry| {
|
||||||
|
entry.unwrap().path()
|
||||||
|
}).collect();
|
||||||
|
|
||||||
|
for entry in c_files.iter() {
|
||||||
|
println!("C FILE: {}", entry.display());
|
||||||
|
}
|
||||||
|
|
||||||
|
Build::new()
|
||||||
|
.files(c_files)
|
||||||
|
.include(most_src)
|
||||||
|
.include("/usr/bin/slang.h")
|
||||||
|
.flag("-lslang")
|
||||||
|
.compile("most");
|
||||||
|
|
||||||
|
//println!("rustc-cdylib-link-arg=--verbose");
|
||||||
|
//println!("cargo:rustc-link-search=/usr/lib");
|
||||||
|
//println!("cargo:rustc-link-lib=static=slang");
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user