Skip to content

Commit 395c4a9

Browse files
authored
Merge pull request #2943 from compnerd/indexstore
Build: correct lookup for `libIndexStore.dll` on Windows
2 parents 4d62ad7 + 4a05cf5 commit 395c4a9

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

Sources/Build/BuildDelegate.swift

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -265,8 +265,25 @@ public final class BuildExecutionContext {
265265
private var indexStoreAPICache = LazyCache(createIndexStoreAPI)
266266
private func createIndexStoreAPI() -> Result<IndexStoreAPI, Error> {
267267
Result {
268+
#if os(Windows)
269+
// The library's runtime component is in the `bin` directory on
270+
// Windows rather than the `lib` directory as on unicies. The `lib`
271+
// directory contains the import library (and possibly static
272+
// archives) which are used for linking. The runtime component is
273+
// not (necessarily) part of the SDK distributions.
274+
//
275+
// NOTE: the library name here `libIndexStore.dll` is technically
276+
// incorrect as per the Windows naming convention. However, the
277+
// library is currently installed as `libIndexStore.dll` rather than
278+
// `IndexStore.dll`. In the future, this may require a fallback
279+
// search, preferring `IndexStore.dll` over `libIndexStore.dll`.
280+
let indexStoreLib = buildParameters.toolchain.swiftCompiler
281+
.parentDirectory
282+
.appending(component: "libIndexStore.dll")
283+
#else
268284
let ext = buildParameters.hostTriple.dynamicLibraryExtension
269285
let indexStoreLib = buildParameters.toolchain.toolchainLibDir.appending(component: "libIndexStore" + ext)
286+
#endif
270287
return try IndexStoreAPI(dylib: indexStoreLib)
271288
}
272289
}

0 commit comments

Comments
 (0)