Skip to content

Commit 7e6a110

Browse files
committed
Specify build flag that hopefully works
1 parent e11234a commit 7e6a110

File tree

1 file changed

+9
-16
lines changed

1 file changed

+9
-16
lines changed

pqcrypto-internals/build.rs

Lines changed: 9 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -34,20 +34,20 @@ fn main() {
3434

3535
let target_arch = env::var("CARGO_CFG_TARGET_ARCH").unwrap_or_default();
3636
let target_env = env::var("CARGO_CFG_TARGET_ENV").unwrap_or_default();
37-
if target_arch == "x86" || target_arch == "x86_64" {
38-
let mut builder = cc::Build::new();
37+
let mut builder = cc::Build::new();
3938

40-
if target_os == "wasi" {
41-
let wasi_sdk_path =
42-
&std::env::var("WASI_SDK_DIR").expect("missing environment variable: WASI_SDK_DIR");
43-
builder.flag(format!("--sysroot={wasi_sdk_path}").as_str());
44-
}
39+
if target_os == "wasi" {
40+
let wasi_sdk_path =
41+
&std::env::var("WASI_SDK_DIR").expect("missing environment variable: WASI_SDK_DIR");
42+
builder.flag(format!("--sysroot={wasi_sdk_path}").as_str());
43+
}
4544

45+
if target_arch == "x86" || target_arch == "x86_64" {
4646
if target_env == "msvc" {
4747
builder.flag("/arch:AVX2");
4848
} else {
4949
builder.flag("-mavx2");
50-
};
50+
}
5151
builder
5252
.file(
5353
cfiledir
@@ -57,15 +57,8 @@ fn main() {
5757
.compile("keccak4x");
5858
println!("cargo:rustc-link-lib=keccak4x")
5959
} else if target_arch == "aarch64" && target_env != "msvc" {
60-
let mut builder = cc::Build::new();
61-
62-
if target_os == "wasi" {
63-
let wasi_sdk_path =
64-
&std::env::var("WASI_SDK_DIR").expect("missing environment variable: WASI_SDK_DIR");
65-
builder.flag(format!("--sysroot={wasi_sdk_path}").as_str());
66-
}
67-
6860
builder
61+
.flag("-march=armv8-a")
6962
.file(cfiledir.join("keccak2x").join("fips202x2.c"))
7063
.file(cfiledir.join("keccak2x").join("feat.S"))
7164
.compile("keccak2x");

0 commit comments

Comments
 (0)