Skip to content

Commit

Permalink
Merge pull request #210 from MerchGuardian/android_udev_fix
Browse files Browse the repository at this point in the history
Android does not have udev; Do not link to udev on Android
  • Loading branch information
a1ien authored Sep 15, 2024
2 parents 8f8c3c6 + 705eadd commit cd95bb7
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions libusb1-sys/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -158,14 +158,16 @@ fn make_source() {
Some("__attribute__((visibility(\"default\")))"),
);

if let Ok(lib) = pkg_config::probe_library("libudev") {
base_config.define("USE_UDEV", Some("1"));
base_config.define("HAVE_LIBUDEV", Some("1"));
base_config.file(libusb_source.join("libusb/os/linux_udev.c"));
for path in lib.include_paths {
base_config.include(path.to_str().unwrap());
}
};
if std::env::var("CARGO_CFG_TARGET_OS") != Ok("android".into()) {
if let Ok(lib) = pkg_config::probe_library("libudev") {
base_config.define("USE_UDEV", Some("1"));
base_config.define("HAVE_LIBUDEV", Some("1"));
base_config.file(libusb_source.join("libusb/os/linux_udev.c"));
for path in lib.include_paths {
base_config.include(path.to_str().unwrap());
}
};
}

println!("Including posix!");
base_config.file(libusb_source.join("libusb/os/events_posix.c"));
Expand Down

0 comments on commit cd95bb7

Please sign in to comment.