use std::path::Path;
use crate::vendored_include_dirs::VENDORED_INCLUDE_DIRS;
#[must_use]
pub fn system_include_flags(sys_dir: &Path) -> Vec<String> {
VENDORED_INCLUDE_DIRS
.iter()
.map(|include_dir| format!("-isystem{}", sys_dir.join(include_dir).display()))
.collect()
}
#[cfg(test)]
mod tests {
use std::path::Path;
use super::system_include_flags;
#[test]
fn every_vendored_include_dir_becomes_a_system_include_under_the_sys_dir() {
assert_eq!(
system_include_flags(Path::new("/repo/llama-cpp-bindings-sys")),
[
"-isystem/repo/llama-cpp-bindings-sys/GSL/include",
"-isystem/repo/llama-cpp-bindings-sys/llama.cpp",
"-isystem/repo/llama-cpp-bindings-sys/llama.cpp/common",
"-isystem/repo/llama-cpp-bindings-sys/llama.cpp/include",
"-isystem/repo/llama-cpp-bindings-sys/llama.cpp/ggml/include",
"-isystem/repo/llama-cpp-bindings-sys/llama.cpp/vendor",
]
);
}
}