winrt: Add runnable to run configuration

When Creator checks whether the application that is being debugged
is a debug build, it gets its information from the runnable so we
have to provide one when winrt is used.

Change-Id: I2259783f82eef96b50ba5f804306e5225919d24b
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
Oliver Wolff
2017-11-29 09:09:22 +01:00
parent 78ef474c71
commit e05f2889ad
2 changed files with 45 additions and 0 deletions

View File

@@ -32,6 +32,8 @@
#include <projectexplorer/target.h>
#include <projectexplorer/kitinformation.h>
#include <projectexplorer/runconfigurationaspects.h>
#include <projectexplorer/runnables.h>
#include <qmakeprojectmanager/qmakeproject.h>
namespace WinRt {
@@ -93,5 +95,44 @@ QString WinRtRunConfiguration::buildSystemTarget() const
->mapProFilePathToTarget(Utils::FileName::fromString(m_proFilePath));
}
ProjectExplorer::Runnable WinRtRunConfiguration::runnable() const
{
ProjectExplorer::StandardRunnable r;
r.executable = executable();
r.commandLineArguments = arguments();
return r;
}
QString WinRtRunConfiguration::executable() const
{
QmakeProjectManager::QmakeProject *project
= static_cast<QmakeProjectManager::QmakeProject *>(target()->project());
if (!project)
return QString();
QmakeProjectManager::QmakeProFile *rootProFile = project->rootProFile();
if (!rootProFile)
return QString();
const QmakeProjectManager::QmakeProFile *pro
= rootProFile->findProFile(Utils::FileName::fromString(m_proFilePath));
if (!pro)
return QString();
QmakeProjectManager::TargetInformation ti = pro->targetInformation();
if (!ti.valid)
return QString();
QString destDir = ti.destDir.toString();
if (destDir.isEmpty())
destDir = ti.buildDir.toString();
else if (QDir::isRelativePath(destDir))
destDir = QDir::cleanPath(ti.buildDir.toString() + '/' + destDir);
QString executable = QDir::cleanPath(destDir + '/' + ti.target);
executable = Utils::HostOsInfo::withExecutableSuffix(executable);
return executable;
}
} // namespace Internal
} // namespace WinRt

View File

@@ -48,6 +48,8 @@ public:
QString buildSystemTarget() const final;
ProjectExplorer::Runnable runnable() const override;
signals:
void argumentsChanged(QString);
void uninstallAfterStopChanged(bool);
@@ -58,6 +60,8 @@ private:
QString m_proFilePath;
bool m_uninstallAfterStop = false;
QString executable() const;
};
} // namespace Internal