summaryrefslogtreecommitdiff
path: root/build.rs
blob: 8383cda607f8c1753a44e9445eeeec7d03657527 (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
25
26
27
use std::collections::HashMap;
use std::env;

fn main() {
    let target = env::var("TARGET").unwrap();
    if !target.contains("linux") {
        panic!("Non-linux build targets are not tested and may not have a corresponding driver at the moment.");
    }

    let mut archmap: HashMap<&'static str, &'static str> = HashMap::new();
    archmap.insert("x86_64", "x64");
    archmap.insert("x86", "x86");
    archmap.insert("armv5", "armv5");
    archmap.insert("armv6", "armv6");
    archmap.insert("armv7", "armv7");
    archmap.insert("armv8", "armv8");
    for (arch, dir) in archmap.iter() {
        if target.contains(arch) {
            println!("cargo:rustc-link-search={}/lib/{}/", env::var("CARGO_MANIFEST_DIR").unwrap(), dir);
        }
    }
    println!("cargo:rustc-link-lib=ASICamera2");
    println!("cargo:rustc-link-lib=qhyccd");
    // qhyccd needs libstdc++
    println!("cargo:rustc-flags=-l dylib=stdc++");
    println!("cargo:rustc-flags=-l dylib=usb-1.0");
}