Replace build.rs with link attributes (#205)

This commit is contained in:
Artyom Pavlov
2021-02-17 02:09:32 +00:00
committed by GitHub
parent 9b2d55803e
commit c4a0004e8b
2 changed files with 1 additions and 14 deletions
-14
View File
@@ -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");
}
}
+1
View File
@@ -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,