| 429 | }; |
| 430 | #endif |
| 431 | SC::Result SC::PluginCompiler::findBestCompiler(PluginCompiler& compiler) |
| 432 | { |
| 433 | #if SC_PLATFORM_WINDOWS |
| 434 | // TODO: can we use findLatest in order to avoid finding best compiler version...? |
| 435 | FixedVector<StringPath, 8> rootPaths; |
| 436 | SC_TRY(VisualStudioPathFinder().findAll(rootPaths)) |
| 437 | for (auto& base : rootPaths) |
| 438 | SC_TRY(PluginString::append(base, {SC_NATIVE_STR("/VC/Tools/MSVC")})); |
| 439 | |
| 440 | compiler.type = Type::MicrosoftCompiler; |
| 441 | CompilerFinder compilerFinder; |
| 442 | for (const auto& basePath : rootPaths) |
| 443 | { |
| 444 | StringSpan base = basePath.view(); |
| 445 | PluginFileSystemIterator iterator; |
| 446 | if (not iterator.init(base)) |
| 447 | continue; |
| 448 | PluginFileSystemIterator::Entry entry; |
| 449 | while (iterator.next(entry)) |
| 450 | { |
| 451 | if (entry.isDirectory and entry.name != SC_NATIVE_STR(".") and entry.name != SC_NATIVE_STR("..")) |
| 452 | { |
| 453 | SC_TRY(compilerFinder.tryFindCompiler(base, entry.name, compiler)); |
| 454 | if (compilerFinder.found) |
| 455 | break; |
| 456 | } |
| 457 | } |
| 458 | |
| 459 | if (compilerFinder.found) |
| 460 | { |
| 461 | break; |
| 462 | } |
| 463 | } |
| 464 | if (not compilerFinder.found) |
| 465 | { |
| 466 | return Result::Error("Visual Studio PluginCompiler not found"); |
| 467 | } |
| 468 | #elif SC_PLATFORM_APPLE |
| 469 | compiler.type = Type::ClangCompiler; |
| 470 | SC_TRY(compiler.compilerPath.assign("clang")); |
| 471 | SC_TRY(compiler.linkerPath.assign("clang")); |
| 472 | #elif SC_PLATFORM_LINUX |
| 473 | compiler.type = Type::GnuCompiler; |
| 474 | SC_TRY(compiler.compilerPath.assign("g++")); |
| 475 | SC_TRY(compiler.linkerPath.assign("g++")); |
| 476 | #endif |
| 477 | return Result(true); |
| 478 | } |
| 479 | |
| 480 | SC::Result SC::PluginCompiler::compileFile(const PluginDefinition& definition, const PluginSysroot& sysroot, |
| 481 | const PluginCompilerEnvironment& compilerEnvironment, StringSpan sourceFile, |
nothing calls this directly
no test coverage detected