Skip to content

Commit

Permalink
Remove utils, and updated CI
Browse files Browse the repository at this point in the history
  • Loading branch information
mrLSD committed Jul 1, 2024
1 parent 503e134 commit 2b9ee1c
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 128 deletions.
1 change: 0 additions & 1 deletion .github/workflows/swift.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ jobs:
source /Users/runner/.bash_profile
clang --version
swift --version
# swift utils/make-pkg-config.swift
- name: Build
run: swift build -v
Expand Down
13 changes: 10 additions & 3 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
import PackageDescription
import Foundation

let (cFlags, linkFlags) = try! getLLVMConfig()
// Get LLVM flags and version
let (cFlags, linkFlags, _version) = try! getLLVMConfig()

let package = Package(
name: "llvm-api",
Expand All @@ -31,7 +32,7 @@ let package = Package(
)

/// Get LLVM config flags
func getLLVMConfig() throws -> ([String], [String]) {
func getLLVMConfig() throws -> ([String], [String], [Int]) {
let brewPrefix = {
guard let brew = which("brew") else { return nil }
return run(brew, args: ["--prefix"])
Expand All @@ -40,6 +41,12 @@ func getLLVMConfig() throws -> ([String], [String]) {
guard let llvmConfig = which("llvm-config") ?? which("\(brewPrefix)/opt/llvm/bin/llvm-config") else {
throw "Failed to find llvm-config. Ensure llvm-config is installed and in your PATH"
}
// Fetch LLVM version
let versionStr = run(llvmConfig, args: ["--version"])!
.replacing(charactersIn: .newlines, with: "")
.replacingOccurrences(of: "svn", with: "")
let versionComponents = versionStr.components(separatedBy: ".")
.compactMap { Int($0) }
// Get linkage (LD) flags
let ldFlags = run(llvmConfig, args: ["--ldflags", "--libs", "all", "--system-libs"])!
.replacing(charactersIn: .newlines, with: " ")
Expand All @@ -50,7 +57,7 @@ func getLLVMConfig() throws -> ([String], [String]) {
.replacing(charactersIn: .newlines, with: "")
.components(separatedBy: " ")
.filter { $0.hasPrefix("-I") }
return (cFlags, ldFlags)
return (cFlags, ldFlags, versionComponents)
}

/// Runs the specified program at the provided path.
Expand Down
124 changes: 0 additions & 124 deletions utils/make-pkg-config.swift

This file was deleted.

0 comments on commit 2b9ee1c

Please sign in to comment.