Nim: Added support for the Nim compiler inside Kits

Change-Id: I6f9761aac0b0fc02a6974b284a7d600c1ece5b8b
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
This commit is contained in:
Filippo Cucchetto
2017-01-21 23:36:14 +01:00
parent bb916860ca
commit 28d9c305ad
11 changed files with 545 additions and 16 deletions

View File

@@ -27,6 +27,7 @@
#include "nimbuildconfiguration.h"
#include "nimprojectnode.h"
#include "nimprojectmanager.h"
#include "nimtoolchain.h"
#include "../nimconstants.h"
@@ -35,6 +36,8 @@
#include <projectexplorer/kit.h>
#include <projectexplorer/projectexplorerconstants.h>
#include <projectexplorer/target.h>
#include <projectexplorer/toolchain.h>
#include <projectexplorer/kitinformation.h>
#include <texteditor/textdocument.h>
#include <utils/algorithm.h>
@@ -163,9 +166,20 @@ void NimProject::updateProject()
emit parsingFinished();
}
bool NimProject::supportsKit(Kit *k, QString *) const
bool NimProject::supportsKit(Kit *k, QString *errorMessage) const
{
return k->isValid();
auto tc = dynamic_cast<NimToolChain*>(ToolChainKitInformation::toolChain(k, Constants::C_NIMLANGUAGE_ID));
if (!tc) {
if (errorMessage)
*errorMessage = tr("No nim compiler set.");
return false;
}
if (!tc->compilerCommand().exists()) {
if (errorMessage)
*errorMessage = tr("Nim compiler doesn't exist");
return false;
}
return true;
}
FileNameList NimProject::nimFiles() const