extern crate gcc; use std::fs::read_dir; use std::path::Path; use std::ffi::OsString; fn main() { let src_path = Path::new("externals/7zx/src"); let files = read_dir("externals/7zx/src").unwrap(); let mut gcc = gcc::Build::new(); for file in files { let filename : OsString = file.unwrap().file_name(); let file_string = filename.to_str().unwrap(); if file_string.ends_with(".c") { let path = src_path.join(file_string); gcc.file(path); } } gcc.include("externals/7zx/include") .include("externals/7zx/src") .compile("lib7zx.a"); }