use super::{C_STANDARD, CXX_STANDARD};
use std::path::{Path, PathBuf};
pub fn build(install_dir: &Path, build_type: &str) -> PathBuf {
println!("[snappy] Building");
let mut config = cmake::Config::new(std::path::Path::new("deps").join("snappy"));
config
.profile(build_type)
.define("CMAKE_CXX_STANDARD", CXX_STANDARD)
.define("CMAKE_C_STANDARD", C_STANDARD)
.define("BUILD_SHARED_LIBS", "OFF")
.define("SNAPPY_BUILD_TESTS", "OFF")
.define("SNAPPY_BUILD_BENCHMARKS", "OFF")
.define("HAVE_LIBZ", "OFF")
.define("CMAKE_INSTALL_LIBDIR", install_dir);
crate::apply_cmake_flags(&mut config);
let dest_prefix = config.build();
assert_eq!(
dest_prefix.join(install_dir.file_name().unwrap()),
install_dir,
"CMake should build Snappy in provided install_dir"
);
dest_prefix
}