Re:[PATCH] Qt4 - fix ui rules for qmake generated vcproj
Thiago A. Corrêa <[email protected]> Tue, 19 Jul 2005 19:57:52 -0300
| Newsgroups | gmane.comp.kde.devel.cygwin |
|---|---|
| Message-ID | <[email protected]> |
Hi there,
Sorry, please forget the last patch, apply this one instead. It contains everything from the last one + working moc rules and fixed the translation of -l and -L from LIBS += in .pro files.
Regards,
Thiago A. Correa
---------- Início da mensagem original -----------
De: "Thiago A. Corrêa" [email protected]
Para: "kde-cygwin" [email protected]
Cc:
Data: Tue, 19 Jul 2005 19:26:48 -0300
Assunto: [PATCH] Qt4 - fix ui rules for qmake generated vcproj
> This should fix UIC custom build rules when using vcproj files to build.
> Should be applied from %QTDIR%\qmake, I hope *smile*
> Should also fix some verbose debug output I forgot to disable before sending the last patch *sigh*
>
>
> Regards,
> Thiago A. Correa
>
>
_______________________________________________
kde-cygwin mailing list
[email protected]
https://mail.kde.org/mailman/listinfo/kde-cygwin
fixuicandmoc.patch
(application/octet-stream, 6.2 KB)
? fixuic.patch
? fixuicandmoc.patch
Index: generators/win32/msvc_objectmodel.cpp
===================================================================
RCS file: /cvsroot/qtwin/qt-4/qmake/generators/win32/msvc_objectmodel.cpp,v
retrieving revision 1.2
diff -u -p -r1.2 msvc_objectmodel.cpp
--- generators/win32/msvc_objectmodel.cpp 10 Jul 2005 20:17:24 -0000 1.2
+++ generators/win32/msvc_objectmodel.cpp 19 Jul 2005 22:34:28 -0000
@@ -1830,14 +1830,17 @@ VCFilter::VCFilter()
void VCFilter::addMOCstage( QTextStream & /*strm*/, QString filename )
{
-/* QString mocOutput = Project->var( "MOC_OBJ" );
+ QString mocOutput = Project->var( "MOC_OBJ" );
QString mocApp = Project->var( "QMAKE_MOC" );
if( mocOutput.isEmpty() && filename.endsWith(".moc") ) {
// In specialcases we DO moc .cpp files
// when the result is an .moc file
mocOutput = filename;
- filename = Project->findMocSource( mocOutput );
+ int dot = filename.lastIndexOf( '.' );
+ if( dot != -1 )
+ filename.truncate( dot );
+ filename.append(".cpp");
}
if (mocOutput.isEmpty())
@@ -1848,9 +1851,9 @@ void VCFilter::addMOCstage( QTextStream
CustomBuildTool.Description = "Moc'ing " + filename + "...";
CustomBuildTool.CommandLine += (mocApp + " "
+ filename + " -o " + mocOutput);
- CustomBuildTool.AdditionalDependencies = mocApp;
+ CustomBuildTool.AdditionalDependencies += mocApp;
CustomBuildTool.Outputs += mocOutput;
- */
+
}
void VCFilter::addUICstage( QTextStream & /*strm*/, QString str )
@@ -1859,52 +1862,33 @@ void VCFilter::addUICstage( QTextStream
useCustomBuildTool = TRUE;
QString uicApp = Project->var("QMAKE_UIC");
- QString mocApp = Project->var( "QMAKE_MOC" );
QString fname = str.section( '\\', -1 );
- QString mocDir = Project->var( "MOC_DIR" );
QString uiDir = Project->var( "UI_DIR" );
QString uiHeaders;
- QString uiSources;
// Determining the paths for the output files.
int slash = str.lastIndexOf( '\\' );
QString pname = ( slash != -1 ) ? str.left( slash+1 ) : QString( ".\\" );
if( !uiDir.isEmpty() ) {
uiHeaders = uiDir;
- uiSources = uiDir;
} else {
uiHeaders = Project->var( "UI_HEADERS_DIR" );
- uiSources = Project->var( "UI_SOURCES_DIR" );
if( uiHeaders.isEmpty() )
uiHeaders = pname;
- if( uiSources.isEmpty() )
- uiSources = pname;
}
if( !uiHeaders.endsWith( "\\" ) )
uiHeaders += "\\";
- if( !uiSources.endsWith( "\\" ) )
- uiSources += "\\";
// Determine the file name.
int dot = fname.lastIndexOf( '.' );
if( dot != -1 )
fname.truncate( dot );
-
- if ( mocDir.isEmpty() )
- mocDir = pname;
-
+ fname.prepend("ui_");
CustomBuildTool.Description = ("Uic'ing " + str + "...\"");
CustomBuildTool.CommandLine += // Create .h from .ui file
uicApp + " " + str + " -o " + uiHeaders + fname + ".h";
- CustomBuildTool.CommandLine += // Create .cpp from .ui file
- uicApp + " " + str + " -i " + fname + ".h -o " + uiSources + fname + ".cpp";
- CustomBuildTool.CommandLine += // Moc the headerfile
- mocApp + " " + uiHeaders + fname + ".h -o " + mocDir + Option::h_moc_mod + fname + Option::h_moc_ext;
-
- CustomBuildTool.AdditionalDependencies += mocApp;
CustomBuildTool.AdditionalDependencies += uicApp;
- CustomBuildTool.Outputs +=
- uiHeaders + fname + ".h;" + uiSources + fname + ".cpp;" + mocDir + Option::h_moc_mod + fname + Option::h_moc_ext;
+ CustomBuildTool.Outputs += uiHeaders + fname + ".h;";
}
void VCFilter::modifyPCHstage( QTextStream &/*strm*/, QString str )
Index: generators/win32/msvc_vcproj.cpp
===================================================================
RCS file: /cvsroot/qtwin/qt-4/qmake/generators/win32/msvc_vcproj.cpp,v
retrieving revision 1.2
diff -u -p -r1.2 msvc_vcproj.cpp
--- generators/win32/msvc_vcproj.cpp 10 Jul 2005 20:17:25 -0000 1.2
+++ generators/win32/msvc_vcproj.cpp 19 Jul 2005 22:59:11 -0000
@@ -901,9 +901,9 @@ void VcprojGenerator::initHeaderFiles()
void VcprojGenerator::initMOCFiles()
{
vcProject.MOCFiles.flat_files = project->isActiveConfig("flat");
- vcProject.MOCFiles.Name = "Generated MOC Files";
+ vcProject.MOCFiles.Name = "Generated Files";
vcProject.MOCFiles.Filter = "cpp;c;cxx;moc";
- vcProject.MOCFiles.Files += project->variables()["SRCMOC"].replaceInStrings("&", "&");
+ vcProject.MOCFiles.Files += project->variables()["GENERATED_SOURCES"].replaceInStrings("&", "&");
nonflatDir_BubbleSort( vcProject.MOCFiles.Files,
vcProject.MOCFiles.flat_files );
vcProject.MOCFiles.Project = this;
@@ -1201,21 +1201,18 @@ void VcprojGenerator::initOld()
project->variables()["QMAKE_LIBS"] += project->variables()["LIBS"];
// Update -lname to name.lib, and -Ldir to
-/* QStringList &libList = project->variables()["QMAKE_LIBS"];
- for( it = libList.begin(); it != libList.end(); ) {
+ QStringList &libList = project->variables()["QMAKE_LIBS"];
+ for( it = libList.begin(); it != libList.end(); ++it ) {
QString s = *it;
s.replace("&", "&");
if( s.startsWith( "-l" ) ) {
- *it = libList.removeAll( *it );
- it = libList.insert( it, s.mid( 2 ) + ".lib" );
+ *it = s.mid( 2 ) + ".lib";
} else if( s.startsWith( "-L" ) ) {
project->variables()["QMAKE_LIBDIR"] += (*it).mid(2);
- *it = libList.removeAll( *it );
- } else {
- it++;
- }
+ libList.removeAll( *it );
}
-*/
+ }
+
// Run through all variables containing filepaths, and -----------
// slash-slosh them correctly depending on current OS -----------
project->variables()["QMAKE_FILETAGS"] += QString("HEADERS SOURCES DEF_FILE RC_FILE TARGET QMAKE_LIBS DESTDIR DLLDESTDIR INCLUDEPATH").split(" ");
@@ -1466,7 +1463,7 @@ void VcprojGenerator::processPrlVariable
void VcprojGenerator::outputVariables()
{
-#if 1
+#if 0
qDebug( "Generator: MSVC.NET: List of current variables:" );
for ( QMap<QString, QStringList>::ConstIterator it = project->variables().begin(); it != project->variables().end(); ++it) {
qDebug( "Generator: MSVC.NET: %s => %s", it.key().toLatin1().constData(), it.value().join(" | ").toLatin1().constData() );