extern crate cc; extern crate glob; use std::path::Path; fn main() { let common_dir = Path::new("pqclean/common"); let common_files = vec![ common_dir.join("fips202.c"), common_dir.join("aes.c"), common_dir.join("sha2.c"), common_dir.join("randombytes.c"), common_dir.join("sp800-185.c"), ]; cc::Build::new() .flag("-std=c99") .include("pqclean/common") .files(common_files.into_iter()) .compile("pqclean_common"); { let mut builder = cc::Build::new(); let target_dir = Path::new("pqclean/crypto_kem/newhope1024cpa/clean"); let scheme_files = glob::glob(target_dir.join("*.c").to_str().unwrap()).unwrap(); builder .flag("-std=c99") .include("pqclean/common") .include(target_dir) .files( scheme_files .into_iter() .map(|p| p.unwrap().to_string_lossy().into_owned()), ); builder.compile("newhope1024cpa_clean"); } { let mut builder = cc::Build::new(); let target_dir = Path::new("pqclean/crypto_kem/newhope1024cca/clean"); let scheme_files = glob::glob(target_dir.join("*.c").to_str().unwrap()).unwrap(); builder .flag("-std=c99") .include("pqclean/common") .include(target_dir) .files( scheme_files .into_iter() .map(|p| p.unwrap().to_string_lossy().into_owned()), ); builder.compile("newhope1024cca_clean"); } { let mut builder = cc::Build::new(); let target_dir = Path::new("pqclean/crypto_kem/newhope512cpa/clean"); let scheme_files = glob::glob(target_dir.join("*.c").to_str().unwrap()).unwrap(); builder .flag("-std=c99") .include("pqclean/common") .include(target_dir) .files( scheme_files .into_iter() .map(|p| p.unwrap().to_string_lossy().into_owned()), ); builder.compile("newhope512cpa_clean"); } { let mut builder = cc::Build::new(); let target_dir = Path::new("pqclean/crypto_kem/newhope512cca/clean"); let scheme_files = glob::glob(target_dir.join("*.c").to_str().unwrap()).unwrap(); builder .flag("-std=c99") .include("pqclean/common") .include(target_dir) .files( scheme_files .into_iter() .map(|p| p.unwrap().to_string_lossy().into_owned()), ); builder.compile("newhope512cca_clean"); } }