Skip to content

Commit

Permalink
Don't read CLANG anymore in build.rs
Browse files Browse the repository at this point in the history
  • Loading branch information
xxuejie committed Jan 4, 2024
1 parent 6cbf068 commit f9c6d1a
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions contracts/atomics-without-a/build.rs
Original file line number Diff line number Diff line change
@@ -1,19 +1,18 @@
fn main() {
println!("cargo:rerun-if-changed=../../deps/lib-dummy-atomics/atomics.c");

let clang = match std::env::var_os("CLANG") {
Some(val) => val,
None => "clang-16".into(),
};

let target_arch = std::env::var("CARGO_CFG_TARGET_ARCH").unwrap();
if target_arch == "riscv64" {
cc::Build::new()
let mut build = cc::Build::new();
assert!(
build.get_compiler().is_like_clang(),
"Clang must be used as the compiler!"
);
build
.file("../../deps/lib-dummy-atomics/atomics.c")
.static_flag(true)
.include("../../deps/ckb-c-stdlib")
.include("../../deps/ckb-c-stdlib/libc")
.compiler(clang)
.no_default_flags(true)
.flag("--target=riscv64")
.flag("-march=rv64imc_zba_zbb_zbc_zbs")
Expand Down

0 comments on commit f9c6d1a

Please sign in to comment.