@@ -198,8 +198,35 @@ static void updateRuntimeLibraryPaths(SearchPathOptions &SearchPathOpts,
198
198
if (LangOpts.hasFeature (Feature::Embedded))
199
199
LibSubDir = " embedded" ;
200
200
201
- llvm::sys::path::append (LibPath, LibSubDir);
202
201
SearchPathOpts.RuntimeLibraryPaths .clear ();
202
+
203
+ #if defined(_WIN32)
204
+ // Resource path looks like this:
205
+ //
206
+ // C:\...\Swift\Toolchains\6.0.0+Asserts\usr\lib\swift
207
+ //
208
+ // The runtimes are in
209
+ //
210
+ // C:\...\Swift\Runtimes\6.0.0\usr\bin
211
+ //
212
+ llvm::SmallString<128 > RuntimePath (LibPath);
213
+
214
+ llvm::sys::path::remove_filename (RuntimePath);
215
+ llvm::sys::path::remove_filename (RuntimePath);
216
+ llvm::sys::path::remove_filename (RuntimePath);
217
+
218
+ llvm::SmallString<128 > VersionWithAttrs (llvm::sys::path::filename (RuntimePath));
219
+ size_t MaybePlus = VersionWithAttrs.find_first_of (' +' );
220
+ StringRef Version = VersionWithAttrs.substr (0 , MaybePlus);
221
+
222
+ llvm::sys::path::remove_filename (RuntimePath);
223
+ llvm::sys::path::remove_filename (RuntimePath);
224
+ llvm::sys::path::append (RuntimePath, " Runtimes" , Version, " usr" , " bin" );
225
+
226
+ SearchPathOpts.RuntimeLibraryPaths .push_back (std::string (RuntimePath.str ()));
227
+ #endif
228
+
229
+ llvm::sys::path::append (LibPath, LibSubDir);
203
230
SearchPathOpts.RuntimeLibraryPaths .push_back (std::string (LibPath.str ()));
204
231
if (Triple.isOSDarwin ())
205
232
SearchPathOpts.RuntimeLibraryPaths .push_back (DARWIN_OS_LIBRARY_PATH);
0 commit comments