use IntoIterator for the add_flags methods
This commit is contained in:
parent
841c8e4f93
commit
de01bd3c72
2 changed files with 11 additions and 10 deletions
|
|
@ -6,16 +6,16 @@ pub fn build_cpp_compilation(config: &ProcessedCli) -> Option<CppCompilation> {
|
|||
|
||||
// -ffp-contract=off emulates Rust's approach of not fusing separate mul-add operations
|
||||
let mut command = CompilationCommandBuilder::new()
|
||||
.add_arch_flags(vec!["armv8.6-a", "crypto", "crc", "dotprod", "fp16"])
|
||||
.add_arch_flags(["armv8.6-a", "crypto", "crc", "dotprod", "fp16"])
|
||||
.set_compiler(cpp_compiler)
|
||||
.set_target(&config.target)
|
||||
.set_opt_level("2")
|
||||
.set_cxx_toolchain_dir(config.cxx_toolchain_dir.as_deref())
|
||||
.set_project_root("c_programs")
|
||||
.add_extra_flags(vec!["-ffp-contract=off", "-Wno-narrowing"]);
|
||||
.add_extra_flags(["-ffp-contract=off", "-Wno-narrowing"]);
|
||||
|
||||
if !config.target.contains("v7") {
|
||||
command = command.add_arch_flags(vec!["faminmax", "lut", "sha3"]);
|
||||
command = command.add_arch_flags(["faminmax", "lut", "sha3"]);
|
||||
}
|
||||
|
||||
if !cpp_compiler.contains("clang") {
|
||||
|
|
|
|||
|
|
@ -37,9 +37,9 @@ impl CompilationCommandBuilder {
|
|||
self
|
||||
}
|
||||
|
||||
pub fn add_arch_flags(mut self, flags: Vec<&str>) -> Self {
|
||||
let mut new_arch_flags = flags.into_iter().map(|v| v.to_string()).collect();
|
||||
self.arch_flags.append(&mut new_arch_flags);
|
||||
pub fn add_arch_flags<'a>(mut self, flags: impl IntoIterator<Item = &'a str>) -> Self {
|
||||
self.arch_flags
|
||||
.extend(flags.into_iter().map(|s| s.to_owned()));
|
||||
|
||||
self
|
||||
}
|
||||
|
|
@ -55,14 +55,15 @@ impl CompilationCommandBuilder {
|
|||
self
|
||||
}
|
||||
|
||||
pub fn add_extra_flags(mut self, flags: Vec<&str>) -> Self {
|
||||
let mut flags: Vec<String> = flags.into_iter().map(|f| f.to_string()).collect();
|
||||
self.extra_flags.append(&mut flags);
|
||||
pub fn add_extra_flags<'a>(mut self, flags: impl IntoIterator<Item = &'a str>) -> Self {
|
||||
self.extra_flags
|
||||
.extend(flags.into_iter().map(|s| s.to_owned()));
|
||||
|
||||
self
|
||||
}
|
||||
|
||||
pub fn add_extra_flag(self, flag: &str) -> Self {
|
||||
self.add_extra_flags(vec![flag])
|
||||
self.add_extra_flags([flag])
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue