Replace build.rs with link attributes (#205)
This commit is contained in:
@@ -1,14 +0,0 @@
|
||||
#![deny(warnings)]
|
||||
|
||||
use std::env;
|
||||
|
||||
fn main() {
|
||||
let target = env::var("TARGET").expect("TARGET was not set");
|
||||
if target.contains("windows") {
|
||||
// for BCryptGenRandom
|
||||
println!("cargo:rustc-link-lib=bcrypt");
|
||||
} else if target.contains("apple-ios") {
|
||||
// for SecRandomCopyBytes and kSecRandomDefault
|
||||
println!("cargo:rustc-link-lib=framework=Security");
|
||||
}
|
||||
}
|
||||
@@ -11,6 +11,7 @@ use core::{ffi::c_void, num::NonZeroU32, ptr};
|
||||
|
||||
const BCRYPT_USE_SYSTEM_PREFERRED_RNG: u32 = 0x00000002;
|
||||
|
||||
#[link(name = "bcrypt")]
|
||||
extern "system" {
|
||||
fn BCryptGenRandom(
|
||||
hAlgorithm: *mut c_void,
|
||||
|
||||
Reference in New Issue
Block a user