2019-08-30 12:33:40 +00:00
|
|
|
extern crate cmake;
|
|
|
|
use cmake::Config;
|
2019-09-01 12:58:39 +00:00
|
|
|
use std::path::PathBuf;
|
|
|
|
|
|
|
|
/* OS SPECIFIC CONFIGS */
|
|
|
|
|
|
|
|
#[cfg(target_os = "windows")]
|
|
|
|
fn get_config() -> PathBuf {
|
|
|
|
Config::new("native/libwinbridge").build()
|
|
|
|
}
|
|
|
|
|
|
|
|
#[cfg(target_os = "linux")]
|
|
|
|
fn get_config() -> PathBuf {
|
|
|
|
Config::new("native/liblinuxbridge").build()
|
|
|
|
}
|
|
|
|
|
2019-09-05 15:20:52 +00:00
|
|
|
#[cfg(target_os = "macos")]
|
|
|
|
fn get_config() -> PathBuf {
|
|
|
|
Config::new("native/libmacbridge").build()
|
|
|
|
}
|
|
|
|
|
2019-09-01 12:58:39 +00:00
|
|
|
/*
|
|
|
|
OS CUSTOM CARGO CONFIG LINES
|
|
|
|
Note: this is where linked libraries should be specified.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#[cfg(target_os = "windows")]
|
|
|
|
fn print_config() {
|
|
|
|
println!("cargo:rustc-link-lib=static=winbridge");
|
2019-09-12 20:14:41 +00:00
|
|
|
println!("cargo:rustc-link-lib=static=user32"); // TODO: maybe dylib is better
|
2019-09-01 12:58:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#[cfg(target_os = "linux")]
|
|
|
|
fn print_config() {
|
2019-09-01 14:50:20 +00:00
|
|
|
println!("cargo:rustc-link-search=native=/usr/lib/x86_64-linux-gnu/");
|
2019-09-01 12:58:39 +00:00
|
|
|
println!("cargo:rustc-link-lib=static=linuxbridge");
|
|
|
|
println!("cargo:rustc-link-lib=dylib=X11");
|
|
|
|
println!("cargo:rustc-link-lib=dylib=Xtst");
|
2019-09-01 14:50:20 +00:00
|
|
|
println!("cargo:rustc-link-lib=dylib=xdo");
|
2019-09-01 12:58:39 +00:00
|
|
|
}
|
2019-08-30 12:33:40 +00:00
|
|
|
|
2019-09-05 15:20:52 +00:00
|
|
|
#[cfg(target_os = "macos")]
|
|
|
|
fn print_config() {
|
2019-09-05 16:34:03 +00:00
|
|
|
println!("cargo:rustc-link-lib=dylib=c++");
|
2019-09-05 15:20:52 +00:00
|
|
|
println!("cargo:rustc-link-lib=static=macbridge");
|
|
|
|
println!("cargo:rustc-link-lib=framework=Cocoa");
|
|
|
|
}
|
|
|
|
|
2019-08-30 12:33:40 +00:00
|
|
|
fn main()
|
|
|
|
{
|
2019-09-01 12:58:39 +00:00
|
|
|
let dst = get_config();
|
2019-08-30 12:33:40 +00:00
|
|
|
|
|
|
|
println!("cargo:rustc-link-search=native={}", dst.display());
|
2019-09-01 12:58:39 +00:00
|
|
|
print_config();
|
2019-08-30 12:33:40 +00:00
|
|
|
}
|