Skip to content

Commit

Permalink
refactor project::get_library_name (#13)
Browse files Browse the repository at this point in the history
  • Loading branch information
rjodinchr authored Dec 2, 2024
1 parent cbc31e8 commit 5c10b7e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 10 deletions.
2 changes: 1 addition & 1 deletion src/ninja_target.rs
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ impl NinjaTarget {
.replace(".so", "")
} else {
generated_libraries.insert(lib.to_string());
project.get_library_name(lib)
rework_name(project.get_library_name(lib))
};
if lib.ends_with(".a") {
static_libraries.insert(lib_name);
Expand Down
17 changes: 8 additions & 9 deletions src/project/clvk.rs
Original file line number Diff line number Diff line change
Expand Up @@ -106,12 +106,10 @@ impl<'a> crate::project::Project<'a> for Clvk<'a> {
let mut deps: GenDepsMap = HashMap::new();
let mut libs: HashSet<String> = HashSet::new();
for library in &self.generated_libraries {
let prefix = if project == ProjectId::LlvmProject {
"external/clspv/third_party/llvm/".to_string()
} else {
"external/".to_string() + &add_slash_suffix(project.str())
};
if let Some(lib) = library.strip_prefix(&prefix) {
if let Some(lib) = self
.get_library_name(library)
.strip_prefix(&add_slash_suffix(project.str()))
{
libs.insert(lib.to_string());
}
}
Expand All @@ -121,10 +119,11 @@ impl<'a> crate::project::Project<'a> for Clvk<'a> {

fn get_library_name(&self, library: &str) -> String {
library
.replace("external/clspv/third_party/llvm", "llvm-project")
.replace(
"external/clspv/third_party/llvm",
ProjectId::LlvmProject.str(),
)
.replace("external/", "")
.replace("/", "_")
.replace(".", "_")
}

fn get_target_header_libs(&self, _target: &str) -> HashSet<String> {
Expand Down

0 comments on commit 5c10b7e

Please sign in to comment.