mirror of
https://gitee.com/openharmony/third_party_rust_log
synced 2024-11-23 07:40:08 +00:00
build.rs: Convert to functions
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
This commit is contained in:
parent
18ab92ffe6
commit
5334a7ecee
32
build.rs
32
build.rs
@ -20,24 +20,13 @@ fn main() {
|
||||
None => return,
|
||||
};
|
||||
|
||||
match &target[..] {
|
||||
"thumbv6m-none-eabi"
|
||||
| "msp430-none-elf"
|
||||
| "riscv32i-unknown-none-elf"
|
||||
| "riscv32imc-unknown-none-elf" => {}
|
||||
|
||||
_ => {
|
||||
if target_has_atomic_cas(&target) {
|
||||
println!("cargo:rustc-cfg=atomic_cas");
|
||||
}
|
||||
};
|
||||
|
||||
match &target[..] {
|
||||
"msp430-none-elf" | "riscv32i-unknown-none-elf" | "riscv32imc-unknown-none-elf" => {}
|
||||
|
||||
_ => {
|
||||
if target_has_atomics(&target) {
|
||||
println!("cargo:rustc-cfg=has_atomics");
|
||||
}
|
||||
};
|
||||
|
||||
// If the Rust version is at least 1.46.0 then we can use type ids at compile time
|
||||
if minor >= 47 {
|
||||
@ -52,6 +41,23 @@ fn main() {
|
||||
println!("cargo:rerun-if-changed=build.rs");
|
||||
}
|
||||
|
||||
fn target_has_atomic_cas(target: &str) -> bool {
|
||||
match &target[..] {
|
||||
"thumbv6m-none-eabi"
|
||||
| "msp430-none-elf"
|
||||
| "riscv32i-unknown-none-elf"
|
||||
| "riscv32imc-unknown-none-elf" => false,
|
||||
_ => true,
|
||||
}
|
||||
}
|
||||
|
||||
fn target_has_atomics(target: &str) -> bool {
|
||||
match &target[..] {
|
||||
"msp430-none-elf" | "riscv32i-unknown-none-elf" | "riscv32imc-unknown-none-elf" => false,
|
||||
_ => true,
|
||||
}
|
||||
}
|
||||
|
||||
fn rustc_target() -> Option<String> {
|
||||
env::var("TARGET").ok()
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user