Skip to content

Commit

Permalink
Update Package.swift conditional config
Browse files Browse the repository at this point in the history
  • Loading branch information
mrLSD committed Jul 17, 2024
1 parent 7c12785 commit c43e751
Showing 1 changed file with 27 additions and 17 deletions.
44 changes: 27 additions & 17 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,32 @@ import PackageDescription
// Get LLVM flags and version
#if CLI_BUILD
let (cFlags, linkFlags, _version) = try! getLLVMConfig()
let customSystemLibrary: Target = .systemLibrary(
name: "CLLVM",
path: "llvm-api/CLLVM"
)
let llvmTarget: Target = .target(
name: "LLVM",
dependencies: ["CLLVM"],
path: "llvm-api/LLVM",
cSettings: [
.unsafeFlags(cFlags),
],
linkerSettings: [
.unsafeFlags(linkFlags),
]
)
#else
let (cFlags, linkFlags, _version) = ([String](), [String](), [Int]())
let customSystemLibrary: Target = .systemLibrary(
name: "CLLVM",
path: "llvm-api/CLLVM",
pkgConfig: "cllvm"
)
let llvmTarget: Target = .target(
name: "LLVM",
dependencies: ["CLLVM"],
path: "llvm-api/LLVM"
)
#endif

let package = Package(
Expand All @@ -17,22 +41,8 @@ let package = Package(
.library(name: "llvm-api", targets: ["LLVM"]),
],
targets: [
.systemLibrary(
name: "CLLVM",
path: "llvm-api/CLLVM",
pkgConfig: "cllvm"
),
.target(
name: "LLVM",
dependencies: ["CLLVM"],
path: "llvm-api/LLVM",
cSettings: [
.unsafeFlags(cFlags),
],
linkerSettings: [
.unsafeFlags(linkFlags),
]
),
customSystemLibrary,
llvmTarget,
]
)

Expand Down

0 comments on commit c43e751

Please sign in to comment.