Re: Unexpected behaviour of kde4automoc

2007-07-13 Thread Christian Ehrlicher

Matthias Kretz schrieb:
It must be the startDetached that is opening the new console. Please try the 
attached patch.



looks fine

Christian



signature.asc
Description: OpenPGP digital signature
___
Kde-buildsystem mailing list
Kde-buildsystem@kde.org
https://mail.kde.org/mailman/listinfo/kde-buildsystem


Re: Unexpected behaviour of kde4automoc

2007-07-13 Thread Matthias Kretz
It must be the startDetached that is opening the new console. Please try the 
attached patch.

-- 

Matthias Kretz (Germany)<><
http://Vir.homelinux.org/
[EMAIL PROTECTED], [EMAIL PROTECTED],
[EMAIL PROTECTED]
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 mocProcesses;
+QQueue processes;
 };
 
 void AutoMoc::usage(const QString &path)
 {
-cout << "usage: " << path << "" << endl;
+cout << "usage: " << path << "" << 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()) {
  

Re: Unexpected behaviour of kde4automoc

2007-07-13 Thread Jarosław Staniek
Matthias Kretz said the following, On 2007-07-13 10:25:
> On Friday 13 July 2007, Jarosław Staniek wrote:
>> On windows (msvc) kde4automoc executes moc in new window for a quarter of
>> second or so (closes as soon as moc finishes). Have anybody encountered the
>> same for kdelibs updated yesterday?
> 
> Do you need to add WIN32 to add_executable in 
> kdelibs/cmake/automoc/CMakeLists.txt?

This did not help.

-- 
regards / pozdrawiam, Jaroslaw Staniek
  Sponsored by OpenOffice Polska (http://www.openoffice.com.pl/en) to work on
  Kexi & KOffice: http://www.kexi.pl/en, http://www.koffice.org
  KDE3 & KDE4 Libraries for MS Windows: http://kdelibs.com, http://www.kde.org

___
Kde-buildsystem mailing list
Kde-buildsystem@kde.org
https://mail.kde.org/mailman/listinfo/kde-buildsystem


Re: Unexpected behaviour of kde4automoc

2007-07-13 Thread Matthias Kretz
On Friday 13 July 2007, Ralf Habacker wrote:
> Christian Ehrlicher schrieb:
> > Jarosław Staniek schrieb:
> >> Hello,
> >> On windows (msvc) kde4automoc executes moc in new window for a
> >> quarter of second or so (closes as soon as moc finishes). Have
> >> anybody encountered the same for kdelibs updated yesterday?
> >
> > moc is a console app -> QProcess spawns a new moc process and the new
> > window appears. Don't know how to tell QProcess to not open the console.
> > Maybe the moc output should be redirected to the current console
> > window (at least for 'make VERBOSE=1')
>
> Maybe QProcess::detached ?

Ah, now I understand - I thought it was kde4automoc that was doing wrong...

cmake -E cmake_echo_color ... is started with QProcess::startDetached. The moc 
processes are started with QProcess::start. The problem with starting moc 
detached is that kde4automoc may not finish before the moc processes are 
done.

This is how moc is executed:
QProcess *mocProc = new QProcess;
mocProc->setProcessChannelMode(QProcess::ForwardedChannels);
mocProc->start(mocExe, args, QIODevice::NotOpen);

-- 

Matthias Kretz (Germany)<><
http://Vir.homelinux.org/
[EMAIL PROTECTED], [EMAIL PROTECTED],
[EMAIL PROTECTED]


pgpxI0KodI1sW.pgp
Description: PGP signature
___
Kde-buildsystem mailing list
Kde-buildsystem@kde.org
https://mail.kde.org/mailman/listinfo/kde-buildsystem


Re: Unexpected behaviour of kde4automoc

2007-07-13 Thread Matthias Kretz
On Friday 13 July 2007, Jarosław Staniek wrote:
> On windows (msvc) kde4automoc executes moc in new window for a quarter of
> second or so (closes as soon as moc finishes). Have anybody encountered the
> same for kdelibs updated yesterday?

Do you need to add WIN32 to add_executable in 
kdelibs/cmake/automoc/CMakeLists.txt?

-- 

Matthias Kretz (Germany)<><
http://Vir.homelinux.org/
[EMAIL PROTECTED], [EMAIL PROTECTED],
[EMAIL PROTECTED]


pgpBZCgHGxwOD.pgp
Description: PGP signature
___
Kde-buildsystem mailing list
Kde-buildsystem@kde.org
https://mail.kde.org/mailman/listinfo/kde-buildsystem


Re: Unexpected behaviour of kde4automoc

2007-07-13 Thread Ralf Habacker
Christian Ehrlicher schrieb:
> Jarosław Staniek schrieb:
>> Hello,
>> On windows (msvc) kde4automoc executes moc in new window for a
>> quarter of second or so (closes as soon as moc finishes). Have
>> anybody encountered the same for kdelibs updated yesterday?
>>
> moc is a console app -> QProcess spawns a new moc process and the new
> window appears. Don't know how to tell QProcess to not open the console.
> Maybe the moc output should be redirected to the current console
> window (at least for 'make VERBOSE=1')
Maybe QProcess::detached ?

Ralf


___
Kde-buildsystem mailing list
Kde-buildsystem@kde.org
https://mail.kde.org/mailman/listinfo/kde-buildsystem


Re: Unexpected behaviour of kde4automoc

2007-07-13 Thread Christian Ehrlicher

Jarosław Staniek schrieb:

Hello,
On windows (msvc) kde4automoc executes moc in new window for a quarter of 
second or so (closes as soon as moc finishes). Have anybody encountered the 
same for kdelibs updated yesterday?


moc is a console app -> QProcess spawns a new moc process and the new 
window appears. Don't know how to tell QProcess to not open the console.
Maybe the moc output should be redirected to the current console window 
(at least for 'make VERBOSE=1')


Christian



signature.asc
Description: OpenPGP digital signature
___
Kde-buildsystem mailing list
Kde-buildsystem@kde.org
https://mail.kde.org/mailman/listinfo/kde-buildsystem


Re: Unexpected behaviour of kde4automoc

2007-07-13 Thread Laurent Montel
On Friday 13 July 2007 10:08:44 Jarosław Staniek wrote:
> Hello,
> On windows (msvc) kde4automoc executes moc in new window for a quarter of
> second or so (closes as soon as moc finishes). Have anybody encountered the
> same for kdelibs updated yesterday?

I am the same problem here.
Regards
___
Kde-buildsystem mailing list
Kde-buildsystem@kde.org
https://mail.kde.org/mailman/listinfo/kde-buildsystem


Unexpected behaviour of kde4automoc

2007-07-13 Thread Jarosław Staniek

Hello,
On windows (msvc) kde4automoc executes moc in new window for a quarter of 
second or so (closes as soon as moc finishes). Have anybody encountered the 
same for kdelibs updated yesterday?

-- 
regards / pozdrawiam, Jaroslaw Staniek
  Sponsored by OpenOffice Polska (http://www.openoffice.com.pl/en) to work on
  Kexi & KOffice: http://www.kexi.pl/en, http://www.koffice.org
  KDE3 & KDE4 Libraries for MS Windows: http://kdelibs.com, http://www.kde.org
___
Kde-buildsystem mailing list
Kde-buildsystem@kde.org
https://mail.kde.org/mailman/listinfo/kde-buildsystem