|
|
@ -1,16 +1,14 @@
|
|
|
|
extern crate pkg_config;
|
|
|
|
extern crate pkg_config;
|
|
|
|
|
|
|
|
#[cfg(target_env = "msvc")]
|
|
|
|
|
|
|
|
extern crate vcpkg;
|
|
|
|
|
|
|
|
|
|
|
|
use std::env;
|
|
|
|
use std::env;
|
|
|
|
use std::path::Path;
|
|
|
|
use std::path::Path;
|
|
|
|
use std::process::Command;
|
|
|
|
use std::process::Command;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
#[cfg(not(target_env = "msvc"))]
|
|
|
|
let mongoc_version = env!("CARGO_PKG_VERSION")
|
|
|
|
fn main_linux(mongoc_version: &str) {
|
|
|
|
.split('-')
|
|
|
|
|
|
|
|
.next()
|
|
|
|
|
|
|
|
.expect("Crate version is not valid");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if pkg_config::Config::new()
|
|
|
|
if pkg_config::Config::new()
|
|
|
|
.atleast_version(mongoc_version)
|
|
|
|
.atleast_version(mongoc_version)
|
|
|
|
.statik(true)
|
|
|
|
.statik(true)
|
|
|
@ -98,3 +96,35 @@ fn main() {
|
|
|
|
println!("cargo:rustc-link-lib=static=mongoc-1.0");
|
|
|
|
println!("cargo:rustc-link-lib=static=mongoc-1.0");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#[cfg(target_env = "msvc")]
|
|
|
|
|
|
|
|
fn main_win(mongoc_version: &str) {
|
|
|
|
|
|
|
|
use vcpkg;
|
|
|
|
|
|
|
|
if vcpkg::Config::new()
|
|
|
|
|
|
|
|
.emit_includes(true)
|
|
|
|
|
|
|
|
.probe("mongo-c-driver")
|
|
|
|
|
|
|
|
.is_ok()
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
let out_dir_var = env::var("OUT_DIR").expect("No out dir");
|
|
|
|
|
|
|
|
let out_dir = format!("{}/{}", out_dir_var, mongoc_version);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// println!("found");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Output to Cargo
|
|
|
|
|
|
|
|
println!("cargo:rustc-link-search=native={}/lib", &out_dir);
|
|
|
|
|
|
|
|
println!("cargo:rustc-link-lib=bson");
|
|
|
|
|
|
|
|
println!("cargo:rustc-link-lib=mongo-c-driver");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
|
|
|
|
let mongoc_version = env!("CARGO_PKG_VERSION")
|
|
|
|
|
|
|
|
.split('-')
|
|
|
|
|
|
|
|
.next()
|
|
|
|
|
|
|
|
.expect("Crate version is not valid");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#[cfg(target_env = "msvc")]
|
|
|
|
|
|
|
|
main_win(mongoc_version);
|
|
|
|
|
|
|
|
#[cfg(not(target_env = "msvc"))]
|
|
|
|
|
|
|
|
main_linux(mongoc_version);
|
|
|
|
|
|
|
|
}
|
|
|
|