|
1 | 1 | use std::{env, path::PathBuf}; |
2 | 2 |
|
3 | | -#[cfg(windows)] |
| 3 | +#[cfg(target_os = "windows")] |
4 | 4 | const DEFAULT_LEAPSDK_LIB_PATH: &str = r"C:\Program Files\Ultraleap\LeapSDK\lib\x64"; |
5 | 5 |
|
6 | | -#[cfg(not(windows))] |
| 6 | +#[cfg(target_os = "macos")] |
| 7 | +const DEFAULT_LEAPSDK_LIB_PATH: &str = |
| 8 | + r"/Applications/Ultraleap Hand Tracking.app/Contents/LeapSDK/lib"; |
| 9 | + |
| 10 | +#[cfg(target_os = "linux")] |
7 | 11 | const DEFAULT_LEAPSDK_LIB_PATH: &str = r"/usr/share/doc/ultraleap-hand-tracking-service"; |
8 | 12 |
|
9 | 13 | fn main() { |
10 | 14 | // Find Leap SDK |
11 | | - println!(r"cargo:rerun-if-env-changed=LEAPSDK_LIB_PATH"); |
| 15 | + println!(r"cargo::rerun-if-env-changed=LEAPSDK_LIB_PATH"); |
12 | 16 |
|
13 | 17 | let leapsdk_path = |
14 | 18 | env::var("LEAPSDK_LIB_PATH").unwrap_or_else(|_| DEFAULT_LEAPSDK_LIB_PATH.to_string()); |
15 | 19 |
|
16 | 20 | let leapsdk_path = PathBuf::from(leapsdk_path); |
17 | 21 |
|
18 | 22 | if !leapsdk_path.is_dir() { |
19 | | - 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()); |
| 23 | + 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()); |
20 | 24 | } else { |
21 | 25 | let path_str = leapsdk_path |
22 | 26 | .to_str() |
23 | 27 | .unwrap_or_else(|| panic!("{} is not a valid path.", leapsdk_path.display())); |
24 | 28 |
|
25 | 29 | // Link to LeapC.lib |
26 | | - println!(r"cargo:rustc-link-search={}", path_str); |
27 | | - println!(r"cargo:rustc-link-lib=LeapC"); |
| 30 | + println!(r"cargo::rustc-link-search={}", path_str); |
| 31 | + println!(r"cargo::rustc-link-lib=LeapC"); |
28 | 32 | } |
29 | 33 | } |
0 commit comments