Skip to content

Commit 3ebe556

Browse files
authored
Add MacOS compatibility (#81)
* default SDK path for MacOS * new format for rustc v1.77+ * added entry to changelog, ran cargo fmt
1 parent 0f05d9d commit 3ebe556

File tree

2 files changed

+11
-6
lines changed

2 files changed

+11
-6
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/)
77
## [Unreleased] - yyyy-mm-dd
88

99
### Added
10+
- Support for MacOS
1011

1112
### Changed
1213

build.rs

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,33 @@
11
use std::{env, path::PathBuf};
22

3-
#[cfg(windows)]
3+
#[cfg(target_os = "windows")]
44
const DEFAULT_LEAPSDK_LIB_PATH: &str = r"C:\Program Files\Ultraleap\LeapSDK\lib\x64";
55

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")]
711
const DEFAULT_LEAPSDK_LIB_PATH: &str = r"/usr/share/doc/ultraleap-hand-tracking-service";
812

913
fn main() {
1014
// 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");
1216

1317
let leapsdk_path =
1418
env::var("LEAPSDK_LIB_PATH").unwrap_or_else(|_| DEFAULT_LEAPSDK_LIB_PATH.to_string());
1519

1620
let leapsdk_path = PathBuf::from(leapsdk_path);
1721

1822
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());
2024
} else {
2125
let path_str = leapsdk_path
2226
.to_str()
2327
.unwrap_or_else(|| panic!("{} is not a valid path.", leapsdk_path.display()));
2428

2529
// 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");
2832
}
2933
}

0 commit comments

Comments
 (0)