-
Notifications
You must be signed in to change notification settings - Fork 71
/
Package.swift
162 lines (141 loc) · 4.26 KB
/
Package.swift
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
// swift-tools-version:5.5
import Foundation
import PackageDescription
func hasEnvironmentVariable(_ name: String) -> Bool {
return ProcessInfo.processInfo.environment[name] != nil
}
/// Assume that all the package dependencies are checked out next to indexstore-db and use that instead of fetching a
/// remote dependency.
var useLocalDependencies: Bool { hasEnvironmentVariable("SWIFTCI_USE_LOCAL_DEPS") }
var dependencies: [Package.Dependency] {
if useLocalDependencies {
return [
.package(path: "../swift-lmdb"),
]
} else {
return [
.package(url: "https://github.com/swiftlang/swift-lmdb.git", branch: "main"),
]
}
}
let package = Package(
name: "IndexStoreDB",
products: [
.library(
name: "IndexStoreDB",
targets: ["IndexStoreDB"]),
.library(
name: "IndexStoreDB_CXX",
targets: ["IndexStoreDB_Index"]),
.library(
name: "ISDBTestSupport",
targets: ["ISDBTestSupport"]),
.executable(
name: "tibs",
targets: ["tibs"])
],
dependencies: dependencies,
targets: [
// MARK: Swift interface
.target(
name: "IndexStoreDB",
dependencies: ["IndexStoreDB_CIndexStoreDB"],
exclude: ["CMakeLists.txt"]),
.testTarget(
name: "IndexStoreDBTests",
dependencies: ["IndexStoreDB", "ISDBTestSupport"]),
// MARK: Swift Test Infrastructure
// The Test Index Build System (tibs) library.
.target(
name: "ISDBTibs",
dependencies: []),
.testTarget(
name: "ISDBTibsTests",
dependencies: ["ISDBTibs", "ISDBTestSupport"]),
// Commandline tool for working with tibs projects.
.executableTarget(
name: "tibs",
dependencies: ["ISDBTibs"]),
// Test support library, built on top of tibs.
.target(
name: "ISDBTestSupport",
dependencies: ["IndexStoreDB", "ISDBTibs", "tibs"],
resources: [
.copy("INPUTS")
],
linkerSettings: [
.linkedFramework("XCTest", .when(platforms: [.iOS, .macOS, .tvOS, .watchOS]))
]),
// MARK: C++ interface
// Primary C++ interface.
.target(
name: "IndexStoreDB_Index",
dependencies: ["IndexStoreDB_Database"],
path: "lib/Index",
exclude: [
"CMakeLists.txt",
"indexstore_functions.def",
]),
// C wrapper for IndexStoreDB_Index.
.target(
name: "IndexStoreDB_CIndexStoreDB",
dependencies: ["IndexStoreDB_Index"],
path: "lib/CIndexStoreDB",
exclude: ["CMakeLists.txt"]),
// The lmdb database layer.
.target(
name: "IndexStoreDB_Database",
dependencies: [
"IndexStoreDB_Core",
.product(name: "CLMDB", package: "swift-lmdb"),
],
path: "lib/Database",
exclude: [
"CMakeLists.txt",
]),
// Core index types.
.target(
name: "IndexStoreDB_Core",
dependencies: ["IndexStoreDB_Support"],
path: "lib/Core",
exclude: ["CMakeLists.txt"]),
// Support code that is generally useful to the C++ implementation.
.target(
name: "IndexStoreDB_Support",
dependencies: ["IndexStoreDB_LLVMSupport"],
path: "lib/Support",
exclude: ["CMakeLists.txt"]),
// Copy of a subset of llvm's ADT and Support libraries.
.target(
name: "IndexStoreDB_LLVMSupport",
dependencies: [],
path: "lib/LLVMSupport",
exclude: [
"LICENSE.TXT",
"CMakeLists.txt",
// *.inc, *.def
"include/llvm/Support/AArch64TargetParser.def",
"include/llvm/Support/ARMTargetParser.def",
"include/llvm/Support/X86TargetParser.def",
"Support/Unix/Host.inc",
"Support/Unix/Memory.inc",
"Support/Unix/Mutex.inc",
"Support/Unix/Path.inc",
"Support/Unix/Process.inc",
"Support/Unix/Program.inc",
"Support/Unix/Signals.inc",
"Support/Unix/Threading.inc",
"Support/Unix/Watchdog.inc",
"Support/Windows/Host.inc",
"Support/Windows/Memory.inc",
"Support/Windows/Mutex.inc",
"Support/Windows/Path.inc",
"Support/Windows/Process.inc",
"Support/Windows/Program.inc",
"Support/Windows/Signals.inc",
"Support/Windows/Threading.inc",
"Support/Windows/Watchdog.inc",
]),
],
cxxLanguageStandard: .cxx17
)