Skip to content

Commit 5c67f81

Browse files
segiddinsHarlan
authored andcommitted
[make-pkgconfig] Discover llvm-config via brew by default (#113)
* [make-pkgconfig] Discover llvm-config via brew by default * [make-pkgconfig] Use brew --prefix
1 parent 1e1f638 commit 5c67f81

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

utils/make-pkgconfig.swift

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,14 @@ func makeFile() throws {
5656
}
5757
let cllvmPath = pkgConfigDir.appendingPathComponent("cllvm.pc")
5858

59+
let brewLLVMConfig: () -> String? = {
60+
guard let brew = which("brew") else { return nil }
61+
guard let brewPrefix = run(brew, args: ["--prefix"]) else { return nil }
62+
return which(brewPrefix + "/opt/llvm/bin/llvm-config")
63+
}
64+
5965
/// Ensure we have llvm-config in the PATH
60-
guard let llvmConfig = which("llvm-config-3.9") ?? which("llvm-config") else {
66+
guard let llvmConfig = which("llvm-config-3.9") ?? which("llvm-config") ?? brewLLVMConfig() else {
6167
throw "Failed to find llvm-config. Ensure llvm-config is installed and " +
6268
"in your PATH"
6369
}

0 commit comments

Comments
 (0)