forked from plule/leaprs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.rs
29 lines (22 loc) · 1.1 KB
/
build.rs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
use std::{env, path::PathBuf};
#[cfg(windows)]
const DEFAULT_LEAPSDK_LIB_PATH: &str = r"C:\Program Files\Ultraleap\LeapSDK\lib\x64";
#[cfg(not(windows))]
const DEFAULT_LEAPSDK_LIB_PATH: &str = r"/usr/share/doc/ultraleap-hand-tracking-service";
fn main() {
// Find Leap SDK
println!(r"cargo:rerun-if-env-changed=LEAPSDK_LIB_PATH");
let leapsdk_path =
env::var("LEAPSDK_LIB_PATH").unwrap_or_else(|_| DEFAULT_LEAPSDK_LIB_PATH.to_string());
let leapsdk_path = PathBuf::from(leapsdk_path);
if !leapsdk_path.is_dir() {
println!("cargo:warning=Could not find LeapSDK at the location {}. Install it from https://developer.leapmotion.com/tracking-software-download or set its location with the environment variable LEAPSDK_LIB_PATH.", leapsdk_path.display());
} else {
let path_str = leapsdk_path
.to_str()
.unwrap_or_else(|| panic!("{} is not a valid path.", leapsdk_path.display()));
// Link to LeapC.lib
println!(r"cargo:rustc-link-search={}", path_str);
println!(r"cargo:rustc-link-lib=LeapC");
}
}