diff --git a/Cargo.toml b/Cargo.toml index 0b1e2c4..d9e3723 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -26,9 +26,6 @@ portable = [ "blst/portable", "semolina/portable" ] # Binary can be executed on Broadwell+ and Ryzen+ systems. force-adx = [ "blst/force-adx", "semolina/force-adx" ] cuda-mobile = [] -# Build with __MSM_SORT_DONT_IMPLEMENT__ to prevent redefining -# symbols that breaks compilation during linking. -dont-implement-sort = [] [dependencies] blst = "~0.3.11" diff --git a/build.rs b/build.rs index 3a6f625..8d08528 100644 --- a/build.rs +++ b/build.rs @@ -73,20 +73,26 @@ fn common_build_configurations(cc: &mut cc::Build) { } fn determine_cc_def(target_arch: &str, default_def: &str) -> Option { - match (cfg!(feature = "portable"), cfg!(feature = "force-adx")) { - (true, false) => Some(default_def.to_string()), - (false, true) if target_arch == "x86_64" => Some("__ADX__".to_string()), - (false, false) - if target_arch == "x86_64" - && std::is_x86_feature_detected!("adx") => - { - Some("__ADX__".to_string()) + if cfg!(feature = "portable") && cfg!(feature = "force-adx") { + panic!("Cannot compile with both `portable` and `force-adx` features"); + } + + if cfg!(feature = "portable") { + return Some(default_def.to_string()); + } + + if cfg!(feature = "force-adx") && target_arch == "x86_64" { + return Some("__ADX__".to_string()); + } + + #[cfg(target_arch = "x86_64")] + { + if target_arch == "x86_64" && std::is_x86_feature_detected!("adx") { + return Some("__ADX__".to_string()); } - (true, true) => panic!( - "Cannot compile with both `portable` and `force-adx` features" - ), - _ => None, } + + None } fn cuda_available() -> bool {