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")]
|
2020-05-10 16:01:04 +00:00
|
|
|
fn print_config() {
|
2019-09-01 12:58:39 +00:00
|
|
|
println!("cargo:rustc-link-lib=static=winbridge");
|
2019-09-16 09:02:40 +00:00
|
|
|
println!("cargo:rustc-link-lib=dylib=user32");
|
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");
|
2020-04-03 16:22:31 +00:00
|
|
|
println!("cargo:rustc-link-lib=framework=IOKit");
|
2019-09-05 15:20:52 +00:00
|
|
|
}
|
|
|
|
|
2020-05-10 16:01:04 +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();
|
2020-05-10 16:01:04 +00:00
|
|
|
}
|