forked from qt-creator/qt-creator
Nim: Fix building with nimble
Do not expect nimble to be in PATH, but assume it is located where nim resides. Use kit's information of nim to construct the nimble path and add the path of nim explicitly to the build environment as nimble uses it. Also fixes running nimble test. Change-Id: If7be425f7b811486afe39fc1618709dbb2f75ac9 Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
@@ -25,16 +25,21 @@
|
||||
|
||||
#include "nimbuildsystem.h"
|
||||
|
||||
#include "nimconstants.h"
|
||||
#include "nimproject.h"
|
||||
#include "nimbleproject.h"
|
||||
#include "nimprojectnode.h"
|
||||
|
||||
#include <projectexplorer/target.h>
|
||||
#include <projectexplorer/toolchain.h>
|
||||
#include <projectexplorer/kitinformation.h>
|
||||
|
||||
#include <utils/algorithm.h>
|
||||
#include <utils/fileutils.h>
|
||||
#include <utils/qtcassert.h>
|
||||
|
||||
#include <QStandardPaths>
|
||||
|
||||
using namespace ProjectExplorer;
|
||||
using namespace Utils;
|
||||
|
||||
@@ -191,6 +196,22 @@ void NimBuildSystem::triggerParsing()
|
||||
m_projectScanner.startScan();
|
||||
}
|
||||
|
||||
FilePath NimBuildSystem::nimPathFromKit() const
|
||||
{
|
||||
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
|
||||
{
|
||||
const QString nimbleFromPath = QStandardPaths::findExecutable("nimble");
|
||||
const FilePath nimPath = nimPathFromKit();
|
||||
const FilePath nimbleFromKit = nimPath.pathAppended(HostOsInfo::withExecutableSuffix("nimble"));
|
||||
return nimbleFromKit.exists() ? nimbleFromKit.canonicalPath().toUserOutput() : nimbleFromPath;
|
||||
}
|
||||
|
||||
void NimBuildSystem::loadSettings()
|
||||
{
|
||||
QVariantMap settings = project()->namedSettings(SETTINGS_KEY).toMap();
|
||||
|
||||
Reference in New Issue
Block a user