Skip to content

Commit

Permalink
fix(concrete-csprng): handle multi-valued target_family
Browse files Browse the repository at this point in the history
  • Loading branch information
madsmtm authored and IceTDrinker committed Jun 28, 2024
1 parent 2dc5c8a commit 97ebccb
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions concrete-csprng/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,15 @@ impl FeatureRequirement {
}
}

let target_family = get_target_family_cfg();
let target_families = get_target_family_cfgs();
if let Some(feature_req_target_family) = self.feature_req_target_family {
if feature_req_target_family != target_family {
if target_families
.split(',')
.all(|family| family != feature_req_target_family)
{
panic!(
"Feature `{}` requires target_family `{}`, current cfg: `{}`",
self.feature_name, feature_req_target_family, target_family
"Feature `{}` requires target_family `{}`, current cfgs: `{}`",
self.feature_name, feature_req_target_family, target_families
)
}
}
Expand Down Expand Up @@ -97,7 +100,7 @@ fn get_target_arch_cfg() -> String {
env::var("CARGO_CFG_TARGET_ARCH").expect("CARGO_CFG_TARGET_ARCH is not set")
}

fn get_target_family_cfg() -> String {
fn get_target_family_cfgs() -> String {
env::var("CARGO_CFG_TARGET_FAMILY").expect("CARGO_CFG_TARGET_FAMILY is not set")
}

Expand Down

0 comments on commit 97ebccb

Please sign in to comment.