sys-info 0.3.1

Get system information in Rust. For now it supports Linux, Mac OS X and Windows.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
extern crate gcc;

fn main() {
    if cfg!(target_os = "linux") {
        gcc::compile_library("libinfo.a", &["c/linux.c"]);
    } else if cfg!(target_os = "macos") {
        gcc::compile_library("libinfo.a", &["c/macos.c"]);
    } else if cfg!(target_os = "windows") {
        gcc::compile_library("libinfo.a", &["c/windows.c"]);
        println!("cargo:rustc-flags=-l psapi");
    } else {
        panic!("Unsupported system");
    }
}