summaryrefslogtreecommitdiff
path: root/build.rs
blob: d31d9aa010c01a548c4a74954975fef7b6ca23bf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
extern crate cc;

use std::path::Path;

fn main() {
    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");
}