Joel Galenson | 4be0c6d | 2020-07-07 13:20:14 -0700 | [diff] [blame^] | 1 | #![deny(warnings)] |
| 2 | |
| 3 | use std::env; |
| 4 | |
| 5 | fn main() { |
| 6 | let target = env::var("TARGET").expect("TARGET was not set"); |
| 7 | if target.contains("-uwp-windows-") { |
| 8 | // for BCryptGenRandom |
| 9 | println!("cargo:rustc-link-lib=bcrypt"); |
| 10 | // to work around unavailability of `target_vendor` on Rust 1.33 |
| 11 | println!("cargo:rustc-cfg=getrandom_uwp"); |
| 12 | } else if target.contains("windows") { |
| 13 | // for RtlGenRandom (aka SystemFunction036) |
| 14 | println!("cargo:rustc-link-lib=advapi32"); |
| 15 | } else if target.contains("apple-ios") { |
| 16 | // for SecRandomCopyBytes and kSecRandomDefault |
| 17 | println!("cargo:rustc-link-lib=framework=Security"); |
| 18 | } |
| 19 | } |