-
Notifications
You must be signed in to change notification settings - Fork 2
/
build.rs
24 lines (21 loc) · 877 Bytes
/
build.rs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
/* -*- Mode: rust; rust-indent-offset: 4 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
use bindgen;
use std::env;
use std::path::PathBuf;
fn main() {
let target_os = env::var("CARGO_CFG_TARGET_OS").expect("CARGO_CFG_TARGET_OS unset?");
if target_os == "windows" {
let bindings = bindgen::Builder::default()
.header("src/wrapper-windows.h")
.whitelist_function("NCryptSignHash")
.generate()
.expect("Unable to generate bindings");
let out_path = PathBuf::from(env::var("OUT_DIR").expect("OUT_DIR unset?"));
bindings
.write_to_file(out_path.join("bindings.rs"))
.expect("Couldn't write bindings");
}
}