wiringpi 0.1.2

An API wrapper for WiringPi, implementing the most important functions and provides a bit of type system convenience. See README.md for Raspberry Pi build instructions.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
use std::process::Command;
use std::env;

fn main() {
    if !cfg!(feature = "noclib") {
        let out_dir = env::var("OUT_DIR").unwrap();
        match Command::new("make").arg("-e").status() {
            Ok(status) if !status.success() => panic!("failed to build wiringPi C library (exit code {:?})", status.code()),
            Err(e) => panic!("failed to build wiringPi C library: {}", e),
            _ => {}
        }
        println!("cargo:rustc-flags=-L native={} -l static=wiringpi", out_dir);
    }
}