Nim: Fix running when building with nimble

Change-Id: I62b2eebf408119a19f0e98958e3132c16c9c6aa5
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
Christian Stenger
2020-08-31 14:28:10 +02:00
committed by hjk
parent 79010891e1
commit 158ac2d339
5 changed files with 23 additions and 26 deletions

View File

@@ -196,20 +196,21 @@ void NimBuildSystem::triggerParsing()
m_projectScanner.startScan();
}
FilePath NimBuildSystem::nimPathFromKit() const
FilePath nimPathFromKit(Kit *kit)
{
auto tc = ToolChainKitAspect::toolChain(kit(), Constants::C_NIMLANGUAGE_ID);
auto tc = ToolChainKitAspect::toolChain(kit, Constants::C_NIMLANGUAGE_ID);
QTC_ASSERT(tc, return {});
const FilePath command = tc->compilerCommand();
return command.isEmpty() ? FilePath() : command.absolutePath();
}
QString NimBuildSystem::defaultNimble() const
FilePath nimblePathFromKit(Kit *kit)
{
// There's no extra setting for "nimble", derive it from the "nim" path.
const QString nimbleFromPath = QStandardPaths::findExecutable("nimble");
const FilePath nimPath = nimPathFromKit();
const FilePath nimPath = nimPathFromKit(kit);
const FilePath nimbleFromKit = nimPath.pathAppended(HostOsInfo::withExecutableSuffix("nimble"));
return nimbleFromKit.exists() ? nimbleFromKit.canonicalPath().toUserOutput() : nimbleFromPath;
return nimbleFromKit.exists() ? nimbleFromKit.canonicalPath() : FilePath::fromString(nimbleFromPath);
}
void NimBuildSystem::loadSettings()