@@ -232,8 +232,35 @@ static void updateRuntimeLibraryPaths(SearchPathOptions &SearchPathOpts,
232
232
if (LangOpts.hasFeature (Feature::Embedded))
233
233
LibSubDir = " embedded" ;
234
234
235
- llvm::sys::path::append (LibPath, LibSubDir);
236
235
SearchPathOpts.RuntimeLibraryPaths .clear ();
236
+
237
+ #if defined(_WIN32)
238
+ // Resource path looks like this:
239
+ //
240
+ // C:\...\Swift\Toolchains\6.0.0+Asserts\usr\lib\swift
241
+ //
242
+ // The runtimes are in
243
+ //
244
+ // C:\...\Swift\Runtimes\6.0.0\usr\bin
245
+ //
246
+ llvm::SmallString<128 > RuntimePath (LibPath);
247
+
248
+ llvm::sys::path::remove_filename (RuntimePath);
249
+ llvm::sys::path::remove_filename (RuntimePath);
250
+ llvm::sys::path::remove_filename (RuntimePath);
251
+
252
+ llvm::SmallString<128 > VersionWithAttrs (llvm::sys::path::filename (RuntimePath));
253
+ size_t MaybePlus = VersionWithAttrs.find_first_of (' +' );
254
+ StringRef Version = VersionWithAttrs.substr (0 , MaybePlus);
255
+
256
+ llvm::sys::path::remove_filename (RuntimePath);
257
+ llvm::sys::path::remove_filename (RuntimePath);
258
+ llvm::sys::path::append (RuntimePath, " Runtimes" , Version, " usr" , " bin" );
259
+
260
+ SearchPathOpts.RuntimeLibraryPaths .push_back (std::string (RuntimePath.str ()));
261
+ #endif
262
+
263
+ llvm::sys::path::append (LibPath, LibSubDir);
237
264
SearchPathOpts.RuntimeLibraryPaths .push_back (std::string (LibPath.str ()));
238
265
if (Triple.isOSDarwin ())
239
266
SearchPathOpts.RuntimeLibraryPaths .push_back (DARWIN_OS_LIBRARY_PATH);
0 commit comments