summaryrefslogtreecommitdiff
path: root/build.rs
diff options
context:
space:
mode:
Diffstat (limited to 'build.rs')
-rw-r--r--build.rs23
1 files changed, 22 insertions, 1 deletions
diff --git a/build.rs b/build.rs
index 7791134..d31d9aa 100644
--- a/build.rs
+++ b/build.rs
@@ -1,3 +1,24 @@
+extern crate cc;
+
+use std::path::Path;
+
fn main() {
- println!("cargo:rustc-link-lib=nitrokey");
+ let sources = [
+ "DeviceCommunicationExceptions.cpp",
+ "NK_C_API.cc",
+ "NitrokeyManager.cc",
+ "command_id.cc",
+ "device.cc",
+ "log.cc",
+ "misc.cc",
+ ];
+ let library_dir = Path::new("libnitrokey-3.3");
+
+ cc::Build::new()
+ .cpp(true)
+ .include(library_dir.join("libnitrokey"))
+ .files(sources.iter().map(|s| library_dir.join(s)))
+ .compile("libnitrokey.a");
+
+ println!("cargo:rustc-link-lib=hidapi-libusb");
}