Skip to content

Commit c43e751

Browse files
committed
Update Package.swift conditional config
1 parent 7c12785 commit c43e751

File tree

1 file changed

+27
-17
lines changed

1 file changed

+27
-17
lines changed

Package.swift

Lines changed: 27 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,32 @@ import PackageDescription
77
// Get LLVM flags and version
88
#if CLI_BUILD
99
let (cFlags, linkFlags, _version) = try! getLLVMConfig()
10+
let customSystemLibrary: Target = .systemLibrary(
11+
name: "CLLVM",
12+
path: "llvm-api/CLLVM"
13+
)
14+
let llvmTarget: Target = .target(
15+
name: "LLVM",
16+
dependencies: ["CLLVM"],
17+
path: "llvm-api/LLVM",
18+
cSettings: [
19+
.unsafeFlags(cFlags),
20+
],
21+
linkerSettings: [
22+
.unsafeFlags(linkFlags),
23+
]
24+
)
1025
#else
11-
let (cFlags, linkFlags, _version) = ([String](), [String](), [Int]())
26+
let customSystemLibrary: Target = .systemLibrary(
27+
name: "CLLVM",
28+
path: "llvm-api/CLLVM",
29+
pkgConfig: "cllvm"
30+
)
31+
let llvmTarget: Target = .target(
32+
name: "LLVM",
33+
dependencies: ["CLLVM"],
34+
path: "llvm-api/LLVM"
35+
)
1236
#endif
1337

1438
let package = Package(
@@ -17,22 +41,8 @@ let package = Package(
1741
.library(name: "llvm-api", targets: ["LLVM"]),
1842
],
1943
targets: [
20-
.systemLibrary(
21-
name: "CLLVM",
22-
path: "llvm-api/CLLVM",
23-
pkgConfig: "cllvm"
24-
),
25-
.target(
26-
name: "LLVM",
27-
dependencies: ["CLLVM"],
28-
path: "llvm-api/LLVM",
29-
cSettings: [
30-
.unsafeFlags(cFlags),
31-
],
32-
linkerSettings: [
33-
.unsafeFlags(linkFlags),
34-
]
35-
),
44+
customSystemLibrary,
45+
llvmTarget,
3646
]
3747
)
3848

0 commit comments

Comments
 (0)