@@ -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