summaryrefslogtreecommitdiff
path: root/qmake/generators/win32
Unidiff
Diffstat (limited to 'qmake/generators/win32') (more/less context) (ignore whitespace changes)
-rw-r--r--qmake/generators/win32/borland_bmake.cpp56
-rw-r--r--qmake/generators/win32/borland_bmake.h9
-rw-r--r--qmake/generators/win32/mingw_make.cpp524
-rw-r--r--qmake/generators/win32/mingw_make.h58
-rw-r--r--qmake/generators/win32/msvc_dsp.cpp171
-rw-r--r--qmake/generators/win32/msvc_dsp.h14
-rw-r--r--qmake/generators/win32/msvc_nmake.cpp98
-rw-r--r--qmake/generators/win32/msvc_nmake.h8
-rw-r--r--qmake/generators/win32/msvc_objectmodel.cpp243
-rw-r--r--qmake/generators/win32/msvc_objectmodel.h100
-rw-r--r--qmake/generators/win32/msvc_vcproj.cpp412
-rw-r--r--qmake/generators/win32/msvc_vcproj.h30
-rw-r--r--qmake/generators/win32/winmakefile.cpp148
13 files changed, 1413 insertions, 458 deletions
diff --git a/qmake/generators/win32/borland_bmake.cpp b/qmake/generators/win32/borland_bmake.cpp
index ae7b47b..26eea88 100644
--- a/qmake/generators/win32/borland_bmake.cpp
+++ b/qmake/generators/win32/borland_bmake.cpp
@@ -129,12 +129,14 @@ BorlandMakefileGenerator::writeBorlandParts(QTextStream &t)
129 t << "RES_FILE =" << varList("RES_FILE") << endl; 129 t << "RES_FILE =" << varList("RES_FILE") << endl;
130 t << "COPY_FILE = " << var("QMAKE_COPY") << endl; 130 t << "COPY_FILE = " << var("QMAKE_COPY") << endl;
131 t << "COPY_DIR = " << var("QMAKE_COPY") << endl; 131 t << "COPY_DIR = " << var("QMAKE_COPY") << endl;
132 t << "DEL_FILE = " << var("QMAKE_DEL_FILE") << endl; 132 t << "DEL_FILE = " << var("QMAKE_DEL_FILE") << endl;
133 t << "DEL_DIR = " << var("QMAKE_DEL_DIR") << endl; 133 t << "DEL_DIR = " << var("QMAKE_DEL_DIR") << endl;
134 t << "MOVE = " << var("QMAKE_MOVE") << endl; 134 t << "MOVE = " << var("QMAKE_MOVE") << endl;
135 t << "CHK_DIR_EXISTS =" << var("QMAKE_CHK_DIR_EXISTS") << endl;
136 t << "MKDIR =" << var("QMAKE_MKDIR") << endl;
135 t << endl; 137 t << endl;
136 138
137 t << "####### Files" << endl << endl; 139 t << "####### Files" << endl << endl;
138 t << "HEADERS =" << varList("HEADERS") << endl; 140 t << "HEADERS =" << varList("HEADERS") << endl;
139 t << "SOURCES =" << varList("SOURCES") << endl; 141 t << "SOURCES =" << varList("SOURCES") << endl;
140 t << "OBJECTS =" << varList("OBJECTS") << endl; 142 t << "OBJECTS =" << varList("OBJECTS") << endl;
@@ -147,31 +149,39 @@ BorlandMakefileGenerator::writeBorlandParts(QTextStream &t)
147 t << "TARGET =" 149 t << "TARGET ="
148 << varGlue("TARGET",project->first("DESTDIR"),"",project->first("TARGET_EXT")) 150 << varGlue("TARGET",project->first("DESTDIR"),"",project->first("TARGET_EXT"))
149 << endl; 151 << endl;
150 t << endl; 152 t << endl;
151 153
152 t << "####### Implicit rules" << endl << endl; 154 t << "####### Implicit rules" << endl << endl;
153 t << ".SUFFIXES: .cpp .cxx .cc .c" << endl << endl; 155 t << ".SUFFIXES: .c";
154 t << ".cpp.obj:\n\t" << var("QMAKE_RUN_CXX_IMP") << endl << endl; 156 QStringList::Iterator cppit;
155 t << ".cxx.obj:\n\t" << var("QMAKE_RUN_CXX_IMP") << endl << endl; 157 for(cppit = Option::cpp_ext.begin(); cppit != Option::cpp_ext.end(); ++cppit)
156 t << ".cc.obj:\n\t" << var("QMAKE_RUN_CXX_IMP") << endl << endl; 158 t << " " << (*cppit);
157 t << ".c.obj:\n\t" << var("QMAKE_RUN_CC_IMP") << endl << endl; 159 t << endl << endl;
160 for(cppit = Option::cpp_ext.begin(); cppit != Option::cpp_ext.end(); ++cppit)
161 t << (*cppit) << Option::obj_ext << ":\n\t" << var("QMAKE_RUN_CXX_IMP") << endl << endl;
162 t << ".c" << Option::obj_ext << ":\n\t" << var("QMAKE_RUN_CC_IMP") << endl << endl;
158 163
159 t << "####### Build rules" << endl << endl; 164 t << "####### Build rules" << endl << endl;
160 t << "all: " << varGlue("ALL_DEPS",""," "," ") << " $(TARGET)" << endl << endl; 165 t << "all: " << varGlue("ALL_DEPS",""," "," ") << " $(TARGET)" << endl << endl;
161 t << "$(TARGET): $(UICDECLS) $(OBJECTS) $(OBJMOC) " << var("TARGETDEPS"); 166 t << "$(TARGET): " << var("PRE_TARGETDEPS") << " $(UICDECLS) $(OBJECTS) $(OBJMOC) "
167 << var("POST_TARGETDEPS");
162 if(!project->variables()["QMAKE_APP_OR_DLL"].isEmpty()) { 168 if(!project->variables()["QMAKE_APP_OR_DLL"].isEmpty()) {
163 t << "\n\t" << "$(LINK) @&&|" << "\n\t" 169 t << "\n\t" << "$(LINK) @&&|" << "\n\t"
164 << "$(LFLAGS) $(OBJECTS) $(OBJMOC),$(TARGET),,$(LIBS),$(DEF_FILE),$(RES_FILE)"; 170 << "$(LFLAGS) $(OBJECTS) $(OBJMOC),$(TARGET),,$(LIBS),$(DEF_FILE),$(RES_FILE)";
165 } else { 171 } else {
166 t << "\n\t-del $(TARGET)" 172 t << "\n\t-del $(TARGET)"
167 << "\n\t" << "$(LIB) $(TARGET) @&&|" << " \n+" 173 << "\n\t" << "$(LIB) $(TARGET) @&&|" << " \n+"
168 << project->variables()["OBJECTS"].join(" \\\n+") << " \\\n+" 174 << project->variables()["OBJECTS"].join(" \\\n+") << " \\\n+"
169 << project->variables()["OBJMOC"].join(" \\\n+"); 175 << project->variables()["OBJMOC"].join(" \\\n+");
170 } 176 }
171 t << endl << "|" << endl; 177 t << endl << "|" << endl;
178
179 if ( !project->variables()["QMAKE_POST_LINK"].isEmpty() )
180 t << "\t" <<var("QMAKE_POST_LINK") << endl;
181
172 if(project->isActiveConfig("dll") && !project->variables()["DLLDESTDIR"].isEmpty()) { 182 if(project->isActiveConfig("dll") && !project->variables()["DLLDESTDIR"].isEmpty()) {
173 QStringList dlldirs = project->variables()["DLLDESTDIR"]; 183 QStringList dlldirs = project->variables()["DLLDESTDIR"];
174 for ( QStringList::Iterator dlldir = dlldirs.begin(); dlldir != dlldirs.end(); ++dlldir ) { 184 for ( QStringList::Iterator dlldir = dlldirs.begin(); dlldir != dlldirs.end(); ++dlldir ) {
175 t << "\n\t" << "-copy $(TARGET) " << *dlldir; 185 t << "\n\t" << "-copy $(TARGET) " << *dlldir;
176 } 186 }
177 } 187 }
@@ -210,21 +220,18 @@ BorlandMakefileGenerator::writeBorlandParts(QTextStream &t)
210 t << "clean:\n" 220 t << "clean:\n"
211 << varGlue("OBJECTS","\t-del ","\n\t-del ","") 221 << varGlue("OBJECTS","\t-del ","\n\t-del ","")
212 << varGlue("SRCMOC" ,"\n\t-del ","\n\t-del ","") 222 << varGlue("SRCMOC" ,"\n\t-del ","\n\t-del ","")
213 << varGlue("OBJMOC" ,"\n\t-del ","\n\t-del ","") 223 << varGlue("OBJMOC" ,"\n\t-del ","\n\t-del ","")
214 << varGlue("UICDECLS" ,"\n\t-del ","\n\t-del ","") 224 << varGlue("UICDECLS" ,"\n\t-del ","\n\t-del ","")
215 << varGlue("UICIMPLS" ,"\n\t-del ","\n\t-del ","") 225 << varGlue("UICIMPLS" ,"\n\t-del ","\n\t-del ","")
216 << "\n\t-del $(TARGET)"
217 << varGlue("QMAKE_CLEAN","\n\t-del ","\n\t-del ","") 226 << varGlue("QMAKE_CLEAN","\n\t-del ","\n\t-del ","")
218 << varGlue("CLEAN_FILES","\n\t-del ","\n\t-del ",""); 227 << varGlue("CLEAN_FILES","\n\t-del ","\n\t-del ","");
219 if ( project->isActiveConfig("activeqt")) { 228 if ( project->isActiveConfig("activeqt")) {
220 t << ("\n\t-del tmp\\" + targetfilename + ".*"); 229 t << ("\n\t-del tmp\\" + targetfilename + ".*");
221 t << "\n\t-del tmp\\dump.*"; 230 t << "\n\t-del tmp\\dump.*";
222 } 231 }
223 if(project->isActiveConfig("dll") && !project->variables()["DLLDESTDIR"].isEmpty())
224 t << "\n\t-del " << var("DLLDESTDIR") << "\\" << project->variables()[ "TARGET" ].first() << project->variables()[ "TARGET_EXT" ].first();
225 if(!project->isEmpty("IMAGES")) 232 if(!project->isEmpty("IMAGES"))
226 t << varGlue("QMAKE_IMAGE_COLLECTION", "\n\t-del ", "\n\t-del ", ""); 233 t << varGlue("QMAKE_IMAGE_COLLECTION", "\n\t-del ", "\n\t-del ", "");
227 234
228 // blasted user defined targets 235 // blasted user defined targets
229 QStringList &qut = project->variables()["QMAKE_EXTRA_WIN_TARGETS"]; 236 QStringList &qut = project->variables()["QMAKE_EXTRA_WIN_TARGETS"];
230 for(QStringList::Iterator it = qut.begin(); it != qut.end(); ++it) { 237 for(QStringList::Iterator it = qut.begin(); it != qut.end(); ++it) {
@@ -241,12 +248,16 @@ BorlandMakefileGenerator::writeBorlandParts(QTextStream &t)
241 } 248 }
242 t << "\n\n" << targ << ":" << deps << "\n\t" 249 t << "\n\n" << targ << ":" << deps << "\n\t"
243 << cmd; 250 << cmd;
244 } 251 }
245 252
246 t << endl << endl; 253 t << endl << endl;
254
255 t << "distclean: clean"
256 << "\n\t-del $(TARGET)"
257 << endl << endl;
247} 258}
248 259
249void 260void
250BorlandMakefileGenerator::init() 261BorlandMakefileGenerator::init()
251{ 262{
252 if(init_flag) 263 if(init_flag)
@@ -361,13 +372,13 @@ BorlandMakefileGenerator::init()
361 project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_QT_THREAD"]; 372 project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_QT_THREAD"];
362 else 373 else
363 project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_QT"]; 374 project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_QT"];
364 if ( !project->variables()["QMAKE_QT_DLL"].isEmpty() ) { 375 if ( !project->variables()["QMAKE_QT_DLL"].isEmpty() ) {
365 int hver = findHighestVersion(project->first("QMAKE_LIBDIR_QT"), "qt"); 376 int hver = findHighestVersion(project->first("QMAKE_LIBDIR_QT"), "qt");
366 if ( hver == -1 ) 377 if ( hver == -1 )
367 hver = findHighestVersion(project->first("QMAKE_LIBDIR_QT"), "qt-mt"); 378 hver = findHighestVersion(project->first("QMAKE_LIBDIR_QT"), "qtmt");
368 if(hver != -1) { 379 if(hver != -1) {
369 QString ver; 380 QString ver;
370 ver.sprintf("qt%s" QTDLL_POSTFIX "%d.lib", (project->isActiveConfig("thread") ? "mt" : ""), hver); 381 ver.sprintf("qt%s" QTDLL_POSTFIX "%d.lib", (project->isActiveConfig("thread") ? "mt" : ""), hver);
371 QStringList &libs = project->variables()["QMAKE_LIBS"]; 382 QStringList &libs = project->variables()["QMAKE_LIBS"];
372 for(QStringList::Iterator libit = libs.begin(); libit != libs.end(); ++libit) 383 for(QStringList::Iterator libit = libs.begin(); libit != libs.end(); ++libit)
373 (*libit).replace(QRegExp("qt(mt)?\\.lib"), ver); 384 (*libit).replace(QRegExp("qt(mt)?\\.lib"), ver);
@@ -423,12 +434,34 @@ BorlandMakefileGenerator::init()
423 } else { 434 } else {
424 project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_CONSOLE_ANY"]; 435 project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_CONSOLE_ANY"];
425 project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_CONSOLE_ANY"]; 436 project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_CONSOLE_ANY"];
426 project->variables()["QMAKE_LFLAGS"] += project->variables()["QMAKE_LFLAGS_CONSOLE_ANY"]; 437 project->variables()["QMAKE_LFLAGS"] += project->variables()["QMAKE_LFLAGS_CONSOLE_ANY"];
427 project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_CONSOLE"]; 438 project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_CONSOLE"];
428 } 439 }
440 if ( project->isActiveConfig("stl") ) {
441 project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_STL_ON"];
442 project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_STL_ON"];
443 } else {
444 project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_STL_OFF"];
445 project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_STL_OFF"];
446 }
447 if ( project->isActiveConfig("exceptions") ) {
448 project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_EXCEPTIONS_ON"];
449 project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_EXCEPTIONS_ON"];
450 } else {
451 project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_EXCEPTIONS_OFF"];
452 project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_EXCEPTIONS_OFF"];
453 }
454 if ( project->isActiveConfig("rtti") ) {
455 project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_RTTI_ON"];
456 project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_RTTI_ON"];
457 } else {
458 project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_RTTI_OFF"];
459 project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_RTTI_OFF"];
460 }
461
429 if ( project->isActiveConfig("thread") ) { 462 if ( project->isActiveConfig("thread") ) {
430 project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_RTMT"]; 463 project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_RTMT"];
431 } else { 464 } else {
432 project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_RT"]; 465 project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_RT"];
433 } 466 }
434 if ( project->isActiveConfig("moc") ) { 467 if ( project->isActiveConfig("moc") ) {
@@ -449,13 +482,13 @@ BorlandMakefileGenerator::init()
449 fprintf(stderr, "Both .rc and .res file specified.\n"); 482 fprintf(stderr, "Both .rc and .res file specified.\n");
450 fprintf(stderr, "Please specify one of them, not both."); 483 fprintf(stderr, "Please specify one of them, not both.");
451 exit(666); 484 exit(666);
452 } 485 }
453 project->variables()["RES_FILE"] = project->variables()["RC_FILE"]; 486 project->variables()["RES_FILE"] = project->variables()["RC_FILE"];
454 project->variables()["RES_FILE"].first().replace(".rc",".res"); 487 project->variables()["RES_FILE"].first().replace(".rc",".res");
455 project->variables()["TARGETDEPS"] += project->variables()["RES_FILE"]; 488 project->variables()["POST_TARGETDEPS"] += project->variables()["RES_FILE"];
456 } 489 }
457 MakefileGenerator::init(); 490 MakefileGenerator::init();
458 if ( !project->variables()["VERSION"].isEmpty()) { 491 if ( !project->variables()["VERSION"].isEmpty()) {
459 QStringList l = QStringList::split('.', project->first("VERSION")); 492 QStringList l = QStringList::split('.', project->first("VERSION"));
460 project->variables()["VER_MAJ"].append(l[0]); 493 project->variables()["VER_MAJ"].append(l[0]);
461 project->variables()["VER_MIN"].append(l[1]); 494 project->variables()["VER_MIN"].append(l[1]);
@@ -471,7 +504,6 @@ BorlandMakefileGenerator::init()
471 tdsPostfix = ".tds"; 504 tdsPostfix = ".tds";
472 } 505 }
473 project->variables()["QMAKE_CLEAN"].append( 506 project->variables()["QMAKE_CLEAN"].append(
474 project->first("DESTDIR") + project->first("TARGET") + tdsPostfix ); 507 project->first("DESTDIR") + project->first("TARGET") + tdsPostfix );
475 } 508 }
476} 509}
477
diff --git a/qmake/generators/win32/borland_bmake.h b/qmake/generators/win32/borland_bmake.h
index 90f8229..5ffed58 100644
--- a/qmake/generators/win32/borland_bmake.h
+++ b/qmake/generators/win32/borland_bmake.h
@@ -2,13 +2,13 @@
2** $Id$ 2** $Id$
3** 3**
4** Definition of ________ class. 4** Definition of ________ class.
5** 5**
6** Created : 970521 6** Created : 970521
7** 7**
8** Copyright (C) 1992-2000 Trolltech AS. All rights reserved. 8** Copyright (C) 1992-2002 Trolltech AS. All rights reserved.
9** 9**
10** This file is part of the network module of the Qt GUI Toolkit. 10** This file is part of the network module of the Qt GUI Toolkit.
11** 11**
12** This file may be distributed under the terms of the Q Public License 12** 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 13** as defined by Trolltech AS of Norway and appearing in the file
14** LICENSE.QPL included in the packaging of this file. 14** LICENSE.QPL included in the packaging of this file.
@@ -31,14 +31,14 @@
31** See http://www.trolltech.com/gpl/ for GPL licensing information. 31** See http://www.trolltech.com/gpl/ for GPL licensing information.
32** 32**
33** Contact info@trolltech.com if any conditions of this licensing are 33** Contact info@trolltech.com if any conditions of this licensing are
34** not clear to you. 34** not clear to you.
35** 35**
36**********************************************************************/ 36**********************************************************************/
37#ifndef __BORLANDMAKE_H__ 37#ifndef __BORLAND_BMAKE_H__
38#define __BORLANDMAKE_H__ 38#define __BORLAND_BMAKE_H__
39 39
40#include "winmakefile.h" 40#include "winmakefile.h"
41 41
42class BorlandMakefileGenerator : public Win32MakefileGenerator 42class BorlandMakefileGenerator : public Win32MakefileGenerator
43{ 43{
44 bool init_flag; 44 bool init_flag;
@@ -52,8 +52,7 @@ public:
52 ~BorlandMakefileGenerator(); 52 ~BorlandMakefileGenerator();
53}; 53};
54 54
55inline BorlandMakefileGenerator::~BorlandMakefileGenerator() 55inline BorlandMakefileGenerator::~BorlandMakefileGenerator()
56{ } 56{ }
57 57
58 58#endif /* __BORLAND_BMAKE_H__ */
59#endif /* __BORLANDMAKE_H__ */
diff --git a/qmake/generators/win32/mingw_make.cpp b/qmake/generators/win32/mingw_make.cpp
new file mode 100644
index 0000000..7f58a55
--- a/dev/null
+++ b/qmake/generators/win32/mingw_make.cpp
@@ -0,0 +1,524 @@
1/****************************************************************************
2** $Id$
3**
4** Definition of ________ class.
5**
6** Copyright (C) 1992-2002 Trolltech AS. All rights reserved.
7**
8** This file is part of the network module of the Qt GUI Toolkit.
9**
10** This file may be distributed under the terms of the Q Public License
11** as defined by Trolltech AS of Norway and appearing in the file
12** LICENSE.QPL included in the packaging of this file.
13**
14** This file may be distributed and/or modified under the terms of the
15** GNU General Public License version 2 as published by the Free Software
16** Foundation and appearing in the file LICENSE.GPL included in the
17** packaging of this file.
18**
19** Licensees holding valid Qt Enterprise Edition licenses may use this
20** file in accordance with the Qt Commercial License Agreement provided
21** with the Software.
22**
23** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
24** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
25**
26** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
27** information about Qt Commercial License Agreements.
28** See http://www.trolltech.com/qpl/ for QPL licensing information.
29** See http://www.trolltech.com/gpl/ for GPL licensing information.
30**
31** Contact info@trolltech.com if any conditions of this licensing are
32** not clear to you.
33**
34**********************************************************************/
35
36#include "mingw_make.h"
37#include "option.h"
38#include <qregexp.h>
39#include <qdir.h>
40#include <stdlib.h>
41#include <time.h>
42
43
44MingwMakefileGenerator::MingwMakefileGenerator(QMakeProject *p) : Win32MakefileGenerator(p), init_flag(FALSE)
45{
46 Option::obj_ext = ".o";
47}
48
49bool
50MingwMakefileGenerator::writeMakefile(QTextStream &t)
51{
52 writeHeader(t);
53 if(!project->variables()["QMAKE_FAILED_REQUIREMENTS"].isEmpty()) {
54 t << "all clean:" << "\n\t"
55 << "@echo \"Some of the required modules ("
56 << var("QMAKE_FAILED_REQUIREMENTS") << ") are not available.\"" << "\n\t"
57 << "@echo \"Skipped.\"" << endl << endl;
58 writeMakeQmake(t);
59 return TRUE;
60 }
61
62 if(project->first("TEMPLATE") == "app" ||
63 project->first("TEMPLATE") == "lib") {
64 writeMingwParts(t);
65 return MakefileGenerator::writeMakefile(t);
66 }
67 else if(project->first("TEMPLATE") == "subdirs") {
68 writeSubDirs(t);
69 return TRUE;
70 }
71 return FALSE;
72}
73
74void
75MingwMakefileGenerator::writeMingwParts(QTextStream &t)
76{
77 t << "####### Compiler, tools and options" << endl << endl;
78 t << "CC =" << var("QMAKE_CC") << endl;
79 t << "CXX =" << var("QMAKE_CXX") << endl;
80 t << "LEX = " << var("QMAKE_LEX") << endl;
81 t << "YACC = " << var("QMAKE_YACC") << endl;
82 t << "CFLAGS =" << var("QMAKE_CFLAGS") << " "
83 << varGlue("PRL_EXPORT_DEFINES","-D"," -D","") << " "
84 << varGlue("DEFINES","-D"," -D","") << endl;
85 t << "CXXFLAGS =" << var("QMAKE_CXXFLAGS") << " "
86 << varGlue("PRL_EXPORT_DEFINES","-D"," -D","") << " "
87 << varGlue("DEFINES","-D"," -D","") << endl;
88 t << "LEXFLAGS=" << var("QMAKE_LEXFLAGS") << endl;
89 t << "YACCFLAGS=" << var("QMAKE_YACCFLAGS") << endl;
90
91 t << "INCPATH =";
92 QStringList &incs = project->variables()["INCLUDEPATH"];
93 for(QStringList::Iterator incit = incs.begin(); incit != incs.end(); ++incit) {
94 QString inc = (*incit);
95 inc.replace(QRegExp("\\\\$"), "\\\\");
96 inc.replace(QRegExp("\""), "");
97 t << " -I" << inc ;
98 }
99 t << " -I" << specdir()
100 << endl;
101 if(!project->variables()["QMAKE_APP_OR_DLL"].isEmpty()) {
102 t << "LINK =" << var("QMAKE_LINK") << endl;
103 t << "LFLAGS =";
104 if ( !project->variables()["QMAKE_LIBDIR"].isEmpty() )
105 t << varGlue("QMAKE_LIBDIR","-L",";","") << " ";
106 t << var("QMAKE_LFLAGS") << endl;
107 t << "LIBS =" << var("QMAKE_LIBS").replace(QRegExp("(\\slib|^lib)")," -l") << endl;
108 }
109 else {
110 t << "LIB =" << var("QMAKE_LIB") << endl;
111 }
112 t << "MOC =" << (project->isEmpty("QMAKE_MOC") ? QString("moc") :
113 Option::fixPathToTargetOS(var("QMAKE_MOC"), FALSE)) << endl;
114 t << "UIC =" << (project->isEmpty("QMAKE_UIC") ? QString("uic") :
115 Option::fixPathToTargetOS(var("QMAKE_UIC"), FALSE)) << endl;
116 t << "QMAKE =" << (project->isEmpty("QMAKE_QMAKE") ? QString("qmake") :
117 Option::fixPathToTargetOS(var("QMAKE_QMAKE"), FALSE)) << endl;
118 t << "IDC =" << (project->isEmpty("QMAKE_IDC") ? QString("idc") :
119 Option::fixPathToTargetOS(var("QMAKE_IDC"), FALSE)) << endl;
120 t << "IDL =" << (project->isEmpty("QMAKE_IDL") ? QString("midl") :
121 Option::fixPathToTargetOS(var("QMAKE_IDL"), FALSE)) << endl;
122 t << "ZIP =" << var("QMAKE_ZIP") << endl;
123 t << "DEF_FILE =" << varList("DEF_FILE") << endl;
124 t << "COPY_FILE= " << var("QMAKE_COPY") << endl;
125 t << "COPY_DIR= " << var("QMAKE_COPY") << endl;
126 t << "DEL_FILE= " << var("QMAKE_DEL_FILE") << endl;
127 t << "DEL_DIR= " << var("QMAKE_DEL_DIR") << endl;
128 t << "MOVE = " << var("QMAKE_MOVE") << endl;
129 t << "CHK_DIR_EXISTS =" << var("QMAKE_CHK_DIR_EXISTS") << endl;
130 t << "MKDIR =" << var("QMAKE_MKDIR") << endl;
131 t << endl;
132
133 t << "####### Output directory" << endl << endl;
134 if (! project->variables()["OBJECTS_DIR"].isEmpty())
135 t << "OBJECTS_DIR = " << var("OBJECTS_DIR").replace(QRegExp("\\\\$"),"") << endl;
136 else
137 t << "OBJECTS_DIR = . " << endl;
138 if (! project->variables()["MOC_DIR"].isEmpty())
139 t << "MOC_DIR = " << var("MOC_DIR").replace(QRegExp("\\\\$"),"") << endl;
140 else
141 t << "MOC_DIR = . " << endl;
142 t << endl;
143
144 t << "####### Files" << endl << endl;
145 t << "HEADERS =" << varList("HEADERS") << endl;
146 t << "SOURCES =" << varList("SOURCES") << endl;
147 // t << "OBJECTS =" << varList("OBJECTS").replace(QRegExp("\\.obj"),".o") << endl;
148 t << "OBJECTS =" << varList("OBJECTS") << endl;
149 t << "FORMS =" << varList("FORMS") << endl;
150 t << "UICDECLS =" << varList("UICDECLS") << endl;
151 t << "UICIMPLS =" << varList("UICIMPLS") << endl;
152 t << "SRCMOC =" << varList("SRCMOC") << endl;
153 t << "OBJMOC =" << varList("OBJMOC") << endl;
154 // t << "OBJMOC =" << varList("OBJMOC").replace(QRegExp("\\.obj"),".o") << endl;
155 t << "DIST =" << varList("DISTFILES") << endl;
156 t << "TARGET =";
157 if( !project->variables()[ "DESTDIR" ].isEmpty() )
158 t << varGlue("TARGET",project->first("DESTDIR"),"",project->first("TARGET_EXT"));
159 else
160 t << project->variables()[ "TARGET" ].first() << project->variables()[ "TARGET_EXT" ].first();
161 t << endl;
162 t << endl;
163
164 t << "####### Implicit rules" << endl << endl;
165 t << ".SUFFIXES: .cpp .cxx .cc .C .c" << endl << endl;
166 t << ".cpp.o:\n\t" << var("QMAKE_RUN_CXX_IMP") << endl << endl;
167 t << ".cxx.o:\n\t" << var("QMAKE_RUN_CXX_IMP") << endl << endl;
168 t << ".cc.o:\n\t" << var("QMAKE_RUN_CXX_IMP") << endl << endl;
169 t << ".C.o:\n\t" << var("QMAKE_RUN_CXX_IMP") << endl << endl;
170 t << ".c.o:\n\t" << var("QMAKE_RUN_CC_IMP") << endl << endl;
171
172 t << "####### Build rules" << endl << endl;
173 t << "all: " << "$(OBJECTS_DIR) " << "$(MOC_DIR) " << varGlue("ALL_DEPS",""," "," ") << "$(TARGET)" << endl << endl;
174 t << "$(TARGET): " << var("PRE_TARGETDEPS") << " $(UICDECLS) $(OBJECTS) $(OBJMOC) "
175 << var("POST_TARGETDEPS");
176 if(!project->variables()["QMAKE_APP_OR_DLL"].isEmpty()) {
177 t << "\n\t" << "$(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(OBJMOC) $(LIBS)";
178 } else {
179 t << "\n\t" << "$(LIB) $(TARGET) $(OBJECTS) $(OBJMOC)";
180 }
181
182 if(project->isActiveConfig("dll") && !project->variables()["DLLDESTDIR"].isEmpty()) {
183 QStringList dlldirs = project->variables()["DLLDESTDIR"];
184 for ( QStringList::Iterator dlldir = dlldirs.begin(); dlldir != dlldirs.end(); ++dlldir ) {
185 t << "\n\t" << "copy $(TARGET) " << *dlldir;
186 }
187 }
188 QString targetfilename = project->variables()["TARGET"].first();
189 if(project->isActiveConfig("activeqt")) {
190 QString version = project->variables()["VERSION"].first();
191 if ( version.isEmpty() )
192 version = "1.0";
193
194 if ( project->isActiveConfig("dll")) {
195 t << "\n\t" << ("-$(IDC) $(TARGET) /idl tmp\\" + targetfilename + ".idl -version " + version);
196 t << "\n\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");
197 t << "\n\t" << ("-$(IDC) $(TARGET) /tlb tmp\\" + targetfilename + ".tlb");
198 t << "\n\t" << ("-$(IDC) $(TARGET) /regserver" );
199 } else {
200 t << "\n\t" << ("-$(TARGET) -dumpidl tmp\\" + targetfilename + ".idl -version " + version);
201 t << "\n\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");
202 t << "\n\t" << ("-$(IDC) $(TARGET) /tlb tmp\\" + targetfilename + ".tlb");
203 t << "\n\t" << "-$(TARGET) -regserver";
204 }
205 }
206 t << endl << endl;
207
208 if(!project->variables()["RC_FILE"].isEmpty()) {
209 t << var("RES_FILE") << ": " << var("RC_FILE") << "\n\t"
210 << var("QMAKE_RC") << " -i " << var("RC_FILE") << " -o " << var("RC_FILE").replace(QRegExp("\\.rc"),".o") << endl << endl;
211 }
212 project->variables()["RES_FILE"].first().replace(QRegExp("\\.rc"),".o");
213
214 t << "mocables: $(SRCMOC)" << endl << endl;
215
216 t << "$(OBJECTS_DIR):" << "\n\t"
217 << "@if not exist $(OBJECTS_DIR) mkdir $(OBJECTS_DIR)" << endl << endl;
218
219 t << "$(MOC_DIR):" << "\n\t"
220 << "@if not exist $(MOC_DIR) mkdir $(MOC_DIR)" << endl << endl;
221
222 writeMakeQmake(t);
223
224 t << "dist:" << "\n\t"
225 << "$(ZIP) " << var("PROJECT") << ".zip "
226 << var("PROJECT") << ".pro $(SOURCES) $(HEADERS) $(DIST) $(FORMS)" << endl << endl;
227
228 t << "clean:"
229 << varGlue("OBJECTS","\n\t-del ","\n\t-del ","").replace(QRegExp("\\.obj"),".o")
230 << varGlue("SRCMOC" ,"\n\t-del ","\n\t-del ","")
231 << varGlue("OBJMOC" ,"\n\t-del ","\n\t-del ","").replace(QRegExp("\\.obj"),".o")
232 << varGlue("UICDECLS" ,"\n\t-del ","\n\t-del ","")
233 << varGlue("UICIMPLS" ,"\n\t-del ","\n\t-del ","")
234 << "\n\t-del $(TARGET)"
235 << varGlue("QMAKE_CLEAN","\n\t-del ","\n\t-del ","")
236 << varGlue("CLEAN_FILES","\n\t-del ","\n\t-del ","");
237 if ( project->isActiveConfig("activeqt")) {
238 t << ("\n\t-del tmp\\" + targetfilename + ".*");
239 t << "\n\t-del tmp\\dump.*";
240 }
241 if(project->isActiveConfig("dll") && !project->variables()["DLLDESTDIR"].isEmpty())
242 t << "\n\t-del " << var("DLLDESTDIR") << "\\" << project->variables()[ "TARGET" ].first() << project->variables()[ "TARGET_EXT" ].first();
243 if(!project->isEmpty("IMAGES"))
244 t << varGlue("QMAKE_IMAGE_COLLECTION", "\n\t-del ", "\n\t-del ", "");
245
246 // blasted user defined targets
247 QStringList &qut = project->variables()["QMAKE_EXTRA_WIN_TARGETS"];
248 for(QStringList::Iterator it = qut.begin(); it != qut.end(); ++it) {
249 QString targ = var((*it) + ".target"),
250 cmd = var((*it) + ".commands"), deps;
251 if(targ.isEmpty())
252 targ = (*it);
253 QStringList &deplist = project->variables()[(*it) + ".depends"];
254 for(QStringList::Iterator dep_it = deplist.begin(); dep_it != deplist.end(); ++dep_it) {
255 QString dep = var((*dep_it) + ".target");
256 if(dep.isEmpty())
257 dep = (*dep_it);
258 deps += " " + dep;
259 }
260 t << "\n\n" << targ << ":" << deps << "\n\t"
261 << cmd;
262 }
263
264 t << endl << endl;
265}
266
267
268void
269MingwMakefileGenerator::init()
270{
271 if(init_flag)
272 return;
273 init_flag = TRUE;
274
275 /* this should probably not be here, but I'm using it to wrap the .t files */
276 if(project->first("TEMPLATE") == "app")
277 project->variables()["QMAKE_APP_FLAG"].append("1");
278 else if(project->first("TEMPLATE") == "lib")
279 project->variables()["QMAKE_LIB_FLAG"].append("1");
280 else if(project->first("TEMPLATE") == "subdirs") {
281 MakefileGenerator::init();
282 if(project->variables()["MAKEFILE"].isEmpty())
283 project->variables()["MAKEFILE"].append("Makefile");
284 if(project->variables()["QMAKE"].isEmpty())
285 project->variables()["QMAKE"].append("qmake");
286 return;
287 }
288
289 bool is_qt = (project->first("TARGET") == "qt"QTDLL_POSTFIX || project->first("TARGET") == "qt-mt"QTDLL_POSTFIX);
290 project->variables()["QMAKE_ORIG_TARGET"] = project->variables()["TARGET"];
291
292 // LIBS defined in Profile comes first for gcc
293 project->variables()["QMAKE_LIBS"] += project->variables()["LIBS"];
294
295 QString targetfilename = project->variables()["TARGET"].first();
296 QStringList &configs = project->variables()["CONFIG"];
297 if (project->isActiveConfig("qt") && project->isActiveConfig("shared"))
298 project->variables()["DEFINES"].append("QT_DLL");
299 if (project->isActiveConfig("qt_dll"))
300 if(configs.findIndex("qt") == -1) configs.append("qt");
301 if ( project->isActiveConfig("qt") ) {
302 if ( project->isActiveConfig( "plugin" ) ) {
303 project->variables()["CONFIG"].append("dll");
304 if(project->isActiveConfig("qt"))
305 project->variables()["DEFINES"].append("QT_PLUGIN");
306 }
307 if ( (project->variables()["DEFINES"].findIndex("QT_NODLL") == -1) &&
308 ((project->variables()["DEFINES"].findIndex("QT_MAKEDLL") != -1 ||
309 project->variables()["DEFINES"].findIndex("QT_DLL") != -1) ||
310 (getenv("QT_DLL") && !getenv("QT_NODLL"))) ) {
311 project->variables()["QMAKE_QT_DLL"].append("1");
312 if ( is_qt && !project->variables()["QMAKE_LIB_FLAG"].isEmpty() )
313 project->variables()["CONFIG"].append("dll");
314 }
315 if ( project->isActiveConfig("thread") )
316 project->variables()[is_qt ? "PRL_EXPORT_DEFINES" : "DEFINES"].append("QT_THREAD_SUPPORT");
317 if ( project->isActiveConfig("accessibility" ) )
318 project->variables()[is_qt ? "PRL_EXPORT_DEFINES" : "DEFINES"].append("QT_ACCESSIBILITY_SUPPORT");
319 if ( project->isActiveConfig("tablet") )
320 project->variables()[is_qt ? "PRL_EXPORT_DEFINES" : "DEFINES"].append("QT_TABLET_SUPPORT");
321 }
322 if ( project->isActiveConfig("dll") || !project->variables()["QMAKE_APP_FLAG"].isEmpty() ) {
323 project->variables()["CONFIG"].remove("staticlib");
324 project->variables()["QMAKE_APP_OR_DLL"].append("1");
325 } else {
326 project->variables()["CONFIG"].append("staticlib");
327 }
328 if ( project->isActiveConfig("warn_off") ) {
329 project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_WARN_OFF"];
330 project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_WARN_OFF"];
331 } else if ( project->isActiveConfig("warn_on") ) {
332 project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_WARN_ON"];
333 project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_WARN_ON"];
334 }
335 if ( project->isActiveConfig("debug") ) {
336 if ( project->isActiveConfig("thread") ) {
337 // use the DLL RT even here
338 if ( project->variables()["DEFINES"].contains("QT_DLL") ) {
339 project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_MT_DLLDBG"];
340 project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_MT_DLLDBG"];
341 } else {
342 project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_MT_DBG"];
343 project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_MT_DBG"];
344 }
345 }
346 project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_DEBUG"];
347 project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_DEBUG"];
348 project->variables()["QMAKE_LFLAGS"] += project->variables()["QMAKE_LFLAGS_DEBUG"];
349 } else {
350 if ( project->isActiveConfig("thread") ) {
351 if ( project->variables()["DEFINES"].contains("QT_DLL") ) {
352 project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_MT_DLL"];
353 project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_MT_DLL"];
354 } else {
355 project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_MT"];
356 project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_MT"];
357 }
358 }
359 project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_RELEASE"];
360 project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_RELEASE"];
361 project->variables()["QMAKE_LFLAGS"] += project->variables()["QMAKE_LFLAGS_RELEASE"];
362 }
363
364 if ( !project->variables()["QMAKE_INCDIR"].isEmpty())
365 project->variables()["INCLUDEPATH"] += project->variables()["QMAKE_INCDIR"];
366 if ( project->isActiveConfig("qt") || project->isActiveConfig("opengl") )
367 project->variables()["CONFIG"].append("windows");
368 if ( project->isActiveConfig("qt") ) {
369 project->variables()["CONFIG"].append("moc");
370 project->variables()["INCLUDEPATH"] +=project->variables()["QMAKE_INCDIR_QT"];
371 project->variables()["QMAKE_LIBDIR"] += project->variables()["QMAKE_LIBDIR_QT"];
372 if ( !project->isActiveConfig("debug") )
373 project->variables()[is_qt ? "PRL_EXPORT_DEFINES" : "DEFINES"].append("QT_NO_DEBUG");
374 if ( is_qt && !project->variables()["QMAKE_LIB_FLAG"].isEmpty() ) {
375 if ( !project->variables()["QMAKE_QT_DLL"].isEmpty()) {
376 project->variables()["DEFINES"].append("QT_MAKEDLL");
377 project->variables()["QMAKE_LFLAGS"] += project->variables()["QMAKE_LFLAGS_QT_DLL"];
378 }
379 } else {
380 if(project->isActiveConfig("thread"))
381 project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_QT_THREAD"];
382 else
383 project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_QT"];
384 if ( !project->variables()["QMAKE_QT_DLL"].isEmpty() ) {
385 int hver = findHighestVersion(project->first("QMAKE_LIBDIR_QT"), "qt");
386 if ( hver == -1 )
387 hver = findHighestVersion(project->first("QMAKE_LIBDIR_QT"), "qt-mt");
388 if(hver != -1) {
389 QString ver;
390 ver.sprintf("libqt-%s" QTDLL_POSTFIX "%d.a", (project->isActiveConfig("thread") ? "-mt" : ""), hver);
391 QStringList &libs = project->variables()["QMAKE_LIBS"];
392// @@@HGTODO maybe we must change the replace regexp if we understand what's going on
393 for(QStringList::Iterator libit = libs.begin(); libit != libs.end(); ++libit)
394 (*libit).replace(QRegExp("qt(-mt)?\\.lib"), ver);
395 }
396 }
397 if ( project->isActiveConfig( "activeqt" ) ) {
398 project->variables().remove("QMAKE_LIBS_QT_ENTRY");
399 project->variables()["QMAKE_LIBS_QT_ENTRY"] = "qaxserver.lib";
400 if ( project->isActiveConfig( "dll" ) )
401 project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_QT_ENTRY"];
402 }
403 if ( !project->isActiveConfig("dll") && !project->isActiveConfig("plugin") ) {
404 project->variables()["QMAKE_LIBS"] +=project->variables()["QMAKE_LIBS_QT_ENTRY"];
405 }
406 }
407 }
408 if ( project->isActiveConfig("opengl") ) {
409 project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_OPENGL"];
410 project->variables()["QMAKE_LFLAGS"] += project->variables()["QMAKE_LFLAGS_OPENGL"];
411 }
412 if ( project->isActiveConfig("dll") ) {
413 project->variables()["QMAKE_CFLAGS_CONSOLE_ANY"] = project->variables()["QMAKE_CFLAGS_CONSOLE_DLL"];
414 project->variables()["QMAKE_CXXFLAGS_CONSOLE_ANY"] = project->variables()["QMAKE_CXXFLAGS_CONSOLE_DLL"];
415 project->variables()["QMAKE_LFLAGS_CONSOLE_ANY"] = project->variables()["QMAKE_LFLAGS_CONSOLE_DLL"];
416 project->variables()["QMAKE_LFLAGS_WINDOWS_ANY"] = project->variables()["QMAKE_LFLAGS_WINDOWS_DLL"];
417 if ( !project->variables()["QMAKE_LIB_FLAG"].isEmpty()) {
418 project->variables()["TARGET_EXT"].append(
419 QStringList::split('.',project->first("VERSION")).join("") + ".dll");
420 } else {
421 project->variables()["TARGET_EXT"].append(".dll");
422 }
423 } else {
424 project->variables()["QMAKE_CFLAGS_CONSOLE_ANY"] = project->variables()["QMAKE_CFLAGS_CONSOLE"];
425 project->variables()["QMAKE_CXXFLAGS_CONSOLE_ANY"] = project->variables()["QMAKE_CXXFLAGS_CONSOLE"];
426 project->variables()["QMAKE_LFLAGS_CONSOLE_ANY"] = project->variables()["QMAKE_LFLAGS_CONSOLE"];
427 project->variables()["QMAKE_LFLAGS_WINDOWS_ANY"] = project->variables()["QMAKE_LFLAGS_WINDOWS"];
428 if ( !project->variables()["QMAKE_APP_FLAG"].isEmpty()) {
429 project->variables()["TARGET_EXT"].append(".exe");
430 } else {
431 project->variables()["TARGET_EXT"].append(".a");
432 project->variables()["QMAKE_LFLAGS"].append("-static");
433 if(project->variables()["TARGET"].first().left(3) != "lib")
434 project->variables()["TARGET"].first().prepend("lib");
435 }
436 }
437 if ( project->isActiveConfig("windows") ) {
438 if ( project->isActiveConfig("console") ) {
439 project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_CONSOLE_ANY"];
440 project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_CONSOLE_ANY"];
441 project->variables()["QMAKE_LFLAGS"] += project->variables()["QMAKE_LFLAGS_CONSOLE_ANY"];
442 project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_CONSOLE"];
443 } else {
444 project->variables()["QMAKE_LFLAGS"] += project->variables()["QMAKE_LFLAGS_WINDOWS_ANY"];
445 }
446 project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_WINDOWS"];
447 } else {
448 project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_CONSOLE_ANY"];
449 project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_CONSOLE_ANY"];
450 project->variables()["QMAKE_LFLAGS"] += project->variables()["QMAKE_LFLAGS_CONSOLE_ANY"];
451 project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_CONSOLE"];
452 }
453
454 if ( project->isActiveConfig("moc") )
455 setMocAware(TRUE);
456 project->variables()["QMAKE_FILETAGS"] += QStringList::split(' ',
457 "HEADERS SOURCES DEF_FILE RC_FILE TARGET QMAKE_LIBS DESTDIR DLLDESTDIR INCLUDEPATH");
458 QStringList &l = project->variables()["QMAKE_FILETAGS"];
459 for(QStringList::Iterator it = l.begin(); it != l.end(); ++it) {
460 QStringList &gdmf = project->variables()[(*it)];
461 for(QStringList::Iterator inner = gdmf.begin(); inner != gdmf.end(); ++inner)
462 (*inner) = Option::fixPathToTargetOS((*inner), FALSE);
463 }
464
465 if ( project->isActiveConfig("dll") )
466 project->variables()["QMAKE_LFLAGS"].append(QString("-Wl,--out-implib,") + project->first("DESTDIR") + "\\lib"+ project->first("TARGET") + ".a");
467
468 if ( !project->variables()["DEF_FILE"].isEmpty() )
469 project->variables()["QMAKE_LFLAGS"].append(QString("-Wl,--output-def,") + project->first("DEF_FILE"));
470// if(!project->isActiveConfig("incremental"))
471 //project->variables()["QMAKE_LFLAGS"].append(QString("/incremental:no"));
472
473#if 0
474 if ( !project->variables()["VERSION"].isEmpty() ) {
475 QString version = project->variables()["VERSION"][0];
476 int firstDot = version.find( "." );
477 QString major = version.left( firstDot );
478 QString minor = version.right( version.length() - firstDot - 1 );
479 minor.replace( ".", "" );
480 project->variables()["QMAKE_LFLAGS"].append( "/VERSION:" + major + "." + minor );
481 }
482#endif
483 if ( !project->variables()["RC_FILE"].isEmpty()) {
484 if ( !project->variables()["RES_FILE"].isEmpty()) {
485 fprintf(stderr, "Both .rc and .res file specified.\n");
486 fprintf(stderr, "Please specify one of them, not both.");
487 exit(666);
488 }
489 project->variables()["RES_FILE"] = project->variables()["RC_FILE"];
490 project->variables()["RES_FILE"].first().replace(".rc",".o");
491 project->variables()["POST_TARGETDEPS"] += project->variables()["RES_FILE"];
492 }
493 if ( !project->variables()["RES_FILE"].isEmpty())
494 project->variables()["QMAKE_LIBS"] += project->variables()["RES_FILE"];
495
496 MakefileGenerator::init();
497 if ( !project->variables()["VERSION"].isEmpty()) {
498 QStringList l = QStringList::split('.', project->first("VERSION"));
499 project->variables()["VER_MAJ"].append(l[0]);
500 project->variables()["VER_MIN"].append(l[1]);
501 }
502 if(project->isActiveConfig("dll")) {
503 project->variables()["QMAKE_CLEAN"].append(project->first("DESTDIR") +"lib" + project->first("TARGET") + ".a");
504 }
505}
506
507void
508MingwMakefileGenerator::writeSubDirs(QTextStream &t)
509{
510 QString qs ;
511 QTextStream ts (&qs, IO_WriteOnly) ;
512 Win32MakefileGenerator::writeSubDirs( ts ) ;
513 QRegExp rx("(\\n\\tcd [^\\n\\t]+)(\\n\\t.+)\\n\\t@cd ..") ;
514 rx.setMinimal(true);
515 int pos = 0 ;
516 while ( -1 != (pos = rx.search( qs, pos)))
517 {
518 QString qsMatch = rx.cap(2);
519 qsMatch.replace("\n\t"," && \\\n\t");
520 qs.replace(pos+rx.cap(1).length(), rx.cap(2).length(), qsMatch );
521 pos += (rx.cap(1).length()+qsMatch.length());
522 }
523 t << qs ;
524}
diff --git a/qmake/generators/win32/mingw_make.h b/qmake/generators/win32/mingw_make.h
new file mode 100644
index 0000000..c00bf1b
--- a/dev/null
+++ b/qmake/generators/win32/mingw_make.h
@@ -0,0 +1,58 @@
1/****************************************************************************
2** $Id$
3**
4** Definition of ________ class.
5**
6** Copyright (C) 1992-2002 Trolltech AS. All rights reserved.
7**
8** This file is part of the network module of the Qt GUI Toolkit.
9**
10** This file may be distributed under the terms of the Q Public License
11** as defined by Trolltech AS of Norway and appearing in the file
12** LICENSE.QPL included in the packaging of this file.
13**
14** This file may be distributed and/or modified under the terms of the
15** GNU General Public License version 2 as published by the Free Software
16** Foundation and appearing in the file LICENSE.GPL included in the
17** packaging of this file.
18**
19** Licensees holding valid Qt Enterprise Edition licenses may use this
20** file in accordance with the Qt Commercial License Agreement provided
21** with the Software.
22**
23** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
24** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
25**
26** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
27** information about Qt Commercial License Agreements.
28** See http://www.trolltech.com/qpl/ for QPL licensing information.
29** See http://www.trolltech.com/gpl/ for GPL licensing information.
30**
31** Contact info@trolltech.com if any conditions of this licensing are
32** not clear to you.
33**
34**********************************************************************/
35#ifndef __MINGW_MAKE_H__
36#define __MINGW_MAKE_H__
37
38#include "winmakefile.h"
39
40class MingwMakefileGenerator : public Win32MakefileGenerator
41{
42 bool init_flag;
43 void writeMingwParts(QTextStream &);
44 void writeSubDirs(QTextStream &t) ;
45
46 bool writeMakefile(QTextStream &);
47 void init();
48
49public:
50 MingwMakefileGenerator(QMakeProject *p);
51 ~MingwMakefileGenerator();
52
53};
54
55inline MingwMakefileGenerator::~MingwMakefileGenerator()
56{ }
57
58#endif /* __MINGW_MAKE_H__ */
diff --git a/qmake/generators/win32/msvc_dsp.cpp b/qmake/generators/win32/msvc_dsp.cpp
index 8b08c78..3fa0496 100644
--- a/qmake/generators/win32/msvc_dsp.cpp
+++ b/qmake/generators/win32/msvc_dsp.cpp
@@ -505,12 +505,36 @@ DspMakefileGenerator::init()
505{ 505{
506 if(init_flag) 506 if(init_flag)
507 return; 507 return;
508 QStringList::Iterator it; 508 QStringList::Iterator it;
509 init_flag = TRUE; 509 init_flag = TRUE;
510 510
511 const bool thread = project->isActiveConfig("thread");
512
513 if ( project->isActiveConfig("stl") ) {
514 project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_STL_ON"];
515 project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_STL_ON"];
516 } else {
517 project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_STL_OFF"];
518 project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_STL_OFF"];
519 }
520 if ( project->isActiveConfig("exceptions") ) {
521 project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_EXCEPTIONS_ON"];
522 project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_EXCEPTIONS_ON"];
523 } else {
524 project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_EXCEPTIONS_OFF"];
525 project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_EXCEPTIONS_OFF"];
526 }
527 if ( project->isActiveConfig("rtti") ) {
528 project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_RTTI_ON"];
529 project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_RTTI_ON"];
530 } else {
531 project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_RTTI_OFF"];
532 project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_RTTI_OFF"];
533 }
534
511 /* this should probably not be here, but I'm using it to wrap the .t files */ 535 /* this should probably not be here, but I'm using it to wrap the .t files */
512 if(project->first("TEMPLATE") == "vcapp" ) 536 if(project->first("TEMPLATE") == "vcapp" )
513 project->variables()["QMAKE_APP_FLAG"].append("1"); 537 project->variables()["QMAKE_APP_FLAG"].append("1");
514 else if(project->first("TEMPLATE") == "vclib") 538 else if(project->first("TEMPLATE") == "vclib")
515 project->variables()["QMAKE_LIB_FLAG"].append("1"); 539 project->variables()["QMAKE_LIB_FLAG"].append("1");
516 if ( project->variables()["QMAKESPEC"].isEmpty() ) 540 if ( project->variables()["QMAKESPEC"].isEmpty() )
@@ -565,23 +589,23 @@ DspMakefileGenerator::init()
565 if ( is_qt && !project->variables()["QMAKE_LIB_FLAG"].isEmpty() ) { 589 if ( is_qt && !project->variables()["QMAKE_LIB_FLAG"].isEmpty() ) {
566 if ( !project->variables()["QMAKE_QT_DLL"].isEmpty() ) { 590 if ( !project->variables()["QMAKE_QT_DLL"].isEmpty() ) {
567 project->variables()["DEFINES"].append("QT_MAKEDLL"); 591 project->variables()["DEFINES"].append("QT_MAKEDLL");
568 project->variables()["QMAKE_LFLAGS"].append("/base:\"0x39D00000\""); 592 project->variables()["QMAKE_LFLAGS"].append("/base:\"0x39D00000\"");
569 } 593 }
570 } else { 594 } else {
571 if(project->isActiveConfig("thread")) 595 if( thread )
572 project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_QT_THREAD"]; 596 project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_QT_THREAD"];
573 else 597 else
574 project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_QT"]; 598 project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_QT"];
575 if ( !project->variables()["QMAKE_QT_DLL"].isEmpty() ) { 599 if ( !project->variables()["QMAKE_QT_DLL"].isEmpty() ) {
576 int hver = findHighestVersion(project->first("QMAKE_LIBDIR_QT"), "qt"); 600 int hver = findHighestVersion(project->first("QMAKE_LIBDIR_QT"), "qt");
577 if ( hver == -1 ) 601 if ( hver == -1 )
578 hver = findHighestVersion(project->first("QMAKE_LIBDIR_QT"), "qt-mt"); 602 hver = findHighestVersion(project->first("QMAKE_LIBDIR_QT"), "qt-mt");
579 if(hver != -1) { 603 if(hver != -1) {
580 QString ver; 604 QString ver;
581 ver.sprintf("qt%s" QTDLL_POSTFIX "%d.lib", (project->isActiveConfig("thread") ? "-mt" : ""), hver); 605 ver.sprintf("qt%s" QTDLL_POSTFIX "%d.lib", (thread ? "-mt" : ""), hver);
582 QStringList &libs = project->variables()["QMAKE_LIBS"]; 606 QStringList &libs = project->variables()["QMAKE_LIBS"];
583 for(QStringList::Iterator libit = libs.begin(); libit != libs.end(); ++libit) 607 for(QStringList::Iterator libit = libs.begin(); libit != libs.end(); ++libit)
584 (*libit).replace(QRegExp("qt(-mt)?\\.lib"), ver); 608 (*libit).replace(QRegExp("qt(-mt)?\\.lib"), ver);
585 } 609 }
586 } 610 }
587 if ( project->isActiveConfig( "activeqt" ) ) { 611 if ( project->isActiveConfig( "activeqt" ) ) {
@@ -619,13 +643,13 @@ DspMakefileGenerator::init()
619 } 643 }
620 644
621 if ( project->isActiveConfig("opengl") ) { 645 if ( project->isActiveConfig("opengl") ) {
622 project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_OPENGL"]; 646 project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_OPENGL"];
623 project->variables()["QMAKE_LFLAGS"] += project->variables()["QMAKE_LFLAGS_OPENGL"]; 647 project->variables()["QMAKE_LFLAGS"] += project->variables()["QMAKE_LFLAGS_OPENGL"];
624 } 648 }
625 if ( project->isActiveConfig("thread") ) { 649 if ( thread ) {
626 if(project->isActiveConfig("qt")) 650 if(project->isActiveConfig("qt"))
627 project->variables()[is_qt ? "PRL_EXPORT_DEFINES" : "DEFINES"].append("QT_THREAD_SUPPORT" ); 651 project->variables()[is_qt ? "PRL_EXPORT_DEFINES" : "DEFINES"].append("QT_THREAD_SUPPORT" );
628 if ( project->isActiveConfig("dll") || project->first("TARGET") == "qtmain" 652 if ( project->isActiveConfig("dll") || project->first("TARGET") == "qtmain"
629 || !project->variables()["QMAKE_QT_DLL"].isEmpty() ) { 653 || !project->variables()["QMAKE_QT_DLL"].isEmpty() ) {
630 project->variables()["MSVCDSP_MTDEFD"] += project->variables()["QMAKE_CXXFLAGS_MT_DLLDBG"]; 654 project->variables()["MSVCDSP_MTDEFD"] += project->variables()["QMAKE_CXXFLAGS_MT_DLLDBG"];
631 project->variables()["MSVCDSP_MTDEF"] += project->variables()["QMAKE_CXXFLAGS_MT_DLL"]; 655 project->variables()["MSVCDSP_MTDEF"] += project->variables()["QMAKE_CXXFLAGS_MT_DLL"];
@@ -729,12 +753,13 @@ DspMakefileGenerator::init()
729 if ( !project->variables()["QMAKE_LIBDIR"].isEmpty() ) 753 if ( !project->variables()["QMAKE_LIBDIR"].isEmpty() )
730 project->variables()["MSVCDSP_LFLAGS" ].append(varGlue("QMAKE_LIBDIR","/LIBPATH:\"","\" /LIBPATH:\"","\"")); 754 project->variables()["MSVCDSP_LFLAGS" ].append(varGlue("QMAKE_LIBDIR","/LIBPATH:\"","\" /LIBPATH:\"","\""));
731 project->variables()["MSVCDSP_CXXFLAGS" ] += project->variables()["QMAKE_CXXFLAGS"]; 755 project->variables()["MSVCDSP_CXXFLAGS" ] += project->variables()["QMAKE_CXXFLAGS"];
732 project->variables()["MSVCDSP_DEFINES"].append(varGlue("DEFINES","/D ","" " /D ","")); 756 project->variables()["MSVCDSP_DEFINES"].append(varGlue("DEFINES","/D ","" " /D ",""));
733 project->variables()["MSVCDSP_DEFINES"].append(varGlue("PRL_EXPORT_DEFINES","/D ","" " /D ","")); 757 project->variables()["MSVCDSP_DEFINES"].append(varGlue("PRL_EXPORT_DEFINES","/D ","" " /D ",""));
734 758
759 processPrlFiles();
735 QStringList &libs = project->variables()["QMAKE_LIBS"]; 760 QStringList &libs = project->variables()["QMAKE_LIBS"];
736 for(QStringList::Iterator libit = libs.begin(); libit != libs.end(); ++libit) { 761 for(QStringList::Iterator libit = libs.begin(); libit != libs.end(); ++libit) {
737 QString lib = (*libit); 762 QString lib = (*libit);
738 lib.replace(QRegExp("\""), ""); 763 lib.replace(QRegExp("\""), "");
739 project->variables()["MSVCDSP_LIBS"].append(" \"" + lib + "\""); 764 project->variables()["MSVCDSP_LIBS"].append(" \"" + lib + "\"");
740 } 765 }
@@ -751,12 +776,24 @@ DspMakefileGenerator::init()
751 project->variables()["MSVCDSP_RELDEFS"].append("/D \"QT_NO_DEBUG\""); 776 project->variables()["MSVCDSP_RELDEFS"].append("/D \"QT_NO_DEBUG\"");
752 } else { 777 } else {
753 project->variables()["MSVCDSP_RELDEFS"].clear(); 778 project->variables()["MSVCDSP_RELDEFS"].clear();
754 } 779 }
755 780
756 QString dest; 781 QString dest;
782 QString postLinkStep;
783 QString copyDllStep;
784 QString activeQtStepPreCopyDll;
785 QString activeQtStepPostCopyDll;
786 QString activeQtStepPreCopyDllDebug;
787 QString activeQtStepPostCopyDllDebug;
788 QString activeQtStepPreCopyDllRelease;
789 QString activeQtStepPostCopyDllRelease;
790
791 if ( !project->variables()["QMAKE_POST_LINK"].isEmpty() )
792 postLinkStep += var("QMAKE_POST_LINK");
793
757 if ( !project->variables()["DESTDIR"].isEmpty() ) { 794 if ( !project->variables()["DESTDIR"].isEmpty() ) {
758 project->variables()["TARGET"].first().prepend(project->first("DESTDIR")); 795 project->variables()["TARGET"].first().prepend(project->first("DESTDIR"));
759 Option::fixPathToTargetOS(project->first("TARGET")); 796 Option::fixPathToTargetOS(project->first("TARGET"));
760 dest = project->first("TARGET"); 797 dest = project->first("TARGET");
761 if ( project->first("TARGET").startsWith("$(QTDIR)") ) 798 if ( project->first("TARGET").startsWith("$(QTDIR)") )
762 dest.replace( "$(QTDIR)", getenv("QTDIR") ); 799 dest.replace( "$(QTDIR)", getenv("QTDIR") );
@@ -767,73 +804,78 @@ DspMakefileGenerator::init()
767 imp.replace(".dll", ".lib"); 804 imp.replace(".dll", ".lib");
768 project->variables()["MSVCDSP_TARGET"].append(QString(" /implib:\"") + imp + "\""); 805 project->variables()["MSVCDSP_TARGET"].append(QString(" /implib:\"") + imp + "\"");
769 } 806 }
770 } 807 }
771 if ( project->isActiveConfig("dll") && !project->variables()["DLLDESTDIR"].isEmpty() ) { 808 if ( project->isActiveConfig("dll") && !project->variables()["DLLDESTDIR"].isEmpty() ) {
772 QStringList dlldirs = project->variables()["DLLDESTDIR"]; 809 QStringList dlldirs = project->variables()["DLLDESTDIR"];
773 QString copydll = "# Begin Special Build Tool\n" 810 if ( dlldirs.count() )
774 "TargetPath=" + dest + "\n" 811 copyDllStep += "\t";
775 "SOURCE=$(InputPath)\n"
776 "PostBuild_Desc=Copy DLL to " + project->first("DLLDESTDIR") + "\n"
777 "PostBuild_Cmds=";
778
779 for ( QStringList::Iterator dlldir = dlldirs.begin(); dlldir != dlldirs.end(); ++dlldir ) { 812 for ( QStringList::Iterator dlldir = dlldirs.begin(); dlldir != dlldirs.end(); ++dlldir ) {
780 copydll += "copy \"" + dest + "\" \"" + *dlldir + "\"\t"; 813 copyDllStep += "copy \"$(TargetPath)\" \"" + *dlldir + "\"\t";
781 } 814 }
782
783 copydll += "\n# End Special Build Tool";
784 project->variables()["MSVCDSP_COPY_DLL_REL"].append( copydll );
785 project->variables()["MSVCDSP_COPY_DLL_DBG"].append( copydll );
786 } 815 }
816
787 if ( project->isActiveConfig("activeqt") ) { 817 if ( project->isActiveConfig("activeqt") ) {
788 QString idl = project->variables()["QMAKE_IDL"].first(); 818 QString idl = project->variables()["QMAKE_IDL"].first();
789 QString idc = project->variables()["QMAKE_IDC"].first(); 819 QString idc = project->variables()["QMAKE_IDC"].first();
790 QString version = project->variables()["VERSION"].first(); 820 QString version = project->variables()["VERSION"].first();
791 if ( version.isEmpty() ) 821 if ( version.isEmpty() )
792 version = "1.0"; 822 version = "1.0";
793 823
794 project->variables()["MSVCDSP_IDLSOURCES"].append( "tmp\\" + targetfilename + ".idl" ); 824 project->variables()["MSVCDSP_IDLSOURCES"].append( "tmp\\" + targetfilename + ".idl" );
795 project->variables()["MSVCDSP_IDLSOURCES"].append( "tmp\\" + targetfilename + ".tlb" ); 825 project->variables()["MSVCDSP_IDLSOURCES"].append( "tmp\\" + targetfilename + ".tlb" );
796 project->variables()["MSVCDSP_IDLSOURCES"].append( "tmp\\" + targetfilename + ".midl" ); 826 project->variables()["MSVCDSP_IDLSOURCES"].append( "tmp\\" + targetfilename + ".midl" );
797 if ( project->isActiveConfig( "dll" ) ) { 827 if ( project->isActiveConfig( "dll" ) ) {
798 QString regcmd = "# Begin Special Build Tool\n" 828 activeQtStepPreCopyDll +=
799 "TargetPath=" + targetfilename + "\n" 829 "\t" + idc + " %1 -idl tmp\\" + targetfilename + ".idl -version " + version +
800 "SOURCE=$(InputPath)\n"
801 "PostBuild_Desc=Finalizing ActiveQt server...\n"
802 "PostBuild_Cmds=" +
803 idc + " %1 -idl tmp\\" + targetfilename + ".idl -version " + version +
804 "\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" 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"
805 "\t" + idc + " %1 /tlb tmp\\" + targetfilename + ".tlb" 831 "\t" + idc + " %1 /tlb tmp\\" + targetfilename + ".tlb";
806 "\t" + idc + " %1 /regserver\n" 832 activeQtStepPostCopyDll +=
807 "# End Special Build Tool"; 833 "\t" + idc + " %1 /regserver\n";
808 834
809 QString executable = project->variables()["MSVCDSP_TARGETDIRREL"].first() + "\\" + project->variables()["TARGET"].first(); 835 QString executable = project->variables()["MSVCDSP_TARGETDIRREL"].first() + "\\" + targetfilename + ".dll";
810 project->variables()["MSVCDSP_COPY_DLL_REL"].append( regcmd.arg(executable).arg(executable).arg(executable) ); 836 activeQtStepPreCopyDllRelease = activeQtStepPreCopyDll.arg(executable).arg(executable);
837 activeQtStepPostCopyDllRelease = activeQtStepPostCopyDll.arg(executable);
811 838
812 executable = project->variables()["MSVCDSP_TARGETDIRDEB"].first() + "\\" + project->variables()["TARGET"].first(); 839 executable = project->variables()["MSVCDSP_TARGETDIRDEB"].first() + "\\" + targetfilename + ".dll";
813 project->variables()["MSVCDSP_COPY_DLL_DBG"].append( regcmd.arg(executable).arg(executable).arg(executable) ); 840 activeQtStepPreCopyDllDebug = activeQtStepPreCopyDll.arg(executable).arg(executable);
841 activeQtStepPostCopyDllDebug = activeQtStepPostCopyDll.arg(executable);
814 } else { 842 } else {
815 QString regcmd = "# Begin Special Build Tool\n" 843 activeQtStepPreCopyDll +=
816 "TargetPath=" + targetfilename + "\n" 844 "\t%1 -dumpidl tmp\\" + targetfilename + ".idl -version " + version +
817 "SOURCE=$(InputPath)\n"
818 "PostBuild_Desc=Finalizing ActiveQt server...\n"
819 "PostBuild_Cmds="
820 "%1 -dumpidl tmp\\" + targetfilename + ".idl -version " + version +
821 "\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" 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"
822 "\t" + idc + " %1 /tlb tmp\\" + targetfilename + ".tlb" 846 "\t" + idc + " %1 /tlb tmp\\" + targetfilename + ".tlb";
823 "\t%1 -regserver\n" 847 activeQtStepPostCopyDll +=
824 "# End Special Build Tool"; 848 "\t%1 -regserver\n";
825 849 QString executable = project->variables()["MSVCDSP_TARGETDIRREL"].first() + "\\" + targetfilename + ".exe";
826 QString executable = project->variables()["MSVCDSP_TARGETDIRREL"].first() + "\\" + project->variables()["TARGET"].first(); 850 activeQtStepPreCopyDllRelease = activeQtStepPreCopyDll.arg(executable).arg(executable);
827 project->variables()["MSVCDSP_REGSVR_REL"].append( regcmd.arg(executable).arg(executable).arg(executable) ); 851 activeQtStepPostCopyDllRelease = activeQtStepPostCopyDll.arg(executable);
828 852
829 executable = project->variables()["MSVCDSP_TARGETDIRDEB"].first() + "\\" + project->variables()["TARGET"].first(); 853 executable = project->variables()["MSVCDSP_TARGETDIRDEB"].first() + "\\" + targetfilename + ".exe";
830 project->variables()["MSVCDSP_REGSVR_DBG"].append( regcmd.arg(executable).arg(executable).arg(executable) ); 854 activeQtStepPreCopyDllDebug = activeQtStepPreCopyDll.arg(executable).arg(executable);
855 activeQtStepPostCopyDllDebug = activeQtStepPostCopyDll.arg(executable);
831 } 856 }
832 857
833 } 858 }
859
860
861 if ( !postLinkStep.isEmpty() || !copyDllStep.isEmpty() || !activeQtStepPreCopyDllDebug.isEmpty() || !activeQtStepPreCopyDllRelease.isEmpty() ) {
862 project->variables()["MSVCDSP_POST_LINK_DBG"].append(
863 "# Begin Special Build Tool\n"
864 "SOURCE=$(InputPath)\n"
865 "PostBuild_Desc=Post Build Step\n"
866 "PostBuild_Cmds=" + postLinkStep + activeQtStepPreCopyDllDebug + copyDllStep + activeQtStepPostCopyDllDebug + "\n"
867 "# End Special Build Tool\n" );
868 project->variables()["MSVCDSP_POST_LINK_REL"].append(
869 "# Begin Special Build Tool\n"
870 "SOURCE=$(InputPath)\n"
871 "PostBuild_Desc=Post Build Step\n"
872 "PostBuild_Cmds=" + postLinkStep + activeQtStepPreCopyDllRelease + copyDllStep + activeQtStepPostCopyDllRelease + "\n"
873 "# End Special Build Tool\n" );
874 }
875
834 if ( !project->variables()["SOURCES"].isEmpty() || !project->variables()["RC_FILE"].isEmpty() ) { 876 if ( !project->variables()["SOURCES"].isEmpty() || !project->variables()["RC_FILE"].isEmpty() ) {
835 project->variables()["SOURCES"] += project->variables()["RC_FILE"]; 877 project->variables()["SOURCES"] += project->variables()["RC_FILE"];
836 } 878 }
837 QStringList &list = project->variables()["FORMS"]; 879 QStringList &list = project->variables()["FORMS"];
838 for( it = list.begin(); it != list.end(); ++it ) { 880 for( it = list.begin(); it != list.end(); ++it ) {
839 if ( QFile::exists( *it + ".h" ) ) 881 if ( QFile::exists( *it + ".h" ) )
@@ -841,13 +883,13 @@ DspMakefileGenerator::init()
841 } 883 }
842 project->variables()["QMAKE_INTERNAL_PRL_LIBS"] << "MSVCDSP_LIBS"; 884 project->variables()["QMAKE_INTERNAL_PRL_LIBS"] << "MSVCDSP_LIBS";
843} 885}
844 886
845 887
846QString 888QString
847DspMakefileGenerator::findTemplate(QString file) 889DspMakefileGenerator::findTemplate(const QString &file)
848{ 890{
849 QString ret; 891 QString ret;
850 if(!QFile::exists((ret = file)) && 892 if(!QFile::exists((ret = file)) &&
851 !QFile::exists((ret = QString(Option::mkfile::qmakespec + "/" + file))) && 893 !QFile::exists((ret = QString(Option::mkfile::qmakespec + "/" + file))) &&
852 !QFile::exists((ret = QString(getenv("QTDIR")) + "/mkspecs/win32-msvc/" + file)) && 894 !QFile::exists((ret = QString(getenv("QTDIR")) + "/mkspecs/win32-msvc/" + file)) &&
853 !QFile::exists((ret = (QString(getenv("HOME")) + "/.tmake/" + file)))) 895 !QFile::exists((ret = (QString(getenv("HOME")) + "/.tmake/" + file))))
@@ -868,64 +910,65 @@ DspMakefileGenerator::processPrlVariable(const QString &var, const QStringList &
868 } else { 910 } else {
869 MakefileGenerator::processPrlVariable(var, l); 911 MakefileGenerator::processPrlVariable(var, l);
870 } 912 }
871} 913}
872 914
873 915
874int 916void
875DspMakefileGenerator::beginGroupForFile(QString file, QTextStream &t, 917DspMakefileGenerator::beginGroupForFile(QString file, QTextStream &t,
876 QString filter) 918 const QString& filter)
877{ 919{
878 if(project->isActiveConfig("flat")) 920 if(project->isActiveConfig("flat"))
879 return 0; 921 return;
880 922
881 fileFixify(file, QDir::currentDirPath(), QDir::currentDirPath(), TRUE); 923 fileFixify(file, QDir::currentDirPath(), QDir::currentDirPath(), TRUE);
882 file = file.section(Option::dir_sep, 0, -2); 924 file = file.section(Option::dir_sep, 0, -2);
883 if(file.right(Option::dir_sep.length()) != Option::dir_sep) 925 if(file.right(Option::dir_sep.length()) != Option::dir_sep)
884 file += Option::dir_sep; 926 file += Option::dir_sep;
885 if(file == currentGroup) 927 if(file == currentGroup)
886 return 0; 928 return;
887 929
888 if(file.isEmpty() || !QDir::isRelativePath(file)) { 930 if(file.isEmpty() || !QDir::isRelativePath(file)) {
889 endGroups(t); 931 endGroups(t);
890 return 0; 932 return;
891 } 933 }
892 if(file.startsWith(currentGroup)) 934 if(file.startsWith(currentGroup))
893 file = file.mid(currentGroup.length()); 935 file = file.mid(currentGroup.length());
894 else 936 int dirSep = currentGroup.findRev( Option::dir_sep );
895 endGroups(t); 937 while( !file.startsWith( currentGroup ) && dirSep != -1 ) {
896 int lvl = file.contains(Option::dir_sep), old_lvl = currentGroup.contains(Option::dir_sep); 938 currentGroup.truncate( dirSep );
897 if(lvl > old_lvl) { 939 dirSep = currentGroup.findRev( Option::dir_sep );
898 QStringList dirs = QStringList::split(Option::dir_sep, file); 940 if ( !file.startsWith( currentGroup ) && dirSep != -1 )
899 for(QStringList::Iterator dir_it = dirs.begin(); dir_it != dirs.end(); ++dir_it) {
900 t << "# Begin Group \"" << (*dir_it) << "\"\n"
901 << "# Prop Default_Filter \"" << filter << "\"\n";
902 }
903 } else {
904 for(int x = old_lvl - lvl; x; x--)
905 t << "\n# End Group\n"; 941 t << "\n# End Group\n";
906 } 942 }
943 if ( !file.startsWith( currentGroup ) ) {
944 t << "\n# End Group\n";
945 currentGroup = "";
946 }
947 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) {
949 t << "# Begin Group \"" << (*dir_it) << "\"\n"
950 << "# Prop Default_Filter \"" << filter << "\"\n";
951 }
907 currentGroup = file; 952 currentGroup = file;
908 return lvl - old_lvl;
909} 953}
910 954
911 955
912int 956void
913DspMakefileGenerator::endGroups(QTextStream &t) 957DspMakefileGenerator::endGroups(QTextStream &t)
914{ 958{
915 if(project->isActiveConfig("flat")) 959 if(project->isActiveConfig("flat"))
916 return 0; 960 return;
917 else if(currentGroup.isEmpty()) 961 else if(currentGroup.isEmpty())
918 return 0; 962 return;
919 963
920 QStringList dirs = QStringList::split(Option::dir_sep, currentGroup); 964 QStringList dirs = QStringList::split(Option::dir_sep, currentGroup);
921 for(QStringList::Iterator dir_it = dirs.end(); dir_it != dirs.begin(); --dir_it) { 965 for(QStringList::Iterator dir_it = dirs.end(); dir_it != dirs.begin(); --dir_it) {
922 t << "\n# End Group\n"; 966 t << "\n# End Group\n";
923 } 967 }
924 currentGroup = ""; 968 currentGroup = "";
925 return dirs.count();
926} 969}
927 970
928bool 971bool
929DspMakefileGenerator::openOutput(QFile &file) const 972DspMakefileGenerator::openOutput(QFile &file) const
930{ 973{
931 QString outdir; 974 QString outdir;
diff --git a/qmake/generators/win32/msvc_dsp.h b/qmake/generators/win32/msvc_dsp.h
index a7fc3e7..3a7d18e 100644
--- a/qmake/generators/win32/msvc_dsp.h
+++ b/qmake/generators/win32/msvc_dsp.h
@@ -2,13 +2,13 @@
2** $Id$ 2** $Id$
3** 3**
4** Definition of ________ class. 4** Definition of ________ class.
5** 5**
6** Created : 970521 6** Created : 970521
7** 7**
8** Copyright (C) 1992-2000 Trolltech AS. All rights reserved. 8** Copyright (C) 1992-2002 Trolltech AS. All rights reserved.
9** 9**
10** This file is part of the network module of the Qt GUI Toolkit. 10** This file is part of the network module of the Qt GUI Toolkit.
11** 11**
12** This file may be distributed under the terms of the Q Public License 12** 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 13** as defined by Trolltech AS of Norway and appearing in the file
14** LICENSE.QPL included in the packaging of this file. 14** LICENSE.QPL included in the packaging of this file.
@@ -31,29 +31,29 @@
31** See http://www.trolltech.com/gpl/ for GPL licensing information. 31** See http://www.trolltech.com/gpl/ for GPL licensing information.
32** 32**
33** Contact info@trolltech.com if any conditions of this licensing are 33** Contact info@trolltech.com if any conditions of this licensing are
34** not clear to you. 34** not clear to you.
35** 35**
36**********************************************************************/ 36**********************************************************************/
37#ifndef __DSPMAKE_H__ 37#ifndef __MSVC_DSP_H__
38#define __DSPMAKE_H__ 38#define __MSVC_DSP_H__
39 39
40#include "winmakefile.h" 40#include "winmakefile.h"
41#include <qvaluestack.h> 41#include <qvaluestack.h>
42 42
43class DspMakefileGenerator : public Win32MakefileGenerator 43class DspMakefileGenerator : public Win32MakefileGenerator
44{ 44{
45 QString currentGroup; 45 QString currentGroup;
46 int beginGroupForFile(QString file, QTextStream &, const QString filter=""); 46 void beginGroupForFile(QString file, QTextStream &, const QString& filter="");
47 int endGroups(QTextStream &); 47 void endGroups(QTextStream &);
48 48
49 bool init_flag; 49 bool init_flag;
50 bool writeDspParts(QTextStream &); 50 bool writeDspParts(QTextStream &);
51 51
52 bool writeMakefile(QTextStream &); 52 bool writeMakefile(QTextStream &);
53 QString findTemplate(QString file); 53 QString findTemplate(const QString &file);
54 void init(); 54 void init();
55 55
56public: 56public:
57 DspMakefileGenerator(QMakeProject *p); 57 DspMakefileGenerator(QMakeProject *p);
58 ~DspMakefileGenerator(); 58 ~DspMakefileGenerator();
59 59
@@ -67,7 +67,7 @@ protected:
67inline DspMakefileGenerator::~DspMakefileGenerator() 67inline DspMakefileGenerator::~DspMakefileGenerator()
68{ } 68{ }
69 69
70inline bool DspMakefileGenerator::findLibraries() 70inline bool DspMakefileGenerator::findLibraries()
71{ return Win32MakefileGenerator::findLibraries("MSVCDSP_LIBS"); } 71{ return Win32MakefileGenerator::findLibraries("MSVCDSP_LIBS"); }
72 72
73#endif /* __DSPMAKE_H__ */ 73#endif /* __MSVC_DSP_H__ */
diff --git a/qmake/generators/win32/msvc_nmake.cpp b/qmake/generators/win32/msvc_nmake.cpp
index 9cc9a69..ecef34d 100644
--- a/qmake/generators/win32/msvc_nmake.cpp
+++ b/qmake/generators/win32/msvc_nmake.cpp
@@ -2,13 +2,13 @@
2** $Id$ 2** $Id$
3** 3**
4** Definition of ________ class. 4** Definition of ________ class.
5** 5**
6** Created : 970521 6** Created : 970521
7** 7**
8** Copyright (C) 1992-2000 Trolltech AS. All rights reserved. 8** Copyright (C) 1992-2002 Trolltech AS. All rights reserved.
9** 9**
10** This file is part of the network module of the Qt GUI Toolkit. 10** This file is part of the network module of the Qt GUI Toolkit.
11** 11**
12** This file may be distributed under the terms of the Q Public License 12** 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 13** as defined by Trolltech AS of Norway and appearing in the file
14** LICENSE.QPL included in the packaging of this file. 14** LICENSE.QPL included in the packaging of this file.
@@ -35,12 +35,13 @@
35** 35**
36**********************************************************************/ 36**********************************************************************/
37 37
38#include "msvc_nmake.h" 38#include "msvc_nmake.h"
39#include "option.h" 39#include "option.h"
40#include <qregexp.h> 40#include <qregexp.h>
41#include <qdict.h>
41#include <qdir.h> 42#include <qdir.h>
42#include <stdlib.h> 43#include <stdlib.h>
43#include <time.h> 44#include <time.h>
44 45
45 46
46NmakeMakefileGenerator::NmakeMakefileGenerator(QMakeProject *p) : Win32MakefileGenerator(p), init_flag(FALSE) 47NmakeMakefileGenerator::NmakeMakefileGenerator(QMakeProject *p) : Win32MakefileGenerator(p), init_flag(FALSE)
@@ -132,12 +133,14 @@ NmakeMakefileGenerator::writeNmakeParts(QTextStream &t)
132 t << "ZIP =" << var("QMAKE_ZIP") << endl; 133 t << "ZIP =" << var("QMAKE_ZIP") << endl;
133 t << "COPY_FILE= " << var("QMAKE_COPY") << endl; 134 t << "COPY_FILE= " << var("QMAKE_COPY") << endl;
134 t << "COPY_DIR= " << var("QMAKE_COPY") << endl; 135 t << "COPY_DIR= " << var("QMAKE_COPY") << endl;
135 t << "DEL_FILE= " << var("QMAKE_DEL_FILE") << endl; 136 t << "DEL_FILE= " << var("QMAKE_DEL_FILE") << endl;
136 t << "DEL_DIR= " << var("QMAKE_DEL_DIR") << endl; 137 t << "DEL_DIR= " << var("QMAKE_DEL_DIR") << endl;
137 t << "MOVE = " << var("QMAKE_MOVE") << endl; 138 t << "MOVE = " << var("QMAKE_MOVE") << endl;
139 t << "CHK_DIR_EXISTS =" << var("QMAKE_CHK_DIR_EXISTS") << endl;
140 t << "MKDIR =" << var("QMAKE_MKDIR") << endl;
138 t << endl; 141 t << endl;
139 142
140 t << "####### Files" << endl << endl; 143 t << "####### Files" << endl << endl;
141 t << "HEADERS =" << varList("HEADERS") << endl; 144 t << "HEADERS =" << varList("HEADERS") << endl;
142 t << "SOURCES =" << varList("SOURCES") << endl; 145 t << "SOURCES =" << varList("SOURCES") << endl;
143 t << "OBJECTS =" << varList("OBJECTS") << endl; 146 t << "OBJECTS =" << varList("OBJECTS") << endl;
@@ -153,29 +156,72 @@ NmakeMakefileGenerator::writeNmakeParts(QTextStream &t)
153 else 156 else
154 t << project->variables()[ "TARGET" ].first() << project->variables()[ "TARGET_EXT" ].first(); 157 t << project->variables()[ "TARGET" ].first() << project->variables()[ "TARGET_EXT" ].first();
155 t << endl; 158 t << endl;
156 t << endl; 159 t << endl;
157 160
158 t << "####### Implicit rules" << endl << endl; 161 t << "####### Implicit rules" << endl << endl;
159 t << ".SUFFIXES: .cpp .cxx .cc .c" << endl << endl; 162 t << ".SUFFIXES: .c";
160 t << ".cpp.obj:\n\t" << var("QMAKE_RUN_CXX_IMP") << endl << endl; 163 QStringList::Iterator cppit;
161 t << ".cxx.obj:\n\t" << var("QMAKE_RUN_CXX_IMP") << endl << endl; 164 for(cppit = Option::cpp_ext.begin(); cppit != Option::cpp_ext.end(); ++cppit)
162 t << ".cc.obj:\n\t" << var("QMAKE_RUN_CXX_IMP") << endl << endl; 165 t << " " << (*cppit);
163 t << ".c.obj:\n\t" << var("QMAKE_RUN_CC_IMP") << endl << endl; 166 t << endl << endl;
167 if(!project->isActiveConfig("no_batch")) {
168 // Batchmode doesn't use the non implicit rules QMAKE_RUN_CXX & QMAKE_RUN_CC
169 project->variables().remove("QMAKE_RUN_CXX");
170 project->variables().remove("QMAKE_RUN_CC");
171
172 QDict<void> source_directories;
173 source_directories.insert(".", (void*)1);
174 if(!project->isEmpty("MOC_DIR"))
175 source_directories.insert(project->first("MOC_DIR"), (void*)1);
176 if(!project->isEmpty("UI_SOURCES_DIR"))
177 source_directories.insert(project->first("UI_SOURCES_DIR"), (void*)1);
178 else if(!project->isEmpty("UI_DIR"))
179 source_directories.insert(project->first("UI_DIR"), (void*)1);
180 QString srcs[] = { QString("SOURCES"), QString("UICIMPLS"), QString("SRCMOC"), QString::null };
181 for(int x = 0; !srcs[x].isNull(); x++) {
182 QStringList &l = project->variables()[srcs[x]];
183 for(QStringList::Iterator sit = l.begin(); sit != l.end(); ++sit) {
184 QString sep = "\\";
185 if((*sit).find(sep) == -1)
186 sep = "/";
187 QString dir = (*sit).section(sep, 0, -2);
188 if(!dir.isEmpty() && !source_directories[dir])
189 source_directories.insert(dir, (void*)1);
190 }
191 }
192
193 for(QDictIterator<void> it(source_directories); it.current(); ++it) {
194 if(it.currentKey().isEmpty())
195 continue;
196 for(cppit = Option::cpp_ext.begin(); cppit != Option::cpp_ext.end(); ++cppit)
197 t << "{" << it.currentKey() << "}" << (*cppit) << "{" << var("OBJECTS_DIR") << "}" << Option::obj_ext << "::\n\t"
198 << var("QMAKE_RUN_CXX_IMP_BATCH").replace( QRegExp( "\\$@" ), var("OBJECTS_DIR") ) << endl << "\t$<" << endl << "<<" << endl << endl;
199 t << "{" << it.currentKey() << "}" << ".c{" << var("OBJECTS_DIR") << "}" << Option::obj_ext << "::\n\t"
200 << var("QMAKE_RUN_CC_IMP_BATCH").replace( QRegExp( "\\$@" ), var("OBJECTS_DIR") ) << endl << "\t$<" << endl << "<<" << endl << endl;
201 }
202 } else {
203 for(cppit = Option::cpp_ext.begin(); cppit != Option::cpp_ext.end(); ++cppit)
204 t << (*cppit) << Option::obj_ext << ":\n\t" << var("QMAKE_RUN_CXX_IMP") << endl << endl;
205 t << ".c" << Option::obj_ext << ":\n\t" << var("QMAKE_RUN_CC_IMP") << endl << endl;
206 }
164 207
165 t << "####### Build rules" << endl << endl; 208 t << "####### Build rules" << endl << endl;
166 t << "all: " << varGlue("ALL_DEPS",""," "," ") << "$(TARGET)" << endl << endl; 209 t << "all: " << varGlue("ALL_DEPS",""," "," ") << "$(TARGET)" << endl << endl;
167 t << "$(TARGET): $(UICDECLS) $(OBJECTS) $(OBJMOC) " << var("TARGETDEPS"); 210 t << "$(TARGET): " << var("PRE_TARGETDEPS") << " $(UICDECLS) $(OBJECTS) $(OBJMOC) "
211 << var("POST_TARGETDEPS");
168 if(!project->variables()["QMAKE_APP_OR_DLL"].isEmpty()) { 212 if(!project->variables()["QMAKE_APP_OR_DLL"].isEmpty()) {
169 t << "\n\t" << "$(LINK) $(LFLAGS) /OUT:$(TARGET) @<< " << "\n\t " 213 t << "\n\t" << "$(LINK) $(LFLAGS) /OUT:$(TARGET) @<< " << "\n\t "
170 << "$(OBJECTS) $(OBJMOC) $(LIBS)"; 214 << "$(OBJECTS) $(OBJMOC) $(LIBS)";
171 } else { 215 } else {
172 t << "\n\t" << "$(LIB) /OUT:$(TARGET) @<<" << "\n\t " 216 t << "\n\t" << "$(LIB) /OUT:$(TARGET) @<<" << "\n\t "
173 << "$(OBJECTS) $(OBJMOC)"; 217 << "$(OBJECTS) $(OBJMOC)";
174 } 218 }
175 t << endl << "<<" << endl; 219 t << endl << "<<" << endl;
220 if ( !project->variables()["QMAKE_POST_LINK"].isEmpty() )
221 t << "\t" << var( "QMAKE_POST_LINK" ) << endl;
176 if(project->isActiveConfig("dll") && !project->variables()["DLLDESTDIR"].isEmpty()) { 222 if(project->isActiveConfig("dll") && !project->variables()["DLLDESTDIR"].isEmpty()) {
177 QStringList dlldirs = project->variables()["DLLDESTDIR"]; 223 QStringList dlldirs = project->variables()["DLLDESTDIR"];
178 for ( QStringList::Iterator dlldir = dlldirs.begin(); dlldir != dlldirs.end(); ++dlldir ) { 224 for ( QStringList::Iterator dlldir = dlldirs.begin(); dlldir != dlldirs.end(); ++dlldir ) {
179 t << "\n\t" << "-copy $(TARGET) " << *dlldir; 225 t << "\n\t" << "-copy $(TARGET) " << *dlldir;
180 } 226 }
181 } 227 }
@@ -217,12 +263,13 @@ NmakeMakefileGenerator::writeNmakeParts(QTextStream &t)
217 << varGlue("SRCMOC" ,"\n\t-del ","\n\t-del ","") 263 << varGlue("SRCMOC" ,"\n\t-del ","\n\t-del ","")
218 << varGlue("OBJMOC" ,"\n\t-del ","\n\t-del ","") 264 << varGlue("OBJMOC" ,"\n\t-del ","\n\t-del ","")
219 << varGlue("UICDECLS" ,"\n\t-del ","\n\t-del ","") 265 << varGlue("UICDECLS" ,"\n\t-del ","\n\t-del ","")
220 << varGlue("UICIMPLS" ,"\n\t-del ","\n\t-del ","") 266 << varGlue("UICIMPLS" ,"\n\t-del ","\n\t-del ","")
221 << varGlue("QMAKE_CLEAN","\n\t-del ","\n\t-del ","") 267 << varGlue("QMAKE_CLEAN","\n\t-del ","\n\t-del ","")
222 << varGlue("CLEAN_FILES","\n\t-del ","\n\t-del ",""); 268 << varGlue("CLEAN_FILES","\n\t-del ","\n\t-del ","");
269
223 if ( project->isActiveConfig("activeqt")) { 270 if ( project->isActiveConfig("activeqt")) {
224 t << ("\n\t-del tmp\\" + targetfilename + ".*"); 271 t << ("\n\t-del tmp\\" + targetfilename + ".*");
225 t << "\n\t-del tmp\\dump.*"; 272 t << "\n\t-del tmp\\dump.*";
226 } 273 }
227 if(!project->isEmpty("IMAGES")) 274 if(!project->isEmpty("IMAGES"))
228 t << varGlue("QMAKE_IMAGE_COLLECTION", "\n\t-del ", "\n\t-del ", ""); 275 t << varGlue("QMAKE_IMAGE_COLLECTION", "\n\t-del ", "\n\t-del ", "");
@@ -243,12 +290,16 @@ NmakeMakefileGenerator::writeNmakeParts(QTextStream &t)
243 } 290 }
244 t << "\n\n" << targ << ":" << deps << "\n\t" 291 t << "\n\n" << targ << ":" << deps << "\n\t"
245 << cmd; 292 << cmd;
246 } 293 }
247 294
248 t << endl << endl; 295 t << endl << endl;
296
297 t << "distclean: clean"
298 << "\n\t-del $(TARGET)"
299 << endl << endl;
249} 300}
250 301
251 302
252void 303void
253NmakeMakefileGenerator::init() 304NmakeMakefileGenerator::init()
254{ 305{
@@ -428,12 +479,34 @@ NmakeMakefileGenerator::init()
428 } else { 479 } else {
429 project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_CONSOLE_ANY"]; 480 project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_CONSOLE_ANY"];
430 project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_CONSOLE_ANY"]; 481 project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_CONSOLE_ANY"];
431 project->variables()["QMAKE_LFLAGS"] += project->variables()["QMAKE_LFLAGS_CONSOLE_ANY"]; 482 project->variables()["QMAKE_LFLAGS"] += project->variables()["QMAKE_LFLAGS_CONSOLE_ANY"];
432 project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_CONSOLE"]; 483 project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_CONSOLE"];
433 } 484 }
485 if ( project->isActiveConfig("stl") ) {
486 project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_STL_ON"];
487 project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_STL_ON"];
488 } else {
489 project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_STL_OFF"];
490 project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_STL_OFF"];
491 }
492 if ( project->isActiveConfig("exceptions") ) {
493 project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_EXCEPTIONS_ON"];
494 project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_EXCEPTIONS_ON"];
495 } else {
496 project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_EXCEPTIONS_OFF"];
497 project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_EXCEPTIONS_OFF"];
498 }
499 if ( project->isActiveConfig("rtti") ) {
500 project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_RTTI_ON"];
501 project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_RTTI_ON"];
502 } else {
503 project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_RTTI_OFF"];
504 project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_RTTI_OFF"];
505 }
506
434 507
435 if ( project->isActiveConfig("moc") ) 508 if ( project->isActiveConfig("moc") )
436 setMocAware(TRUE); 509 setMocAware(TRUE);
437 project->variables()["QMAKE_LIBS"] += project->variables()["LIBS"]; 510 project->variables()["QMAKE_LIBS"] += project->variables()["LIBS"];
438 project->variables()["QMAKE_FILETAGS"] += QStringList::split(' ', 511 project->variables()["QMAKE_FILETAGS"] += QStringList::split(' ',
439 "HEADERS SOURCES DEF_FILE RC_FILE TARGET QMAKE_LIBS DESTDIR DLLDESTDIR INCLUDEPATH"); 512 "HEADERS SOURCES DEF_FILE RC_FILE TARGET QMAKE_LIBS DESTDIR DLLDESTDIR INCLUDEPATH");
@@ -462,27 +535,28 @@ NmakeMakefileGenerator::init()
462 fprintf(stderr, "Both .rc and .res file specified.\n"); 535 fprintf(stderr, "Both .rc and .res file specified.\n");
463 fprintf(stderr, "Please specify one of them, not both."); 536 fprintf(stderr, "Please specify one of them, not both.");
464 exit(666); 537 exit(666);
465 } 538 }
466 project->variables()["RES_FILE"] = project->variables()["RC_FILE"]; 539 project->variables()["RES_FILE"] = project->variables()["RC_FILE"];
467 project->variables()["RES_FILE"].first().replace(".rc",".res"); 540 project->variables()["RES_FILE"].first().replace(".rc",".res");
468 project->variables()["TARGETDEPS"] += project->variables()["RES_FILE"]; 541 project->variables()["POST_TARGETDEPS"] += project->variables()["RES_FILE"];
469 } 542 }
470 if ( !project->variables()["RES_FILE"].isEmpty()) 543 if ( !project->variables()["RES_FILE"].isEmpty())
471 project->variables()["QMAKE_LIBS"] += project->variables()["RES_FILE"]; 544 project->variables()["QMAKE_LIBS"] += project->variables()["RES_FILE"];
472 545
473 MakefileGenerator::init(); 546 MakefileGenerator::init();
474 if ( !project->variables()["VERSION"].isEmpty()) { 547 if ( !project->variables()["VERSION"].isEmpty()) {
475 QStringList l = QStringList::split('.', project->first("VERSION")); 548 QStringList l = QStringList::split('.', project->first("VERSION"));
476 project->variables()["VER_MAJ"].append(l[0]); 549 project->variables()["VER_MAJ"].append(l[0]);
477 project->variables()["VER_MIN"].append(l[1]); 550 project->variables()["VER_MIN"].append(l[1]);
478 } 551 }
552
553 QString version = QStringList::split('.', project->first("VERSION")).join("");
479 if(project->isActiveConfig("dll")) { 554 if(project->isActiveConfig("dll")) {
480 project->variables()["QMAKE_CLEAN"].append(project->first("DESTDIR") + project->first("TARGET") + ".lib"); 555 project->variables()["QMAKE_CLEAN"].append(project->first("DESTDIR") + project->first("TARGET") + version + ".exp");
481 project->variables()["QMAKE_CLEAN"].append(project->first("DESTDIR") + project->first("TARGET") + ".exp");
482 } 556 }
483 if(project->isActiveConfig("debug")) { 557 if(project->isActiveConfig("debug")) {
484 project->variables()["QMAKE_CLEAN"].append(project->first("DESTDIR") + project->first("TARGET") + ".pdb"); 558 project->variables()["QMAKE_CLEAN"].append(project->first("DESTDIR") + project->first("TARGET") + version + ".pdb");
485 project->variables()["QMAKE_CLEAN"].append(project->first("DESTDIR") + project->first("TARGET") + ".ilk"); 559 project->variables()["QMAKE_CLEAN"].append(project->first("DESTDIR") + project->first("TARGET") + version + ".ilk");
486 project->variables()["QMAKE_CLEAN"].append("vc*.pdb"); 560 project->variables()["QMAKE_CLEAN"].append("vc*.pdb");
487 } 561 }
488} 562}
diff --git a/qmake/generators/win32/msvc_nmake.h b/qmake/generators/win32/msvc_nmake.h
index d3e170f..579fc35 100644
--- a/qmake/generators/win32/msvc_nmake.h
+++ b/qmake/generators/win32/msvc_nmake.h
@@ -2,13 +2,13 @@
2** $Id$ 2** $Id$
3** 3**
4** Definition of ________ class. 4** Definition of ________ class.
5** 5**
6** Created : 970521 6** Created : 970521
7** 7**
8** Copyright (C) 1992-2000 Trolltech AS. All rights reserved. 8** Copyright (C) 1992-2002 Trolltech AS. All rights reserved.
9** 9**
10** This file is part of the network module of the Qt GUI Toolkit. 10** This file is part of the network module of the Qt GUI Toolkit.
11** 11**
12** This file may be distributed under the terms of the Q Public License 12** 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 13** as defined by Trolltech AS of Norway and appearing in the file
14** LICENSE.QPL included in the packaging of this file. 14** LICENSE.QPL included in the packaging of this file.
@@ -31,14 +31,14 @@
31** See http://www.trolltech.com/gpl/ for GPL licensing information. 31** See http://www.trolltech.com/gpl/ for GPL licensing information.
32** 32**
33** Contact info@trolltech.com if any conditions of this licensing are 33** Contact info@trolltech.com if any conditions of this licensing are
34** not clear to you. 34** not clear to you.
35** 35**
36**********************************************************************/ 36**********************************************************************/
37#ifndef __NMAKEMAKE_H__ 37#ifndef __MSVC_NMAKE_H__
38#define __NMAKEMAKE_H__ 38#define __MSVC_NMAKE_H__
39 39
40#include "winmakefile.h" 40#include "winmakefile.h"
41 41
42class NmakeMakefileGenerator : public Win32MakefileGenerator 42class NmakeMakefileGenerator : public Win32MakefileGenerator
43{ 43{
44 bool init_flag; 44 bool init_flag;
@@ -53,7 +53,7 @@ public:
53 53
54}; 54};
55 55
56inline NmakeMakefileGenerator::~NmakeMakefileGenerator() 56inline NmakeMakefileGenerator::~NmakeMakefileGenerator()
57{ } 57{ }
58 58
59#endif /* __NMAKEMAKE_H__ */ 59#endif /* __MSVC_NMAKE_H__ */
diff --git a/qmake/generators/win32/msvc_objectmodel.cpp b/qmake/generators/win32/msvc_objectmodel.cpp
index c2b9e30..7ffe4f7 100644
--- a/qmake/generators/win32/msvc_objectmodel.cpp
+++ b/qmake/generators/win32/msvc_objectmodel.cpp
@@ -251,33 +251,33 @@ const char* _WarnLevel = "\n\t\t\t\tWarnLevel=\"";
251 const char* _WarningLevel = "\n\t\t\t\tWarningLevel=\""; 251 const char* _WarningLevel = "\n\t\t\t\tWarningLevel=\"";
252 const char* _WholeProgramOptimization = "\n\t\t\t\tWholeProgramOptimization=\""; 252 const char* _WholeProgramOptimization = "\n\t\t\t\tWholeProgramOptimization=\"";
253 253
254// Property name and value as Pairs --------------------------------- 254// Property name and value as Pairs ---------------------------------
255struct TPair { 255struct TPair {
256 TPair( const char* n, const triState v ) : name(n), value(v) {}; 256 TPair( const char* n, const triState v ) : name(n), value(v) {};
257 const char* name; 257 const char* name;
258 const triState value; 258 const triState value;
259}; 259};
260struct EPair { 260struct EPair {
261 EPair( const char* n, const int v ) : name(n), value(v) {}; 261 EPair( const char* n, const int v ) : name(n), value(v) {};
262 const char* name; 262 const char* name;
263 const int value; 263 const int value;
264}; 264};
265struct LPair { 265struct LPair {
266 LPair( const char* n, const long v ) : name(n), value(v) {}; 266 LPair( const char* n, const long v ) : name(n), value(v) {};
267 const char* name; 267 const char* name;
268 const long value; 268 const long value;
269}; 269};
270struct SPair { 270struct SPair {
271 SPair( const char* n, const QString& v ) : name(n), value(v) {}; 271 SPair( const char* n, const QString& v ) : name(n), value(v) {};
272 const char* name; 272 const char* name;
273 const QString& value; 273 const QString& value;
274}; 274};
275struct XPair { 275struct XPair {
276 XPair( const char* n, const QStringList& v, const char* s = "," ) : name(n), value(v), sep(s) {}; 276 XPair( const char* n, const QStringList& v, const char* s = "," ) : name(n), value(v), sep(s) {};
277 const char* name; 277 const char* name;
278 const QStringList& value; 278 const QStringList& value;
279 const char* sep; 279 const char* sep;
280}; 280};
281 281
282// void streamSPair( QTextStream &strm, const char *n, const QString &s ) 282// void streamSPair( QTextStream &strm, const char *n, const QString &s )
283 283
@@ -380,13 +380,13 @@ VCCLCompilerTool::VCCLCompilerTool()
380 380
381QTextStream &operator<<( QTextStream &strm, const VCCLCompilerTool &tool ) 381QTextStream &operator<<( QTextStream &strm, const VCCLCompilerTool &tool )
382{ 382{
383 strm << _begTool3; 383 strm << _begTool3;
384 strm << _VCCLCompilerToolName; 384 strm << _VCCLCompilerToolName;
385 strm << XPair( _AdditionalIncludeDirectories, tool.AdditionalIncludeDirectories ); 385 strm << XPair( _AdditionalIncludeDirectories, tool.AdditionalIncludeDirectories );
386 strm << XPair( _AdditionalOptions, tool.AdditionalOptions ); 386 strm << XPair( _AdditionalOptions, tool.AdditionalOptions, " " );
387 strm << XPair( _AdditionalUsingDirectories, tool.AdditionalUsingDirectories ); 387 strm << XPair( _AdditionalUsingDirectories, tool.AdditionalUsingDirectories );
388 strm << SPair( _AssemblerListingLocation, tool.AssemblerListingLocation ); 388 strm << SPair( _AssemblerListingLocation, tool.AssemblerListingLocation );
389 if ( tool.AssemblerOutput != asmListingNone ) strm << EPair( _AssemblerOutput, tool.AssemblerOutput ); 389 if ( tool.AssemblerOutput != asmListingNone ) strm << EPair( _AssemblerOutput, tool.AssemblerOutput );
390 if ( tool.BasicRuntimeChecks != runtimeBasicCheckNone ) strm << EPair( _BasicRuntimeChecks, tool.BasicRuntimeChecks ); 390 if ( tool.BasicRuntimeChecks != runtimeBasicCheckNone ) strm << EPair( _BasicRuntimeChecks, tool.BasicRuntimeChecks );
391 if ( tool.BrowseInformation != brInfoNone ) strm << EPair( _BrowseInformation, tool.BrowseInformation ); 391 if ( tool.BrowseInformation != brInfoNone ) strm << EPair( _BrowseInformation, tool.BrowseInformation );
392 strm << SPair( _BrowseInformationFile, tool.BrowseInformationFile ); 392 strm << SPair( _BrowseInformationFile, tool.BrowseInformationFile );
@@ -439,40 +439,44 @@ QTextStream &operator<<( QTextStream &strm, const VCCLCompilerTool &tool )
439 strm << XPair( _UndefinePreprocessorDefinitions, tool.UndefinePreprocessorDefinitions ); 439 strm << XPair( _UndefinePreprocessorDefinitions, tool.UndefinePreprocessorDefinitions );
440 if ( !tool.PrecompiledHeaderFile.isEmpty() || 440 if ( !tool.PrecompiledHeaderFile.isEmpty() ||
441 !tool.PrecompiledHeaderThrough.isEmpty() ) 441 !tool.PrecompiledHeaderThrough.isEmpty() )
442 strm << EPair( _UsePrecompiledHeader, tool.UsePrecompiledHeader ); 442 strm << EPair( _UsePrecompiledHeader, tool.UsePrecompiledHeader );
443 strm << TPair( _WarnAsError, tool.WarnAsError ); 443 strm << TPair( _WarnAsError, tool.WarnAsError );
444 strm << EPair( _WarningLevel, tool.WarningLevel ); 444 strm << EPair( _WarningLevel, tool.WarningLevel );
445 strm << TPair( _WholeProgramOptimization, tool.WholeProgramOptimization ); 445 strm << TPair( _WholeProgramOptimization, tool.WholeProgramOptimization );
446 strm << "/>"; 446 strm << "/>";
447return strm; 447return strm;
448} 448}
449 449
450bool VCCLCompilerTool::parseOption( const char* option ) 450bool VCCLCompilerTool::parseOption( const char* option )
451{ 451{
452 // skip index 0 ('/' or '-') 452 // skip index 0 ('/' or '-')
453 char first = option[1]; 453 char first = option[1];
454 char second = option[2]; 454 char second = option[2];
455 char third = option[3]; 455 char third = option[3];
456 char fourth = option[4]; 456 char fourth = option[4];
457 bool found = TRUE;
457 458
458 switch ( first ) { 459 switch ( first ) {
459 case '?': 460 case '?':
460 case 'h': 461 case 'h':
461 qWarning( "Generator: Option '/?', '/help': MSVC.NET projects do not support outputting help info" ); 462 qWarning( "Generator: Option '/?', '/help': MSVC.NET projects do not support outputting help info" );
462 return FALSE; 463 found = FALSE;
464 break;
463 case '@': 465 case '@':
464 qWarning( "Generator: Option '/@': MSVC.NET projects do not support the use of a response file" ); 466 qWarning( "Generator: Option '/@': MSVC.NET projects do not support the use of a response file" );
465 return FALSE; 467 found = FALSE;
468 break;
466 case 'l': 469 case 'l':
467 qWarning( "Generator: Option '/link': qmake generator does not support passing link options through the compiler tool" ); 470 qWarning( "Generator: Option '/link': qmake generator does not support passing link options through the compiler tool" );
468 return FALSE; 471 found = FALSE;
469 472 break;
470 case 'A': 473 case 'A':
471 if ( second != 'I' ) 474 if ( second != 'I' ) {
472 return FALSE; 475 found = FALSE; break;
476 }
473 AdditionalUsingDirectories += option+2; 477 AdditionalUsingDirectories += option+2;
474 break; 478 break;
475 case 'C': 479 case 'C':
476 KeepComments = _True; 480 KeepComments = _True;
477 break; 481 break;
478 case 'D': 482 case 'D':
@@ -484,13 +488,13 @@ bool VCCLCompilerTool::parseOption( const char* option )
484 // ExceptionHandling must be false, or it will override 488 // ExceptionHandling must be false, or it will override
485 // with an /EHsc option 489 // with an /EHsc option
486 ExceptionHandling = _False; 490 ExceptionHandling = _False;
487 AdditionalOptions += option; 491 AdditionalOptions += option;
488 break; 492 break;
489 } 493 }
490 return FALSE; 494 found = FALSE; break;
491 } 495 }
492 GeneratePreprocessedFile = preprocessYes; 496 GeneratePreprocessedFile = preprocessYes;
493 break; 497 break;
494 case 'F': 498 case 'F':
495 if ( second <= '9' && second >= '0' ) { 499 if ( second <= '9' && second >= '0' ) {
496 AdditionalOptions += option; 500 AdditionalOptions += option;
@@ -541,22 +545,22 @@ bool VCCLCompilerTool::parseOption( const char* option )
541 PrecompiledHeaderFile = option+3; 545 PrecompiledHeaderFile = option+3;
542 break; 546 break;
543 case 'x': 547 case 'x':
544 ExpandAttributedSource = _True; 548 ExpandAttributedSource = _True;
545 break; 549 break;
546 default: 550 default:
547 return FALSE; 551 found = FALSE; break;
548 } 552 }
549 } 553 }
550 break; 554 break;
551 case 'G': 555 case 'G':
552 switch ( second ) { 556 switch ( second ) {
553 case '3': 557 case '3':
554 case '4': 558 case '4':
555 qWarning( "Option '/G3' and '/G4' were phased out in Visual C++ 5.0" ); 559 qWarning( "Option '/G3' and '/G4' were phased out in Visual C++ 5.0" );
556 return FALSE; 560 found = FALSE; break;
557 case '5': 561 case '5':
558 OptimizeForProcessor = procOptimizePentium; 562 OptimizeForProcessor = procOptimizePentium;
559 break; 563 break;
560 case '6': 564 case '6':
561 case 'B': 565 case 'B':
562 OptimizeForProcessor = procOptimizePentiumProAndAbove; 566 OptimizeForProcessor = procOptimizePentiumProAndAbove;
@@ -616,13 +620,13 @@ bool VCCLCompilerTool::parseOption( const char* option )
616 EnableFunctionLevelLinking = _True; 620 EnableFunctionLevelLinking = _True;
617 break; 621 break;
618 case 'z': 622 case 'z':
619 CallingConvention = callConventionStdCall; 623 CallingConvention = callConventionStdCall;
620 break; 624 break;
621 default: 625 default:
622 return FALSE; 626 found = FALSE; break;
623 } 627 }
624 break; 628 break;
625 case 'H': 629 case 'H':
626 AdditionalOptions += option; 630 AdditionalOptions += option;
627 break; 631 break;
628 case 'I': 632 case 'I':
@@ -630,13 +634,13 @@ bool VCCLCompilerTool::parseOption( const char* option )
630 break; 634 break;
631 case 'L': 635 case 'L':
632 if ( second == 'D' ) { 636 if ( second == 'D' ) {
633 AdditionalOptions += option; 637 AdditionalOptions += option;
634 break; 638 break;
635 } 639 }
636 return FALSE; 640 found = FALSE; break;
637 case 'M': 641 case 'M':
638 if ( second == 'D' ) { 642 if ( second == 'D' ) {
639 RuntimeLibrary = rtMultiThreadedDLL; 643 RuntimeLibrary = rtMultiThreadedDLL;
640 if ( third == 'd' ) 644 if ( third == 'd' )
641 RuntimeLibrary = rtMultiThreadedDebugDLL; 645 RuntimeLibrary = rtMultiThreadedDebugDLL;
642 break; 646 break;
@@ -648,13 +652,13 @@ bool VCCLCompilerTool::parseOption( const char* option )
648 } else if ( second == 'T' ) { 652 } else if ( second == 'T' ) {
649 RuntimeLibrary = rtMultiThreaded; 653 RuntimeLibrary = rtMultiThreaded;
650 if ( third == 'd' ) 654 if ( third == 'd' )
651 RuntimeLibrary = rtMultiThreadedDebug; 655 RuntimeLibrary = rtMultiThreadedDebug;
652 break; 656 break;
653 } 657 }
654 return FALSE; 658 found = FALSE; break;
655 case 'O': 659 case 'O':
656 switch ( second ) { 660 switch ( second ) {
657 case '1': 661 case '1':
658 Optimization = optimizeMinSpace; 662 Optimization = optimizeMinSpace;
659 break; 663 break;
660 case '2': 664 case '2':
@@ -668,13 +672,13 @@ bool VCCLCompilerTool::parseOption( const char* option )
668 InlineFunctionExpansion = expandDisable; 672 InlineFunctionExpansion = expandDisable;
669 else if ( third == '1' ) 673 else if ( third == '1' )
670 InlineFunctionExpansion = expandOnlyInline; 674 InlineFunctionExpansion = expandOnlyInline;
671 else if ( third == '2' ) 675 else if ( third == '2' )
672 InlineFunctionExpansion = expandAnySuitable; 676 InlineFunctionExpansion = expandAnySuitable;
673 else 677 else
674 return FALSE; 678 found = FALSE;
675 break; 679 break;
676 case 'd': 680 case 'd':
677 Optimization = optimizeDisabled; 681 Optimization = optimizeDisabled;
678 break; 682 break;
679 case 'g': 683 case 'g':
680 GlobalOptimizations = _True; 684 GlobalOptimizations = _True;
@@ -702,46 +706,46 @@ bool VCCLCompilerTool::parseOption( const char* option )
702 case 'y': 706 case 'y':
703 OmitFramePointers = _True; 707 OmitFramePointers = _True;
704 if ( third == '-' ) 708 if ( third == '-' )
705 OmitFramePointers = _False; 709 OmitFramePointers = _False;
706 break; 710 break;
707 default: 711 default:
708 return FALSE; 712 found = FALSE; break;
709 } 713 }
710 break; 714 break;
711 case 'P': 715 case 'P':
712 GeneratePreprocessedFile = preprocessYes; 716 GeneratePreprocessedFile = preprocessYes;
713 break; 717 break;
714 case 'Q': 718 case 'Q':
715 if ( second == 'I' ) { 719 if ( second == 'I' ) {
716 AdditionalOptions += option; 720 AdditionalOptions += option;
717 break; 721 break;
718 } 722 }
719 return FALSE; 723 found = FALSE; break;
720 case 'R': 724 case 'R':
721 if ( second == 'T' && third == 'C' ) { 725 if ( second == 'T' && third == 'C' ) {
722 if ( fourth == '1' ) 726 if ( fourth == '1' )
723 BasicRuntimeChecks = runtimeBasicCheckAll; 727 BasicRuntimeChecks = runtimeBasicCheckAll;
724 else if ( fourth == 'c' ) 728 else if ( fourth == 'c' )
725 SmallerTypeCheck = _True; 729 SmallerTypeCheck = _True;
726 else if ( fourth == 's' ) 730 else if ( fourth == 's' )
727 BasicRuntimeChecks = runtimeCheckStackFrame; 731 BasicRuntimeChecks = runtimeCheckStackFrame;
728 else if ( fourth == 'u' ) 732 else if ( fourth == 'u' )
729 BasicRuntimeChecks = runtimeCheckUninitVariables; 733 BasicRuntimeChecks = runtimeCheckUninitVariables;
730 else 734 else
731 return FALSE; 735 found = FALSE; break;
732 } 736 }
733 break; 737 break;
734 case 'T': 738 case 'T':
735 if ( second == 'C' ) { 739 if ( second == 'C' ) {
736 CompileAs = compileAsC; 740 CompileAs = compileAsC;
737 } else if ( second == 'P' ) { 741 } else if ( second == 'P' ) {
738 CompileAs = compileAsCPlusPlus; 742 CompileAs = compileAsCPlusPlus;
739 } else { 743 } else {
740 qWarning( "Generator: Options '/Tp<filename>' and '/Tc<filename>' are not supported by qmake" ); 744 qWarning( "Generator: Options '/Tp<filename>' and '/Tc<filename>' are not supported by qmake" );
741 return FALSE; 745 found = FALSE; break;
742 } 746 }
743 break; 747 break;
744 case 'U': 748 case 'U':
745 UndefinePreprocessorDefinitions += option+2; 749 UndefinePreprocessorDefinitions += option+2;
746 break; 750 break;
747 case 'V': 751 case 'V':
@@ -775,13 +779,13 @@ bool VCCLCompilerTool::parseOption( const char* option )
775 if ( third == '6' && fourth == '4' ) { 779 if ( third == '6' && fourth == '4' ) {
776 Detect64BitPortabilityProblems = _True; 780 Detect64BitPortabilityProblems = _True;
777 break; 781 break;
778 } 782 }
779 // Fallthrough 783 // Fallthrough
780 default: 784 default:
781 return FALSE; 785 found = FALSE; break;
782 } 786 }
783 break; 787 break;
784 case 'X': 788 case 'X':
785 IgnoreStandardIncludePath = _True; 789 IgnoreStandardIncludePath = _True;
786 break; 790 break;
787 case 'Y': 791 case 'Y':
@@ -804,13 +808,13 @@ bool VCCLCompilerTool::parseOption( const char* option )
804 break; 808 break;
805 case 'u': 809 case 'u':
806 UsePrecompiledHeader = pchUseUsingSpecific; 810 UsePrecompiledHeader = pchUseUsingSpecific;
807 PrecompiledHeaderFile = option+3; 811 PrecompiledHeaderFile = option+3;
808 break; 812 break;
809 default: 813 default:
810 return FALSE; 814 found = FALSE; break;
811 } 815 }
812 break; 816 break;
813 case 'Z': 817 case 'Z':
814 switch ( second ) { 818 switch ( second ) {
815 case '7': 819 case '7':
816 DebugInformationFormat = debugOldStyleInfo; 820 DebugInformationFormat = debugOldStyleInfo;
@@ -837,15 +841,15 @@ bool VCCLCompilerTool::parseOption( const char* option )
837 if ( third == ':' ) { 841 if ( third == ':' ) {
838 if ( fourth == 'f' ) 842 if ( fourth == 'f' )
839 ForceConformanceInForLoopScope = _True; 843 ForceConformanceInForLoopScope = _True;
840 else if ( fourth == 'w' ) 844 else if ( fourth == 'w' )
841 TreatWChar_tAsBuiltInType = _True; 845 TreatWChar_tAsBuiltInType = _True;
842 else 846 else
843 return FALSE; 847 found = FALSE;
844 } else { 848 } else {
845 return FALSE; 849 found = FALSE; break;
846 } 850 }
847 break; 851 break;
848 case 'g': 852 case 'g':
849 case 'm': 853 case 'm':
850 case 's': 854 case 's':
851 AdditionalOptions += option; 855 AdditionalOptions += option;
@@ -866,17 +870,17 @@ bool VCCLCompilerTool::parseOption( const char* option )
866 StructMemberAlignment = alignFourBytes; 870 StructMemberAlignment = alignFourBytes;
867 break; 871 break;
868 case '8': 872 case '8':
869 StructMemberAlignment = alignEightBytes; 873 StructMemberAlignment = alignEightBytes;
870 break; 874 break;
871 default: 875 default:
872 return FALSE; 876 found = FALSE; break;
873 } 877 }
874 break; 878 break;
875 default: 879 default:
876 return FALSE; 880 found = FALSE; break;
877 } 881 }
878 break; 882 break;
879 case 'c': 883 case 'c':
880 if ( second == '\0' ) { 884 if ( second == '\0' ) {
881 CompileOnly = _True; 885 CompileOnly = _True;
882 } else if ( second == 'l' ) { 886 } else if ( second == 'l' ) {
@@ -884,45 +888,46 @@ bool VCCLCompilerTool::parseOption( const char* option )
884 CompileAsManaged = managedAssembly; 888 CompileAsManaged = managedAssembly;
885 TurnOffAssemblyGeneration = _True; 889 TurnOffAssemblyGeneration = _True;
886 } else { 890 } else {
887 CompileAsManaged = managedAssembly; 891 CompileAsManaged = managedAssembly;
888 } 892 }
889 } else { 893 } else {
890 return FALSE; 894 found = FALSE; break;
891 } 895 }
892 break; 896 break;
893 case 'd': 897 case 'd':
894 if ( second != 'r' ) 898 if ( second != 'r' ) {
895 return FALSE; 899 found = FALSE; break;
900 }
896 CompileAsManaged = managedAssembly; 901 CompileAsManaged = managedAssembly;
897 break; 902 break;
898 case 'n': 903 case 'n':
899 if ( second == 'o' && third == 'B' && fourth == 'o' ) { 904 if ( second == 'o' && third == 'B' && fourth == 'o' ) {
900 AdditionalOptions += "/noBool"; 905 AdditionalOptions += "/noBool";
901 break; 906 break;
902 } 907 }
903 if ( second == 'o' && third == 'l' && fourth == 'o' ) { 908 if ( second == 'o' && third == 'l' && fourth == 'o' ) {
904 SuppressStartupBanner = _True; 909 SuppressStartupBanner = _True;
905 break; 910 break;
906 } 911 }
907 return FALSE; 912 found = FALSE; break;
908 case 's': 913 case 's':
909 if ( second == 'h' && third == 'o' && fourth == 'w' ) { 914 if ( second == 'h' && third == 'o' && fourth == 'w' ) {
910 ShowIncludes = _True; 915 ShowIncludes = _True;
911 break; 916 break;
912 } 917 }
913 return FALSE; 918 found = FALSE; break;
914 case 'u': 919 case 'u':
915 UndefineAllPreprocessorDefinitions = _True; 920 UndefineAllPreprocessorDefinitions = _True;
916 break; 921 break;
917 case 'v': 922 case 'v':
918 if ( second == 'd' || second == 'm' ) { 923 if ( second == 'd' || second == 'm' ) {
919 AdditionalOptions += option; 924 AdditionalOptions += option;
920 break; 925 break;
921 } 926 }
922 return FALSE; 927 found = FALSE; break;
923 case 'w': 928 case 'w':
924 switch ( second ) { 929 switch ( second ) {
925 case '\0': 930 case '\0':
926 WarningLevel = warningLevel_0; 931 WarningLevel = warningLevel_0;
927 break; 932 break;
928 case 'd': 933 case 'd':
@@ -930,14 +935,16 @@ bool VCCLCompilerTool::parseOption( const char* option )
930 break; 935 break;
931 default: 936 default:
932 AdditionalOptions += option; 937 AdditionalOptions += option;
933 } 938 }
934 break; 939 break;
935 default: 940 default:
936 return FALSE; 941 found = FALSE; break;
937 } 942 }
943 if( !found )
944 warn_msg( WarnLogic, "Could not parse Compiler option: %s", option );
938 return TRUE; 945 return TRUE;
939} 946}
940 947
941// VCLinkerTool ----------------------------------------------------- 948// VCLinkerTool -----------------------------------------------------
942VCLinkerTool::VCLinkerTool() 949VCLinkerTool::VCLinkerTool()
943 :EnableCOMDATFolding( optFoldingDefault ), 950 :EnableCOMDATFolding( optFoldingDefault ),
@@ -977,13 +984,13 @@ VCLinkerTool::VCLinkerTool()
977QTextStream &operator<<( QTextStream &strm, const VCLinkerTool &tool ) 984QTextStream &operator<<( QTextStream &strm, const VCLinkerTool &tool )
978{ 985{
979 strm << _begTool3; 986 strm << _begTool3;
980 strm << _VCLinkerToolName; 987 strm << _VCLinkerToolName;
981 strm << XPair( _AdditionalDependencies4, tool.AdditionalDependencies, " " ); 988 strm << XPair( _AdditionalDependencies4, tool.AdditionalDependencies, " " );
982 strm << XPair( _AdditionalLibraryDirectories, tool.AdditionalLibraryDirectories ); 989 strm << XPair( _AdditionalLibraryDirectories, tool.AdditionalLibraryDirectories );
983 strm << XPair( _AdditionalOptions, tool.AdditionalOptions ); 990 strm << XPair( _AdditionalOptions, tool.AdditionalOptions, " " );
984 strm << XPair( _AddModuleNamesToAssembly, tool.AddModuleNamesToAssembly ); 991 strm << XPair( _AddModuleNamesToAssembly, tool.AddModuleNamesToAssembly );
985 strm << SPair( _BaseAddress, tool.BaseAddress ); 992 strm << SPair( _BaseAddress, tool.BaseAddress );
986 strm << XPair( _DelayLoadDLLs, tool.DelayLoadDLLs ); 993 strm << XPair( _DelayLoadDLLs, tool.DelayLoadDLLs );
987 if ( tool.EnableCOMDATFolding != optFoldingDefault ) strm << EPair( _EnableCOMDATFolding, tool.EnableCOMDATFolding ); 994 if ( tool.EnableCOMDATFolding != optFoldingDefault ) strm << EPair( _EnableCOMDATFolding, tool.EnableCOMDATFolding );
988 strm << SPair( _EntryPointSymbol, tool.EntryPointSymbol ); 995 strm << SPair( _EntryPointSymbol, tool.EntryPointSymbol );
989 strm << XPair( _ForceSymbolReferences, tool.ForceSymbolReferences ); 996 strm << XPair( _ForceSymbolReferences, tool.ForceSymbolReferences );
@@ -1043,65 +1050,69 @@ static uint elfHash( const char* name )
1043 const uchar *k; 1050 const uchar *k;
1044 uint h = 0; 1051 uint h = 0;
1045 uint g; 1052 uint g;
1046 1053
1047 if ( name ) { 1054 if ( name ) {
1048 k = (const uchar *) name; 1055 k = (const uchar *) name;
1049 while ( (*k) && 1056 while ( (*k) &&
1050 (*k)!= ':' && 1057 (*k)!= ':' &&
1051 (*k)!=',' && 1058 (*k)!=',' &&
1052 (*k)!=' ' ) { 1059 (*k)!=' ' ) {
1053 h = ( h << 4 ) + *k++; 1060 h = ( h << 4 ) + *k++;
1054 if ( (g = (h & 0xf0000000)) != 0 ) 1061 if ( (g = (h & 0xf0000000)) != 0 )
1055 h ^= g >> 24; 1062 h ^= g >> 24;
1056 h &= ~g; 1063 h &= ~g;
1057 } 1064 }
1058 } 1065 }
1059 if ( !h ) 1066 if ( !h )
1060 h = 1; 1067 h = 1;
1061 return h; 1068 return h;
1062} 1069}
1070
1071//#define USE_DISPLAY_HASH
1072#ifdef USE_DISPLAY_HASH
1063static void displayHash( const char* str ) 1073static void displayHash( const char* str )
1064{ 1074{
1065 printf( "case 0x%07x: // %s\n break;\n", elfHash(str), str ); 1075 printf( "case 0x%07x: // %s\n break;\n", elfHash(str), str );
1066} 1076}
1077#endif
1067 1078
1068bool VCLinkerTool::parseOption( const char* option ) 1079bool VCLinkerTool::parseOption( const char* option )
1069{ 1080{
1070#if 0 1081#ifdef USE_DISPLAY_HASH
1071 // Main options 1082 // Main options
1072 displayHash( "/ALIGN" ); displayHash( "/ALLOWBIND" ); displayHash( "/ASSEMBLYMODULE" ); 1083 displayHash( "/ALIGN" ); displayHash( "/ALLOWBIND" ); displayHash( "/ASSEMBLYMODULE" );
1073 displayHash( "/ASSEMBLYRESOURCE" ); displayHash( "/BASE" ); displayHash( "/DEBUG" ); 1084 displayHash( "/ASSEMBLYRESOURCE" ); displayHash( "/BASE" ); displayHash( "/DEBUG" );
1074 displayHash( "/DEF" ); displayHash( "/DEFAULTLIB" ); displayHash( "/DELAY" ); 1085 displayHash( "/DEF" ); displayHash( "/DEFAULTLIB" ); displayHash( "/DELAY" );
1075 displayHash( "/DELAYLOAD" ); displayHash( "/DLL" ); displayHash( "/DRIVER" ); 1086 displayHash( "/DELAYLOAD" ); displayHash( "/DLL" ); displayHash( "/DRIVER" );
1076 displayHash( "/ENTRY" ); displayHash( "/EXETYPE" ); displayHash( "/EXPORT" ); 1087 displayHash( "/ENTRY" ); displayHash( "/EXETYPE" ); displayHash( "/EXPORT" );
1077 displayHash( "/FIXED" ); displayHash( "/FORCE" ); displayHash( "/HEAP" ); 1088 displayHash( "/FIXED" ); displayHash( "/FORCE" ); displayHash( "/HEAP" );
1078 displayHash( "/IDLOUT" ); displayHash( "/IGNOREIDL" ); displayHash( "/IMPLIB" ); 1089 displayHash( "/IDLOUT" ); displayHash( "/IGNOREIDL" ); displayHash( "/IMPLIB" );
1079 displayHash( "/INCLUDE" ); displayHash( "/INCREMENTAL" ); displayHash( "/LARGEADDRESSAWARE" ); 1090 displayHash( "/INCLUDE" ); displayHash( "/INCREMENTAL" ); displayHash( "/LARGEADDRESSAWARE" );
1080 displayHash( "/LIBPATH" ); displayHash( "/LTCG" ); displayHash( "/MACHINE" ); 1091 displayHash( "/LIBPATH" ); displayHash( "/LTCG" ); displayHash( "/MACHINE" );
1081 displayHash( "/MAP" ); displayHash( "/MAPINFO" ); displayHash( "/MERGE" ); 1092 displayHash( "/MAP" ); displayHash( "/MAPINFO" ); displayHash( "/MERGE" );
1082 displayHash( "/MIDL" ); displayHash( "/NOASSEMBLY" ); displayHash( "/NODEFAULTLIB" ); 1093 displayHash( "/MIDL" ); displayHash( "/NOASSEMBLY" ); displayHash( "/NODEFAULTLIB" );
1083 displayHash( "/NOENTRY" ); displayHash( "/NOLOGO" ); displayHash( "/OPT" ); 1094 displayHash( "/NOENTRY" ); displayHash( "/NOLOGO" ); displayHash( "/OPT" );
1084 displayHash( "/ORDER" ); displayHash( "/OUT" ); displayHash( "/PDB" ); 1095 displayHash( "/ORDER" ); displayHash( "/OUT" ); displayHash( "/PDB" );
1085 displayHash( "/PDBSTRIPPED" ); displayHash( "/RELEASE" ); displayHash( "/SECTION" ); 1096 displayHash( "/PDBSTRIPPED" ); displayHash( "/RELEASE" ); displayHash( "/SECTION" );
1086 displayHash( "/STACK" ); displayHash( "/STUB" ); displayHash( "/SUBSYSTEM" ); 1097 displayHash( "/STACK" ); displayHash( "/STUB" ); displayHash( "/SUBSYSTEM" );
1087 displayHash( "/SWAPRUN" ); displayHash( "/TLBID" ); displayHash( "/TLBOUT" ); 1098 displayHash( "/SWAPRUN" ); displayHash( "/TLBID" ); displayHash( "/TLBOUT" );
1088 displayHash( "/TSAWARE" ); displayHash( "/VERBOSE" ); displayHash( "/VERSION" ); 1099 displayHash( "/TSAWARE" ); displayHash( "/VERBOSE" ); displayHash( "/VERSION" );
1089 displayHash( "/VXD" ); displayHash( "/WS " ); 1100 displayHash( "/VXD" ); displayHash( "/WS " );
1090#endif 1101#endif
1091#if 0 1102#ifdef USE_DISPLAY_HASH
1092 // Sub options 1103 // Sub options
1093 displayHash( "UNLOAD" ); displayHash( "NOBIND" ); displayHash( "no" ); displayHash( "NOSTATUS" ); displayHash( "STATUS" ); 1104 displayHash( "UNLOAD" ); displayHash( "NOBIND" ); displayHash( "no" ); displayHash( "NOSTATUS" ); displayHash( "STATUS" );
1094 displayHash( "AM33" ); displayHash( "ARM" ); displayHash( "CEE" ); displayHash( "IA64" ); displayHash( "X86" ); displayHash( "M32R" ); 1105 displayHash( "AM33" ); displayHash( "ARM" ); displayHash( "CEE" ); displayHash( "IA64" ); displayHash( "X86" ); displayHash( "M32R" );
1095 displayHash( "MIPS" ); displayHash( "MIPS16" ); displayHash( "MIPSFPU" ); displayHash( "MIPSFPU16" ); displayHash( "MIPSR41XX" ); displayHash( "PPC" ); 1106 displayHash( "MIPS" ); displayHash( "MIPS16" ); displayHash( "MIPSFPU" ); displayHash( "MIPSFPU16" ); displayHash( "MIPSR41XX" ); displayHash( "PPC" );
1096 displayHash( "SH3" ); displayHash( "SH4" ); displayHash( "SH5" ); displayHash( "THUMB" ); displayHash( "TRICORE" ); displayHash( "EXPORTS" ); 1107 displayHash( "SH3" ); displayHash( "SH4" ); displayHash( "SH5" ); displayHash( "THUMB" ); displayHash( "TRICORE" ); displayHash( "EXPORTS" );
1097 displayHash( "LINES" ); displayHash( "REF" ); displayHash( "NOREF" ); displayHash( "ICF" ); displayHash( "WIN98" ); displayHash( "NOWIN98" ); 1108 displayHash( "LINES" ); displayHash( "REF" ); displayHash( "NOREF" ); displayHash( "ICF" ); displayHash( "WIN98" ); displayHash( "NOWIN98" );
1098 displayHash( "CONSOLE" ); displayHash( "EFI_APPLICATION" ); displayHash( "EFI_BOOT_SERVICE_DRIVER" ); displayHash( "EFI_ROM" ); displayHash( "EFI_RUNTIME_DRIVER" ); displayHash( "NATIVE" ); 1109 displayHash( "CONSOLE" ); displayHash( "EFI_APPLICATION" ); displayHash( "EFI_BOOT_SERVICE_DRIVER" ); displayHash( "EFI_ROM" ); displayHash( "EFI_RUNTIME_DRIVER" ); displayHash( "NATIVE" );
1099 displayHash( "POSIX" ); displayHash( "WINDOWS" ); displayHash( "WINDOWSCE" ); displayHash( "NET" ); displayHash( "CD" ); displayHash( "NO" ); 1110 displayHash( "POSIX" ); displayHash( "WINDOWS" ); displayHash( "WINDOWSCE" ); displayHash( "NET" ); displayHash( "CD" ); displayHash( "NO" );
1100#endif 1111#endif
1101 1112 bool found = TRUE;
1102 switch ( elfHash(option) ) { 1113 switch ( elfHash(option) ) {
1103 case 0x3360dbe: // /ALIGN[:number] 1114 case 0x3360dbe: // /ALIGN[:number]
1104 case 0x1485c34: // /ALLOWBIND[:NO] 1115 case 0x1485c34: // /ALLOWBIND[:NO]
1105 case 0x6b21972: // /DEFAULTLIB:library 1116 case 0x6b21972: // /DEFAULTLIB:library
1106 case 0x396ea92: // /DRIVER[:UPONLY | :WDM] 1117 case 0x396ea92: // /DRIVER[:UPONLY | :WDM]
1107 case 0xaca9d75: // /EXETYPE[:DYNAMIC | :DEV386] 1118 case 0xaca9d75: // /EXETYPE[:DYNAMIC | :DEV386]
@@ -1138,13 +1149,13 @@ bool VCLinkerTool::parseOption( const char* option )
1138 AdditionalOptions += option; 1149 AdditionalOptions += option;
1139 break; 1150 break;
1140 case 0x06f4bf4: // /DELAYLOAD:dllname 1151 case 0x06f4bf4: // /DELAYLOAD:dllname
1141 DelayLoadDLLs += option+11; 1152 DelayLoadDLLs += option+11;
1142 break; 1153 break;
1143 // case 0x003390c: // /DLL 1154 // case 0x003390c: // /DLL
1144 // This option is not used for vcproj files 1155 // This option is not used for vcproj files
1145 //break; 1156 //break;
1146 case 0x33a3979: // /ENTRY:function 1157 case 0x33a3979: // /ENTRY:function
1147 EntryPointSymbol = option+7; 1158 EntryPointSymbol = option+7;
1148 break; 1159 break;
1149 case 0x033c960: // /HEAP:reserve[,commit] 1160 case 0x033c960: // /HEAP:reserve[,commit]
1150 { 1161 {
@@ -1189,13 +1200,13 @@ bool VCLinkerTool::parseOption( const char* option )
1189 if ( *(option+5) == ':' && 1200 if ( *(option+5) == ':' &&
1190 *(option+6) == 'S' ) 1201 *(option+6) == 'S' )
1191 ShowProgress = linkProgressAll; 1202 ShowProgress = linkProgressAll;
1192 break; 1203 break;
1193 case 0x157cf65: // /MACHINE:{AM33|ARM|CEE|IA64|X86|M32R|MIPS|MIPS16|MIPSFPU|MIPSFPU16|MIPSR41XX|PPC|SH3|SH4|SH5|THUMB|TRICORE} 1204 case 0x157cf65: // /MACHINE:{AM33|ARM|CEE|IA64|X86|M32R|MIPS|MIPS16|MIPSFPU|MIPSFPU16|MIPSR41XX|PPC|SH3|SH4|SH5|THUMB|TRICORE}
1194 switch ( elfHash(option+9) ) { 1205 switch ( elfHash(option+9) ) {
1195 // Very limited documentation on all options but X86, 1206 // Very limited documentation on all options but X86,
1196 // so we put the others in AdditionalOptions... 1207 // so we put the others in AdditionalOptions...
1197 case 0x0046063: // AM33 1208 case 0x0046063: // AM33
1198 case 0x000466d: // ARM 1209 case 0x000466d: // ARM
1199 case 0x0004795: // CEE 1210 case 0x0004795: // CEE
1200 case 0x004d494: // IA64 1211 case 0x004d494: // IA64
1201 case 0x0050672: // M32R 1212 case 0x0050672: // M32R
@@ -1213,13 +1224,13 @@ bool VCLinkerTool::parseOption( const char* option )
1213 AdditionalOptions += option; 1224 AdditionalOptions += option;
1214 break; 1225 break;
1215 case 0x0005bb6: // X86 1226 case 0x0005bb6: // X86
1216 TargetMachine = machineX86; 1227 TargetMachine = machineX86;
1217 break; 1228 break;
1218 default: 1229 default:
1219 return FALSE; 1230 found = FALSE;
1220 } 1231 }
1221 break; 1232 break;
1222 case 0x0034160: // /MAP[:filename] 1233 case 0x0034160: // /MAP[:filename]
1223 GenerateMapFile = _True; 1234 GenerateMapFile = _True;
1224 MapFileName = option+5; 1235 MapFileName = option+5;
1225 break; 1236 break;
@@ -1272,13 +1283,13 @@ bool VCLinkerTool::parseOption( const char* option )
1272 OptimizeForWindows98 = optWin98Yes; 1283 OptimizeForWindows98 = optWin98Yes;
1273 break; 1284 break;
1274 case 'W': // NOWIN98 1285 case 'W': // NOWIN98
1275 OptimizeForWindows98 = optWin98No; 1286 OptimizeForWindows98 = optWin98No;
1276 break; 1287 break;
1277 default: 1288 default:
1278 return FALSE; 1289 found = FALSE;
1279 } 1290 }
1280 } 1291 }
1281 break; 1292 break;
1282 case 0x34468a2: // /ORDER:@filename 1293 case 0x34468a2: // /ORDER:@filename
1283 FunctionOrder = option+8; 1294 FunctionOrder = option+8;
1284 break; 1295 break;
@@ -1321,23 +1332,23 @@ bool VCLinkerTool::parseOption( const char* option )
1321 case 0x5268ea5: // NATIVE 1332 case 0x5268ea5: // NATIVE
1322 case 0x05547e8: // POSIX 1333 case 0x05547e8: // POSIX
1323 case 0x2949c95: // WINDOWSCE 1334 case 0x2949c95: // WINDOWSCE
1324 AdditionalOptions += option; 1335 AdditionalOptions += option;
1325 break; 1336 break;
1326 default: 1337 default:
1327 return FALSE; 1338 found = FALSE;
1328 } 1339 }
1329 } 1340 }
1330 break; 1341 break;
1331 case 0x8b654de: // /SWAPRUN:{NET | CD} 1342 case 0x8b654de: // /SWAPRUN:{NET | CD}
1332 if ( *(option+9) == 'N' ) 1343 if ( *(option+9) == 'N' )
1333 SwapRunFromNet = _True; 1344 SwapRunFromNet = _True;
1334 else if ( *(option+9) == 'C' ) 1345 else if ( *(option+9) == 'C' )
1335 SwapRunFromCD = _True; 1346 SwapRunFromCD = _True;
1336 else 1347 else
1337 return FALSE; 1348 found = FALSE;
1338 break; 1349 break;
1339 case 0x34906d4: // /TLBID:id 1350 case 0x34906d4: // /TLBID:id
1340 TypeLibraryResourceID = QString( option+7 ).toLong(); 1351 TypeLibraryResourceID = QString( option+7 ).toLong();
1341 break; 1352 break;
1342 case 0x4907494: // /TLBOUT:[path\]filename 1353 case 0x4907494: // /TLBOUT:[path\]filename
1343 TypeLibraryFile = option+8; 1354 TypeLibraryFile = option+8;
@@ -1357,15 +1368,17 @@ bool VCLinkerTool::parseOption( const char* option )
1357 } 1368 }
1358 break; 1369 break;
1359 case 0xaa77f7e: // /VERSION:major[.minor] 1370 case 0xaa77f7e: // /VERSION:major[.minor]
1360 Version = option+9; 1371 Version = option+9;
1361 break; 1372 break;
1362 default: 1373 default:
1363 return FALSE; 1374 found = FALSE;
1364 } 1375 }
1365 return TRUE; 1376 if( !found )
1377 warn_msg( WarnLogic, "Could not parse Linker options: %s", option );
1378 return found;
1366} 1379}
1367 1380
1368// VCMIDLTool ------------------------------------------------------- 1381// VCMIDLTool -------------------------------------------------------
1369VCMIDLTool::VCMIDLTool() 1382VCMIDLTool::VCMIDLTool()
1370 :DefaultCharType( midlCharUnsigned ), 1383 :DefaultCharType( midlCharUnsigned ),
1371 EnableErrorChecks( midlDisableAll ), 1384 EnableErrorChecks( midlDisableAll ),
@@ -1389,13 +1402,13 @@ VCMIDLTool::VCMIDLTool()
1389 1402
1390QTextStream &operator<<( QTextStream &strm, const VCMIDLTool &tool ) 1403QTextStream &operator<<( QTextStream &strm, const VCMIDLTool &tool )
1391{ 1404{
1392 strm << _begTool3; 1405 strm << _begTool3;
1393 strm << _VCMIDLToolName; 1406 strm << _VCMIDLToolName;
1394 strm << XPair( _AdditionalIncludeDirectories, tool.AdditionalIncludeDirectories ); 1407 strm << XPair( _AdditionalIncludeDirectories, tool.AdditionalIncludeDirectories );
1395 strm << XPair( _AdditionalOptions, tool.AdditionalOptions ); 1408 strm << XPair( _AdditionalOptions, tool.AdditionalOptions, " " );
1396 strm << XPair( _CPreprocessOptions, tool.CPreprocessOptions ); 1409 strm << XPair( _CPreprocessOptions, tool.CPreprocessOptions );
1397 strm << EPair( _DefaultCharType, tool.DefaultCharType ); 1410 strm << EPair( _DefaultCharType, tool.DefaultCharType );
1398 strm << SPair( _DLLDataFileName, tool.DLLDataFileName ); 1411 strm << SPair( _DLLDataFileName, tool.DLLDataFileName );
1399 strm << EPair( _EnableErrorChecks, tool.EnableErrorChecks ); 1412 strm << EPair( _EnableErrorChecks, tool.EnableErrorChecks );
1400 strm << TPair( _ErrorCheckAllocations, tool.ErrorCheckAllocations ); 1413 strm << TPair( _ErrorCheckAllocations, tool.ErrorCheckAllocations );
1401 strm << TPair( _ErrorCheckBounds, tool.ErrorCheckBounds ); 1414 strm << TPair( _ErrorCheckBounds, tool.ErrorCheckBounds );
@@ -1424,40 +1437,41 @@ QTextStream &operator<<( QTextStream &strm, const VCMIDLTool &tool )
1424 strm << "/>"; 1437 strm << "/>";
1425 return strm; 1438 return strm;
1426} 1439}
1427 1440
1428bool VCMIDLTool::parseOption( const char* option ) 1441bool VCMIDLTool::parseOption( const char* option )
1429{ 1442{
1430#if 0 1443#ifdef USE_DISPLAY_HASH
1431 displayHash( "/D name[=def]" ); displayHash( "/I directory-list" ); displayHash( "/Oi" ); 1444 displayHash( "/D name[=def]" ); displayHash( "/I directory-list" ); displayHash( "/Oi" );
1432 displayHash( "/Oic" ); displayHash( "/Oicf" ); displayHash( "/Oif" ); displayHash( "/Os" ); 1445 displayHash( "/Oic" ); displayHash( "/Oicf" ); displayHash( "/Oif" ); displayHash( "/Os" );
1433 displayHash( "/U name" ); displayHash( "/WX" ); displayHash( "/W{0|1|2|3|4}" ); 1446 displayHash( "/U name" ); displayHash( "/WX" ); displayHash( "/W{0|1|2|3|4}" );
1434 displayHash( "/Zp {N}" ); displayHash( "/Zs" ); displayHash( "/acf filename" ); 1447 displayHash( "/Zp {N}" ); displayHash( "/Zs" ); displayHash( "/acf filename" );
1435 displayHash( "/align {N}" ); displayHash( "/app_config" ); displayHash( "/c_ext" ); 1448 displayHash( "/align {N}" ); displayHash( "/app_config" ); displayHash( "/c_ext" );
1436 displayHash( "/char ascii7" ); displayHash( "/char signed" ); displayHash( "/char unsigned" ); 1449 displayHash( "/char ascii7" ); displayHash( "/char signed" ); displayHash( "/char unsigned" );
1437 displayHash( "/client none" ); displayHash( "/client stub" ); displayHash( "/confirm" ); 1450 displayHash( "/client none" ); displayHash( "/client stub" ); displayHash( "/confirm" );
1438 displayHash( "/cpp_cmd cmd_line" ); displayHash( "/cpp_opt options" ); 1451 displayHash( "/cpp_cmd cmd_line" ); displayHash( "/cpp_opt options" );
1439 displayHash( "/cstub filename" ); displayHash( "/dlldata filename" ); displayHash( "/env win32" ); 1452 displayHash( "/cstub filename" ); displayHash( "/dlldata filename" ); displayHash( "/env win32" );
1440 displayHash( "/env win64" ); displayHash( "/error all" ); displayHash( "/error allocation" ); 1453 displayHash( "/env win64" ); displayHash( "/error all" ); displayHash( "/error allocation" );
1441 displayHash( "/error bounds_check" ); displayHash( "/error enum" ); displayHash( "/error none" ); 1454 displayHash( "/error bounds_check" ); displayHash( "/error enum" ); displayHash( "/error none" );
1442 displayHash( "/error ref" ); displayHash( "/error stub_data" ); displayHash( "/h filename" ); 1455 displayHash( "/error ref" ); displayHash( "/error stub_data" ); displayHash( "/h filename" );
1443 displayHash( "/header filename" ); displayHash( "/iid filename" ); displayHash( "/lcid" ); 1456 displayHash( "/header filename" ); displayHash( "/iid filename" ); displayHash( "/lcid" );
1444 displayHash( "/mktyplib203" ); displayHash( "/ms_ext" ); displayHash( "/ms_union" ); 1457 displayHash( "/mktyplib203" ); displayHash( "/ms_ext" ); displayHash( "/ms_union" );
1445 displayHash( "/msc_ver <nnnn>" ); displayHash( "/newtlb" ); displayHash( "/no_cpp" ); 1458 displayHash( "/msc_ver <nnnn>" ); displayHash( "/newtlb" ); displayHash( "/no_cpp" );
1446 displayHash( "/no_def_idir" ); displayHash( "/no_default_epv" ); displayHash( "/no_format_opt" ); 1459 displayHash( "/no_def_idir" ); displayHash( "/no_default_epv" ); displayHash( "/no_format_opt" );
1447 displayHash( "/no_warn" ); displayHash( "/nocpp" ); displayHash( "/nologo" ); displayHash( "/notlb" ); 1460 displayHash( "/no_warn" ); displayHash( "/nocpp" ); displayHash( "/nologo" ); displayHash( "/notlb" );
1448 displayHash( "/o filename" ); displayHash( "/oldnames" ); displayHash( "/oldtlb" ); 1461 displayHash( "/o filename" ); displayHash( "/oldnames" ); displayHash( "/oldtlb" );
1449 displayHash( "/osf" ); displayHash( "/out directory" ); displayHash( "/pack {N}" ); 1462 displayHash( "/osf" ); displayHash( "/out directory" ); displayHash( "/pack {N}" );
1450 displayHash( "/prefix all" ); displayHash( "/prefix client" ); displayHash( "/prefix server" ); 1463 displayHash( "/prefix all" ); displayHash( "/prefix client" ); displayHash( "/prefix server" );
1451 displayHash( "/prefix switch" ); displayHash( "/protocol all" ); displayHash( "/protocol dce" ); 1464 displayHash( "/prefix switch" ); displayHash( "/protocol all" ); displayHash( "/protocol dce" );
1452 displayHash( "/protocol ndr64" ); displayHash( "/proxy filename" ); displayHash( "/robust" ); 1465 displayHash( "/protocol ndr64" ); displayHash( "/proxy filename" ); displayHash( "/robust" );
1453 displayHash( "/rpcss" ); displayHash( "/savePP" ); displayHash( "/server none" ); 1466 displayHash( "/rpcss" ); displayHash( "/savePP" ); displayHash( "/server none" );
1454 displayHash( "/server stub" ); displayHash( "/sstub filename" ); displayHash( "/syntax_check" ); 1467 displayHash( "/server stub" ); displayHash( "/sstub filename" ); displayHash( "/syntax_check" );
1455 displayHash( "/target {system}" ); displayHash( "/tlb filename" ); displayHash( "/use_epv" ); 1468 displayHash( "/target {system}" ); displayHash( "/tlb filename" ); displayHash( "/use_epv" );
1456 displayHash( "/win32" ); displayHash( "/win64" ); 1469 displayHash( "/win32" ); displayHash( "/win64" );
1457#endif 1470#endif
1471 bool found = TRUE;
1458 int offset = 0; 1472 int offset = 0;
1459 switch( elfHash(option) ) { 1473 switch( elfHash(option) ) {
1460 case 0x0000334: // /D name[=def] 1474 case 0x0000334: // /D name[=def]
1461 PreprocessorDefinitions += option+3; 1475 PreprocessorDefinitions += option+3;
1462 break; 1476 break;
1463 case 0x0000339: // /I directory-list 1477 case 0x0000339: // /I directory-list
@@ -1487,13 +1501,13 @@ bool VCMIDLTool::parseOption( const char* option )
1487 StructMemberAlignment = midlAlignFourBytes; 1501 StructMemberAlignment = midlAlignFourBytes;
1488 break; 1502 break;
1489 case '8': 1503 case '8':
1490 StructMemberAlignment = midlAlignEightBytes; 1504 StructMemberAlignment = midlAlignEightBytes;
1491 break; 1505 break;
1492 default: 1506 default:
1493 return FALSE; 1507 found = FALSE;
1494 } 1508 }
1495 break; 1509 break;
1496 case 0x0359e82: // /char {ascii7|signed|unsigned} 1510 case 0x0359e82: // /char {ascii7|signed|unsigned}
1497 switch( *(option+6) ) { 1511 switch( *(option+6) ) {
1498 case 'a': 1512 case 'a':
1499 DefaultCharType = midlCharAscii7; 1513 DefaultCharType = midlCharAscii7;
@@ -1502,13 +1516,13 @@ bool VCMIDLTool::parseOption( const char* option )
1502 DefaultCharType = midlCharSigned; 1516 DefaultCharType = midlCharSigned;
1503 break; 1517 break;
1504 case 'u': 1518 case 'u':
1505 DefaultCharType = midlCharUnsigned; 1519 DefaultCharType = midlCharUnsigned;
1506 break; 1520 break;
1507 default: 1521 default:
1508 return FALSE; 1522 found = FALSE;
1509 } 1523 }
1510 break; 1524 break;
1511 case 0xa766524: // /cpp_opt options 1525 case 0xa766524: // /cpp_opt options
1512 CPreprocessOptions += option+9; 1526 CPreprocessOptions += option+9;
1513 break; 1527 break;
1514 case 0xb32abf1: // /dlldata filename 1528 case 0xb32abf1: // /dlldata filename
@@ -1533,19 +1547,19 @@ bool VCMIDLTool::parseOption( const char* option )
1533 ErrorCheckEnumRange = _True; 1547 ErrorCheckEnumRange = _True;
1534 break; 1548 break;
1535 case 'n': 1549 case 'n':
1536 EnableErrorChecks = midlDisableAll; 1550 EnableErrorChecks = midlDisableAll;
1537 break; 1551 break;
1538 case 'r': 1552 case 'r':
1539 break;
1540 ErrorCheckRefPointers = _True; 1553 ErrorCheckRefPointers = _True;
1541 case 's':
1542 break; 1554 break;
1555 case 's':
1543 ErrorCheckStubData = _True; 1556 ErrorCheckStubData = _True;
1557 break;
1544 default: 1558 default:
1545 return FALSE; 1559 found = FALSE;
1546 } 1560 }
1547 break; 1561 break;
1548 case 0x5eb7af2: // /header filename 1562 case 0x5eb7af2: // /header filename
1549 offset = 5; 1563 offset = 5;
1550 case 0x0000358: // /h filename 1564 case 0x0000358: // /h filename
1551 HeaderFileName = option + offset + 3; 1565 HeaderFileName = option + offset + 3;
@@ -1644,17 +1658,19 @@ bool VCMIDLTool::parseOption( const char* option )
1644 WarningLevel = midlWarningLevel_3; 1658 WarningLevel = midlWarningLevel_3;
1645 break; 1659 break;
1646 case '4': 1660 case '4':
1647 WarningLevel = midlWarningLevel_4; 1661 WarningLevel = midlWarningLevel_4;
1648 break; 1662 break;
1649 default: 1663 default:
1650 return FALSE; 1664 found = FALSE;
1651 } 1665 }
1652 } 1666 }
1653 break; 1667 break;
1654 } 1668 }
1669 if( !found )
1670 warn_msg( WarnLogic, "Could not parse MIDL option: %s", option );
1655 return TRUE; 1671 return TRUE;
1656} 1672}
1657 1673
1658// VCLibrarianTool -------------------------------------------------- 1674// VCLibrarianTool --------------------------------------------------
1659VCLibrarianTool::VCLibrarianTool() 1675VCLibrarianTool::VCLibrarianTool()
1660 :IgnoreAllDefaultLibraries( unset ), 1676 :IgnoreAllDefaultLibraries( unset ),
@@ -1665,13 +1681,13 @@ VCLibrarianTool::VCLibrarianTool()
1665QTextStream &operator<<( QTextStream &strm, const VCLibrarianTool &tool ) 1681QTextStream &operator<<( QTextStream &strm, const VCLibrarianTool &tool )
1666{ 1682{
1667 strm << _begTool3; 1683 strm << _begTool3;
1668 strm << SPair( _ToolName, QString( "VCLibrarianTool" ) ); 1684 strm << SPair( _ToolName, QString( "VCLibrarianTool" ) );
1669 strm << XPair( _AdditionalDependencies4, tool.AdditionalDependencies ); 1685 strm << XPair( _AdditionalDependencies4, tool.AdditionalDependencies );
1670 strm << XPair( _AdditionalLibraryDirectories, tool.AdditionalLibraryDirectories ); 1686 strm << XPair( _AdditionalLibraryDirectories, tool.AdditionalLibraryDirectories );
1671 strm << XPair( _AdditionalOptions, tool.AdditionalOptions ); 1687 strm << XPair( _AdditionalOptions, tool.AdditionalOptions, " " );
1672 strm << XPair( _ExportNamedFunctions, tool.ExportNamedFunctions ); 1688 strm << XPair( _ExportNamedFunctions, tool.ExportNamedFunctions );
1673 strm << XPair( _ForceSymbolReferences, tool.ForceSymbolReferences ); 1689 strm << XPair( _ForceSymbolReferences, tool.ForceSymbolReferences );
1674 strm << TPair( _IgnoreAllDefaultLibraries, tool.IgnoreAllDefaultLibraries ); 1690 strm << TPair( _IgnoreAllDefaultLibraries, tool.IgnoreAllDefaultLibraries );
1675 strm << XPair( _IgnoreDefaultLibraryNames, tool.IgnoreDefaultLibraryNames ); 1691 strm << XPair( _IgnoreDefaultLibraryNames, tool.IgnoreDefaultLibraryNames );
1676 strm << SPair( _ModuleDefinitionFile, tool.ModuleDefinitionFile ); 1692 strm << SPair( _ModuleDefinitionFile, tool.ModuleDefinitionFile );
1677 strm << SPair( _OutputFile, tool.OutputFile ); 1693 strm << SPair( _OutputFile, tool.OutputFile );
@@ -1711,13 +1727,13 @@ VCResourceCompilerTool::VCResourceCompilerTool()
1711QTextStream &operator<<( QTextStream &strm, const VCResourceCompilerTool &tool ) 1727QTextStream &operator<<( QTextStream &strm, const VCResourceCompilerTool &tool )
1712{ 1728{
1713 strm << _begTool3; 1729 strm << _begTool3;
1714 strm << _VCResourceCompilerToolName; 1730 strm << _VCResourceCompilerToolName;
1715 strm << SPair( _ToolPath, tool.ToolPath ); 1731 strm << SPair( _ToolPath, tool.ToolPath );
1716 strm << XPair( _AdditionalIncludeDirectories, tool.AdditionalIncludeDirectories ); 1732 strm << XPair( _AdditionalIncludeDirectories, tool.AdditionalIncludeDirectories );
1717 strm << XPair( _AdditionalOptions, tool.AdditionalOptions ); 1733 strm << XPair( _AdditionalOptions, tool.AdditionalOptions, " " );
1718 if ( tool.Culture != rcUseDefault ) strm << EPair( _Culture, tool.Culture ); 1734 if ( tool.Culture != rcUseDefault ) strm << EPair( _Culture, tool.Culture );
1719 strm << XPair( _FullIncludePath, tool.FullIncludePath ); 1735 strm << XPair( _FullIncludePath, tool.FullIncludePath );
1720 strm << TPair( _IgnoreStandardIncludePath, tool.IgnoreStandardIncludePath ); 1736 strm << TPair( _IgnoreStandardIncludePath, tool.IgnoreStandardIncludePath );
1721 strm << XPair( _PreprocessorDefinitions, tool.PreprocessorDefinitions ); 1737 strm << XPair( _PreprocessorDefinitions, tool.PreprocessorDefinitions );
1722 strm << SPair( _ResourceOutputFileName, tool.ResourceOutputFileName ); 1738 strm << SPair( _ResourceOutputFileName, tool.ResourceOutputFileName );
1723 if ( tool.ShowProgress != linkProgressNotSet ) strm << EPair( _ShowProgress, tool.ShowProgress ); 1739 if ( tool.ShowProgress != linkProgressNotSet ) strm << EPair( _ShowProgress, tool.ShowProgress );
@@ -1848,35 +1864,56 @@ void VCFilter::generateMOC( QTextStream &strm, QString str ) const
1848void VCFilter::generateUIC( QTextStream &strm, const QString& str ) const 1864void VCFilter::generateUIC( QTextStream &strm, const QString& str ) const
1849{ 1865{
1850 QString uicApp = Project->var("QMAKE_UIC"); 1866 QString uicApp = Project->var("QMAKE_UIC");
1851 QString mocApp = Project->var( "QMAKE_MOC" ); 1867 QString mocApp = Project->var( "QMAKE_MOC" );
1852 QString fname = str.section( '\\', -1 ); 1868 QString fname = str.section( '\\', -1 );
1853 QString mocDir = Project->var( "MOC_DIR" ); 1869 QString mocDir = Project->var( "MOC_DIR" );
1870 QString uiDir = Project->var( "UI_DIR" );
1871 QString uiHeaders;
1872 QString uiSources;
1873
1874 // Determining the paths for the output files.
1875 int slash = str.findRev( '\\' );
1876 QString pname = ( slash != -1 ) ? str.left( slash+1 ) : QString( ".\\" );
1877 if( !uiDir.isEmpty() ) {
1878 uiHeaders = uiDir;
1879 uiSources = uiDir;
1880 } else {
1881 uiHeaders = Project->var( "UI_HEADERS_DIR" );
1882 uiSources = Project->var( "UI_SOURCES_DIR" );
1883 if( uiHeaders.isEmpty() )
1884 uiHeaders = pname;
1885 if( uiSources.isEmpty() )
1886 uiSources = pname;
1887 }
1888 if( !uiHeaders.endsWith( "\\" ) )
1889 uiHeaders += "\\";
1890 if( !uiSources.endsWith( "\\" ) )
1891 uiSources += "\\";
1892
1893 // Determine the file name.
1854 int dot = fname.findRev( '.' ); 1894 int dot = fname.findRev( '.' );
1855 if( dot != -1 ) 1895 if( dot != -1 )
1856 fname.truncate( dot ); 1896 fname.truncate( dot );
1857 1897
1858 int slash = str.findRev( '\\' );
1859 QString pname = ( slash != -1 ) ? str.left( slash+1 ) : QString(".\\");
1860
1861 strm << _begFileConfiguration; 1898 strm << _begFileConfiguration;
1862 strm << _Name5; 1899 strm << _Name5;
1863 strm << Config->Name; 1900 strm << Config->Name;
1864 strm << "\">"; 1901 strm << "\">";
1865 strm << _begTool5; 1902 strm << _begTool5;
1866 strm << _VCCustomBuildTool; 1903 strm << _VCCustomBuildTool;
1867 strm << _Description6; 1904 strm << _Description6;
1868 strm << "Uic'ing " << str << "...\""; 1905 strm << "Uic'ing " << str << "...\"";
1869 strm << _CommandLine6; 1906 strm << _CommandLine6;
1870 strm << uicApp << " " << str << " -o " << pname << fname << ".h &amp;&amp; "; // Create .h from .ui file 1907 strm << uicApp << " " << str << " -o " << uiHeaders << fname << ".h &amp;&amp; "; // Create .h from .ui file
1871 strm << uicApp << " " << str << " -i " << fname << ".h -o " << pname << fname << ".cpp &amp;&amp; ";// Create .cpp from .ui file 1908 strm << uicApp << " " << str << " -i " << fname << ".h -o " << uiSources << fname << ".cpp &amp;&amp; ";// Create .cpp from .ui file
1872 strm << mocApp << " " << pname << fname << ".h -o " << mocDir << "moc_" << fname << ".cpp\""; 1909 strm << mocApp << " " << uiHeaders << fname << ".h -o " << mocDir << "moc_" << fname << ".cpp\"";
1873 strm << _AdditionalDependencies6; 1910 strm << _AdditionalDependencies6;
1874 strm << mocApp << ";" << uicApp << "\""; 1911 strm << mocApp << ";" << uicApp << "\"";
1875 strm << _Outputs6; 1912 strm << _Outputs6;
1876 strm << pname << fname << ".h;" << pname << fname << ".cpp;" << mocDir << "moc_" << fname << ".cpp\""; 1913 strm << uiHeaders << fname << ".h;" << uiSources << fname << ".cpp;" << mocDir << "moc_" << fname << ".cpp\"";
1877 strm << "/>"; 1914 strm << "/>";
1878 strm << _endFileConfiguration; 1915 strm << _endFileConfiguration;
1879} 1916}
1880 1917
1881QTextStream &operator<<( QTextStream &strm, const VCFilter &tool ) 1918QTextStream &operator<<( QTextStream &strm, const VCFilter &tool )
1882{ 1919{
@@ -1903,15 +1940,15 @@ QTextStream &operator<<( QTextStream &strm, const VCFilter &tool )
1903 return strm; 1940 return strm;
1904} 1941}
1905 1942
1906// VCProject -------------------------------------------------------- 1943// VCProject --------------------------------------------------------
1907VCProject::VCProject() 1944VCProject::VCProject()
1908{ 1945{
1909 QUuid uniqueId;
1910#if defined(Q_WS_WIN32) 1946#if defined(Q_WS_WIN32)
1911 GUID guid; 1947 GUID guid;
1948 QUuid uniqueId;
1912 HRESULT h = CoCreateGuid( &guid ); 1949 HRESULT h = CoCreateGuid( &guid );
1913 if ( h == S_OK ) 1950 if ( h == S_OK )
1914 uniqueId = QUuid( guid ); 1951 uniqueId = QUuid( guid );
1915 ProjectGUID = uniqueId.toString(); 1952 ProjectGUID = uniqueId.toString();
1916#else 1953#else
1917 // Qt doesn't support GUID on other platforms yet 1954 // Qt doesn't support GUID on other platforms yet
diff --git a/qmake/generators/win32/msvc_objectmodel.h b/qmake/generators/win32/msvc_objectmodel.h
index 2d09280..1dca68d 100644
--- a/qmake/generators/win32/msvc_objectmodel.h
+++ b/qmake/generators/win32/msvc_objectmodel.h
@@ -37,22 +37,22 @@
37 37
38#include "project.h" 38#include "project.h"
39#include <qstring.h> 39#include <qstring.h>
40#include <qstringlist.h> 40#include <qstringlist.h>
41 41
42/* 42/*
43 This Object model is of course VERY simplyfied, 43 This Object model is of course VERY simplyfied,
44 and does not actually follow the original MSVC 44 and does not actually follow the original MSVC
45 object model. However, it fulfilles the basic 45 object model. However, it fulfilles the basic
46 needs for qmake 46 needs for qmake
47*/ 47*/
48 48
49/* 49/*
50 If a triState value is 'unset' then the 50 If a triState value is 'unset' then the
51 corresponding property is not in the output, 51 corresponding property is not in the output,
52 forcing the tool to utilize default values. 52 forcing the tool to utilize default values.
53 False/True values will be in the output... 53 False/True values will be in the output...
54*/ 54*/
55enum customBuildCheck { 55enum customBuildCheck {
56 none, 56 none,
57 moc, 57 moc,
58 uic, 58 uic,
@@ -80,13 +80,13 @@ enum basicRuntimeCheckOption {
80 runtimeCheckStackFrame, 80 runtimeCheckStackFrame,
81 runtimeCheckUninitVariables, 81 runtimeCheckUninitVariables,
82 runtimeBasicCheckAll 82 runtimeBasicCheckAll
83}; 83};
84enum browseInfoOption { 84enum browseInfoOption {
85 brInfoNone, 85 brInfoNone,
86 brAllInfo, 86 brAllInfo,
87 brNoLocalSymbols 87 brNoLocalSymbols
88}; 88};
89enum callingConventionOption { 89enum callingConventionOption {
90 callConventionDefault = -1, 90 callConventionDefault = -1,
91 callConventionCDecl, 91 callConventionCDecl,
92 callConventionFastCall, 92 callConventionFastCall,
@@ -115,19 +115,19 @@ enum ConfigurationTypes {
115}; 115};
116enum debugOption { 116enum debugOption {
117 debugDisabled, 117 debugDisabled,
118 debugOldStyleInfo, 118 debugOldStyleInfo,
119 debugLineInfoOnly, 119 debugLineInfoOnly,
120 debugEnabled, 120 debugEnabled,
121 debugEditAndContinue 121 debugEditAndContinue
122}; 122};
123enum eAppProtectionOption { 123enum eAppProtectionOption {
124 eAppProtectUnchanged, 124 eAppProtectUnchanged,
125 eAppProtectLow, 125 eAppProtectLow,
126 eAppProtectMedium, 126 eAppProtectMedium,
127 eAppProtectHigh 127 eAppProtectHigh
128}; 128};
129enum enumResourceLangID { 129enum enumResourceLangID {
130 rcUseDefault = 0, 130 rcUseDefault = 0,
131 rcAfrikaans = 1078, 131 rcAfrikaans = 1078,
132 rcAlbanian = 1052, 132 rcAlbanian = 1052,
133 rcArabicAlgeria = 5121, 133 rcArabicAlgeria = 5121,
@@ -228,13 +228,13 @@ enum enumSccEvent {
228 eProjectInScc, 228 eProjectInScc,
229 ePreDirtyNotification 229 ePreDirtyNotification
230}; 230};
231enum favorSizeOrSpeedOption { 231enum favorSizeOrSpeedOption {
232 favorNone, 232 favorNone,
233 favorSpeed, 233 favorSpeed,
234 favorSize 234 favorSize
235}; 235};
236enum genProxyLanguage { 236enum genProxyLanguage {
237 genProxyNative, 237 genProxyNative,
238 genProxyManaged 238 genProxyManaged
239}; 239};
240enum inlineExpansionOption { 240enum inlineExpansionOption {
@@ -242,18 +242,18 @@ enum inlineExpansionOption {
242 expandOnlyInline, 242 expandOnlyInline,
243 expandAnySuitable 243 expandAnySuitable
244}; 244};
245enum linkIncrementalType { 245enum linkIncrementalType {
246 linkIncrementalDefault, 246 linkIncrementalDefault,
247 linkIncrementalNo, 247 linkIncrementalNo,
248 linkIncrementalYes 248 linkIncrementalYes
249}; 249};
250enum linkProgressOption { 250enum linkProgressOption {
251 linkProgressNotSet, 251 linkProgressNotSet,
252 linkProgressAll, 252 linkProgressAll,
253 linkProgressLibs 253 linkProgressLibs
254}; 254};
255enum machineTypeOption { 255enum machineTypeOption {
256 machineNotSet, 256 machineNotSet,
257 machineX86 257 machineX86
258}; 258};
259enum midlCharOption { 259enum midlCharOption {
@@ -261,13 +261,13 @@ enum midlCharOption {
261 midlCharSigned, 261 midlCharSigned,
262 midlCharAscii7 262 midlCharAscii7
263}; 263};
264enum midlErrorCheckOption { 264enum midlErrorCheckOption {
265 midlEnableCustom, 265 midlEnableCustom,
266 midlDisableAll, 266 midlDisableAll,
267 midlEnableAll 267 midlEnableAll
268}; 268};
269enum midlStructMemberAlignOption { 269enum midlStructMemberAlignOption {
270 midlAlignNotSet, 270 midlAlignNotSet,
271 midlAlignSingleByte, 271 midlAlignSingleByte,
272 midlAlignTwoBytes, 272 midlAlignTwoBytes,
273 midlAlignFourBytes, 273 midlAlignFourBytes,
@@ -281,25 +281,25 @@ enum midlTargetEnvironment {
281}; 281};
282enum midlWarningLevelOption { 282enum midlWarningLevelOption {
283 midlWarningLevel_0, 283 midlWarningLevel_0,
284 midlWarningLevel_1, 284 midlWarningLevel_1,
285 midlWarningLevel_2, 285 midlWarningLevel_2,
286 midlWarningLevel_3, 286 midlWarningLevel_3,
287 midlWarningLevel_4 287 midlWarningLevel_4
288}; 288};
289enum optFoldingType { 289enum optFoldingType {
290 optFoldingDefault, 290 optFoldingDefault,
291 optNoFolding, 291 optNoFolding,
292 optFolding 292 optFolding
293}; 293};
294enum optimizeOption { 294enum optimizeOption {
295 optimizeDisabled, 295 optimizeDisabled,
296 optimizeMinSpace, 296 optimizeMinSpace,
297 optimizeMaxSpeed, 297 optimizeMaxSpeed,
298 optimizeFull, 298 optimizeFull,
299 optimizeCustom 299 optimizeCustom
300}; 300};
301enum optRefType { 301enum optRefType {
302 optReferencesDefault, 302 optReferencesDefault,
303 optNoReferences, 303 optNoReferences,
304 optReferences 304 optReferences
305}; 305};
@@ -309,44 +309,44 @@ enum optWin98Type {
309 optWin98Yes 309 optWin98Yes
310}; 310};
311enum pchOption { 311enum pchOption {
312 pchNone, 312 pchNone,
313 pchCreateUsingSpecific, 313 pchCreateUsingSpecific,
314 pchGenerateAuto, 314 pchGenerateAuto,
315 pchUseUsingSpecific 315 pchUseUsingSpecific
316}; 316};
317enum preprocessOption { 317enum preprocessOption {
318 preprocessNo, 318 preprocessNo,
319 preprocessYes, 319 preprocessYes,
320 preprocessNoLineNumbers 320 preprocessNoLineNumbers
321}; 321};
322enum ProcessorOptimizeOption { 322enum ProcessorOptimizeOption {
323 procOptimizeBlended, 323 procOptimizeBlended,
324 procOptimizePentium, 324 procOptimizePentium,
325 procOptimizePentiumProAndAbove 325 procOptimizePentiumProAndAbove
326}; 326};
327enum RemoteDebuggerType { 327enum RemoteDebuggerType {
328 DbgLocal, 328 DbgLocal,
329 DbgRemote, 329 DbgRemote,
330 DbgRemoteTCPIP 330 DbgRemoteTCPIP
331}; 331};
332enum runtimeLibraryOption { 332enum runtimeLibraryOption {
333 rtMultiThreaded, 333 rtMultiThreaded,
334 rtMultiThreadedDebug, 334 rtMultiThreadedDebug,
335 rtMultiThreadedDLL, 335 rtMultiThreadedDLL,
336 rtMultiThreadedDebugDLL, 336 rtMultiThreadedDebugDLL,
337 rtSingleThreaded, 337 rtSingleThreaded,
338 rtSingleThreadedDebug 338 rtSingleThreadedDebug
339}; 339};
340enum structMemberAlignOption { 340enum structMemberAlignOption {
341 alignNotSet, 341 alignNotSet,
342 alignSingleByte, 342 alignSingleByte,
343 alignTwoBytes, 343 alignTwoBytes,
344 alignFourBytes, 344 alignFourBytes,
345 alignEightBytes, 345 alignEightBytes,
346 alignSixteenBytes 346 alignSixteenBytes
347}; 347};
348enum subSystemOption { 348enum subSystemOption {
349 subSystemNotSet, 349 subSystemNotSet,
350 subSystemConsole, 350 subSystemConsole,
351 subSystemWindows 351 subSystemWindows
352}; 352};
@@ -363,23 +363,23 @@ enum toolSetType {
363 toolSetAll 363 toolSetAll
364}; 364};
365enum TypeOfDebugger { 365enum TypeOfDebugger {
366 DbgNativeOnly, 366 DbgNativeOnly,
367 DbgManagedOnly, 367 DbgManagedOnly,
368 DbgMixed, 368 DbgMixed,
369 DbgAuto 369 DbgAuto
370}; 370};
371enum useOfATL { 371enum useOfATL {
372 useATLNotSet, 372 useATLNotSet,
373 useATLStatic, 373 useATLStatic,
374 useATLDynamic 374 useATLDynamic
375}; 375};
376enum useOfMfc { 376enum useOfMfc {
377 useMfcStdWin, 377 useMfcStdWin,
378 useMfcStatic, 378 useMfcStatic,
379 useMfcDynamic 379 useMfcDynamic
380}; 380};
381enum warningLevelOption { 381enum warningLevelOption {
382 warningLevel_0, 382 warningLevel_0,
383 warningLevel_1, 383 warningLevel_1,
384 warningLevel_2, 384 warningLevel_2,
385 warningLevel_3, 385 warningLevel_3,
@@ -387,34 +387,32 @@ enum warningLevelOption {
387}; 387};
388 388
389class VCToolBase { 389class VCToolBase {
390protected: 390protected:
391 // Functions 391 // Functions
392 VCToolBase(){}; 392 VCToolBase(){};
393 ~VCToolBase(){}; 393 virtual ~VCToolBase(){}
394 virtual bool parseOption( const char* option ) = 0; 394 virtual bool parseOption( const char* option ) = 0;
395public: 395public:
396 bool parseOptions( QStringList& options ) { 396 void parseOptions( QStringList& options ) {
397 bool result = TRUE; 397 for ( QStringList::ConstIterator it=options.begin(); (it!=options.end()); it++ )
398 for ( QStringList::ConstIterator it=options.begin(); (it!=options.end()) && result; it++ ) 398 parseOption( (*it).latin1() );
399 result = parseOption( (*it).latin1() );
400 return result;
401 } 399 }
402}; 400};
403 401
404class VCConfiguration; 402class VCConfiguration;
405class VCProject; 403class VCProject;
406 404
407class VCCLCompilerTool : public VCToolBase 405class VCCLCompilerTool : public VCToolBase
408{ 406{
409public: 407public:
410 // Functions 408 // Functions
411 VCCLCompilerTool(); 409 VCCLCompilerTool();
412 ~VCCLCompilerTool(){}; 410 virtual ~VCCLCompilerTool(){}
413 virtual bool parseOption( const char* option ); 411 bool parseOption( const char* option );
414 412
415 // Variables 413 // Variables
416 QStringList AdditionalIncludeDirectories; 414 QStringList AdditionalIncludeDirectories;
417 QStringList AdditionalOptions; 415 QStringList AdditionalOptions;
418 QStringList AdditionalUsingDirectories; 416 QStringList AdditionalUsingDirectories;
419 QString AssemblerListingLocation; 417 QString AssemblerListingLocation;
420 asmListingOption AssemblerOutput; 418 asmListingOption AssemblerOutput;
@@ -477,14 +475,14 @@ public:
477 475
478class VCLinkerTool : public VCToolBase 476class VCLinkerTool : public VCToolBase
479{ 477{
480public: 478public:
481 // Functions 479 // Functions
482 VCLinkerTool(); 480 VCLinkerTool();
483 ~VCLinkerTool(){}; 481 virtual ~VCLinkerTool(){}
484 virtual bool parseOption( const char* option ); 482 bool parseOption( const char* option );
485 483
486 // Variables 484 // Variables
487 QStringList AdditionalDependencies; 485 QStringList AdditionalDependencies;
488 QStringList AdditionalLibraryDirectories; 486 QStringList AdditionalLibraryDirectories;
489 QStringList AdditionalOptions; 487 QStringList AdditionalOptions;
490 QStringList AddModuleNamesToAssembly; 488 QStringList AddModuleNamesToAssembly;
@@ -542,14 +540,14 @@ public:
542 540
543class VCMIDLTool : public VCToolBase 541class VCMIDLTool : public VCToolBase
544{ 542{
545public: 543public:
546 // Functions 544 // Functions
547 VCMIDLTool(); 545 VCMIDLTool();
548 ~VCMIDLTool(){}; 546 virtual ~VCMIDLTool(){}
549 virtual bool parseOption( const char* option ); 547 bool parseOption( const char* option );
550 548
551 // Variables 549 // Variables
552 QStringList AdditionalIncludeDirectories; 550 QStringList AdditionalIncludeDirectories;
553 QStringList AdditionalOptions; 551 QStringList AdditionalOptions;
554 QStringList CPreprocessOptions; 552 QStringList CPreprocessOptions;
555 midlCharOption DefaultCharType; 553 midlCharOption DefaultCharType;
@@ -584,14 +582,14 @@ public:
584 582
585class VCLibrarianTool : public VCToolBase 583class VCLibrarianTool : public VCToolBase
586{ 584{
587public: 585public:
588 // Functions 586 // Functions
589 VCLibrarianTool(); 587 VCLibrarianTool();
590 ~VCLibrarianTool(){}; 588 virtual ~VCLibrarianTool(){}
591 virtual bool parseOption( const char* option ){ return FALSE; }; 589 bool parseOption( const char* ){ return FALSE; };
592 590
593 // Variables 591 // Variables
594 QStringList AdditionalDependencies; 592 QStringList AdditionalDependencies;
595 QStringList AdditionalLibraryDirectories; 593 QStringList AdditionalLibraryDirectories;
596 QStringList AdditionalOptions; 594 QStringList AdditionalOptions;
597 QStringList ExportNamedFunctions; 595 QStringList ExportNamedFunctions;
@@ -605,14 +603,14 @@ public:
605 603
606class VCCustomBuildTool : public VCToolBase 604class VCCustomBuildTool : public VCToolBase
607{ 605{
608public: 606public:
609 // Functions 607 // Functions
610 VCCustomBuildTool(); 608 VCCustomBuildTool();
611 ~VCCustomBuildTool(){}; 609 virtual ~VCCustomBuildTool(){}
612 virtual bool parseOption( const char* option ){ return FALSE; }; 610 bool parseOption( const char* ){ return FALSE; };
613 611
614 // Variables 612 // Variables
615 QStringList AdditionalDependencies; 613 QStringList AdditionalDependencies;
616 QString CommandLine; 614 QString CommandLine;
617 QString Description; 615 QString Description;
618 QString Outputs; 616 QString Outputs;
@@ -622,14 +620,14 @@ public:
622 620
623class VCResourceCompilerTool : public VCToolBase 621class VCResourceCompilerTool : public VCToolBase
624{ 622{
625public: 623public:
626 // Functions 624 // Functions
627 VCResourceCompilerTool(); 625 VCResourceCompilerTool();
628 ~VCResourceCompilerTool(){}; 626 virtual ~VCResourceCompilerTool(){}
629 virtual bool parseOption( const char* option ){ return FALSE; }; 627 bool parseOption( const char* ){ return FALSE; };
630 628
631 // Variables 629 // Variables
632 QStringList AdditionalIncludeDirectories; 630 QStringList AdditionalIncludeDirectories;
633 QStringList AdditionalOptions; 631 QStringList AdditionalOptions;
634 enumResourceLangID Culture; 632 enumResourceLangID Culture;
635 QStringList FullIncludePath; 633 QStringList FullIncludePath;
@@ -642,51 +640,51 @@ public:
642 640
643class VCEventTool : public VCToolBase 641class VCEventTool : public VCToolBase
644{ 642{
645protected: 643protected:
646 // Functions 644 // Functions
647 VCEventTool() : ExcludedFromBuild( unset ){}; 645 VCEventTool() : ExcludedFromBuild( unset ){};
648 ~VCEventTool(){}; 646 virtual ~VCEventTool(){}
649 virtual bool parseOption( const char* option ){ return FALSE; }; 647 bool parseOption( const char* ){ return FALSE; };
650 648
651public: 649public:
652 // Variables 650 // Variables
653 QString CommandLine; 651 QString CommandLine;
654 QString Description; 652 QString Description;
655 triState ExcludedFromBuild; 653 triState ExcludedFromBuild;
656 QString ToolName; 654 QString ToolName;
657 QString ToolPath; 655 QString ToolPath;
658}; 656};
659 657
660class VCPostBuildEventTool : public VCEventTool 658class VCPostBuildEventTool : public VCEventTool
661{ 659{
662public: 660public:
663 VCPostBuildEventTool(); 661 VCPostBuildEventTool();
664 ~VCPostBuildEventTool(){}; 662 ~VCPostBuildEventTool(){}
665}; 663};
666 664
667class VCPreBuildEventTool : public VCEventTool 665class VCPreBuildEventTool : public VCEventTool
668{ 666{
669public: 667public:
670 VCPreBuildEventTool(); 668 VCPreBuildEventTool();
671 ~VCPreBuildEventTool(){}; 669 ~VCPreBuildEventTool(){}
672}; 670};
673 671
674class VCPreLinkEventTool : public VCEventTool 672class VCPreLinkEventTool : public VCEventTool
675{ 673{
676public: 674public:
677 VCPreLinkEventTool(); 675 VCPreLinkEventTool();
678 ~VCPreLinkEventTool(){}; 676 ~VCPreLinkEventTool(){}
679}; 677};
680 678
681class VCConfiguration 679class VCConfiguration
682{ 680{
683public: 681public:
684 // Functions 682 // Functions
685 VCConfiguration(); 683 VCConfiguration();
686 ~VCConfiguration(){}; 684 ~VCConfiguration(){}
687 685
688 // Variables 686 // Variables
689 triState ATLMinimizesCRunTimeLibraryUsage; 687 triState ATLMinimizesCRunTimeLibraryUsage;
690 triState BuildBrowserInformation; 688 triState BuildBrowserInformation;
691 charSet CharacterSet; 689 charSet CharacterSet;
692 ConfigurationTypesConfigurationType; 690 ConfigurationTypesConfigurationType;
@@ -717,13 +715,13 @@ public:
717class VcprojGenerator; 715class VcprojGenerator;
718class VCFilter 716class VCFilter
719{ 717{
720public: 718public:
721 // Functions 719 // Functions
722 VCFilter(); 720 VCFilter();
723 ~VCFilter(){}; 721 ~VCFilter(){}
724 void generateMOC( QTextStream &strm, QString str ) const; 722 void generateMOC( QTextStream &strm, QString str ) const;
725 void generateUIC( QTextStream &strm, const QString& str ) const; 723 void generateUIC( QTextStream &strm, const QString& str ) const;
726 724
727 // Variables 725 // Variables
728 QString Name; 726 QString Name;
729 QString Filter; 727 QString Filter;
@@ -736,13 +734,13 @@ public:
736 734
737class VCProject 735class VCProject
738{ 736{
739public: 737public:
740 // Functions 738 // Functions
741 VCProject(); 739 VCProject();
742 ~VCProject(){}; 740 ~VCProject(){}
743 741
744 // Variables 742 // Variables
745 QString Name; 743 QString Name;
746 QString Version; 744 QString Version;
747 QString ProjectGUID; 745 QString ProjectGUID;
748 QString SccProjectName; 746 QString SccProjectName;
diff --git a/qmake/generators/win32/msvc_vcproj.cpp b/qmake/generators/win32/msvc_vcproj.cpp
index a2bb6e9..d2cbc31 100644
--- a/qmake/generators/win32/msvc_vcproj.cpp
+++ b/qmake/generators/win32/msvc_vcproj.cpp
@@ -2,13 +2,13 @@
2** $Id$ 2** $Id$
3** 3**
4** Definition of VcprojGenerator class. 4** Definition of VcprojGenerator class.
5** 5**
6** Created : 970521 6** Created : 970521
7** 7**
8** Copyright (C) 1992-2000 Trolltech AS. All rights reserved. 8** Copyright (C) 1992-2002 Trolltech AS. All rights reserved.
9** 9**
10** This file is part of the network module of the Qt GUI Toolkit. 10** This file is part of the network module of the Qt GUI Toolkit.
11** 11**
12** This file may be distributed under the terms of the Q Public License 12** 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 13** as defined by Trolltech AS of Norway and appearing in the file
14** LICENSE.QPL included in the packaging of this file. 14** LICENSE.QPL included in the packaging of this file.
@@ -35,68 +35,153 @@
35** 35**
36**********************************************************************/ 36**********************************************************************/
37 37
38#include "msvc_vcproj.h" 38#include "msvc_vcproj.h"
39#include "option.h" 39#include "option.h"
40#include <qdir.h> 40#include <qdir.h>
41#include <stdlib.h>
42#include <qregexp.h> 41#include <qregexp.h>
42#include <qdict.h>
43#include <quuid.h>
44#include <stdlib.h>
43 45
44#if defined(Q_OS_WIN32) 46#if defined(Q_OS_WIN32)
45#include <objbase.h> 47#include <objbase.h>
48#ifndef GUID_DEFINED
49#define GUID_DEFINED
50typedef struct _GUID
51{
52 ulong Data1;
53 ushort Data2;
54 ushort Data3;
55 uchar Data4[8];
56} GUID;
57#endif
46#endif 58#endif
47 59
60// Flatfile Tags ----------------------------------------------------
61 const char* _snlHeader = "Microsoft Visual Studio Solution File, Format Version 7.00";
62 // The following UUID _may_ change for later servicepacks...
63 // If so we need to search through the registry at
64 // HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\7.0\Projects
65 // to find the subkey that contains a "PossibleProjectExtension"
66 // containing "vcproj"...
67 // Use the hardcoded value for now so projects generated on other
68 // platforms are actually usable.
69const char* _snlMSVCvcprojGUID = "{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}";
70 const char* _snlProjectBeg= "\nProject(\"";
71 const char* _snlProjectMid= "\") = ";
72 const char* _snlProjectEnd= "\nEndProject";
73 const char* _snlGlobalBeg= "\nGlobal";
74 const char* _snlGlobalEnd= "\nEndGlobal";
75 const char* _snlSolutionConf= "\n\tGlobalSection(SolutionConfiguration) = preSolution"
76 "\n\t\tConfigName.0 = Release"
77 "\n\tEndGlobalSection";
78 const char* _snlProjDepBeg= "\n\tGlobalSection(ProjectDependencies) = postSolution";
79 const char* _snlProjDepEnd= "\n\tEndGlobalSection";
80 const char* _snlProjConfBeg= "\n\tGlobalSection(ProjectConfiguration) = postSolution";
81 const char* _snlProjConfTag1= ".Release.ActiveCfg = Release|Win32";
82 const char* _snlProjConfTag2= ".Release.Build.0 = Release|Win32";
83 const char* _snlProjConfEnd= "\n\tEndGlobalSection";
84 const char* _snlExtSections= "\n\tGlobalSection(ExtensibilityGlobals) = postSolution"
85 "\n\tEndGlobalSection"
86 "\n\tGlobalSection(ExtensibilityAddIns) = postSolution"
87 "\n\tEndGlobalSection";
88// ------------------------------------------------------------------
89
48VcprojGenerator::VcprojGenerator(QMakeProject *p) : Win32MakefileGenerator(p), init_flag(FALSE) 90VcprojGenerator::VcprojGenerator(QMakeProject *p) : Win32MakefileGenerator(p), init_flag(FALSE)
49{ 91{
50} 92}
51 93
52/* \internal 94/* \internal
53 Generates a project file for the given profile. 95 Generates a project file for the given profile.
54 Options are either a Visual Studio projectfiles, or 96 Options are either a Visual Studio projectfiles, or
55 recursive projectfiles.. Maybe we can make .sln files 97 solutionfiles by parsing recursive projectdirectories.
56 someday?
57*/ 98*/
58bool VcprojGenerator::writeMakefile(QTextStream &t) 99bool VcprojGenerator::writeMakefile(QTextStream &t)
59{ 100{
60 // Check if all requirements are fullfilled 101 // Check if all requirements are fullfilled
61 if(!project->variables()["QMAKE_FAILED_REQUIREMENTS"].isEmpty()) { 102 if(!project->variables()["QMAKE_FAILED_REQUIREMENTS"].isEmpty()) {
62 fprintf(stderr, "Project file not generated because all requirements not met:\n\t%s\n", 103 fprintf(stderr, "Project file not generated because all requirements not met:\n\t%s\n",
63 var("QMAKE_FAILED_REQUIREMENTS").latin1()); 104 var("QMAKE_FAILED_REQUIREMENTS").latin1());
64 return TRUE; 105 return TRUE;
65 } 106 }
66 107
67 // Generate full project file 108 // Generate project file
68 if(project->first("TEMPLATE") == "vcapp" || 109 if(project->first("TEMPLATE") == "vcapp" ||
69 project->first("TEMPLATE") == "vclib") { 110 project->first("TEMPLATE") == "vclib") {
70 debug_msg(1, "Generator: MSVC.NET: Writing project file" ); 111 debug_msg(1, "Generator: MSVC.NET: Writing project file" );
71 t << vcProject; 112 t << vcProject;
72 return TRUE; 113 return TRUE;
73 } else if(project->first("TEMPLATE") == "vcsubdirs") { // Generate recursive project 114 }
115 // Generate solution file
116 else if(project->first("TEMPLATE") == "vcsubdirs") {
74 debug_msg(1, "Generator: MSVC.NET: Writing solution file" ); 117 debug_msg(1, "Generator: MSVC.NET: Writing solution file" );
75 writeSubDirs(t); 118 writeSubDirs(t);
76 return TRUE; 119 return TRUE;
77 } 120 }
78 return FALSE; 121 return FALSE;
79 122
80} 123}
81 124
82struct VcsolutionDepend { 125struct VcsolutionDepend {
126 QString uuid;
83 QString vcprojFile, orig_target, target; 127 QString vcprojFile, orig_target, target;
128 ::target targetType;
84 QStringList dependencies; 129 QStringList dependencies;
85}; 130};
86 131
132QUuid VcprojGenerator::increaseUUID( const QUuid &id )
133{
134 QUuid result( id );
135 Q_LONG dataFirst = (result.data4[0] << 24) +
136 (result.data4[1] << 16) +
137 (result.data4[2] << 8) +
138 result.data4[3];
139 Q_LONG dataLast = (result.data4[4] << 24) +
140 (result.data4[5] << 16) +
141 (result.data4[6] << 8) +
142 result.data4[7];
143
144 if ( !(dataLast++) )
145 dataFirst++;
146
147 result.data4[0] = uchar((dataFirst >> 24) & 0xff);
148 result.data4[1] = uchar((dataFirst >> 16) & 0xff);
149 result.data4[2] = uchar((dataFirst >> 8) & 0xff);
150 result.data4[3] = uchar( dataFirst & 0xff);
151 result.data4[4] = uchar((dataLast >> 24) & 0xff);
152 result.data4[5] = uchar((dataLast >> 16) & 0xff);
153 result.data4[6] = uchar((dataLast >> 8) & 0xff);
154 result.data4[7] = uchar( dataLast & 0xff);
155 return result;
156}
157
87void VcprojGenerator::writeSubDirs(QTextStream &t) 158void VcprojGenerator::writeSubDirs(QTextStream &t)
88{ 159{
89 if(project->first("TEMPLATE") == "subdirs") { 160 if(project->first("TEMPLATE") == "subdirs") {
90 writeHeader(t); 161 writeHeader(t);
91 Win32MakefileGenerator::writeSubDirs(t); 162 Win32MakefileGenerator::writeSubDirs(t);
92 return; 163 return;
93 } 164 }
94 165
95 QPtrList<VcsolutionDepend> solution_depends; 166 t << _snlHeader;
96 solution_depends.setAutoDelete(TRUE); 167 QUuid solutionGUID;
168#if defined(Q_WS_WIN32)
169 GUID guid;
170 HRESULT h = CoCreateGuid( &guid );
171 if ( h == S_OK )
172 solutionGUID = QUuid( guid );
173#else
174 // Qt doesn't support GUID on other platforms yet,
175 // so we use the all-zero uuid, and increase that.
176#endif
177
178
179 QDict<VcsolutionDepend> solution_depends;
180 QPtrList<VcsolutionDepend> solution_cleanup;
181 solution_cleanup.setAutoDelete(TRUE);
97 QStringList subdirs = project->variables()["SUBDIRS"]; 182 QStringList subdirs = project->variables()["SUBDIRS"];
98 QString oldpwd = QDir::currentDirPath(); 183 QString oldpwd = QDir::currentDirPath();
99 for(QStringList::Iterator it = subdirs.begin(); it != subdirs.end(); ++it) { 184 for(QStringList::Iterator it = subdirs.begin(); it != subdirs.end(); ++it) {
100 QFileInfo fi(Option::fixPathToLocalOS((*it), TRUE)); 185 QFileInfo fi(Option::fixPathToLocalOS((*it), TRUE));
101 if(fi.exists()) { 186 if(fi.exists()) {
102 if(fi.isDir()) { 187 if(fi.isDir()) {
@@ -113,78 +198,109 @@ void VcprojGenerator::writeSubDirs(QTextStream &t)
113 fprintf(stderr, "Cannot find directory: %s\n", dir.latin1()); 198 fprintf(stderr, "Cannot find directory: %s\n", dir.latin1());
114 } 199 }
115 if(tmp_proj.read(fn, oldpwd)) { 200 if(tmp_proj.read(fn, oldpwd)) {
116 if(tmp_proj.first("TEMPLATE") == "vcsubdirs") { 201 if(tmp_proj.first("TEMPLATE") == "vcsubdirs") {
117 QStringList tmp_subdirs = fileFixify(tmp_proj.variables()["SUBDIRS"]); 202 QStringList tmp_subdirs = fileFixify(tmp_proj.variables()["SUBDIRS"]);
118 subdirs += tmp_subdirs; 203 subdirs += tmp_subdirs;
119 } else if(tmp_proj.first("TEMPLATE") == "vcapp" || 204 } else if(tmp_proj.first("TEMPLATE") == "vcapp" || tmp_proj.first("TEMPLATE") == "vclib") {
120 tmp_proj.first("TEMPLATE") == "vclib") { 205 // Initialize a 'fake' project to get the correct variables
121 QString vcproj = fi.baseName() + project->first("VCPROJ_EXTENSION"); 206 // and to be able to extract all the dependencies
122 if(QFile::exists(vcproj) || 1) { 207 VcprojGenerator tmp_vcproj(&tmp_proj);
123 VcprojGenerator tmp_dsp(&tmp_proj); 208 tmp_vcproj.setNoIO(TRUE);
124 tmp_dsp.setNoIO(TRUE); 209 tmp_vcproj.init();
125 tmp_dsp.init(); 210 if(Option::debug_level) {
126 if(Option::debug_level) { 211 QMap<QString, QStringList> &vars = tmp_proj.variables();
127 QMap<QString, QStringList> &vars = tmp_proj.variables(); 212 for(QMap<QString, QStringList>::Iterator it = vars.begin();
128 for(QMap<QString, QStringList>::Iterator it = vars.begin(); 213 it != vars.end(); ++it) {
129 it != vars.end(); ++it) { 214 if(it.key().left(1) != "." && !it.data().isEmpty())
130 if(it.key().left(1) != "." && !it.data().isEmpty()) 215 debug_msg(1, "%s: %s === %s", fn.latin1(), it.key().latin1(),
131 debug_msg(1, "%s: %s === %s", fn.latin1(), it.key().latin1(), 216 it.data().join(" :: ").latin1());
132 it.data().join(" :: ").latin1());
133 }
134 } 217 }
135 VcsolutionDepend *newDep = new VcsolutionDepend; 218 }
136 newDep->vcprojFile = fileFixify(vcproj); 219
137 newDep->orig_target = tmp_proj.first("QMAKE_ORIG_TARGET"); 220 // We assume project filename is [QMAKE_ORIG_TARGET].vcproj
138 newDep->target = tmp_proj.first("TARGET").section(Option::dir_sep, -1); 221 QString vcproj = fixFilename(tmp_vcproj.project->first("QMAKE_ORIG_TARGET")) + project->first("VCPROJ_EXTENSION");
139 if(newDep->target.endsWith(".dll")) 222
140 newDep->target = newDep->target.left(newDep->target.length()-3) + "lib"; 223 // If file doesn't exsist, then maybe the users configuration
141 if(!tmp_proj.isEmpty("FORMS")) 224 // doesn't allow it to be created. Skip to next...
142 newDep->dependencies << "uic.exe"; 225 if(!QFile::exists(QDir::currentDirPath() + Option::dir_sep + vcproj)) {
143 { 226 qDebug( "Ignored (not found) '%s'", QString(QDir::currentDirPath() + Option::dir_sep + vcproj).latin1() );
144 QStringList where("QMAKE_LIBS"); 227 goto nextfile; // # Dirty!
145 if(!tmp_proj.isEmpty("QMAKE_INTERNAL_PRL_LIBS")) 228 }
146 where = tmp_proj.variables()["QMAKE_INTERNAL_PRL_LIBS"]; 229
147 for(QStringList::iterator wit = where.begin(); 230 VcsolutionDepend *newDep = new VcsolutionDepend;
148 wit != where.end(); ++wit) { 231 newDep->vcprojFile = fileFixify(vcproj);
149 QStringList &l = tmp_proj.variables()[(*wit)]; 232 newDep->orig_target = tmp_proj.first("QMAKE_ORIG_TARGET");
150 for(QStringList::Iterator it = l.begin(); it != l.end(); ++it) { 233 newDep->target = tmp_proj.first("TARGET").section(Option::dir_sep, -1);
151 QString opt = (*it); 234 newDep->targetType = tmp_vcproj.projectTarget;
152 if(!opt.startsWith("/")) //Not a switch 235 {
153 newDep->dependencies << opt.section(Option::dir_sep, -1); 236 static QUuid uuid = solutionGUID;
154 } 237 uuid = increaseUUID( uuid );
238 newDep->uuid = uuid.toString().upper();
239 }
240 if(newDep->target.endsWith(".dll"))
241 newDep->target = newDep->target.left(newDep->target.length()-3) + "lib";
242 if(!tmp_proj.isEmpty("FORMS"))
243 newDep->dependencies << "uic.exe";
244 {
245 QStringList where("QMAKE_LIBS");
246 if(!tmp_proj.isEmpty("QMAKE_INTERNAL_PRL_LIBS"))
247 where = tmp_proj.variables()["QMAKE_INTERNAL_PRL_LIBS"];
248 for(QStringList::iterator wit = where.begin();
249 wit != where.end(); ++wit) {
250 QStringList &l = tmp_proj.variables()[(*wit)];
251 for(QStringList::Iterator it = l.begin(); it != l.end(); ++it) {
252 QString opt = (*it);
253 if(!opt.startsWith("/")) //Not a switch
254 newDep->dependencies << opt.section(Option::dir_sep, -1);
155 } 255 }
156 } 256 }
157 solution_depends.append(newDep);
158 } 257 }
258 solution_cleanup.append(newDep);
259 solution_depends.insert(newDep->target, newDep);
260 {
261 QRegExp libVersion("[0-9]{3,3}\\.lib$");
262 if(libVersion.search(newDep->target) != -1)
263 solution_depends.insert(newDep->target.left(newDep->target.length() -
264 libVersion.matchedLength()) + ".lib", newDep);
265 }
266 t << _snlProjectBeg << _snlMSVCvcprojGUID << _snlProjectMid
267 << "\"" << newDep->orig_target << "\", \"" << newDep->vcprojFile
268 << "\", \"" << newDep->uuid << "\"";
269 t << _snlProjectEnd;
159 } 270 }
160 } 271 }
272nextfile:
161 QDir::setCurrent(oldpwd); 273 QDir::setCurrent(oldpwd);
162 } 274 }
163 } 275 }
164 } 276 }
165 277 t << _snlGlobalBeg;
166 VcsolutionDepend *vc; 278 t << _snlSolutionConf;
167 QMap<QString, int> uuids; 279 t << _snlProjDepBeg;
168 QRegExp libVersion("[0-9]{3,3}\\.lib$"); 280 for(solution_cleanup.first(); solution_cleanup.current(); solution_cleanup.next()) {
169 for(vc = solution_depends.first(); vc; vc = solution_depends.next()) { 281 int cnt = 0;
170 static int uuid = 666; 282 for(QStringList::iterator dit = solution_cleanup.current()->dependencies.begin();
171 uuids.insert(vc->target, uuid); 283 dit != solution_cleanup.current()->dependencies.end();
172 if(libVersion.match(vc->target) != -1) 284 ++dit) {
173 uuids.insert(vc->target.left(vc->target.length() - libVersion.matchedLength()) + ".lib", 285 VcsolutionDepend *vc;
174 uuid); 286 if((vc=solution_depends[*dit])) {
175 t << "\"" << vc->orig_target << "\" \"" << vc->vcprojFile << "\" { " << uuid << " }" << endl; 287 if(solution_cleanup.current()->targetType != StaticLib || vc->targetType == Application)
176 uuid++; 288 t << "\n\t\t" << solution_cleanup.current()->uuid << "." << cnt++ << " = " << vc->uuid;
177 } 289 }
178 for(vc = solution_depends.first(); vc; vc = solution_depends.next()) {
179 int uuid = uuids[vc->target], cnt = 0;
180 for(QStringList::iterator dit = vc->dependencies.begin(); dit != vc->dependencies.end(); ++dit) {
181 if(uuids.contains((*dit)))
182 t << uuid << "." << cnt++ << " = " << uuids[(*dit)] << endl;
183 } 290 }
184 } 291 }
292 t << _snlProjDepEnd;
293 t << _snlProjConfBeg;
294 for(solution_cleanup.first(); solution_cleanup.current(); solution_cleanup.next()) {
295 t << "\n\t\t" << solution_cleanup.current()->uuid << _snlProjConfTag1;
296 t << "\n\t\t" << solution_cleanup.current()->uuid << _snlProjConfTag2;
297 }
298 t << _snlProjConfEnd;
299 t << _snlExtSections;
300 t << _snlGlobalEnd;
185} 301}
186 302
187// ------------------------------------------------------------------------------------------------ 303// ------------------------------------------------------------------------------------------------
188// ------------------------------------------------------------------------------------------------ 304// ------------------------------------------------------------------------------------------------
189 305
190void VcprojGenerator::init() 306void VcprojGenerator::init()
@@ -303,18 +419,18 @@ void VcprojGenerator::initConfiguration()
303 break; 419 break;
304 case Application: 420 case Application:
305 default: 421 default:
306 vcProject.Configuration.ConfigurationType = typeApplication; 422 vcProject.Configuration.ConfigurationType = typeApplication;
307 break; 423 break;
308 } 424 }
309 vcProject.Configuration.Name = ( project->isActiveConfig( "release" ) ? "Release|" : "Debug|" ); 425 vcProject.Configuration.Name = ( project->isActiveConfig( "debug" ) ? "Debug|" : "Release|" );
310 vcProject.Configuration.Name += ( vcProject.Configuration.idl.TargetEnvironment == midlTargetWin64 ? "Win64" : "Win32" ); 426 vcProject.Configuration.Name += ( vcProject.Configuration.idl.TargetEnvironment == midlTargetWin64 ? "Win64" : "Win32" );
311 vcProject.Configuration.ATLMinimizesCRunTimeLibraryUsage = ( project->first("ATLMinimizesCRunTimeLibraryUsage").isEmpty() ? _False : _True ); 427 vcProject.Configuration.ATLMinimizesCRunTimeLibraryUsage = ( project->first("ATLMinimizesCRunTimeLibraryUsage").isEmpty() ? _False : _True );
312 vcProject.Configuration.BuildBrowserInformation = triState( temp.isEmpty() ? unset : temp.toShort() ); 428 vcProject.Configuration.BuildBrowserInformation = triState( temp.isEmpty() ? (short)unset : temp.toShort() );
313 temp = project->first("CharacterSet"); 429 temp = project->first("CharacterSet");
314 vcProject.Configuration.CharacterSet = charSet( temp.isEmpty() ? charSetNotSet : temp.toShort() ); 430 vcProject.Configuration.CharacterSet = charSet( temp.isEmpty() ? (short)charSetNotSet : temp.toShort() );
315 vcProject.Configuration.DeleteExtensionsOnClean = project->first("DeleteExtensionsOnClean"); 431 vcProject.Configuration.DeleteExtensionsOnClean = project->first("DeleteExtensionsOnClean");
316 vcProject.Configuration.ImportLibrary = vcProject.Configuration.linker.ImportLibrary; 432 vcProject.Configuration.ImportLibrary = vcProject.Configuration.linker.ImportLibrary;
317 vcProject.Configuration.IntermediateDirectory = project->first("OBJECTS_DIR"); 433 vcProject.Configuration.IntermediateDirectory = project->first("OBJECTS_DIR");
318// temp = (projectTarget == StaticLib) ? project->first("DESTDIR"):project->first("DLLDESTDIR"); 434// temp = (projectTarget == StaticLib) ? project->first("DESTDIR"):project->first("DLLDESTDIR");
319 vcProject.Configuration.OutputDirectory = "."; //( temp.isEmpty() ? QString(".") : temp ); 435 vcProject.Configuration.OutputDirectory = "."; //( temp.isEmpty() ? QString(".") : temp );
320 vcProject.Configuration.PrimaryOutput = project->first("PrimaryOutput"); 436 vcProject.Configuration.PrimaryOutput = project->first("PrimaryOutput");
@@ -335,13 +451,13 @@ void VcprojGenerator::initConfiguration()
335} 451}
336 452
337void VcprojGenerator::initCompilerTool() 453void VcprojGenerator::initCompilerTool()
338{ 454{
339 QString placement = project->first("OBJECTS_DIR"); 455 QString placement = project->first("OBJECTS_DIR");
340 if ( placement.isEmpty() ) 456 if ( placement.isEmpty() )
341 placement = project->isActiveConfig( "release" )? ".\\Release\\":".\\Debug\\"; 457 placement = ".\\";
342 458
343 vcProject.Configuration.compiler.AssemblerListingLocation = placement ; 459 vcProject.Configuration.compiler.AssemblerListingLocation = placement ;
344 vcProject.Configuration.compiler.ProgramDataBaseFileName = placement ; 460 vcProject.Configuration.compiler.ProgramDataBaseFileName = placement ;
345 vcProject.Configuration.compiler.ObjectFile = placement ; 461 vcProject.Configuration.compiler.ObjectFile = placement ;
346 vcProject.Configuration.compiler.PrecompiledHeaderFile = placement + project->first("QMAKE_ORIG_TARGET") + ".pch"; 462 vcProject.Configuration.compiler.PrecompiledHeaderFile = placement + project->first("QMAKE_ORIG_TARGET") + ".pch";
347 463
@@ -359,12 +475,13 @@ void VcprojGenerator::initCompilerTool()
359 } 475 }
360 } else { 476 } else {
361 // Release version 477 // Release version
362 vcProject.Configuration.compiler.parseOptions( project->variables()["QMAKE_CXXFLAGS"] ); 478 vcProject.Configuration.compiler.parseOptions( project->variables()["QMAKE_CXXFLAGS"] );
363 vcProject.Configuration.compiler.parseOptions( project->variables()["QMAKE_CXXFLAGS_RELEASE"] ); 479 vcProject.Configuration.compiler.parseOptions( project->variables()["QMAKE_CXXFLAGS_RELEASE"] );
364 vcProject.Configuration.compiler.PreprocessorDefinitions += "QT_NO_DEBUG"; 480 vcProject.Configuration.compiler.PreprocessorDefinitions += "QT_NO_DEBUG";
481 vcProject.Configuration.compiler.PreprocessorDefinitions += "NDEBUG";
365 if ( project->isActiveConfig("thread") ) { 482 if ( project->isActiveConfig("thread") ) {
366 if ( (projectTarget == Application) || (projectTarget == StaticLib) ) 483 if ( (projectTarget == Application) || (projectTarget == StaticLib) )
367 vcProject.Configuration.compiler.parseOptions( project->variables()["QMAKE_CXXFLAGS_MT"] ); 484 vcProject.Configuration.compiler.parseOptions( project->variables()["QMAKE_CXXFLAGS_MT"] );
368 else 485 else
369 vcProject.Configuration.compiler.parseOptions( project->variables()["QMAKE_CXXFLAGS_MT_DLL"] ); 486 vcProject.Configuration.compiler.parseOptions( project->variables()["QMAKE_CXXFLAGS_MT_DLL"] );
370 } else { 487 } else {
@@ -372,13 +489,13 @@ void VcprojGenerator::initCompilerTool()
372 } 489 }
373 } 490 }
374 491
375 // Common for both release and debug 492 // Common for both release and debug
376 if ( project->isActiveConfig("warn_off") ) 493 if ( project->isActiveConfig("warn_off") )
377 vcProject.Configuration.compiler.parseOptions( project->variables()["QMAKE_CXXFLAGS_WARN_OFF"] ); 494 vcProject.Configuration.compiler.parseOptions( project->variables()["QMAKE_CXXFLAGS_WARN_OFF"] );
378 else 495 else if ( project->isActiveConfig("warn_on") )
379 vcProject.Configuration.compiler.parseOptions( project->variables()["QMAKE_CXXFLAGS_WARN_ON"] ); 496 vcProject.Configuration.compiler.parseOptions( project->variables()["QMAKE_CXXFLAGS_WARN_ON"] );
380 if ( project->isActiveConfig("windows") ) 497 if ( project->isActiveConfig("windows") )
381 vcProject.Configuration.compiler.PreprocessorDefinitions += project->variables()["MSVCPROJ_WINCONDEF"]; 498 vcProject.Configuration.compiler.PreprocessorDefinitions += project->variables()["MSVCPROJ_WINCONDEF"];
382 499
383 // Can this be set for ALL configs? 500 // Can this be set for ALL configs?
384 // If so, use qmake.conf! 501 // If so, use qmake.conf!
@@ -405,19 +522,21 @@ void VcprojGenerator::initLibrarianTool()
405void VcprojGenerator::initLinkerTool() 522void VcprojGenerator::initLinkerTool()
406{ 523{
407 vcProject.Configuration.linker.parseOptions( project->variables()["MSVCPROJ_LFLAGS"] ); 524 vcProject.Configuration.linker.parseOptions( project->variables()["MSVCPROJ_LFLAGS"] );
408 vcProject.Configuration.linker.AdditionalDependencies += project->variables()["MSVCPROJ_LIBS"]; 525 vcProject.Configuration.linker.AdditionalDependencies += project->variables()["MSVCPROJ_LIBS"];
409 526
410 switch ( projectTarget ) { 527 switch ( projectTarget ) {
411 case Application: 528 case Application:
412 vcProject.Configuration.linker.OutputFile = project->first( "DESTDIR" ); 529 vcProject.Configuration.linker.OutputFile = project->first( "DESTDIR" );
413 break; 530 break;
414 case SharedLib: 531 case SharedLib:
415 vcProject.Configuration.linker.parseOptions( project->variables()["MSVCPROJ_LIBOPTIONS"] ); 532 vcProject.Configuration.linker.parseOptions( project->variables()["MSVCPROJ_LIBOPTIONS"] );
416 vcProject.Configuration.linker.OutputFile = project->first( "DLLDESTDIR" ); 533 vcProject.Configuration.linker.OutputFile = project->first( "DLLDESTDIR" );
417 break; 534 break;
535 case StaticLib: //unhandled - added to remove warnings..
536 break;
418 } 537 }
419 538
420 if( vcProject.Configuration.linker.OutputFile.isEmpty() ) 539 if( vcProject.Configuration.linker.OutputFile.isEmpty() )
421 vcProject.Configuration.linker.OutputFile = ".\\"; 540 vcProject.Configuration.linker.OutputFile = ".\\";
422 541
423 if( !vcProject.Configuration.linker.OutputFile.endsWith("\\") ) 542 if( !vcProject.Configuration.linker.OutputFile.endsWith("\\") )
@@ -456,30 +575,46 @@ void VcprojGenerator::initPreBuildEventTools()
456{ 575{
457 QString collectionName = project->first("QMAKE_IMAGE_COLLECTION"); 576 QString collectionName = project->first("QMAKE_IMAGE_COLLECTION");
458 if( !collectionName.isEmpty() ) { 577 if( !collectionName.isEmpty() ) {
459 QStringList& list = project->variables()["IMAGES"]; 578 QStringList& list = project->variables()["IMAGES"];
460 vcProject.Configuration.preBuild.Description = "Generate imagecollection"; 579 vcProject.Configuration.preBuild.Description = "Generate imagecollection";
461 //vcProject.Configuration.preBuild.AdditionalDependencies += list; 580 //vcProject.Configuration.preBuild.AdditionalDependencies += list;
462 vcProject.Configuration.preBuild.CommandLine = project->first("QMAKE_UIC") + " -embed " + project->first("QMAKE_ORIG_TARGET") + " " + list.join(" ") + " -o " + collectionName; 581
582 QFile imgs( ".imgcol" );
583 imgs.open( IO_WriteOnly );
584 QTextStream s( &imgs );
585 QStringList::ConstIterator it = list.begin();
586 while( it!=list.end() ) {
587 s << *it << " ";
588 it++;
589 }
590
591 vcProject.Configuration.preBuild.CommandLine = project->first("QMAKE_UIC") + " -embed " + project->first("QMAKE_ORIG_TARGET") + " -f .imgcol -o " + collectionName;
463 //vcProject.Configuration.preBuild.Outputs = collectionName; 592 //vcProject.Configuration.preBuild.Outputs = collectionName;
464 593
465 } 594 }
466} 595}
467 596
468void VcprojGenerator::initPostBuildEventTools() 597void VcprojGenerator::initPostBuildEventTools()
469{ 598{
599 if ( !project->variables()["QMAKE_POST_LINK"].isEmpty() ) {
600 vcProject.Configuration.postBuild.Description = var("QMAKE_POST_LINK");
601 vcProject.Configuration.postBuild.CommandLine = var("QMAKE_POST_LINK");
602 }
470 if( project->isActiveConfig( "activeqt" ) ) { 603 if( project->isActiveConfig( "activeqt" ) ) {
471 QString name = project->first( "QMAKE_ORIG_TARGET" ); 604 QString name = project->first( "QMAKE_ORIG_TARGET" );
472 QString nameext = project->first( "TARGET" ); 605 QString nameext = project->first( "TARGET" );
473 QString objdir = project->first( "OBJECTS_DIR" ); 606 QString objdir = project->first( "OBJECTS_DIR" );
474 QString idc = project->first( "QMAKE_IDC" ); 607 QString idc = project->first( "QMAKE_IDC" );
475 608
476 vcProject.Configuration.postBuild.Description = "Finalizing ActiveQt server..."; 609 vcProject.Configuration.postBuild.Description = "Finalizing ActiveQt server...";
610 if ( !vcProject.Configuration.postBuild.CommandLine.isEmpty() )
611 vcProject.Configuration.postBuild.CommandLine += " &amp;&amp; ";
477 612
478 if( project->isActiveConfig( "dll" ) ) { // In process 613 if( project->isActiveConfig( "dll" ) ) { // In process
479 vcProject.Configuration.postBuild.CommandLine = 614 vcProject.Configuration.postBuild.CommandLine +=
480 // call idc to generate .idl file from .dll 615 // call idc to generate .idl file from .dll
481 idc + " " + vcProject.Configuration.OutputDirectory + "\\" + nameext + " -idl " + objdir + name + ".idl -version 1.0 &amp;&amp; " + 616 idc + " " + vcProject.Configuration.OutputDirectory + "\\" + nameext + " -idl " + objdir + name + ".idl -version 1.0 &amp;&amp; " +
482 // call midl to create implementations of the .idl file 617 // call midl to create implementations of the .idl file
483 project->first( "QMAKE_IDL" ) + " " + objdir + name + ".idl /nologo /o " + objdir + name + ".midl /tlb " + objdir + name + ".tlb /iid " + objdir + 618 project->first( "QMAKE_IDL" ) + " " + objdir + name + ".idl /nologo /o " + objdir + name + ".midl /tlb " + objdir + name + ".tlb /iid " + objdir +
484 "dump.midl /dlldata " + objdir + "dump.midl /cstub " + objdir + "dump.midl /header " + objdir + "dump.midl /proxy " + objdir + "dump.midl /sstub " + 619 "dump.midl /dlldata " + objdir + "dump.midl /cstub " + objdir + "dump.midl /header " + objdir + "dump.midl /proxy " + objdir + "dump.midl /sstub " +
485 objdir + "dump.midl &amp;&amp; " + 620 objdir + "dump.midl &amp;&amp; " +
@@ -599,39 +734,46 @@ void VcprojGenerator::initResourceFiles()
599 vcProject.ResourceFiles.Files += project->variables()["IDLSOURCES"]; 734 vcProject.ResourceFiles.Files += project->variables()["IDLSOURCES"];
600 vcProject.ResourceFiles.Files.sort(); 735 vcProject.ResourceFiles.Files.sort();
601 vcProject.ResourceFiles.Project = this; 736 vcProject.ResourceFiles.Project = this;
602 vcProject.ResourceFiles.CustomBuild = none; 737 vcProject.ResourceFiles.CustomBuild = none;
603} 738}
604 739
605/*
606// $$MSVCPROJ_IDLSOURCES ---------------------------------------------
607void VcprojGenerator::writeIDLs( QTextStream &t )
608{
609 QStringList &l = project->variables()["MSVCPROJ_IDLSOURCES"];
610 for(QStringList::Iterator it = l.begin(); it != l.end(); ++it) {
611 t << "# Begin Source File" << endl << endl;
612 t << "SOURCE=" << (*it) << endl;
613 t << "# PROP Exclude_From_Build 1" << endl;
614 t << "# End Source File" << endl << endl;
615 }
616 debug_msg(3, "Generator: MSVC.NET: Added IDLs" );
617}
618*/
619
620/* \internal 740/* \internal
621 Sets up all needed variables from the environment and all the different caches and .conf files 741 Sets up all needed variables from the environment and all the different caches and .conf files
622*/ 742*/
623 743
624void VcprojGenerator::initOld() 744void VcprojGenerator::initOld()
625{ 745{
626 if( init_flag ) 746 if( init_flag )
627 return; 747 return;
628 748
629 init_flag = TRUE; 749 init_flag = TRUE;
630 QStringList::Iterator it; 750 QStringList::Iterator it;
631 751
752 if ( project->isActiveConfig("stl") ) {
753 project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_STL_ON"];
754 project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_STL_ON"];
755 } else {
756 project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_STL_OFF"];
757 project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_STL_OFF"];
758 }
759 if ( project->isActiveConfig("exceptions") ) {
760 project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_EXCEPTIONS_ON"];
761 project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_EXCEPTIONS_ON"];
762 } else {
763 project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_EXCEPTIONS_OFF"];
764 project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_EXCEPTIONS_OFF"];
765 }
766 if ( project->isActiveConfig("rtti") ) {
767 project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_RTTI_ON"];
768 project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_RTTI_ON"];
769 } else {
770 project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_RTTI_OFF"];
771 project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_RTTI_OFF"];
772 }
773
632 // this should probably not be here, but I'm using it to wrap the .t files 774 // this should probably not be here, but I'm using it to wrap the .t files
633 if(project->first("TEMPLATE") == "vcapp" ) 775 if(project->first("TEMPLATE") == "vcapp" )
634 project->variables()["QMAKE_APP_FLAG"].append("1"); 776 project->variables()["QMAKE_APP_FLAG"].append("1");
635 else if(project->first("TEMPLATE") == "vclib") 777 else if(project->first("TEMPLATE") == "vclib")
636 project->variables()["QMAKE_LIB_FLAG"].append("1"); 778 project->variables()["QMAKE_LIB_FLAG"].append("1");
637 if ( project->variables()["QMAKESPEC"].isEmpty() ) 779 if ( project->variables()["QMAKESPEC"].isEmpty() )
@@ -785,23 +927,36 @@ void VcprojGenerator::initOld()
785 927
786 project->variables()["MSVCPROJ_VER"] = "7.00"; 928 project->variables()["MSVCPROJ_VER"] = "7.00";
787 project->variables()["MSVCPROJ_DEBUG_OPT"] = "/GZ /ZI"; 929 project->variables()["MSVCPROJ_DEBUG_OPT"] = "/GZ /ZI";
788 930
789 // INCREMENTAL:NO ------------------------------------------------ 931 // INCREMENTAL:NO ------------------------------------------------
790 if(!project->isActiveConfig("incremental")) { 932 if(!project->isActiveConfig("incremental")) {
791 project->variables()["QMAKE_LFLAGS"].append(QString("/incremental:no")); 933 project->variables()["QMAKE_LFLAGS"].append(QString("/INCREMENTAL:no"));
792 if ( is_qt ) 934 if ( is_qt )
793 project->variables()["MSVCPROJ_DEBUG_OPT"] = "/GZ /Zi"; 935 project->variables()["MSVCPROJ_DEBUG_OPT"] = "/GZ /Zi";
794 } 936 }
795 937
796 // MOC ----------------------------------------------------------- 938 // MOC -----------------------------------------------------------
797 if ( project->isActiveConfig("moc") ) 939 if ( project->isActiveConfig("moc") )
798 setMocAware(TRUE); 940 setMocAware(TRUE);
799 941
800 942
801 project->variables()["QMAKE_LIBS"] += project->variables()["LIBS"]; 943 project->variables()["QMAKE_LIBS"] += project->variables()["LIBS"];
944 // Update -lname to name.lib, and -Ldir to
945 QStringList &libList = project->variables()["QMAKE_LIBS"];
946 for( it = libList.begin(); it != libList.end(); ) {
947 QString s = *it;
948 if( s.startsWith( "-l" ) ) {
949 it = libList.remove( it );
950 it = libList.insert( it, s.mid( 2 ) + ".lib" );
951 } else if( s.startsWith( "-L" ) ) {
952 it = libList.remove( it );
953 } else {
954 it++;
955 }
956 }
802 957
803 // Run through all variables containing filepaths, and ----------- 958 // Run through all variables containing filepaths, and -----------
804 // slash-slosh them correctly depending on current OS ----------- 959 // slash-slosh them correctly depending on current OS -----------
805 project->variables()["QMAKE_FILETAGS"] += QStringList::split(' ', "HEADERS SOURCES DEF_FILE RC_FILE TARGET QMAKE_LIBS DESTDIR DLLDESTDIR INCLUDEPATH"); 960 project->variables()["QMAKE_FILETAGS"] += QStringList::split(' ', "HEADERS SOURCES DEF_FILE RC_FILE TARGET QMAKE_LIBS DESTDIR DLLDESTDIR INCLUDEPATH");
806 QStringList &l = project->variables()["QMAKE_FILETAGS"]; 961 QStringList &l = project->variables()["QMAKE_FILETAGS"];
807 for(it = l.begin(); it != l.end(); ++it) { 962 for(it = l.begin(); it != l.end(); ++it) {
@@ -818,14 +973,14 @@ void VcprojGenerator::initOld()
818 targetfilename = msvcproj_project; 973 targetfilename = msvcproj_project;
819 } 974 }
820 975
821 // Save filename w/o extention in $$QMAKE_ORIG_TARGET ------------ 976 // Save filename w/o extention in $$QMAKE_ORIG_TARGET ------------
822 project->variables()["QMAKE_ORIG_TARGET"] = project->variables()["TARGET"]; 977 project->variables()["QMAKE_ORIG_TARGET"] = project->variables()["TARGET"];
823 978
824 // TARGET (add extention to $$TARGET) ---------------------------- 979 // TARGET (add extention to $$TARGET)
825 project->variables()["TARGET"].first() += project->first("TARGET_EXT"); 980 //project->variables()["MSVCPROJ_DEFINES"].append(varGlue(".first() += project->first("TARGET_EXT");
826 981
827 // Init base class too ------------------------------------------- 982 // Init base class too -------------------------------------------
828 MakefileGenerator::init(); 983 MakefileGenerator::init();
829 984
830 985
831 if ( msvcproj_project.isEmpty() ) 986 if ( msvcproj_project.isEmpty() )
@@ -864,14 +1019,21 @@ void VcprojGenerator::initOld()
864 } 1019 }
865 1020
866 // $$QMAKE.. -> $$MSVCPROJ.. ------------------------------------- 1021 // $$QMAKE.. -> $$MSVCPROJ.. -------------------------------------
867 project->variables()["MSVCPROJ_LIBS"] += project->variables()["QMAKE_LIBS"]; 1022 project->variables()["MSVCPROJ_LIBS"] += project->variables()["QMAKE_LIBS"];
868 project->variables()["MSVCPROJ_LIBS"] += project->variables()["QMAKE_LIBS_WINDOWS"]; 1023 project->variables()["MSVCPROJ_LIBS"] += project->variables()["QMAKE_LIBS_WINDOWS"];
869 project->variables()["MSVCPROJ_LFLAGS" ] += project->variables()["QMAKE_LFLAGS"]; 1024 project->variables()["MSVCPROJ_LFLAGS" ] += project->variables()["QMAKE_LFLAGS"];
870 if ( !project->variables()["QMAKE_LIBDIR"].isEmpty() ) 1025 if ( !project->variables()["QMAKE_LIBDIR"].isEmpty() ) {
871 project->variables()["MSVCPROJ_LFLAGS" ].append(varGlue("QMAKE_LIBDIR","/LIBPATH:"," /LIBPATH:","")); 1026 QStringList strl = project->variables()["QMAKE_LIBDIR"];
1027 QStringList::iterator stri;
1028 for ( stri = strl.begin(); stri != strl.end(); ++stri ) {
1029 if ( !(*stri).startsWith("/LIBPATH:") )
1030 (*stri).prepend( "/LIBPATH:" );
1031 }
1032 project->variables()["MSVCPROJ_LFLAGS"] += strl;
1033 }
872 project->variables()["MSVCPROJ_CXXFLAGS" ] += project->variables()["QMAKE_CXXFLAGS"]; 1034 project->variables()["MSVCPROJ_CXXFLAGS" ] += project->variables()["QMAKE_CXXFLAGS"];
873 // We don't use this... Direct manipulation of compiler object 1035 // We don't use this... Direct manipulation of compiler object
874 //project->variables()["MSVCPROJ_DEFINES"].append(varGlue("DEFINES","/D ","" " /D ","")); 1036 //project->variables()["MSVCPROJ_DEFINES"].append(varGlue("DEFINES","/D ","" " /D ",""));
875 //project->variables()["MSVCPROJ_DEFINES"].append(varGlue("PRL_EXPORT_DEFINES","/D ","" " /D ","")); 1037 //project->variables()["MSVCPROJ_DEFINES"].append(varGlue("PRL_EXPORT_DEFINES","/D ","" " /D ",""));
876 QStringList &incs = project->variables()["INCLUDEPATH"]; 1038 QStringList &incs = project->variables()["INCLUDEPATH"];
877 for(QStringList::Iterator incit = incs.begin(); incit != incs.end(); ++incit) { 1039 for(QStringList::Iterator incit = incs.begin(); incit != incs.end(); ++incit) {
@@ -880,25 +1042,24 @@ void VcprojGenerator::initOld()
880 project->variables()["MSVCPROJ_INCPATH"].append("/I" + inc ); 1042 project->variables()["MSVCPROJ_INCPATH"].append("/I" + inc );
881 } 1043 }
882 project->variables()["MSVCPROJ_INCPATH"].append("/I" + specdir()); 1044 project->variables()["MSVCPROJ_INCPATH"].append("/I" + specdir());
883 1045
884 QString dest; 1046 QString dest;
885 project->variables()["MSVCPROJ_TARGET"] = project->first("TARGET"); 1047 project->variables()["MSVCPROJ_TARGET"] = project->first("TARGET");
886 if ( !project->variables()["DESTDIR"].isEmpty() ) { 1048 Option::fixPathToTargetOS(project->first("TARGET"));
887 project->variables()["TARGET"].first().prepend(project->first("DESTDIR")); 1049 dest = project->first("TARGET") + project->first( "TARGET_EXT" );
888 Option::fixPathToTargetOS(project->first("TARGET")); 1050 if ( project->first("TARGET").startsWith("$(QTDIR)") )
889 dest = project->first("TARGET"); 1051 dest.replace( QRegExp("\\$\\(QTDIR\\)"), getenv("QTDIR") );
890 if ( project->first("TARGET").startsWith("$(QTDIR)") ) 1052 project->variables()["MSVCPROJ_TARGET"] = dest;
891 dest.replace( QRegExp("\\$\\(QTDIR\\)"), getenv("QTDIR") ); 1053 if ( project->isActiveConfig("dll") ) {
892 project->variables()["MSVCPROJ_TARGET"].append( 1054 QString imp = project->first( "DESTDIR" );
893 QString("/OUT:") + dest ); 1055 if( !imp.isNull() && !imp.endsWith( "\\" ) )
894 if ( project->isActiveConfig("dll") ) { 1056 imp += "\\";
895 QString imp = dest; 1057 imp += dest;
896 imp.replace(QRegExp("\\.dll"), ".lib"); 1058 imp.replace(QRegExp("\\.dll"), ".lib");
897 project->variables()["MSVCPROJ_LIBOPTIONS"] += (QString("/IMPLIB:") + imp ); 1059 project->variables()["MSVCPROJ_LIBOPTIONS"] += QString("/IMPLIB:") + imp;
898 }
899 } 1060 }
900 1061
901 // DLL COPY ------------------------------------------------------ 1062 // DLL COPY ------------------------------------------------------
902 if ( project->isActiveConfig("dll") && !project->variables()["DLLDESTDIR"].isEmpty() ) { 1063 if ( project->isActiveConfig("dll") && !project->variables()["DLLDESTDIR"].isEmpty() ) {
903 QStringList dlldirs = project->variables()["DLLDESTDIR"]; 1064 QStringList dlldirs = project->variables()["DLLDESTDIR"];
904 QString copydll = "# Begin Special Build Tool\n" 1065 QString copydll = "# Begin Special Build Tool\n"
@@ -993,29 +1154,32 @@ bool VcprojGenerator::openOutput(QFile &file) const
993 QString ext = project->first("VCPROJ_EXTENSION"); 1154 QString ext = project->first("VCPROJ_EXTENSION");
994 if(project->first("TEMPLATE") == "vcsubdirs") 1155 if(project->first("TEMPLATE") == "vcsubdirs")
995 ext = project->first("VCSOLUTION_EXTENSION"); 1156 ext = project->first("VCSOLUTION_EXTENSION");
996 file.setName(outdir + project->first("TARGET") + ext); 1157 file.setName(outdir + project->first("TARGET") + ext);
997 } 1158 }
998 if(QDir::isRelativePath(file.name())) { 1159 if(QDir::isRelativePath(file.name())) {
999 QString ofile; 1160 file.setName( Option::fixPathToLocalOS(QDir::currentDirPath() + Option::dir_sep + fixFilename(file.name())) );
1000 ofile = file.name();
1001 int slashfind = ofile.findRev('\\');
1002 if (slashfind == -1) {
1003 ofile = ofile.replace("-", "_");
1004 } else {
1005 int hypenfind = ofile.find('-', slashfind);
1006 while (hypenfind != -1 && slashfind < hypenfind) {
1007 ofile = ofile.replace(hypenfind, 1, "_");
1008 hypenfind = ofile.find('-', hypenfind + 1);
1009 }
1010 }
1011 file.setName(Option::fixPathToLocalOS(QDir::currentDirPath() + Option::dir_sep + ofile));
1012 } 1161 }
1013 return Win32MakefileGenerator::openOutput(file); 1162 return Win32MakefileGenerator::openOutput(file);
1014} 1163}
1015 1164
1165QString VcprojGenerator::fixFilename(QString ofile) const
1166{
1167 int slashfind = ofile.findRev('\\');
1168 if (slashfind == -1) {
1169 ofile = ofile.replace('-', '_');
1170 } else {
1171 int hypenfind = ofile.find('-', slashfind);
1172 while (hypenfind != -1 && slashfind < hypenfind) {
1173 ofile = ofile.replace(hypenfind, 1, '_');
1174 hypenfind = ofile.find('-', hypenfind + 1);
1175 }
1176 }
1177 return ofile;
1178}
1179
1016QString VcprojGenerator::findTemplate(QString file) 1180QString VcprojGenerator::findTemplate(QString file)
1017{ 1181{
1018 QString ret; 1182 QString ret;
1019 if(!QFile::exists((ret = file)) && 1183 if(!QFile::exists((ret = file)) &&
1020 !QFile::exists((ret = QString(Option::mkfile::qmakespec + "/" + file))) && 1184 !QFile::exists((ret = QString(Option::mkfile::qmakespec + "/" + file))) &&
1021 !QFile::exists((ret = QString(getenv("QTDIR")) + "/mkspecs/win32-msvc.net/" + file)) && 1185 !QFile::exists((ret = QString(getenv("QTDIR")) + "/mkspecs/win32-msvc.net/" + file)) &&
@@ -1039,12 +1203,12 @@ void VcprojGenerator::processPrlVariable(const QString &var, const QStringList &
1039 } 1203 }
1040} 1204}
1041 1205
1042void VcprojGenerator::outputVariables() 1206void VcprojGenerator::outputVariables()
1043{ 1207{
1044#if 0 1208#if 0
1045 debug_msg(3, "Generator: MSVC.NET: List of current variables:" ); 1209 qDebug( "Generator: MSVC.NET: List of current variables:" );
1046 for ( QMap<QString, QStringList>::ConstIterator it = project->variables().begin(); it != project->variables().end(); ++it) { 1210 for ( QMap<QString, QStringList>::ConstIterator it = project->variables().begin(); it != project->variables().end(); ++it) {
1047 debug_msg(3, "Generator: MSVC.NET: %s => %s", it.key().latin1(), it.data().join(" | ").latin1() ); 1211 qDebug( "Generator: MSVC.NET: %s => %s", it.key().latin1(), it.data().join(" | ").latin1() );
1048 } 1212 }
1049#endif 1213#endif
1050} 1214}
diff --git a/qmake/generators/win32/msvc_vcproj.h b/qmake/generators/win32/msvc_vcproj.h
index 583b164..69e0c02 100644
--- a/qmake/generators/win32/msvc_vcproj.h
+++ b/qmake/generators/win32/msvc_vcproj.h
@@ -2,13 +2,13 @@
2** $Id$ 2** $Id$
3** 3**
4** Definition of VcprojGenerator class. 4** Definition of VcprojGenerator class.
5** 5**
6** Created : 970521 6** Created : 970521
7** 7**
8** Copyright (C) 1992-2000 Trolltech AS. All rights reserved. 8** Copyright (C) 1992-2002 Trolltech AS. All rights reserved.
9** 9**
10** This file is part of the network module of the Qt GUI Toolkit. 10** This file is part of the network module of the Qt GUI Toolkit.
11** 11**
12** This file may be distributed under the terms of the Q Public License 12** 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 13** as defined by Trolltech AS of Norway and appearing in the file
14** LICENSE.QPL included in the packaging of this file. 14** LICENSE.QPL included in the packaging of this file.
@@ -31,24 +31,25 @@
31** See http://www.trolltech.com/gpl/ for GPL licensing information. 31** See http://www.trolltech.com/gpl/ for GPL licensing information.
32** 32**
33** Contact info@trolltech.com if any conditions of this licensing are 33** Contact info@trolltech.com if any conditions of this licensing are
34** not clear to you. 34** not clear to you.
35** 35**
36**********************************************************************/ 36**********************************************************************/
37#ifndef __VCPROJMAKE_H__ 37#ifndef __MSVC_VCPROJ_H__
38#define __VCPROJMAKE_H__ 38#define __MSVC_VCPROJ_H__
39 39
40#include "winmakefile.h" 40#include "winmakefile.h"
41#include "msvc_objectmodel.h" 41#include "msvc_objectmodel.h"
42 42
43enum target { 43enum target {
44 Application, 44 Application,
45 SharedLib, 45 SharedLib,
46 StaticLib 46 StaticLib
47}; 47};
48 48
49struct QUuid;
49class VcprojGenerator : public Win32MakefileGenerator 50class VcprojGenerator : public Win32MakefileGenerator
50{ 51{
51 bool init_flag; 52 bool init_flag;
52 bool writeVcprojParts(QTextStream &); 53 bool writeVcprojParts(QTextStream &);
53 54
54 bool writeMakefile(QTextStream &); 55 bool writeMakefile(QTextStream &);
@@ -65,12 +66,13 @@ public:
65 66
66protected: 67protected:
67 virtual bool openOutput(QFile &file) const; 68 virtual bool openOutput(QFile &file) const;
68 virtual void processPrlVariable(const QString &, const QStringList &); 69 virtual void processPrlVariable(const QString &, const QStringList &);
69 virtual bool findLibraries(); 70 virtual bool findLibraries();
70 virtual void outputVariables(); 71 virtual void outputVariables();
72 QString fixFilename(QString ofile) const;
71 73
72 void initOld(); 74 void initOld();
73 void initProject(); 75 void initProject();
74 void initConfiguration(); 76 void initConfiguration();
75 void initCompilerTool(); 77 void initCompilerTool();
76 void initLinkerTool(); 78 void initLinkerTool();
@@ -86,33 +88,17 @@ protected:
86 void initUICFiles(); 88 void initUICFiles();
87 void initFormsFiles(); 89 void initFormsFiles();
88 void initTranslationFiles(); 90 void initTranslationFiles();
89 void initLexYaccFiles(); 91 void initLexYaccFiles();
90 void initResourceFiles(); 92 void initResourceFiles();
91 93
92 /*
93 void writeGuid( QTextStream &t );
94 void writeAdditionalOptions( QTextStream &t );
95 void writeHeaders( QTextStream &t );
96 void writeSources( QTextStream &t );
97 void writeMocs( QTextStream &t );
98 void writeLexs( QTextStream &t );
99 void writeYaccs( QTextStream &t );
100 void writePictures( QTextStream &t );
101 void writeImages( QTextStream &t );
102 void writeIDLs( QTextStream &t );
103
104 void writeForms( QTextStream &t );
105 void writeFormsSourceHeaders( QString &variable, QTextStream &t );
106 void writeTranslations( QTextStream &t );
107 void writeStrippedTranslations( QTextStream &t );
108 */
109
110 VCProject vcProject; 94 VCProject vcProject;
111 target projectTarget; 95 target projectTarget;
112 96
97private:
98 QUuid increaseUUID(const QUuid &id);
113 friend class VCFilter; 99 friend class VCFilter;
114}; 100};
115 101
116inline VcprojGenerator::~VcprojGenerator() 102inline VcprojGenerator::~VcprojGenerator()
117{ } 103{ }
118 104
@@ -123,7 +109,7 @@ inline QString VcprojGenerator::defaultMakefile() const
123 109
124inline bool VcprojGenerator::findLibraries() 110inline bool VcprojGenerator::findLibraries()
125{ 111{
126 return Win32MakefileGenerator::findLibraries("MSVCVCPROJ_LIBS"); 112 return Win32MakefileGenerator::findLibraries("MSVCVCPROJ_LIBS");
127} 113}
128 114
129#endif /* __VCPROJMAKE_H__ */ 115#endif /* __MSVC_VCPROJ_H__ */
diff --git a/qmake/generators/win32/winmakefile.cpp b/qmake/generators/win32/winmakefile.cpp
index a07c921..bc3fed9 100644
--- a/qmake/generators/win32/winmakefile.cpp
+++ b/qmake/generators/win32/winmakefile.cpp
@@ -98,13 +98,13 @@ Win32MakefileGenerator::writeSubDirs(QTextStream &t)
98 QPtrListIterator<SubDir> it(subdirs); 98 QPtrListIterator<SubDir> it(subdirs);
99 99
100 if(!project->isEmpty("MAKEFILE")) 100 if(!project->isEmpty("MAKEFILE"))
101 t << "MAKEFILE=" << var("MAKEFILE") << endl; 101 t << "MAKEFILE=" << var("MAKEFILE") << endl;
102 t << "QMAKE =" << (project->isEmpty("QMAKE_QMAKE") ? QString("qmake") : var("QMAKE_QMAKE")) << endl; 102 t << "QMAKE =" << (project->isEmpty("QMAKE_QMAKE") ? QString("qmake") : var("QMAKE_QMAKE")) << endl;
103 t << "SUBTARGETS= "; 103 t << "SUBTARGETS= ";
104 for( it.toFirst(); it.current(); ++it) 104 for( it.toFirst(); it.current(); ++it)
105 t << " \\\n\t\t" << it.current()->target; 105 t << " \\\n\t\t" << it.current()->target;
106 t << endl << endl; 106 t << endl << endl;
107 t << "all: qmake_all $(SUBTARGETS)" << endl << endl; 107 t << "all: qmake_all $(SUBTARGETS)" << endl << endl;
108 108
109 for( it.toFirst(); it.current(); ++it) { 109 for( it.toFirst(); it.current(); ++it) {
110 bool have_dir = !(*it)->directory.isEmpty(); 110 bool have_dir = !(*it)->directory.isEmpty();
@@ -113,34 +113,32 @@ Win32MakefileGenerator::writeSubDirs(QTextStream &t)
113 QString mkfile = (*it)->makefile; 113 QString mkfile = (*it)->makefile;
114 if(have_dir) 114 if(have_dir)
115 mkfile.prepend((*it)->directory + Option::dir_sep); 115 mkfile.prepend((*it)->directory + Option::dir_sep);
116 t << mkfile << ":"; 116 t << mkfile << ":";
117 if(project->variables()["QMAKE_NOFORCE"].isEmpty()) 117 if(project->variables()["QMAKE_NOFORCE"].isEmpty())
118 t << " FORCE"; 118 t << " FORCE";
119 if(have_dir) 119 if(have_dir)
120 t << "\n\t" << "cd " << (*it)->directory; 120 t << "\n\t" << "cd " << (*it)->directory;
121 t << "\n\t" << "$(QMAKE) " << (*it)->profile << " " << buildArgs(); 121 t << "\n\t" << "$(QMAKE) " << (*it)->profile << " " << buildArgs();
122 if((*it)->makefile != "$(MAKEFILE)") 122 t << " -o " << (*it)->makefile;
123 t << " -o " << (*it)->makefile;
124 if(have_dir) { 123 if(have_dir) {
125 int subLevels = it.current()->directory.contains(Option::dir_sep) + 1; 124 int subLevels = it.current()->directory.contains(Option::dir_sep) + 1;
126 t << "\n\t" << "@cd .."; 125 t << "\n\t" << "@cd ..";
127 for(int i = 1; i < subLevels; i++ ) 126 for(int i = 1; i < subLevels; i++ )
128 t << Option::dir_sep << ".."; 127 t << Option::dir_sep << "..";
129 } 128 }
130 t << endl; 129 t << endl;
131 130
132 //now actually build 131 //now actually build
133 t << (*it)->target << ": " << mkfile; 132 t << (*it)->target << ": " << mkfile;
134 if(project->variables()["QMAKE_NOFORCE"].isEmpty()) 133 if(project->variables()["QMAKE_NOFORCE"].isEmpty())
135 t << " FORCE"; 134 t << " FORCE";
136 if(have_dir) 135 if(have_dir)
137 t << "\n\t" << "cd " << (*it)->directory; 136 t << "\n\t" << "cd " << (*it)->directory;
138 t << "\n\t" << "$(MAKE)"; 137 t << "\n\t" << "$(MAKE)";
139 if((*it)->makefile != "$(MAKEFILE)") 138 t << " -f " << (*it)->makefile;
140 t << " -f " << (*it)->makefile;
141 if(have_dir) { 139 if(have_dir) {
142 int subLevels = it.current()->directory.contains(Option::dir_sep) + 1; 140 int subLevels = it.current()->directory.contains(Option::dir_sep) + 1;
143 t << "\n\t" << "@cd .."; 141 t << "\n\t" << "@cd ..";
144 for(int i = 1; i < subLevels; i++ ) 142 for(int i = 1; i < subLevels; i++ )
145 t << Option::dir_sep << ".."; 143 t << Option::dir_sep << "..";
146 } 144 }
@@ -152,20 +150,22 @@ Win32MakefileGenerator::writeSubDirs(QTextStream &t)
152 writeMakeQmake(t); 150 writeMakeQmake(t);
153 151
154 t << "qmake_all:"; 152 t << "qmake_all:";
155 if ( !subdirs.isEmpty() ) { 153 if ( !subdirs.isEmpty() ) {
156 for( it.toFirst(); it.current(); ++it) { 154 for( it.toFirst(); it.current(); ++it) {
157 QString subdir = (*it)->directory; 155 QString subdir = (*it)->directory;
156 QString profile = (*it)->profile;
158 int subLevels = subdir.contains(Option::dir_sep) + 1; 157 int subLevels = subdir.contains(Option::dir_sep) + 1;
159 t << "\n\t" 158 t << "\n\t"
160 << "cd " << subdir << "\n\t"; 159 << "cd " << subdir << "\n\t";
161 int lastSlash = subdir.findRev(Option::dir_sep); 160 int lastSlash = subdir.findRev(Option::dir_sep);
162 if(lastSlash != -1) 161 if(lastSlash != -1)
163 subdir = subdir.mid( lastSlash + 1 ); 162 subdir = subdir.mid( lastSlash + 1 );
164 t << "$(QMAKE) " << subdir << ".pro" 163 t << "$(QMAKE) "
165 << (!project->isEmpty("MAKEFILE") ? QString(" -o ") + var("MAKEFILE") : QString("")) 164 << ( !profile.isEmpty() ? profile : subdir + ".pro" )
165 << " -o " << (*it)->makefile
166 << " " << buildArgs() << "\n\t" 166 << " " << buildArgs() << "\n\t"
167 << "@cd .."; 167 << "@cd ..";
168 for(int i = 1; i < subLevels; i++ ) 168 for(int i = 1; i < subLevels; i++ )
169 t << Option::dir_sep << ".."; 169 t << Option::dir_sep << "..";
170 } 170 }
171 } else { 171 } else {
@@ -183,19 +183,17 @@ Win32MakefileGenerator::writeSubDirs(QTextStream &t)
183 if (!subdirs.isEmpty()) { 183 if (!subdirs.isEmpty()) {
184 for( it.toFirst(); it.current(); ++it) { 184 for( it.toFirst(); it.current(); ++it) {
185 int subLevels = (*it)->directory.contains(Option::dir_sep) + 1; 185 int subLevels = (*it)->directory.contains(Option::dir_sep) + 1;
186 bool have_dir = !(*it)->directory.isEmpty(); 186 bool have_dir = !(*it)->directory.isEmpty();
187 if(have_dir) 187 if(have_dir)
188 t << "\n\t" << "cd " << (*it)->directory; 188 t << "\n\t" << "cd " << (*it)->directory;
189 QString in_file; 189 QString in_file = " -f " + (*it)->makefile;
190 if((*it)->makefile != "$(MAKEFILE)")
191 in_file = " -f " + (*it)->makefile;
192 t << "\n\t" << "$(MAKE) " << in_file << " " << targs[x]; 190 t << "\n\t" << "$(MAKE) " << in_file << " " << targs[x];
193 if(have_dir) { 191 if(have_dir) {
194 t << "\n\t" << "@cd .."; 192 t << "\n\t" << "@cd ..";
195 for(int i = 1; i < subLevels; i++ ) 193 for(int i = 1; i < subLevels; i++ )
196 t << Option::dir_sep << ".."; 194 t << Option::dir_sep << "..";
197 } 195 }
198 } 196 }
199 } else { 197 } else {
200 // Borland make does not like empty an empty command section, so 198 // Borland make does not like empty an empty command section, so
201 // insert a dummy command. 199 // insert a dummy command.
@@ -207,97 +205,139 @@ Win32MakefileGenerator::writeSubDirs(QTextStream &t)
207 if(project->variables()["QMAKE_NOFORCE"].isEmpty()) 205 if(project->variables()["QMAKE_NOFORCE"].isEmpty())
208 t << "FORCE:" << endl << endl; 206 t << "FORCE:" << endl << endl;
209} 207}
210 208
211 209
212int 210int
213Win32MakefileGenerator::findHighestVersion(const QString &d, const 211Win32MakefileGenerator::findHighestVersion(const QString &d, const QString &stem)
214 QString &stem)
215{ 212{
216 if(!QFile::exists(Option::fixPathToLocalOS(d))) 213 QString bd = Option::fixPathToLocalOS(d, TRUE);
214 if(!QFile::exists(bd))
217 return -1; 215 return -1;
218 if(!project->variables()["QMAKE_" + stem.upper() + 216 if(!project->variables()["QMAKE_" + stem.upper() + "_VERSION_OVERRIDE"].isEmpty())
219 "_VERSION_OVERRIDE"].isEmpty()) 217 return project->variables()["QMAKE_" + stem.upper() + "_VERSION_OVERRIDE"].first().toInt();
220 return project->variables()["QMAKE_" + stem.upper() + 218
221 "_VERSION_OVERRIDE"].first().toInt();
222 QString bd = d;
223 fixEnvVariables(bd);
224 QDir dir(bd); 219 QDir dir(bd);
225 int biggest=-1; 220 int biggest=-1;
226 QStringList entries = dir.entryList(); 221 QStringList entries = dir.entryList();
227 QRegExp regx( "(" + stem + "([0-9]*)).lib", FALSE ); 222 QString dllStem = stem + QTDLL_POSTFIX;
228 for(QStringList::Iterator it = entries.begin(); it != entries.end(); 223 QRegExp regx( "(" + dllStem + "([0-9]*)).lib", FALSE );
229 ++it) { 224 for(QStringList::Iterator it = entries.begin(); it != entries.end(); ++it) {
230 if(regx.exactMatch((*it))) 225 if(regx.exactMatch((*it)))
231 biggest = QMAX(biggest, (regx.cap(1) == stem || 226 biggest = QMAX(biggest, (regx.cap(1) == dllStem ||
232 regx.cap(2).isEmpty()) ? -1 : regx.cap(2).toInt()); 227 regx.cap(2).isEmpty()) ? -1 : regx.cap(2).toInt());
228 }
229 if(dir.exists(dllStem + Option::prl_ext)) {
230 QMakeProject proj;
231 if(proj.read(bd + dllStem + Option::prl_ext, QDir::currentDirPath(), TRUE)) {
232 if(!proj.isEmpty("QMAKE_PRL_VERSION"))
233 biggest = QMAX(biggest, proj.first("QMAKE_PRL_VERSION").replace(".", "").toInt());
234 }
233 } 235 }
234 return biggest; 236 return biggest;
235} 237}
236 238
237 239
238bool 240bool
239Win32MakefileGenerator::findLibraries(const QString &where) 241Win32MakefileGenerator::findLibraries(const QString &where)
240{ 242{
241 243
242 QStringList &l = project->variables()[where]; 244 QStringList &l = project->variables()[where];
243 QPtrList<MakefileDependDir> dirs; 245 QPtrList<MakefileDependDir> dirs;
246 {
247 QStringList &libpaths = project->variables()["QMAKE_LIBDIR"];
248 for(QStringList::Iterator libpathit = libpaths.begin(); libpathit != libpaths.end(); ++libpathit) {
249 QString r = (*libpathit), l = r;
250 fixEnvVariables(l);
251 dirs.append(new MakefileDependDir(r.replace("\"",""), l.replace("\"","")));
252 }
253 }
244 dirs.setAutoDelete(TRUE); 254 dirs.setAutoDelete(TRUE);
245 for(QStringList::Iterator it = l.begin(); it != l.end(); ) { 255 for(QStringList::Iterator it = l.begin(); it != l.end(); ) {
246 QString opt = (*it); 256 QChar quote;
247 bool remove = FALSE; 257 bool modified_opt = FALSE, remove = FALSE;
248 if(opt.startsWith("-L") || opt.startsWith("/L")) { 258 QString opt = (*it).stripWhiteSpace();
249 QString r = opt.right(opt.length() - 2), l = Option::fixPathToLocalOS(r); 259 if((opt[0] == '\'' || opt[0] == '"') && opt[(int)opt.length()-1] == opt[0]) {
260 quote = opt[0];
261 opt = opt.mid(1, opt.length()-2);
262 }
263 if(opt.startsWith("/LIBPATH:")) {
264 QString r = opt.mid(9), l = Option::fixPathToLocalOS(r);
265 dirs.append(new MakefileDependDir(r.replace("\"",""),
266 l.replace("\"","")));
267 } else if(opt.startsWith("-L") || opt.startsWith("/L")) {
268 QString r = opt.mid(2), l = Option::fixPathToLocalOS(r);
250 dirs.append(new MakefileDependDir(r.replace("\"",""), 269 dirs.append(new MakefileDependDir(r.replace("\"",""),
251 l.replace("\"",""))); 270 l.replace("\"","")));
252 remove = TRUE; 271 remove = TRUE; //we eat this switch
253 } else if(opt.startsWith("-l") || opt.startsWith("/l")) { 272 } else if(opt.startsWith("-l") || opt.startsWith("/l")) {
254 QString lib = opt.right(opt.length() - 2), out; 273 QString lib = opt.right(opt.length() - 2), out;
255 if(!lib.isEmpty()) { 274 if(!lib.isEmpty()) {
256 for(MakefileDependDir *mdd = dirs.first(); mdd; mdd = dirs.next() ) { 275 for(MakefileDependDir *mdd = dirs.first(); mdd; mdd = dirs.next() ) {
276 QString extension;
257 int ver = findHighestVersion(mdd->local_dir, lib); 277 int ver = findHighestVersion(mdd->local_dir, lib);
258 if(ver > 0) 278 if(ver > 0)
259 lib += QString::number(ver); 279 extension += QString::number(ver);
260 lib += ".lib"; 280 extension += ".lib";
261 if(QFile::exists(mdd->local_dir + Option::dir_sep + lib)) { 281 if(QFile::exists(mdd->local_dir + Option::dir_sep + lib + Option::prl_ext) ||
262 out = mdd->real_dir + Option::dir_sep + lib; 282 QFile::exists(mdd->local_dir + Option::dir_sep + lib + extension)) {
283 out = mdd->real_dir + Option::dir_sep + lib + extension;
263 break; 284 break;
264 } 285 }
265 } 286 }
266 } 287 }
267 if(out.isEmpty()) 288 if(out.isEmpty()) {
268 remove = TRUE; 289 remove = TRUE; //just eat it since we cannot find one..
269 else 290 } else {
291 modified_opt = TRUE;
270 (*it) = out; 292 (*it) = out;
293 }
271 } else if(!QFile::exists(Option::fixPathToLocalOS(opt))) { 294 } else if(!QFile::exists(Option::fixPathToLocalOS(opt))) {
272 QString dir, file = opt; 295 QPtrList<MakefileDependDir> lib_dirs;
296 QString file = opt;
273 int slsh = file.findRev(Option::dir_sep); 297 int slsh = file.findRev(Option::dir_sep);
274 if(slsh != -1) { 298 if(slsh != -1) {
275 dir = file.left(slsh+1); 299 QString r = file.left(slsh+1), l = r;
300 fixEnvVariables(l);
301 lib_dirs.append(new MakefileDependDir(r.replace("\"",""), l.replace("\"","")));
276 file = file.right(file.length() - slsh - 1); 302 file = file.right(file.length() - slsh - 1);
277 } 303 } else {
278 if ( !(project->variables()["QMAKE_QT_DLL"].isEmpty() && (file == "qt.lib" || file == "qt-mt.lib")) ) { 304 lib_dirs = dirs;
279 if(file.endsWith(".lib")) { 305 }
280 file = file.left(file.length() - 4); 306 if(file.endsWith(".lib")) {
281 if(!file.at(file.length()-1).isNumber()) { 307 file = file.left(file.length() - 4);
282 int ver = findHighestVersion(dir, file); 308 if(!file.at(file.length()-1).isNumber()) {
309 for(MakefileDependDir *mdd = lib_dirs.first(); mdd; mdd = lib_dirs.next() ) {
310 QString lib_tmpl(file + "%1" + ".lib");
311 int ver = findHighestVersion(mdd->local_dir, file);
283 if(ver != -1) { 312 if(ver != -1) {
284 file = QString(dir + file + "%1" + ".lib");
285 if(ver) 313 if(ver)
286 (*it) = file.arg(ver); 314 lib_tmpl = lib_tmpl.arg(ver);
287 else 315 else
288 (*it) = file.arg(""); 316 lib_tmpl = lib_tmpl.arg("");
317 if(slsh != -1) {
318 QString dir = mdd->real_dir;
319 if(!dir.endsWith(Option::dir_sep))
320 dir += Option::dir_sep;
321 lib_tmpl.prepend(dir);
322 }
323 modified_opt = TRUE;
324 (*it) = lib_tmpl;
325 break;
289 } 326 }
290 } 327 }
291 } 328 }
292 } 329 }
293 } 330 }
294 if(remove) 331 if(remove) {
295 it = l.remove(it); 332 it = l.remove(it);
296 else 333 } else {
334 if(!quote.isNull() && modified_opt)
335 (*it) = quote + (*it) + quote;
297 ++it; 336 ++it;
337 }
298 } 338 }
299 return TRUE; 339 return TRUE;
300} 340}
301 341
302void 342void
303Win32MakefileGenerator::processPrlFiles() 343Win32MakefileGenerator::processPrlFiles()
@@ -320,14 +360,14 @@ Win32MakefileGenerator::processPrlFiles()
320 QString where = "QMAKE_LIBS"; 360 QString where = "QMAKE_LIBS";
321 if(!project->isEmpty("QMAKE_INTERNAL_PRL_LIBS")) 361 if(!project->isEmpty("QMAKE_INTERNAL_PRL_LIBS"))
322 where = project->first("QMAKE_INTERNAL_PRL_LIBS"); 362 where = project->first("QMAKE_INTERNAL_PRL_LIBS");
323 QStringList &l = project->variables()[where]; 363 QStringList &l = project->variables()[where];
324 for(QStringList::Iterator it = l.begin(); it != l.end(); ++it) { 364 for(QStringList::Iterator it = l.begin(); it != l.end(); ++it) {
325 QString opt = (*it); 365 QString opt = (*it);
326 if(opt.left(1) == "/") { 366 if(opt.startsWith("/")) {
327 if(opt.left(9) == "/LIBPATH:") { 367 if(opt.startsWith("/LIBPATH:")) {
328 QString r = opt.mid(9), l = r; 368 QString r = opt.mid(9), l = r;
329 fixEnvVariables(l); 369 fixEnvVariables(l);
330 libdirs.append(new MakefileDependDir(r.replace("\"",""), 370 libdirs.append(new MakefileDependDir(r.replace("\"",""),
331 l.replace("\"",""))); 371 l.replace("\"","")));
332 } 372 }
333 } else { 373 } else {