https://github.com/openbytedev/build-target
A crate that provides programmatic access to information about the current build target inside build.rs.
https://github.com/openbytedev/build-target
Last synced: about 1 year ago
JSON representation
A crate that provides programmatic access to information about the current build target inside build.rs.
- Host: GitHub
- URL: https://github.com/openbytedev/build-target
- Owner: OpenByteDev
- License: mit
- Created: 2021-07-31T22:27:00.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2022-04-29T21:23:49.000Z (almost 4 years ago)
- Last Synced: 2024-10-14T11:49:01.769Z (over 1 year ago)
- Language: Rust
- Homepage:
- Size: 65.4 KB
- Stars: 3
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# build-target
[](https://github.com/OpenByteDev/build-target/actions/workflows/ci.yml)
[](https://crates.io/crates/build-target)
[](https://docs.rs/build-target)
[](https://deps.rs/repo/github/openbytedev/build-target)
[](https://github.com/OpenByteDev/build-target/blob/master/LICENSE)
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 = build_target::target_arch().unwrap(); // eg. "x86_64", "aarch64", ...
let env = build_target::target_env().unwrap(); // eg. "gnu", "msvc", ...
let family = build_target::target_family().unwrap(); // eg. "windows", "unix", ...
let os = build_target::target_os().unwrap(); // eg. "android", "linux", ...
let triple = build_target::target_triple().unwrap(); // eg. "x86_64-unknown-linux-gnu", ...
}
```
## Attribution
This crate is inspired by and partially based on [`platforms`](https://crates.io/crates/platforms).
## License
Licensed under MIT license ([LICENSE](https://github.com/OpenByteDev/build-target/blob/master/LICENSE) or http://opensource.org/licenses/MIT)