[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-buildsystem
Subject: Re: Unexpected behaviour of kde4automoc
From: Matthias Kretz <kretz () kde ! org>
Date: 2007-07-13 8:52:43
Message-ID: 200707131052.44514.kretz () kde ! org
[Download RAW message or body]
[Attachment #2 (multipart/signed)]
[Attachment #4 (multipart/mixed)]
It must be the startDetached that is opening the new console. Please try the
attached patch.
--
________________________________________________________
Matthias Kretz (Germany) <><
http://Vir.homelinux.org/
MatthiasKretz@gmx.net, kretz@kde.org,
Matthias.Kretz@urz.uni-heidelberg.de
["kde4automoc.patch" (text/x-diff)]
Index: kde4automoc.cpp
===================================================================
--- kde4automoc.cpp (revision 685985)
+++ kde4automoc.cpp (working copy)
@@ -42,26 +42,27 @@
void usage(const QString &);
void echoColor(const QString &msg)
{
- QProcess cmakeEcho;
- cmakeEcho.setProcessChannelMode(QProcess::ForwardedChannels);
+ QProcess *cmakeEcho = new QProcess;
+ cmakeEcho->setProcessChannelMode(QProcess::ForwardedChannels);
QStringList args(cmakeEchoColorArgs);
args << msg;
- cmakeEcho.startDetached("cmake", args);
+ cmakeEcho->start("cmake", args, QIODevice::NotOpen);
+ processes.enqueue(cmakeEcho);
}
- QString bindir;
+ QString builddir;
QString mocExe;
QStringList mocIncludes;
QStringList cmakeEchoColorArgs;
const bool verbose;
QTextStream cerr;
QTextStream cout;
- QQueue<QProcess *> mocProcesses;
+ QQueue<QProcess *> processes;
};
void AutoMoc::usage(const QString &path)
{
- cout << "usage: " << path << " <outfile> <srcdir> <bindir> <moc executable>" << endl;
+ cout << "usage: " << path << " <outfile> <srcdir> <builddir> <moc executable>" << endl;
::exit(EXIT_FAILURE);
}
@@ -94,9 +95,9 @@
if (!srcdir.endsWith('/')) {
srcdir += '/';
}
- bindir = args[3];
- if (!bindir.endsWith('/')) {
- bindir += '/';
+ builddir = args[3];
+ if (!builddir.endsWith('/')) {
+ builddir += '/';
}
mocExe = args[4];
@@ -127,7 +128,11 @@
QRegExp qObjectRegExp("[\n]\\s*Q_OBJECT\\b");
foreach (const QString &absFilename, sourceFiles) {
//qDebug() << absFilename;
- const QFileInfo absFilenameInfo(absFilename);
+ const QFileInfo sourceFileInfo(absFilename);
+//X const QFileInfo markFileInfo(builddir + sourceFileInfo.fileName() + ".mark");
+//X if (markFileInfo.lastModified() >= sourceFileInfo.lastModified()) {
+//X continue;
+//X }
if (absFilename.endsWith(".cpp") || absFilename.endsWith(".cc") ||
absFilename.endsWith(".cxx") || absFilename.endsWith(".C")) {
//qDebug() << "check .cpp file";
@@ -139,13 +144,13 @@
continue;
}
const QString contentsString = QString::fromUtf8(contents);
- const QString absPath = absFilenameInfo.absolutePath() + '/';
+ const QString absPath = sourceFileInfo.absolutePath() + '/';
Q_ASSERT(absPath.endsWith('/'));
int matchOffset = mocIncludeRegExp.indexIn(contentsString);
if (matchOffset < 0) {
// no moc #include, look whether we need to create a moc from the .h nevertheless
//qDebug() << "no moc #include in the .cpp file";
- const QString basename = absFilenameInfo.completeBaseName();
+ const QString basename = sourceFileInfo.completeBaseName();
const QString headername = absPath + basename + ".h";
if (QFile::exists(headername) && !includedMocs.contains(headername) &&
!notIncludedMocs.contains(headername)) {
@@ -193,7 +198,7 @@
// automoc the moc is run unconditionally on the header and the resulting file is
// included in the _automoc.cpp file (unless there's a .cpp file later on that
// includes the moc from this header)
- const QString currentMoc = "moc_" + absFilenameInfo.completeBaseName() + ".cpp";
+ const QString currentMoc = "moc_" + sourceFileInfo.completeBaseName() + ".cpp";
notIncludedMocs.insert(absFilename, currentMoc);
}
} else {
@@ -228,19 +233,19 @@
AutoMoc::~AutoMoc()
{
// let all remaining moc processes finish
- while (!mocProcesses.isEmpty()) {
- QProcess *mocProc = mocProcesses.dequeue();
- if (!mocProc->waitForFinished()) {
- cerr << "kde4automoc: moc failed: " << mocProc->errorString() << endl;
+ while (!processes.isEmpty()) {
+ QProcess *proc = processes.dequeue();
+ if (!proc->waitForFinished()) {
+ cerr << "kde4automoc: process failed: " << proc->errorString() << endl;
}
- delete mocProc;
+ delete proc;
}
}
void AutoMoc::generateMoc(const QString &sourceFile, const QString &mocFileName)
{
//qDebug() << Q_FUNC_INFO << sourceFile << mocFileName;
- const QString mocFilePath = bindir + mocFileName;
+ const QString mocFilePath = builddir + mocFileName;
if (QFileInfo(mocFilePath).lastModified() < QFileInfo(sourceFile).lastModified()) {
if (verbose) {
echoColor("Generating " + mocFileName);
@@ -249,13 +254,13 @@
}
// we don't want too many child processes
- if (mocProcesses.size() > 10) {
- while (!mocProcesses.isEmpty()) {
- QProcess *mocProc = mocProcesses.dequeue();
- if (!mocProc->waitForFinished()) {
- cerr << "kde4automoc: moc failed: " << mocProc->errorString() << endl;
+ if (processes.size() > 10) {
+ while (!processes.isEmpty()) {
+ QProcess *proc = processes.dequeue();
+ if (!proc->waitForFinished()) {
+ cerr << "kde4automoc: process failed: " << proc->errorString() << endl;
}
- delete mocProc;
+ delete proc;
}
}
@@ -265,6 +270,6 @@
args << "-o" << mocFilePath << sourceFile;
//qDebug() << "executing: " << mocExe << args;
mocProc->start(mocExe, args, QIODevice::NotOpen);
- mocProcesses.enqueue(mocProc);
+ processes.enqueue(mocProc);
}
}
[Attachment #8 (application/pgp-signature)]
_______________________________________________
Kde-buildsystem mailing list
Kde-buildsystem@kde.org
https://mail.kde.org/mailman/listinfo/kde-buildsystem
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic