Diffstat (limited to 'qmake/generators/win32/msvc_dsp.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | qmake/generators/win32/msvc_dsp.cpp | 238 |
1 files changed, 188 insertions, 50 deletions
diff --git a/qmake/generators/win32/msvc_dsp.cpp b/qmake/generators/win32/msvc_dsp.cpp index 3fa0496..d2abac6 100644 --- a/qmake/generators/win32/msvc_dsp.cpp +++ b/qmake/generators/win32/msvc_dsp.cpp | |||
@@ -1,13 +1,11 @@ | |||
1 | /**************************************************************************** | 1 | /**************************************************************************** |
2 | ** $Id$ | ||
3 | ** | 2 | ** |
4 | ** Definition of ________ class. | ||
5 | ** | 3 | ** |
6 | ** Created : 970521 | 4 | ** Implementation of DspMakefileGenerator class. |
7 | ** | 5 | ** |
8 | ** Copyright (C) 1992-2002 Trolltech AS. All rights reserved. | 6 | ** Copyright (C) 1992-2003 Trolltech AS. All rights reserved. |
9 | ** | 7 | ** |
10 | ** This file is part of the network module of the Qt GUI Toolkit. | 8 | ** This file is part of qmake. |
11 | ** | 9 | ** |
12 | ** This file may be distributed under the terms of the Q Public License | 10 | ** This file may be distributed under the terms of the Q Public License |
13 | ** as defined by Trolltech AS of Norway and appearing in the file | 11 | ** as defined by Trolltech AS of Norway and appearing in the file |
@@ -78,6 +76,8 @@ DspMakefileGenerator::writeDspParts(QTextStream &t) | |||
78 | } else { | 76 | } else { |
79 | dspfile = project->first("MSVCDSP_TEMPLATE"); | 77 | dspfile = project->first("MSVCDSP_TEMPLATE"); |
80 | } | 78 | } |
79 | if (dspfile.startsWith("\"") && dspfile.endsWith("\"")) | ||
80 | dspfile = dspfile.mid(1, dspfile.length() - 2); | ||
81 | QString dspfile_loc = findTemplate(dspfile); | 81 | QString dspfile_loc = findTemplate(dspfile); |
82 | 82 | ||
83 | QFile file(dspfile_loc); | 83 | QFile file(dspfile_loc); |
@@ -87,6 +87,30 @@ DspMakefileGenerator::writeDspParts(QTextStream &t) | |||
87 | } | 87 | } |
88 | QTextStream dsp(&file); | 88 | QTextStream dsp(&file); |
89 | 89 | ||
90 | QString platform = "Win32"; | ||
91 | if ( !project->variables()["QMAKE_PLATFORM"].isEmpty() ) | ||
92 | platform = varGlue("QMAKE_PLATFORM", "", " ", ""); | ||
93 | |||
94 | // Setup PCH variables | ||
95 | precompH = project->first("PRECOMPILED_HEADER"); | ||
96 | QString namePCH = QFileInfo(precompH).fileName(); | ||
97 | usePCH = !precompH.isEmpty() && project->isActiveConfig("precompile_header"); | ||
98 | if (usePCH) { | ||
99 | // Created files | ||
100 | QString origTarget = project->first("QMAKE_ORIG_TARGET"); | ||
101 | origTarget.replace(QRegExp("-"), "_"); | ||
102 | precompObj = "\"$(IntDir)\\" + origTarget + Option::obj_ext + "\""; | ||
103 | precompPch = "\"$(IntDir)\\" + origTarget + ".pch\""; | ||
104 | // Add PRECOMPILED_HEADER to HEADERS | ||
105 | if (!project->variables()["HEADERS"].contains(precompH)) | ||
106 | project->variables()["HEADERS"] += precompH; | ||
107 | // Add precompile compiler options | ||
108 | project->variables()["PRECOMPILED_FLAGS_REL"] = "/Yu\"" + namePCH + "\" /FI\"" + namePCH + "\" "; | ||
109 | project->variables()["PRECOMPILED_FLAGS_DEB"] = "/Yu\"" + namePCH + "\" /FI\"" + namePCH + "\" "; | ||
110 | // Return to variable pool | ||
111 | project->variables()["PRECOMPILED_OBJECT"] = precompObj; | ||
112 | project->variables()["PRECOMPILED_PCH"] = precompPch; | ||
113 | } | ||
90 | int rep; | 114 | int rep; |
91 | QString line; | 115 | QString line; |
92 | while ( !dsp.eof() ) { | 116 | while ( !dsp.eof() ) { |
@@ -111,7 +135,9 @@ DspMakefileGenerator::writeDspParts(QTextStream &t) | |||
111 | for( it = list.begin(); it != list.end(); ++it) { | 135 | for( it = list.begin(); it != list.end(); ++it) { |
112 | beginGroupForFile((*it), t); | 136 | beginGroupForFile((*it), t); |
113 | t << "# Begin Source File\n\nSOURCE=" << (*it) << endl; | 137 | t << "# Begin Source File\n\nSOURCE=" << (*it) << endl; |
114 | if ( project->isActiveConfig("moc") && (*it).endsWith(Option::moc_ext)) { | 138 | if (usePCH && (*it).endsWith(".c")) |
139 | t << "# SUBTRACT CPP /FI\"" << namePCH << "\" /Yu\"" << namePCH << "\" /Fp" << endl; | ||
140 | if ( project->isActiveConfig("moc") && (*it).endsWith(Option::cpp_moc_ext)) { | ||
115 | QString base = (*it); | 141 | QString base = (*it); |
116 | base.replace(QRegExp("\\..*$"), "").upper(); | 142 | base.replace(QRegExp("\\..*$"), "").upper(); |
117 | base.replace(QRegExp("[^a-zA-Z]"), "_"); | 143 | base.replace(QRegExp("[^a-zA-Z]"), "_"); |
@@ -124,8 +150,8 @@ DspMakefileGenerator::writeDspParts(QTextStream &t) | |||
124 | 150 | ||
125 | t << "USERDEP_" << base << "=\".\\" << findMocSource((*it)) << "\" \"$(QTDIR)\\bin\\moc.exe\"" << endl << endl; | 151 | t << "USERDEP_" << base << "=\".\\" << findMocSource((*it)) << "\" \"$(QTDIR)\\bin\\moc.exe\"" << endl << endl; |
126 | 152 | ||
127 | t << "!IF \"$(CFG)\" == \"" << var("MSVCDSP_PROJECT") << " - Win32 Release\"" << build | 153 | t << "!IF \"$(CFG)\" == \"" << var("MSVCDSP_PROJECT") << " - " << platform << " Release\"" << build |
128 | << "!ELSEIF \"$(CFG)\" == \"" << var("MSVCDSP_PROJECT") << " - Win32 Debug\"" | 154 | << "!ELSEIF \"$(CFG)\" == \"" << var("MSVCDSP_PROJECT") << " - " << platform << " Debug\"" |
129 | << build << "!ENDIF " << endl << endl; | 155 | << build << "!ENDIF " << endl << endl; |
130 | } | 156 | } |
131 | t << "# End Source File" << endl; | 157 | t << "# End Source File" << endl; |
@@ -146,25 +172,77 @@ DspMakefileGenerator::writeDspParts(QTextStream &t) | |||
146 | for(QStringList::Iterator it = list.begin(); it != list.end(); ++it) { | 172 | for(QStringList::Iterator it = list.begin(); it != list.end(); ++it) { |
147 | // beginGroupForFile((*it), t); | 173 | // beginGroupForFile((*it), t); |
148 | t << "# Begin Source File\n\nSOURCE=" << (*it) << endl << endl; | 174 | t << "# Begin Source File\n\nSOURCE=" << (*it) << endl << endl; |
149 | if ( project->isActiveConfig("moc") && !findMocDestination((*it)).isEmpty()) { | 175 | QString compilePCH; |
176 | QStringList customDependencies; | ||
177 | QString createMOC; | ||
178 | QString buildCmdsR, buildCmdsD; | ||
179 | QString buildCmds = "\nBuildCmds= \\\n"; | ||
180 | // Create unique baseID | ||
150 | QString base = (*it); | 181 | QString base = (*it); |
182 | { | ||
151 | base.replace(QRegExp("\\..*$"), "").upper(); | 183 | base.replace(QRegExp("\\..*$"), "").upper(); |
152 | base.replace(QRegExp("[^a-zA-Z]"), "_"); | 184 | base.replace(QRegExp("[^a-zA-Z]"), "_"); |
153 | 185 | } | |
186 | if (usePCH && precompH.endsWith(*it)) { | ||
187 | QString basicBuildCmd = QString("\tcl.exe /TP /W3 /FD /c /D \"WIN32\" /Yc /Fp\"%1\" /Fo\"%2\" %3 %4 %5 %6 %7 %8 %9 /D \"") | ||
188 | .arg(precompPch) | ||
189 | .arg(precompObj) | ||
190 | .arg(var("MSVCDSP_INCPATH")) | ||
191 | .arg(var("MSVCDSP_DEFINES")) | ||
192 | .arg(var("MSVCDSP_CXXFLAGS")); | ||
193 | buildCmdsR = basicBuildCmd | ||
194 | .arg("/D \"NDEBUG\"") | ||
195 | .arg(var("QMAKE_CXXFLAGS_RELEASE")) | ||
196 | .arg(var("MSVCDSP_MTDEF")) | ||
197 | .arg(var("MSVCDSP_RELDEFS")); | ||
198 | buildCmdsD = basicBuildCmd | ||
199 | .arg("/D \"_DEBUG\" /Od") | ||
200 | .arg(var("QMAKE_CXXFLAGS_DEBUG")) | ||
201 | .arg(var("MSVCDSP_MTDEFD")) | ||
202 | .arg(var("MSVCDSP_DEBUG_OPT")); | ||
203 | if (project->first("TEMPLATE") == "vcapp") {// App | ||
204 | buildCmdsR += var("MSVCDSP_WINCONDEF"); | ||
205 | buildCmdsD += var("MSVCDSP_WINCONDEF"); | ||
206 | } else if (project->isActiveConfig("dll")) {// Dll | ||
207 | buildCmdsR += "_WINDOWS\" /D \"_USRDLL"; | ||
208 | buildCmdsD += "_WINDOWS\" /D \"_USRDLL"; | ||
209 | } else { // Lib | ||
210 | buildCmdsR += "_LIB"; | ||
211 | buildCmdsD += "_LIB"; | ||
212 | } | ||
213 | buildCmdsR += "\" /Fd\"$(IntDir)\\\\\" " + (*it) + " \\\n"; | ||
214 | buildCmdsD += "\" /Fd\"$(IntDir)\\\\\" " + (*it) + " \\\n"; | ||
215 | |||
216 | compilePCH = precompPch + " : $(SOURCE) \"$(INTDIR)\" \"$(OUTDIR)\"\n $(BuildCmds)\n\n"; | ||
217 | |||
218 | QStringList &tmp = findDependencies(precompH); | ||
219 | if(!tmp.isEmpty()) // Got Deps for PCH | ||
220 | customDependencies += tmp; | ||
221 | } | ||
222 | if (project->isActiveConfig("moc") && !findMocDestination((*it)).isEmpty()) { | ||
154 | QString mocpath = var( "QMAKE_MOC" ); | 223 | QString mocpath = var( "QMAKE_MOC" ); |
155 | mocpath = mocpath.replace( QRegExp( "\\..*$" ), "" ) + " "; | 224 | mocpath = mocpath.replace( QRegExp( "\\..*$" ), "" ) + " "; |
225 | buildCmds += "\t" + mocpath + (*it) + " -o " + findMocDestination((*it)) + " \\\n"; | ||
226 | createMOC = "\"" + findMocDestination((*it)) +"\" : $(SOURCE) \"$(INTDIR)\" \"$(OUTDIR)\"\n $(BuildCmds)\n\n"; | ||
227 | customDependencies += "\"$(QTDIR)\\bin\\moc.exe\""; | ||
228 | } | ||
229 | if (!createMOC.isEmpty() || !compilePCH.isEmpty()) { | ||
230 | bool doMOC = !createMOC.isEmpty(); | ||
231 | bool doPCH = !compilePCH.isEmpty(); | ||
232 | QString build = "\n\n# Begin Custom Build - "+ | ||
233 | QString(doMOC?"Moc'ing ":"") + | ||
234 | QString((doMOC&&doPCH)?" and ":"") + | ||
235 | QString(doPCH?"Creating PCH cpp from ":"") + | ||
236 | (*it) + "...\nInputPath=.\\" + (*it) + "\n\n" + | ||
237 | buildCmds + "%1\n" + | ||
238 | createMOC + | ||
239 | compilePCH + | ||
240 | "# End Custom Build\n\n"; | ||
156 | 241 | ||
157 | QString build = "\n\n# Begin Custom Build - Moc'ing " + (*it) + | 242 | t << "USERDEP_" << base << "=" << valGlue(customDependencies, "\"", "\" \"", "\"") << endl << endl; |
158 | "...\n" "InputPath=.\\" + (*it) + "\n\n" "\"" + findMocDestination((*it)) + | 243 | t << "!IF \"$(CFG)\" == \"" << var("MSVCDSP_PROJECT") << " - " << platform << " Release\"" << build.arg(buildCmdsR) |
159 | "\"" " : $(SOURCE) \"$(INTDIR)\" \"$(OUTDIR)\"\n" | 244 | << "!ELSEIF \"$(CFG)\" == \"" << var("MSVCDSP_PROJECT") << " - " << platform << " Debug\"" << build.arg(buildCmdsD) |
160 | "\t" + mocpath + (*it) + " -o " + | 245 | << "!ENDIF " << endl << endl; |
161 | findMocDestination((*it)) + "\n\n" "# End Custom Build\n\n"; | ||
162 | |||
163 | t << "USERDEP_" << base << "=\"$(QTDIR)\\bin\\moc.exe\"" << endl << endl; | ||
164 | |||
165 | t << "!IF \"$(CFG)\" == \"" << var("MSVCDSP_PROJECT") << " - Win32 Release\"" << build | ||
166 | << "!ELSEIF \"$(CFG)\" == \"" << var("MSVCDSP_PROJECT") << " - Win32 Debug\"" | ||
167 | << build << "!ENDIF " << endl << endl; | ||
168 | } | 246 | } |
169 | t << "# End Source File" << endl; | 247 | t << "# End Source File" << endl; |
170 | } | 248 | } |
@@ -252,7 +330,7 @@ DspMakefileGenerator::writeDspParts(QTextStream &t) | |||
252 | for(QStringList::Iterator it = list.begin(); it != list.end(); ++it) { | 330 | for(QStringList::Iterator it = list.begin(); it != list.end(); ++it) { |
253 | // beginGroupForFile((*it), t); | 331 | // beginGroupForFile((*it), t); |
254 | t << "# Begin Source File\n\nSOURCE=" << (*it) << endl; | 332 | t << "# Begin Source File\n\nSOURCE=" << (*it) << endl; |
255 | if ( project->isActiveConfig("moc") && (*it).endsWith(Option::moc_ext)) { | 333 | if ( project->isActiveConfig("moc") && (*it).endsWith(Option::cpp_moc_ext)) { |
256 | QString base = (*it); | 334 | QString base = (*it); |
257 | base.replace(QRegExp("\\..*$"), "").upper(); | 335 | base.replace(QRegExp("\\..*$"), "").upper(); |
258 | base.replace(QRegExp("[^a-zA-Z]"), "_"); | 336 | base.replace(QRegExp("[^a-zA-Z]"), "_"); |
@@ -265,8 +343,8 @@ DspMakefileGenerator::writeDspParts(QTextStream &t) | |||
265 | 343 | ||
266 | t << "USERDEP_" << base << "=\".\\" << findMocSource((*it)) << "\" \"$(QTDIR)\\bin\\moc.exe\"" << endl << endl; | 344 | t << "USERDEP_" << base << "=\".\\" << findMocSource((*it)) << "\" \"$(QTDIR)\\bin\\moc.exe\"" << endl << endl; |
267 | 345 | ||
268 | t << "!IF \"$(CFG)\" == \"" << var("MSVCDSP_PROJECT") << " - Win32 Release\"" << build | 346 | t << "!IF \"$(CFG)\" == \"" << var("MSVCDSP_PROJECT") << " - " << platform << " Release\"" << build |
269 | << "!ELSEIF \"$(CFG)\" == \"" << var("MSVCDSP_PROJECT") << " - Win32 Debug\"" | 347 | << "!ELSEIF \"$(CFG)\" == \"" << var("MSVCDSP_PROJECT") << " - " << platform << " Debug\"" |
270 | << build << "!ENDIF " << endl << endl; | 348 | << build << "!ENDIF " << endl << endl; |
271 | } | 349 | } |
272 | t << "# End Source File" << endl; | 350 | t << "# End Source File" << endl; |
@@ -387,19 +465,20 @@ DspMakefileGenerator::writeDspParts(QTextStream &t) | |||
387 | "InputPath=.\\" + base + "\n\n" "BuildCmds= \\\n\t" + uicpath + base + | 465 | "InputPath=.\\" + base + "\n\n" "BuildCmds= \\\n\t" + uicpath + base + |
388 | " -o " + uiHeadersDir + fname + ".h \\\n" "\t" + uicpath + base + | 466 | " -o " + uiHeadersDir + fname + ".h \\\n" "\t" + uicpath + base + |
389 | " -i " + fname + ".h -o " + uiSourcesDir + fname + ".cpp \\\n" | 467 | " -i " + fname + ".h -o " + uiSourcesDir + fname + ".cpp \\\n" |
390 | "\t" + mocpath + uiHeadersDir + fname + ".h -o " + mocFile + "moc_" + fname + ".cpp \\\n"; | 468 | "\t" + mocpath + " " + uiHeadersDir + |
469 | fname + ".h -o " + mocFile + Option::h_moc_mod + fname + Option::h_moc_ext + " \\\n"; | ||
391 | 470 | ||
392 | build.append("\n\"" + uiHeadersDir + fname + ".h\" : \"$(SOURCE)\" \"$(INTDIR)\" \"$(OUTDIR)\"" "\n" | 471 | build.append("\n\"" + uiHeadersDir + fname + ".h\" : \"$(SOURCE)\" \"$(INTDIR)\" \"$(OUTDIR)\"" "\n" |
393 | "\t$(BuildCmds)\n\n" | 472 | "\t$(BuildCmds)\n\n" |
394 | "\"" + uiSourcesDir + fname + ".cpp\" : \"$(SOURCE)\" \"$(INTDIR)\" \"$(OUTDIR)\"" "\n" | 473 | "\"" + uiSourcesDir + fname + ".cpp\" : \"$(SOURCE)\" \"$(INTDIR)\" \"$(OUTDIR)\"" "\n" |
395 | "\t$(BuildCmds)\n\n" | 474 | "\t$(BuildCmds)\n\n" |
396 | "\"" + mocFile + "moc_" + fname + ".cpp\" : \"$(SOURCE)\" \"$(INTDIR)\" \"$(OUTDIR)\"" "\n" | 475 | "\"" + mocFile + Option::h_moc_mod + fname + Option::h_moc_ext + "\" : \"$(SOURCE)\" \"$(INTDIR)\" \"$(OUTDIR)\"" "\n" |
397 | "\t$(BuildCmds)\n\n"); | 476 | "\t$(BuildCmds)\n\n"); |
398 | 477 | ||
399 | build.append("# End Custom Build\n\n"); | 478 | build.append("# End Custom Build\n\n"); |
400 | 479 | ||
401 | t << "!IF \"$(CFG)\" == \"" << var("MSVCDSP_PROJECT") << " - Win32 Release\"" << build | 480 | t << "!IF \"$(CFG)\" == \"" << var("MSVCDSP_PROJECT") << " - " << platform << " Release\"" << build |
402 | << "!ELSEIF \"$(CFG)\" == \"" << var("MSVCDSP_PROJECT") << " - Win32 Debug\"" << build | 481 | << "!ELSEIF \"$(CFG)\" == \"" << var("MSVCDSP_PROJECT") << " - " << platform << " Debug\"" << build |
403 | << "!ENDIF \n\n" << "# End Source File" << endl; | 482 | << "!ENDIF \n\n" << "# End Source File" << endl; |
404 | } | 483 | } |
405 | // endGroups(t); | 484 | // endGroups(t); |
@@ -429,8 +508,8 @@ DspMakefileGenerator::writeDspParts(QTextStream &t) | |||
429 | "\tdel " + fname + "\\\n" | 508 | "\tdel " + fname + "\\\n" |
430 | "\tcopy lex.yy.c " + fname + "\n\n" + | 509 | "\tcopy lex.yy.c " + fname + "\n\n" + |
431 | "# End Custom Build\n\n"; | 510 | "# End Custom Build\n\n"; |
432 | t << "!IF \"$(CFG)\" == \"" << var("MSVCDSP_PROJECT") << " - Win32 Release\"" << build | 511 | t << "!IF \"$(CFG)\" == \"" << var("MSVCDSP_PROJECT") << " - " << platform << " Release\"" << build |
433 | << "!ELSEIF \"$(CFG)\" == \"" << var("MSVCDSP_PROJECT") << " - Win32 Debug\"" << build | 512 | << "!ELSEIF \"$(CFG)\" == \"" << var("MSVCDSP_PROJECT") << " - " << platform << " Debug\"" << build |
434 | << "!ENDIF \n\n" << build | 513 | << "!ENDIF \n\n" << build |
435 | 514 | ||
436 | << "# End Source File" << endl; | 515 | << "# End Source File" << endl; |
@@ -465,8 +544,8 @@ DspMakefileGenerator::writeDspParts(QTextStream &t) | |||
465 | "\tmove y.tab.c " + fname + Option::cpp_ext.first() + "\n\n" + | 544 | "\tmove y.tab.c " + fname + Option::cpp_ext.first() + "\n\n" + |
466 | "# End Custom Build\n\n"; | 545 | "# End Custom Build\n\n"; |
467 | 546 | ||
468 | t << "!IF \"$(CFG)\" == \"" << var("MSVCDSP_PROJECT") << " - Win32 Release\"" << build | 547 | t << "!IF \"$(CFG)\" == \"" << var("MSVCDSP_PROJECT") << " - " << platform << " Release\"" << build |
469 | << "!ELSEIF \"$(CFG)\" == \"" << var("MSVCDSP_PROJECT") << " - Win32 Debug\"" << build | 548 | << "!ELSEIF \"$(CFG)\" == \"" << var("MSVCDSP_PROJECT") << " - " << platform << " Debug\"" << build |
470 | << "!ENDIF \n\n" | 549 | << "!ENDIF \n\n" |
471 | << "# End Source File" << endl; | 550 | << "# End Source File" << endl; |
472 | } | 551 | } |
@@ -532,6 +611,7 @@ DspMakefileGenerator::init() | |||
532 | project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_RTTI_OFF"]; | 611 | project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_RTTI_OFF"]; |
533 | } | 612 | } |
534 | 613 | ||
614 | |||
535 | /* this should probably not be here, but I'm using it to wrap the .t files */ | 615 | /* this should probably not be here, but I'm using it to wrap the .t files */ |
536 | if(project->first("TEMPLATE") == "vcapp" ) | 616 | if(project->first("TEMPLATE") == "vcapp" ) |
537 | project->variables()["QMAKE_APP_FLAG"].append("1"); | 617 | project->variables()["QMAKE_APP_FLAG"].append("1"); |
@@ -548,6 +628,12 @@ DspMakefileGenerator::init() | |||
548 | project->variables()["DEFINES"].append("QT_DLL"); | 628 | project->variables()["DEFINES"].append("QT_DLL"); |
549 | if (project->isActiveConfig("qt_dll")) | 629 | if (project->isActiveConfig("qt_dll")) |
550 | if(configs.findIndex("qt") == -1) configs.append("qt"); | 630 | if(configs.findIndex("qt") == -1) configs.append("qt"); |
631 | if ( project->isActiveConfig("qtopia") ) { | ||
632 | if(configs.findIndex("qtopialib") == -1) | ||
633 | configs.append("qtopialib"); | ||
634 | if(configs.findIndex("qtopiainc") == -1) | ||
635 | configs.append("qtopiainc"); | ||
636 | } | ||
551 | if ( project->isActiveConfig("qt") ) { | 637 | if ( project->isActiveConfig("qt") ) { |
552 | if ( project->isActiveConfig( "plugin" ) ) { | 638 | if ( project->isActiveConfig( "plugin" ) ) { |
553 | project->variables()["CONFIG"].append("dll"); | 639 | project->variables()["CONFIG"].append("dll"); |
@@ -581,6 +667,14 @@ DspMakefileGenerator::init() | |||
581 | project->variables()["MSVCDSP_VERSION"].append( "/VERSION:" + major + "." + minor ); | 667 | project->variables()["MSVCDSP_VERSION"].append( "/VERSION:" + major + "." + minor ); |
582 | } | 668 | } |
583 | 669 | ||
670 | if ( project->isActiveConfig("qtopiainc") ) | ||
671 | project->variables()["INCLUDEPATH"] += project->variables()["QMAKE_INCDIR_QTOPIA"]; | ||
672 | if ( project->isActiveConfig("qtopialib") ) { | ||
673 | if(!project->isEmpty("QMAKE_LIBDIR_QTOPIA")) | ||
674 | project->variables()["QMAKE_LIBDIR"] += project->variables()["QMAKE_LIBDIR_QTOPIA"]; | ||
675 | project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_QTOPIA"]; | ||
676 | } | ||
677 | |||
584 | if ( project->isActiveConfig("qt") ) { | 678 | if ( project->isActiveConfig("qt") ) { |
585 | project->variables()["CONFIG"].append("moc"); | 679 | project->variables()["CONFIG"].append("moc"); |
586 | project->variables()["INCLUDEPATH"] +=project->variables()["QMAKE_INCDIR_QT"]; | 680 | project->variables()["INCLUDEPATH"] +=project->variables()["QMAKE_INCDIR_QT"]; |
@@ -634,6 +728,8 @@ DspMakefileGenerator::init() | |||
634 | } else { | 728 | } else { |
635 | if ( !project->first("OBJECTS_DIR").isEmpty() ) | 729 | if ( !project->first("OBJECTS_DIR").isEmpty() ) |
636 | project->variables()["MSVCDSP_OBJECTSDIRREL"] = project->first("OBJECTS_DIR"); | 730 | project->variables()["MSVCDSP_OBJECTSDIRREL"] = project->first("OBJECTS_DIR"); |
731 | else | ||
732 | project->variables()["MSVCDSP_OBJECTSDIRREL"] = "Release"; | ||
637 | project->variables()["MSVCDSP_OBJECTSDIRDEB"] = "Debug"; | 733 | project->variables()["MSVCDSP_OBJECTSDIRDEB"] = "Debug"; |
638 | if ( !project->first("DESTDIR").isEmpty() ) | 734 | if ( !project->first("DESTDIR").isEmpty() ) |
639 | project->variables()["MSVCDSP_TARGETDIRREL"] = project->first("DESTDIR"); | 735 | project->variables()["MSVCDSP_TARGETDIRREL"] = project->first("DESTDIR"); |
@@ -670,6 +766,10 @@ DspMakefileGenerator::init() | |||
670 | project->variables()[is_qt ? "PRL_EXPORT_DEFINES" : "DEFINES"].append("QT_TABLET_SUPPORT"); | 766 | project->variables()[is_qt ? "PRL_EXPORT_DEFINES" : "DEFINES"].append("QT_TABLET_SUPPORT"); |
671 | } | 767 | } |
672 | if ( project->isActiveConfig("dll") ) { | 768 | if ( project->isActiveConfig("dll") ) { |
769 | project->variables()["QMAKE_CFLAGS_CONSOLE_ANY"] = project->variables()["QMAKE_CFLAGS_CONSOLE_DLL"]; | ||
770 | project->variables()["QMAKE_CXXFLAGS_CONSOLE_ANY"] = project->variables()["QMAKE_CXXFLAGS_CONSOLE_DLL"]; | ||
771 | project->variables()["QMAKE_LFLAGS_CONSOLE_ANY"] = project->variables()["QMAKE_LFLAGS_CONSOLE_DLL"]; | ||
772 | project->variables()["QMAKE_LFLAGS_WINDOWS_ANY"] = project->variables()["QMAKE_LFLAGS_WINDOWS_DLL"]; | ||
673 | if ( !project->variables()["QMAKE_LIB_FLAG"].isEmpty() ) { | 773 | if ( !project->variables()["QMAKE_LIB_FLAG"].isEmpty() ) { |
674 | QString ver_xyz(project->first("VERSION")); | 774 | QString ver_xyz(project->first("VERSION")); |
675 | ver_xyz.replace(".", ""); | 775 | ver_xyz.replace(".", ""); |
@@ -678,12 +778,33 @@ DspMakefileGenerator::init() | |||
678 | project->variables()["TARGET_EXT"].append(".dll"); | 778 | project->variables()["TARGET_EXT"].append(".dll"); |
679 | } | 779 | } |
680 | } else { | 780 | } else { |
781 | project->variables()["QMAKE_CFLAGS_CONSOLE_ANY"] = project->variables()["QMAKE_CFLAGS_CONSOLE"]; | ||
782 | project->variables()["QMAKE_CXXFLAGS_CONSOLE_ANY"] = project->variables()["QMAKE_CXXFLAGS_CONSOLE"]; | ||
783 | project->variables()["QMAKE_LFLAGS_CONSOLE_ANY"] = project->variables()["QMAKE_LFLAGS_CONSOLE"]; | ||
784 | project->variables()["QMAKE_LFLAGS_WINDOWS_ANY"] = project->variables()["QMAKE_LFLAGS_WINDOWS"]; | ||
681 | if ( !project->variables()["QMAKE_APP_FLAG"].isEmpty() ) | 785 | if ( !project->variables()["QMAKE_APP_FLAG"].isEmpty() ) |
682 | project->variables()["TARGET_EXT"].append(".exe"); | 786 | project->variables()["TARGET_EXT"].append(".exe"); |
683 | else | 787 | else |
684 | project->variables()["TARGET_EXT"].append(".lib"); | 788 | project->variables()["TARGET_EXT"].append(".lib"); |
685 | } | 789 | } |
686 | 790 | ||
791 | if ( project->isActiveConfig("windows") ) { | ||
792 | if ( project->isActiveConfig("console") ) { | ||
793 | project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_CONSOLE_ANY"]; | ||
794 | project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_CONSOLE_ANY"]; | ||
795 | project->variables()["QMAKE_LFLAGS"] += project->variables()["QMAKE_LFLAGS_CONSOLE_ANY"]; | ||
796 | project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_CONSOLE"]; | ||
797 | } else { | ||
798 | project->variables()["QMAKE_LFLAGS"] += project->variables()["QMAKE_LFLAGS_WINDOWS_ANY"]; | ||
799 | } | ||
800 | project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_WINDOWS"]; | ||
801 | } else { | ||
802 | project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_CONSOLE_ANY"]; | ||
803 | project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_CONSOLE_ANY"]; | ||
804 | project->variables()["QMAKE_LFLAGS"] += project->variables()["QMAKE_LFLAGS_CONSOLE_ANY"]; | ||
805 | project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_CONSOLE"]; | ||
806 | } | ||
807 | |||
687 | project->variables()["MSVCDSP_VER"] = "6.00"; | 808 | project->variables()["MSVCDSP_VER"] = "6.00"; |
688 | project->variables()["MSVCDSP_DEBUG_OPT"] = "/GZ /ZI"; | 809 | project->variables()["MSVCDSP_DEBUG_OPT"] = "/GZ /ZI"; |
689 | 810 | ||
@@ -732,12 +853,10 @@ DspMakefileGenerator::init() | |||
732 | project->variables()["MSVCDSP_CONSOLE"].append("Console"); | 853 | project->variables()["MSVCDSP_CONSOLE"].append("Console"); |
733 | project->variables()["MSVCDSP_WINCONDEF"].append("_CONSOLE"); | 854 | project->variables()["MSVCDSP_WINCONDEF"].append("_CONSOLE"); |
734 | project->variables()["MSVCDSP_DSPTYPE"].append("0x0103"); | 855 | project->variables()["MSVCDSP_DSPTYPE"].append("0x0103"); |
735 | project->variables()["MSVCDSP_SUBSYSTEM"].append("console"); | ||
736 | } else { | 856 | } else { |
737 | project->variables()["MSVCDSP_CONSOLE"].clear(); | 857 | project->variables()["MSVCDSP_CONSOLE"].clear(); |
738 | project->variables()["MSVCDSP_WINCONDEF"].append("_WINDOWS"); | 858 | project->variables()["MSVCDSP_WINCONDEF"].append("_WINDOWS"); |
739 | project->variables()["MSVCDSP_DSPTYPE"].append("0x0101"); | 859 | project->variables()["MSVCDSP_DSPTYPE"].append("0x0101"); |
740 | project->variables()["MSVCDSP_SUBSYSTEM"].append("windows"); | ||
741 | } | 860 | } |
742 | } else { | 861 | } else { |
743 | if ( project->isActiveConfig("dll") ) { | 862 | if ( project->isActiveConfig("dll") ) { |
@@ -749,6 +868,19 @@ DspMakefileGenerator::init() | |||
749 | 868 | ||
750 | project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_WINDOWS"]; | 869 | project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_WINDOWS"]; |
751 | 870 | ||
871 | processPrlFiles(); | ||
872 | |||
873 | // Update -lname to name.lib, | ||
874 | QStringList &libs2 = project->variables()["QMAKE_LIBS"]; | ||
875 | for ( QStringList::Iterator libit2 = libs2.begin(); libit2 != libs2.end(); ++libit2 ) { | ||
876 | if ( (*libit2).startsWith( "-l" ) ) { | ||
877 | (*libit2) = (*libit2).mid( 2 ) + ".lib"; | ||
878 | } else if ( (*libit2).startsWith( "-L" ) ) { | ||
879 | project->variables()["QMAKE_LIBDIR"] += (*libit2).mid(2); | ||
880 | libit2 = libs2.remove( libit2 ); | ||
881 | } | ||
882 | } | ||
883 | |||
752 | project->variables()["MSVCDSP_LFLAGS" ] += project->variables()["QMAKE_LFLAGS"]; | 884 | project->variables()["MSVCDSP_LFLAGS" ] += project->variables()["QMAKE_LFLAGS"]; |
753 | if ( !project->variables()["QMAKE_LIBDIR"].isEmpty() ) | 885 | if ( !project->variables()["QMAKE_LIBDIR"].isEmpty() ) |
754 | project->variables()["MSVCDSP_LFLAGS" ].append(varGlue("QMAKE_LIBDIR","/LIBPATH:\"","\" /LIBPATH:\"","\"")); | 886 | project->variables()["MSVCDSP_LFLAGS" ].append(varGlue("QMAKE_LIBDIR","/LIBPATH:\"","\" /LIBPATH:\"","\"")); |
@@ -756,7 +888,9 @@ DspMakefileGenerator::init() | |||
756 | project->variables()["MSVCDSP_DEFINES"].append(varGlue("DEFINES","/D ","" " /D ","")); | 888 | project->variables()["MSVCDSP_DEFINES"].append(varGlue("DEFINES","/D ","" " /D ","")); |
757 | project->variables()["MSVCDSP_DEFINES"].append(varGlue("PRL_EXPORT_DEFINES","/D ","" " /D ","")); | 889 | project->variables()["MSVCDSP_DEFINES"].append(varGlue("PRL_EXPORT_DEFINES","/D ","" " /D ","")); |
758 | 890 | ||
759 | processPrlFiles(); | 891 | if (!project->variables()["RES_FILE"].isEmpty()) |
892 | project->variables()["QMAKE_LIBS"] += project->variables()["RES_FILE"]; | ||
893 | |||
760 | QStringList &libs = project->variables()["QMAKE_LIBS"]; | 894 | QStringList &libs = project->variables()["QMAKE_LIBS"]; |
761 | for(QStringList::Iterator libit = libs.begin(); libit != libs.end(); ++libit) { | 895 | for(QStringList::Iterator libit = libs.begin(); libit != libs.end(); ++libit) { |
762 | QString lib = (*libit); | 896 | QString lib = (*libit); |
@@ -768,6 +902,8 @@ DspMakefileGenerator::init() | |||
768 | for(QStringList::Iterator incit = incs.begin(); incit != incs.end(); ++incit) { | 902 | for(QStringList::Iterator incit = incs.begin(); incit != incs.end(); ++incit) { |
769 | QString inc = (*incit); | 903 | QString inc = (*incit); |
770 | inc.replace("\"", ""); | 904 | inc.replace("\"", ""); |
905 | if(inc.endsWith("\\")) // Remove trailing \'s from paths | ||
906 | inc.truncate(inc.length()-1); | ||
771 | project->variables()["MSVCDSP_INCPATH"].append("/I \"" + inc + "\""); | 907 | project->variables()["MSVCDSP_INCPATH"].append("/I \"" + inc + "\""); |
772 | } | 908 | } |
773 | 909 | ||
@@ -820,15 +956,12 @@ DspMakefileGenerator::init() | |||
820 | QString version = project->variables()["VERSION"].first(); | 956 | QString version = project->variables()["VERSION"].first(); |
821 | if ( version.isEmpty() ) | 957 | if ( version.isEmpty() ) |
822 | version = "1.0"; | 958 | version = "1.0"; |
823 | 959 | project->variables()["MSVCDSP_IDLSOURCES"].append( var("OBJECTS_DIR") + targetfilename + ".idl" ); | |
824 | project->variables()["MSVCDSP_IDLSOURCES"].append( "tmp\\" + targetfilename + ".idl" ); | ||
825 | project->variables()["MSVCDSP_IDLSOURCES"].append( "tmp\\" + targetfilename + ".tlb" ); | ||
826 | project->variables()["MSVCDSP_IDLSOURCES"].append( "tmp\\" + targetfilename + ".midl" ); | ||
827 | if ( project->isActiveConfig( "dll" ) ) { | 960 | if ( project->isActiveConfig( "dll" ) ) { |
828 | activeQtStepPreCopyDll += | 961 | activeQtStepPreCopyDll += |
829 | "\t" + idc + " %1 -idl tmp\\" + targetfilename + ".idl -version " + version + | 962 | "\t" + idc + " %1 -idl " + var("OBJECTS_DIR") + targetfilename + ".idl -version " + version + |
830 | "\t" + idl + " tmp\\" + targetfilename + ".idl /nologo /o tmp\\" + targetfilename + ".midl /tlb tmp\\" + targetfilename + ".tlb /iid tmp\\dump.midl /dlldata tmp\\dump.midl /cstub tmp\\dump.midl /header tmp\\dump.midl /proxy tmp\\dump.midl /sstub tmp\\dump.midl" | 963 | "\t" + idl + " /nologo " + var("OBJECTS_DIR") + targetfilename + ".idl /tlb " + var("OBJECTS_DIR") + targetfilename + ".tlb" + |
831 | "\t" + idc + " %1 /tlb tmp\\" + targetfilename + ".tlb"; | 964 | "\t" + idc + " %2 /tlb " + var("OBJECTS_DIR") + targetfilename + ".tlb"; |
832 | activeQtStepPostCopyDll += | 965 | activeQtStepPostCopyDll += |
833 | "\t" + idc + " %1 /regserver\n"; | 966 | "\t" + idc + " %1 /regserver\n"; |
834 | 967 | ||
@@ -841,9 +974,9 @@ DspMakefileGenerator::init() | |||
841 | activeQtStepPostCopyDllDebug = activeQtStepPostCopyDll.arg(executable); | 974 | activeQtStepPostCopyDllDebug = activeQtStepPostCopyDll.arg(executable); |
842 | } else { | 975 | } else { |
843 | activeQtStepPreCopyDll += | 976 | activeQtStepPreCopyDll += |
844 | "\t%1 -dumpidl tmp\\" + targetfilename + ".idl -version " + version + | 977 | "\t%1 -dumpidl " + var("OBJECTS_DIR") + targetfilename + ".idl -version " + version + |
845 | "\t" + idl + " tmp\\" + targetfilename + ".idl /nologo /o tmp\\" + targetfilename + ".midl /tlb tmp\\" + targetfilename + ".tlb /iid tmp\\dump.midl /dlldata tmp\\dump.midl /cstub tmp\\dump.midl /header tmp\\dump.midl /proxy tmp\\dump.midl /sstub tmp\\dump.midl" | 978 | "\t" + idl + " /nologo " + var("OBJECTS_DIR") + targetfilename + ".idl /tlb " + var("OBJECTS_DIR") + targetfilename + ".tlb" + |
846 | "\t" + idc + " %1 /tlb tmp\\" + targetfilename + ".tlb"; | 979 | "\t" + idc + " %2 /tlb " + var("OBJECTS_DIR") + targetfilename + ".tlb"; |
847 | activeQtStepPostCopyDll += | 980 | activeQtStepPostCopyDll += |
848 | "\t%1 -regserver\n"; | 981 | "\t%1 -regserver\n"; |
849 | QString executable = project->variables()["MSVCDSP_TARGETDIRREL"].first() + "\\" + targetfilename + ".exe"; | 982 | QString executable = project->variables()["MSVCDSP_TARGETDIRREL"].first() + "\\" + targetfilename + ".exe"; |
@@ -919,7 +1052,6 @@ DspMakefileGenerator::beginGroupForFile(QString file, QTextStream &t, | |||
919 | { | 1052 | { |
920 | if(project->isActiveConfig("flat")) | 1053 | if(project->isActiveConfig("flat")) |
921 | return; | 1054 | return; |
922 | |||
923 | fileFixify(file, QDir::currentDirPath(), QDir::currentDirPath(), TRUE); | 1055 | fileFixify(file, QDir::currentDirPath(), QDir::currentDirPath(), TRUE); |
924 | file = file.section(Option::dir_sep, 0, -2); | 1056 | file = file.section(Option::dir_sep, 0, -2); |
925 | if(file.right(Option::dir_sep.length()) != Option::dir_sep) | 1057 | if(file.right(Option::dir_sep.length()) != Option::dir_sep) |
@@ -931,19 +1063,23 @@ DspMakefileGenerator::beginGroupForFile(QString file, QTextStream &t, | |||
931 | endGroups(t); | 1063 | endGroups(t); |
932 | return; | 1064 | return; |
933 | } | 1065 | } |
934 | if(file.startsWith(currentGroup)) | 1066 | |
935 | file = file.mid(currentGroup.length()); | 1067 | QString tempFile = file; |
1068 | if(tempFile.startsWith(currentGroup)) | ||
1069 | tempFile = tempFile.mid(currentGroup.length()); | ||
936 | int dirSep = currentGroup.findRev( Option::dir_sep ); | 1070 | int dirSep = currentGroup.findRev( Option::dir_sep ); |
937 | while( !file.startsWith( currentGroup ) && dirSep != -1 ) { | 1071 | |
1072 | while( !tempFile.startsWith( currentGroup ) && dirSep != -1 ) { | ||
938 | currentGroup.truncate( dirSep ); | 1073 | currentGroup.truncate( dirSep ); |
939 | dirSep = currentGroup.findRev( Option::dir_sep ); | 1074 | dirSep = currentGroup.findRev( Option::dir_sep ); |
940 | if ( !file.startsWith( currentGroup ) && dirSep != -1 ) | 1075 | if ( !tempFile.startsWith( currentGroup ) && dirSep != -1 ) |
941 | t << "\n# End Group\n"; | 1076 | t << "\n# End Group\n"; |
942 | } | 1077 | } |
943 | if ( !file.startsWith( currentGroup ) ) { | 1078 | if ( !file.startsWith( currentGroup ) ) { |
944 | t << "\n# End Group\n"; | 1079 | t << "\n# End Group\n"; |
945 | currentGroup = ""; | 1080 | currentGroup = ""; |
946 | } | 1081 | } |
1082 | |||
947 | QStringList dirs = QStringList::split(Option::dir_sep, file.right( file.length() - currentGroup.length() ) ); | 1083 | QStringList dirs = QStringList::split(Option::dir_sep, file.right( file.length() - currentGroup.length() ) ); |
948 | for(QStringList::Iterator dir_it = dirs.begin(); dir_it != dirs.end(); ++dir_it) { | 1084 | for(QStringList::Iterator dir_it = dirs.begin(); dir_it != dirs.end(); ++dir_it) { |
949 | t << "# Begin Group \"" << (*dir_it) << "\"\n" | 1085 | t << "# Begin Group \"" << (*dir_it) << "\"\n" |
@@ -973,6 +1109,8 @@ DspMakefileGenerator::openOutput(QFile &file) const | |||
973 | { | 1109 | { |
974 | QString outdir; | 1110 | QString outdir; |
975 | if(!file.name().isEmpty()) { | 1111 | if(!file.name().isEmpty()) { |
1112 | if(QDir::isRelativePath(file.name())) | ||
1113 | file.setName(Option::output_dir + file.name()); //pwd when qmake was run | ||
976 | QFileInfo fi(file); | 1114 | QFileInfo fi(file); |
977 | if(fi.isDir()) | 1115 | if(fi.isDir()) |
978 | outdir = file.name() + QDir::separator(); | 1116 | outdir = file.name() + QDir::separator(); |