-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* default SDK path for MacOS * new format for rustc v1.77+ * added entry to changelog, ran cargo fmt
- Loading branch information
Showing
2 changed files
with
11 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,33 @@ | ||
use std::{env, path::PathBuf}; | ||
|
||
#[cfg(windows)] | ||
#[cfg(target_os = "windows")] | ||
const DEFAULT_LEAPSDK_LIB_PATH: &str = r"C:\Program Files\Ultraleap\LeapSDK\lib\x64"; | ||
|
||
#[cfg(not(windows))] | ||
#[cfg(target_os = "macos")] | ||
const DEFAULT_LEAPSDK_LIB_PATH: &str = | ||
r"/Applications/Ultraleap Hand Tracking.app/Contents/LeapSDK/lib"; | ||
|
||
#[cfg(target_os = "linux")] | ||
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"); | ||
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()); | ||
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"); | ||
println!(r"cargo::rustc-link-search={}", path_str); | ||
println!(r"cargo::rustc-link-lib=LeapC"); | ||
} | ||
} |