Commit 566d29f8 authored by Joerg Bornemann's avatar Joerg Bornemann

Use qtcbuildhelper for starting the build process on Windows.

Task-number: QTCREATORBUG-4558

Change-Id: Ib6f5be80f034135bbd8c45a22e223e758cc7e7b1
Reviewed-on: http://codereview.qt.nokia.com/2555Reviewed-by: default avatarQt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: default avatarThomas Hartmann <Thomas.Hartmann@nokia.com>
parent c9f7d009
......@@ -36,6 +36,10 @@
#include <QtCore/QDir>
#include <QtCore/QDebug>
#ifdef Q_OS_WIN
#include <qt_windows.h>
#endif
using namespace Utils;
/*!
......@@ -663,6 +667,8 @@ void QtcProcess::start()
QString arguments;
prepareCommand(m_command, m_arguments, &command, &arguments, &env, &workDir);
setNativeArguments(arguments);
if (m_useCtrlCStub)
command.prepend(QLatin1Char('"') + QCoreApplication::applicationDirPath() + QLatin1String("/qtcbuildhelper.exe\" "));
QProcess::start(command, QStringList());
#else
QStringList arguments;
......@@ -677,6 +683,30 @@ void QtcProcess::start()
#endif
}
#ifdef Q_OS_WIN
BOOL CALLBACK sendShutDownMessageToAllWindowsOfProcess_enumWnd(HWND hwnd, LPARAM lParam)
{
static UINT uiShutDownMessage = RegisterWindowMessage(L"qtcbuildhelper_shutdown");
DWORD dwProcessID;
GetWindowThreadProcessId(hwnd, &dwProcessID);
if (lParam == dwProcessID) {
SendNotifyMessage(hwnd, uiShutDownMessage, 0, 0);
return FALSE;
}
return TRUE;
}
#endif
void QtcProcess::terminate()
{
#ifdef Q_OS_WIN
if (m_useCtrlCStub)
EnumWindows(sendShutDownMessageToAllWindowsOfProcess_enumWnd, pid()->dwProcessId);
else
#endif
QProcess::terminate();
}
#ifdef Q_OS_WIN
// This function assumes that the resulting string will be quoted.
......
......@@ -47,12 +47,18 @@ class QTCREATOR_UTILS_EXPORT QtcProcess : public QProcess
Q_OBJECT
public:
QtcProcess(QObject *parent = 0) : QProcess(parent), m_haveEnv(false) {}
QtcProcess(QObject *parent = 0)
: QProcess(parent),
m_haveEnv(false),
m_useCtrlCStub(false)
{}
void setEnvironment(const Environment &env)
{ m_environment = env; m_haveEnv = true; }
void setCommand(const QString &command, const QString &arguments)
{ m_command = command; m_arguments = arguments; }
void setUseCtrlCStub(bool enabled) { m_useCtrlCStub = enabled; }
void start();
void terminate();
enum SplitError {
SplitOk = 0, //! All went just fine
......@@ -142,6 +148,7 @@ private:
QString m_arguments;
Environment m_environment;
bool m_haveEnv;
bool m_useCtrlCStub;
};
}
......
......@@ -14,3 +14,5 @@ HEADERS += \
SOURCES += \
proxyaction.cpp
win32: LIBS += user32.lib
......@@ -189,6 +189,7 @@ void AbstractProcessStep::run(QFutureInterface<bool> &fi)
wd.mkpath(wd.absolutePath());
m_process = new Utils::QtcProcess();
m_process->setUseCtrlCStub(true);
m_process->setWorkingDirectory(wd.absolutePath());
m_process->setEnvironment(m_param.environment());
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment