author | zecke <zecke> | 2004-07-15 17:36:57 (UTC) |
---|---|---|
committer | zecke <zecke> | 2004-07-15 17:36:57 (UTC) |
commit | 323e9a7472a110b4befba7320540263147505bae (patch) (unidiff) | |
tree | 14c810bdb9c0603a30356b17b4bdf9ccb72741c6 /qmake/generators/win32/msvc_dsp.cpp | |
parent | aa292b322f1ecb43dd8f4e3cd295855730dd9f59 (diff) | |
download | opie-323e9a7472a110b4befba7320540263147505bae.zip opie-323e9a7472a110b4befba7320540263147505bae.tar.gz opie-323e9a7472a110b4befba7320540263147505bae.tar.bz2 |
Manually updatet to qmake1.06a which includes support for precompiled
headers.
Opies 'PRO' keyword was already reintroduced
Diffstat (limited to 'qmake/generators/win32/msvc_dsp.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | qmake/generators/win32/msvc_dsp.cpp | 244 |
1 files changed, 191 insertions, 53 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,12 +1,10 @@ | |||
1 | /**************************************************************************** | 1 | /**************************************************************************** |
2 | ** $Id$ | 2 | ** |
3 | ** | 3 | ** |
4 | ** Definition of ________ class. | 4 | ** Implementation of DspMakefileGenerator class. |
5 | ** | 5 | ** |
6 | ** Created : 970521 | 6 | ** Copyright (C) 1992-2003 Trolltech AS. All rights reserved. |
7 | ** | 7 | ** |
8 | ** Copyright (C) 1992-2002 Trolltech AS. All rights reserved. | 8 | ** This file is part of qmake. |
9 | ** | ||
10 | ** This file is part of the network module of the Qt GUI Toolkit. | ||
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 |
@@ -79,4 +77,6 @@ DspMakefileGenerator::writeDspParts(QTextStream &t) | |||
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 | ||
@@ -88,4 +88,28 @@ DspMakefileGenerator::writeDspParts(QTextStream &t) | |||
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; |
@@ -112,5 +136,7 @@ DspMakefileGenerator::writeDspParts(QTextStream &t) | |||
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(); |
@@ -125,6 +151,6 @@ DspMakefileGenerator::writeDspParts(QTextStream &t) | |||
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 | } |
@@ -147,23 +173,75 @@ DspMakefileGenerator::writeDspParts(QTextStream &t) | |||
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; |
150 | QString base = (*it); | 176 | QStringList customDependencies; |
177 | QString createMOC; | ||
178 | QString buildCmdsR, buildCmdsD; | ||
179 | QString buildCmds = "\nBuildCmds= \\\n"; | ||
180 | // Create unique baseID | ||
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]"), "_"); |
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"; | ||
153 | 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( "\\..*$" ), "" ) + " "; |
156 | 225 | buildCmds += "\t" + mocpath + (*it) + " -o " + findMocDestination((*it)) + " \\\n"; | |
157 | QString build = "\n\n# Begin Custom Build - Moc'ing " + (*it) + | 226 | createMOC = "\"" + findMocDestination((*it)) +"\" : $(SOURCE) \"$(INTDIR)\" \"$(OUTDIR)\"\n $(BuildCmds)\n\n"; |
158 | "...\n" "InputPath=.\\" + (*it) + "\n\n" "\"" + findMocDestination((*it)) + | 227 | customDependencies += "\"$(QTDIR)\\bin\\moc.exe\""; |
159 | "\"" " : $(SOURCE) \"$(INTDIR)\" \"$(OUTDIR)\"\n" | 228 | } |
160 | "\t" + mocpath + (*it) + " -o " + | 229 | if (!createMOC.isEmpty() || !compilePCH.isEmpty()) { |
161 | findMocDestination((*it)) + "\n\n" "# End Custom Build\n\n"; | 230 | bool doMOC = !createMOC.isEmpty(); |
162 | 231 | bool doPCH = !compilePCH.isEmpty(); | |
163 | t << "USERDEP_" << base << "=\"$(QTDIR)\\bin\\moc.exe\"" << endl << endl; | 232 | QString build = "\n\n# Begin Custom Build - "+ |
164 | 233 | QString(doMOC?"Moc'ing ":"") + | |
165 | t << "!IF \"$(CFG)\" == \"" << var("MSVCDSP_PROJECT") << " - Win32 Release\"" << build | 234 | QString((doMOC&&doPCH)?" and ":"") + |
166 | << "!ELSEIF \"$(CFG)\" == \"" << var("MSVCDSP_PROJECT") << " - Win32 Debug\"" | 235 | QString(doPCH?"Creating PCH cpp from ":"") + |
167 | << build << "!ENDIF " << endl << endl; | 236 | (*it) + "...\nInputPath=.\\" + (*it) + "\n\n" + |
237 | buildCmds + "%1\n" + | ||
238 | createMOC + | ||
239 | compilePCH + | ||
240 | "# End Custom Build\n\n"; | ||
241 | |||
242 | t << "USERDEP_" << base << "=" << valGlue(customDependencies, "\"", "\" \"", "\"") << endl << endl; | ||
243 | t << "!IF \"$(CFG)\" == \"" << var("MSVCDSP_PROJECT") << " - " << platform << " Release\"" << build.arg(buildCmdsR) | ||
244 | << "!ELSEIF \"$(CFG)\" == \"" << var("MSVCDSP_PROJECT") << " - " << platform << " Debug\"" << build.arg(buildCmdsD) | ||
245 | << "!ENDIF " << endl << endl; | ||
168 | } | 246 | } |
169 | t << "# End Source File" << endl; | 247 | t << "# End Source File" << endl; |
@@ -253,5 +331,5 @@ DspMakefileGenerator::writeDspParts(QTextStream &t) | |||
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(); |
@@ -266,6 +344,6 @@ DspMakefileGenerator::writeDspParts(QTextStream &t) | |||
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 | } |
@@ -388,5 +466,6 @@ DspMakefileGenerator::writeDspParts(QTextStream &t) | |||
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" |
@@ -394,11 +473,11 @@ DspMakefileGenerator::writeDspParts(QTextStream &t) | |||
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 | } |
@@ -430,6 +509,6 @@ DspMakefileGenerator::writeDspParts(QTextStream &t) | |||
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 | ||
@@ -466,6 +545,6 @@ DspMakefileGenerator::writeDspParts(QTextStream &t) | |||
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; |
@@ -533,4 +612,5 @@ DspMakefileGenerator::init() | |||
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" ) |
@@ -549,4 +629,10 @@ DspMakefileGenerator::init() | |||
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" ) ) { |
@@ -582,4 +668,12 @@ DspMakefileGenerator::init() | |||
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"); |
@@ -635,4 +729,6 @@ DspMakefileGenerator::init() | |||
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() ) |
@@ -671,4 +767,8 @@ DspMakefileGenerator::init() | |||
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")); |
@@ -679,4 +779,8 @@ DspMakefileGenerator::init() | |||
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"); |
@@ -685,4 +789,21 @@ DspMakefileGenerator::init() | |||
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"; |
@@ -733,10 +854,8 @@ DspMakefileGenerator::init() | |||
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 { |
@@ -749,5 +868,18 @@ DspMakefileGenerator::init() | |||
749 | 868 | ||
750 | project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_WINDOWS"]; | 869 | project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_WINDOWS"]; |
870 | |||
871 | processPrlFiles(); | ||
751 | 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() ) |
@@ -757,5 +889,7 @@ DspMakefileGenerator::init() | |||
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) { |
@@ -769,4 +903,6 @@ DspMakefileGenerator::init() | |||
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 | } |
@@ -821,13 +957,10 @@ DspMakefileGenerator::init() | |||
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"; |
@@ -842,7 +975,7 @@ DspMakefileGenerator::init() | |||
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"; |
@@ -882,5 +1015,5 @@ DspMakefileGenerator::init() | |||
882 | project->variables()["SOURCES"].append( *it + ".h" ); | 1015 | project->variables()["SOURCES"].append( *it + ".h" ); |
883 | } | 1016 | } |
884 | project->variables()["QMAKE_INTERNAL_PRL_LIBS"] << "MSVCDSP_LIBS"; | 1017 | project->variables()["QMAKE_INTERNAL_PRL_LIBS"] << "MSVCDSP_LIBS"; |
885 | } | 1018 | } |
886 | 1019 | ||
@@ -920,5 +1053,4 @@ DspMakefileGenerator::beginGroupForFile(QString file, QTextStream &t, | |||
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); |
@@ -932,11 +1064,14 @@ DspMakefileGenerator::beginGroupForFile(QString file, QTextStream &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 | } |
@@ -945,4 +1080,5 @@ DspMakefileGenerator::beginGroupForFile(QString file, QTextStream &t, | |||
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) { |
@@ -974,4 +1110,6 @@ DspMakefileGenerator::openOutput(QFile &file) const | |||
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()) |