Skip to content

Commit

Permalink
add coverage for llvm-config path resolution
Browse files Browse the repository at this point in the history
Signed-off-by: onur-ozkan <work@onurozkan.dev>
  • Loading branch information
onur-ozkan committed Feb 10, 2025
1 parent 4b8b18f commit fe4fb79
Show file tree
Hide file tree
Showing 2 changed files with 438 additions and 227 deletions.
19 changes: 16 additions & 3 deletions src/bootstrap/src/core/build_steps/llvm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,14 @@ impl LlvmBuildStatus {
LlvmBuildStatus::ShouldBuild(_) => true,
}
}

#[cfg(test)]
pub fn llvm_result(&self) -> &LlvmResult {
match self {
LlvmBuildStatus::AlreadyBuilt(res) => res,
LlvmBuildStatus::ShouldBuild(meta) => &meta.res,
}
}
}

/// Linker flags to pass to LLVM's CMake invocation.
Expand Down Expand Up @@ -120,12 +128,17 @@ pub fn prebuilt_llvm_config(
let root = "src/llvm-project/llvm";
let out_dir = builder.llvm_out(target);

let build_llvm_config = if target == builder.config.build {
let build_llvm_config = if let Some(build_llvm_config) = builder
.config
.target_config
.get(&builder.config.build)
.and_then(|config| config.llvm_config.clone())
{
build_llvm_config
} else {
let mut llvm_config_ret_dir = builder.llvm_out(builder.config.build);
llvm_config_ret_dir.push("bin");
llvm_config_ret_dir.join(exe("llvm-config", builder.config.build))
} else {
builder.ensure(Llvm { target: builder.config.build }).llvm_config
};

let llvm_cmake_dir = out_dir.join("lib/cmake/llvm");
Expand Down
Loading

0 comments on commit fe4fb79

Please sign in to comment.