Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 20 additions & 2 deletions build.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
const CPP_VERSION_FLAG: &'static str = "-std=c++17";

fn main() {
if std::env::var("DOCS_RS").is_ok() {
return;
Expand All @@ -11,7 +13,7 @@ fn main() {
(_, _, true) => {
// prefer the prefix env var, if not, fall back to the base from the CLI
match std::env::var("CONDA_PREFIX") {
Ok(prefix) => prefix.to_string(),
Ok(prefix) => prefix,
Err(_) => {
let conda = which::which("conda")
.map(|p| p.to_str().unwrap().to_string())
Expand All @@ -37,6 +39,13 @@ fn main() {
let brew_lib_path = format!("{}/lib", library_root);
let include = format!("{}/include", library_root);
let rdkit_include = format!("{}/include/rdkit", library_root);
let linux_boost_lib_path = format!(
"{}/lib/{}-{}-gnu",
library_root,
std::env::consts::ARCH,
std::env::consts::OS
);
let platform = std::env::consts::OS;

let dir = std::fs::read_dir("src/bridge").unwrap();
let rust_files = dir
Expand Down Expand Up @@ -83,26 +92,31 @@ fn main() {
.include(include)
.include(rdkit_include)
.include(std::env::var("CARGO_MANIFEST_DIR").unwrap())
.flag("-std=c++14")
.flag(CPP_VERSION_FLAG)
.warnings(false)
// rdkit has warnings that blow up our build. we could enumerate all those warnings and tell
// the compiler to allow them... .warnings_into_errors(true)
.compile("rdkit");

println!("cargo:rustc-link-search=native={}", brew_lib_path);
println!("cargo:rustc-link-search=native={}", linux_boost_lib_path);

// println!("cargo:rustc-link-lib=static=c++");

for lib in &[
"Catalogs",
"ChemReactions",
"ChemTransforms",
"DataStructs",
"Depictor",
"Descriptors",
"FileParsers",
"Fingerprints",
"GenericGroups",
"GraphMol",
"MolStandardize",
"MolTransforms",
"PartialCharges",
"RDGeneral",
"RDGeometryLib",
"RingDecomposerLib",
Expand All @@ -122,4 +136,8 @@ fn main() {
} else {
println!("cargo:rustc-link-lib=static=boost_serialization");
}

if platform == "linux" {
println!("cargo:rustc-link-lib=RDKitcoordgen");
}
}