linking is a mistake

master
Avril 4 years ago
parent 9023d6d357
commit a1abc933bf
Signed by: flanchan
GPG Key ID: 284488987C31F630

1
.gitignore vendored

@ -1,3 +1,4 @@
target/ target/
Cargo.lock Cargo.lock
*~ *~
lib/*.*

@ -1,6 +1,7 @@
extern crate rustc_version; extern crate rustc_version;
use rustc_version::{version, version_meta, Channel}; use rustc_version::{version, version_meta, Channel};
use std::borrow::Cow;
fn main() { fn main() {
// Assert we haven't travelled back in time // Assert we haven't travelled back in time
@ -25,5 +26,24 @@ fn main() {
// Link to GHOST and required stuffs // Link to GHOST and required stuffs
println!(r"cargo:rustc-link-search=./lib"); println!(r"cargo:rustc-link-search=./lib");
println!("cargo:rustc-link-lib=dylib=stdc++"); // libstdc++ const LINK_TO: &[&'static str] =
&["dylib=stdc++", //libstdc++
"X11", //X11
"OpenGL", "GL", //OpenGL
"GLU", "GLX", "GLEW", //GLEW
"spnav",
"Xxf86vm", "Xext",
"Xi", "Xrender", "Xfixes"
];
for link in LINK_TO.iter().map(|x| Cow::<'static, str>::Borrowed(x))
.chain(std::fs::read_dir("./lib").unwrap().filter_map(|lib| lib.ok()
.map(|entry| entry.path().file_stem()
.map(|x| x.to_str()
.map(|x| Cow::Owned((&x[3..]).to_owned())))
.flatten())
.flatten()))
{
println!("cargo:rustc-link-lib={}", link);
}
} }

Loading…
Cancel
Save