Vendor dependencies

Let's see how I like this workflow.
This commit is contained in:
John Doty 2022-12-19 08:27:18 -08:00
parent 34d1830413
commit 9c435dc440
7500 changed files with 1665121 additions and 99 deletions

34
vendor/link-cplusplus/build.rs vendored Normal file
View file

@ -0,0 +1,34 @@
use std::env;
use std::fs;
use std::path::PathBuf;
fn main() {
println!("cargo:rerun-if-changed=build.rs");
let libstdcxx = cfg!(feature = "libstdc++");
let libcxx = cfg!(feature = "libc++");
let nothing = cfg!(feature = "nothing");
if nothing {
return;
}
if libstdcxx && libcxx {
println!(
"cargo:warning=-lstdc++ and -lc++ are both requested, \
using the platform's default"
);
}
match (libstdcxx, libcxx) {
(true, false) => println!("cargo:rustc-link-lib=stdc++"),
(false, true) => println!("cargo:rustc-link-lib=c++"),
(false, false) | (true, true) => {
// The platform's default.
let out_dir = env::var_os("OUT_DIR").expect("missing OUT_DIR");
let path = PathBuf::from(out_dir).join("dummy.cc");
fs::write(&path, "int rust_link_cplusplus;\n").unwrap();
cc::Build::new().cpp(true).file(&path).compile("link-cplusplus");
}
}
}