-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.rs
More file actions
32 lines (28 loc) · 1.2 KB
/
build.rs
File metadata and controls
32 lines (28 loc) · 1.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
extern crate bindgen;
use std::env;
use std::path::PathBuf;
fn main() {
println!(
"cargo:rustc-link-search=native=C:/Program Files (x86)/National Instruments/Shared/ExternalCompilerSupport/C/lib64/msvc/",
);
println!(
"cargo:rustc-link-search=native=C:/Program Files/National Instruments/Shared/ExternalCompilerSupport/C/lib64/msvc/",
);
println!("cargo:rustc-link-lib=NIDAQmx");
println!("cargo:rerun-if-changed=wrapper.h");
let bindings = bindgen::Builder::default()
.header("wrapper.h")
.clang_arg("-x")
.clang_arg("c++")
.clang_arg("-std=c++17")
.clang_arg("-IC:/Program Files (x86)/National Instruments/Shared/ExternalCompilerSupport/C/include")
.clang_arg("-IC:/Program Files/National Instruments/Shared/ExternalCompilerSupport/C/include")
.parse_callbacks(Box::new(bindgen::CargoCallbacks::new()))
.default_macro_constant_type(bindgen::MacroTypeVariation::Signed)
.generate()
.expect("Unable to generate bindings");
let out_path = PathBuf::from(env::var("OUT_DIR").unwrap());
bindings
.write_to_file(out_path.join("bindings.rs"))
.expect("Couldn't write bindings!");
}