cd6c97ea60
MozReview-Commit-ID: BOgu41N351y --HG-- rename : third_party/rust/serde/.cargo-checksum.json => third_party/rust/serde-0.8.23/.cargo-checksum.json rename : third_party/rust/serde/Cargo.toml => third_party/rust/serde-0.8.23/Cargo.toml rename : third_party/rust/serde/src/bytes.rs => third_party/rust/serde-0.8.23/src/bytes.rs rename : third_party/rust/serde/src/de/impls.rs => third_party/rust/serde-0.8.23/src/de/impls.rs rename : third_party/rust/serde/src/de/mod.rs => third_party/rust/serde-0.8.23/src/de/mod.rs rename : third_party/rust/serde/src/de/value.rs => third_party/rust/serde-0.8.23/src/de/value.rs rename : third_party/rust/serde/src/error.rs => third_party/rust/serde-0.8.23/src/error.rs rename : third_party/rust/serde/src/lib.rs => third_party/rust/serde-0.8.23/src/lib.rs rename : third_party/rust/serde/src/macros.rs => third_party/rust/serde-0.8.23/src/macros.rs rename : third_party/rust/serde/src/ser/impls.rs => third_party/rust/serde-0.8.23/src/ser/impls.rs rename : third_party/rust/serde/src/ser/mod.rs => third_party/rust/serde-0.8.23/src/ser/mod.rs extra : rebase_source : d015147c7a6c01b34c5a1abf035d71f8ecfe0c12 |
||
---|---|---|
.. | ||
src | ||
.cargo-checksum.json | ||
.cargo-ok | ||
.gitignore | ||
.travis.yml | ||
Cargo.toml | ||
README.md | ||
appveyor.yml | ||
build.rs |
README.md
Utility crate to handle the TARGET
environment variable passed into build.rs scripts.
Unlike rust’s #[cfg(target…)]
attributes, build.rs
-scripts do not expose a convenient way
to detect the system the code will be built for in a way which would properly support
cross-compilation.
This crate exposes target_arch
, target_vendor
, target_os
and target_abi
very much in
the same manner as the corresponding cfg
attributes in Rust do, thus allowing build.rs
script to adjust the output depending on the target the crate is being built for..
Custom target json files are also supported.
Using target_build_utils
This crate is only useful if you’re using a build script (build.rs
). Add dependency to this
crate to your Cargo.toml
via:
[package]
# ...
build = "build.rs"
[build-dependencies]
target_build_utils = "0.1"
Then write your build.rs
like this:
extern crate target_build_utils;
use target_build_utils::TargetInfo;
fn main() {
let target = TargetInfo::new().expect("could not get target info");
if target.target_os() == "windows" {
// conditional stuff for windows
}
}
Now, when running cargo build
, your build.rs
should be aware of the properties of the
target system when your crate is being cross-compiled.
License
llvm_build_utils is distributed under ISC (MIT-like) or Apache (version 2.0) license at your choice.