Skip to content

Commit 2b9ee1c

Browse files
committed
Remove utils, and updated CI
1 parent 503e134 commit 2b9ee1c

File tree

3 files changed

+10
-128
lines changed

3 files changed

+10
-128
lines changed

.github/workflows/swift.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ jobs:
2727
source /Users/runner/.bash_profile
2828
clang --version
2929
swift --version
30-
# swift utils/make-pkg-config.swift
3130
3231
- name: Build
3332
run: swift build -v

Package.swift

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
import PackageDescription
55
import Foundation
66

7-
let (cFlags, linkFlags) = try! getLLVMConfig()
7+
// Get LLVM flags and version
8+
let (cFlags, linkFlags, _version) = try! getLLVMConfig()
89

910
let package = Package(
1011
name: "llvm-api",
@@ -31,7 +32,7 @@ let package = Package(
3132
)
3233

3334
/// Get LLVM config flags
34-
func getLLVMConfig() throws -> ([String], [String]) {
35+
func getLLVMConfig() throws -> ([String], [String], [Int]) {
3536
let brewPrefix = {
3637
guard let brew = which("brew") else { return nil }
3738
return run(brew, args: ["--prefix"])
@@ -40,6 +41,12 @@ func getLLVMConfig() throws -> ([String], [String]) {
4041
guard let llvmConfig = which("llvm-config") ?? which("\(brewPrefix)/opt/llvm/bin/llvm-config") else {
4142
throw "Failed to find llvm-config. Ensure llvm-config is installed and in your PATH"
4243
}
44+
// Fetch LLVM version
45+
let versionStr = run(llvmConfig, args: ["--version"])!
46+
.replacing(charactersIn: .newlines, with: "")
47+
.replacingOccurrences(of: "svn", with: "")
48+
let versionComponents = versionStr.components(separatedBy: ".")
49+
.compactMap { Int($0) }
4350
// Get linkage (LD) flags
4451
let ldFlags = run(llvmConfig, args: ["--ldflags", "--libs", "all", "--system-libs"])!
4552
.replacing(charactersIn: .newlines, with: " ")
@@ -50,7 +57,7 @@ func getLLVMConfig() throws -> ([String], [String]) {
5057
.replacing(charactersIn: .newlines, with: "")
5158
.components(separatedBy: " ")
5259
.filter { $0.hasPrefix("-I") }
53-
return (cFlags, ldFlags)
60+
return (cFlags, ldFlags, versionComponents)
5461
}
5562

5663
/// Runs the specified program at the provided path.

utils/make-pkg-config.swift

Lines changed: 0 additions & 124 deletions
This file was deleted.

0 commit comments

Comments
 (0)