espanso/build.rs

55 lines
1.3 KiB
Rust
Raw Normal View History

2019-08-30 12:33:40 +00:00
extern crate cmake;
use cmake::Config;
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()
}
/*
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
}
#[cfg(target_os = "linux")]
fn print_config() {
println!("cargo:rustc-link-search=native=/usr/lib/x86_64-linux-gnu/");
println!("cargo:rustc-link-lib=static=linuxbridge");
println!("cargo:rustc-link-lib=dylib=X11");
println!("cargo:rustc-link-lib=dylib=Xtst");
println!("cargo:rustc-link-lib=dylib=xdo");
}
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()
{
let dst = get_config();
2019-08-30 12:33:40 +00:00
println!("cargo:rustc-link-search=native={}", dst.display());
print_config();
2019-08-30 12:33:40 +00:00
}