build-target

CI crates.io Documentation dependency status MIT

A crate that provides programmatic access to information about the current build target inside build.rs.

Examples

Prints all available information about the current build target. ```rust // inside build.rs

fn main() { // The panic is just used to print the information to the console. panic!("current build target: {:#?}", build_target::target().unwrap() ); } ```

Gets the parts of the current build target individually. ```rust // inside build.rs

fn main() { let arch = buildtarget::targetarch().unwrap(); // eg. "x8664", "aarch64", ... let env = buildtarget::targetenv().unwrap(); // eg. "gnu", "msvc", ... let family = buildtarget::targetfamily().unwrap(); // eg. "windows", "unix", ... let os = buildtarget::targetos().unwrap(); // eg. "android", "linux", ... let triple = buildtarget::targettriple().unwrap(); // eg. x8664-unknown-linux-gnu", ... } ```

Attribution

This crate is inspired by and partially based on platforms.

License

Licensed under MIT license (LICENSE or http://opensource.org/licenses/MIT)