| Crates.io | build-target |
| lib.rs | build-target |
| version | 0.8.0 |
| created_at | 2021-08-01 14:19:46.736078+00 |
| updated_at | 2025-07-15 18:28:45.337202+00 |
| description | A crate that provides programmatic access to information about the current build target. |
| homepage | https://github.com/OpenByteDev/build-target |
| repository | https://github.com/OpenByteDev/build-target |
| max_upload_size | |
| id | 430023 |
| size | 32,033 |
A crate that provides programmatic access to information about the current build target inside build.rs.
Prints all available information about the current build target.
// inside build.rs
fn main() {
// The panic is just used to print the information to the console.
panic!("current build target: {:#?}",
build_target::target()
);
}
Gets the parts of the current build target individually.
// inside build.rs
fn main() {
let arch = build_target::target_arch(); // eg. "x86_64", "aarch64", ...
let endian = build_target::target_endian(); // eg. "big", "little", ...
let env = build_target::target_env(); // eg. "gnu", "msvc", ...
let family = build_target::target_family(); // eg. "windows", "unix", ...
let pw = build_target::target_pointer_width(); // eg. "32", "64", ...
let os = build_target::target_os(); // eg. "android", "linux", ...
let vendor = build_target::target_vendor(); // eg. "apple", "unknown", ...
let triple = build_target::target_triple(); // eg. "x86_64-unknown-linux-gnu", ...
}
This crate is inspired by and partially based on platforms.
Licensed under MIT license (LICENSE or http://opensource.org/licenses/MIT)