-rw-r--r-- | qmake/generators/win32/borland_bmake.cpp | 246 | ||||
-rw-r--r-- | qmake/generators/win32/borland_bmake.h | 11 | ||||
-rw-r--r-- | qmake/generators/win32/mingw_make.cpp | 1232 | ||||
-rw-r--r-- | qmake/generators/win32/mingw_make.h | 119 | ||||
-rw-r--r-- | qmake/generators/win32/msvc_dsp.cpp | 244 | ||||
-rw-r--r-- | qmake/generators/win32/msvc_dsp.h | 15 | ||||
-rw-r--r-- | qmake/generators/win32/msvc_nmake.cpp | 321 | ||||
-rw-r--r-- | qmake/generators/win32/msvc_nmake.h | 17 | ||||
-rw-r--r-- | qmake/generators/win32/msvc_objectmodel.cpp | 341 | ||||
-rw-r--r-- | qmake/generators/win32/msvc_objectmodel.h | 43 | ||||
-rw-r--r-- | qmake/generators/win32/msvc_vcproj.cpp | 712 | ||||
-rw-r--r-- | qmake/generators/win32/msvc_vcproj.h | 14 | ||||
-rw-r--r-- | qmake/generators/win32/winmakefile.cpp | 161 | ||||
-rw-r--r-- | qmake/generators/win32/winmakefile.h | 12 |
14 files changed, 2330 insertions, 1158 deletions
diff --git a/qmake/generators/win32/borland_bmake.cpp b/qmake/generators/win32/borland_bmake.cpp index 26eea88..12607cf 100644 --- a/qmake/generators/win32/borland_bmake.cpp +++ b/qmake/generators/win32/borland_bmake.cpp | |||
@@ -1,11 +1,9 @@ | |||
1 | /**************************************************************************** | 1 | /**************************************************************************** |
2 | ** $Id$ | 2 | ** |
3 | ** | 3 | ** |
4 | ** Definition of ________ class. | 4 | ** NmakeMakefileGenerator of BorlandMakefileGenerator class. |
5 | ** | 5 | ** |
6 | ** Created : 970521 | 6 | ** Copyright (C) 1992-2003 Trolltech AS. All rights reserved. |
7 | ** | 7 | ** |
8 | ** Copyright (C) 1992-2002 Trolltech AS. All rights reserved. | 8 | ** This file is part of qmake. |
9 | ** | ||
10 | ** This file is part of the network module of the Qt GUI Toolkit. | ||
11 | ** | 9 | ** |
@@ -85,6 +83,6 @@ BorlandMakefileGenerator::writeBorlandParts(QTextStream &t) | |||
85 | t << "YACC = " << var("QMAKE_YACC") << endl; | 83 | t << "YACC = " << var("QMAKE_YACC") << endl; |
86 | t << "CFLAGS =" << var("QMAKE_CFLAGS") << " " | 84 | t << "CFLAGS =" << var("QMAKE_CFLAGS") << " " |
87 | << varGlue("PRL_EXPORT_DEFINES","-D"," -D","") << " " | 85 | << varGlue("PRL_EXPORT_DEFINES","-D"," -D","") << " " |
88 | << varGlue("DEFINES","-D"," -D","") << endl; | 86 | << varGlue("DEFINES","-D"," -D","") << endl; |
89 | t << "CXXFLAGS=" << var("QMAKE_CXXFLAGS") << " " | 87 | t << "CXXFLAGS=" << var("QMAKE_CXXFLAGS") << " " |
90 | << varGlue("PRL_EXPORT_DEFINES","-D"," -D","") << " " | 88 | << varGlue("PRL_EXPORT_DEFINES","-D"," -D","") << " " |
@@ -116,7 +114,7 @@ BorlandMakefileGenerator::writeBorlandParts(QTextStream &t) | |||
116 | } | 114 | } |
117 | t << "MOC =" << (project->isEmpty("QMAKE_MOC") ? QString("moc") : | 115 | t << "MOC =" << (project->isEmpty("QMAKE_MOC") ? QString("moc") : |
118 | Option::fixPathToTargetOS(var("QMAKE_MOC"), FALSE)) << endl; | 116 | Option::fixPathToTargetOS(var("QMAKE_MOC"), FALSE)) << endl; |
119 | t << "UIC =" << (project->isEmpty("QMAKE_UIC") ? QString("uic") : | 117 | t << "UIC =" << (project->isEmpty("QMAKE_UIC") ? QString("uic") : |
120 | Option::fixPathToTargetOS(var("QMAKE_UIC"), FALSE)) << endl; | 118 | Option::fixPathToTargetOS(var("QMAKE_UIC"), FALSE)) << endl; |
121 | t << "QMAKE = " << (project->isEmpty("QMAKE_QMAKE") ? QString("qmake") : | 119 | t << "QMAKE = " << (project->isEmpty("QMAKE_QMAKE") ? QString("qmake") : |
122 | Option::fixPathToTargetOS(var("QMAKE_QMAKE"), FALSE)) << endl; | 120 | Option::fixPathToTargetOS(var("QMAKE_QMAKE"), FALSE)) << endl; |
@@ -136,2 +134,4 @@ BorlandMakefileGenerator::writeBorlandParts(QTextStream &t) | |||
136 | t << "MKDIR =" << var("QMAKE_MKDIR") << endl; | 134 | t << "MKDIR =" << var("QMAKE_MKDIR") << endl; |
135 | t << "INSTALL_FILE= " << var("QMAKE_INSTALL_FILE") << endl; | ||
136 | t << "INSTALL_DIR = " << var("QMAKE_INSTALL_DIR") << endl; | ||
137 | t << endl; | 137 | t << endl; |
@@ -147,2 +147,19 @@ BorlandMakefileGenerator::writeBorlandParts(QTextStream &t) | |||
147 | t << "OBJMOC =" << varList("OBJMOC") << endl; | 147 | t << "OBJMOC =" << varList("OBJMOC") << endl; |
148 | |||
149 | QString extraCompilerDeps; | ||
150 | if(!project->isEmpty("QMAKE_EXTRA_WIN_COMPILERS")) { | ||
151 | t << "OBJCOMP = " << varList("OBJCOMP") << endl; | ||
152 | extraCompilerDeps += " $(OBJCOMP) "; | ||
153 | |||
154 | QStringList &comps = project->variables()["QMAKE_EXTRA_WIN_COMPILERS"]; | ||
155 | for(QStringList::Iterator compit = comps.begin(); compit != comps.end(); ++compit) { | ||
156 | QStringList &vars = project->variables()[(*compit) + ".variables"]; | ||
157 | for(QStringList::Iterator varit = vars.begin(); varit != vars.end(); ++varit) { | ||
158 | QStringList vals = project->variables()[(*varit)]; | ||
159 | if(!vals.isEmpty()) | ||
160 | t << "QMAKE_COMP_" << (*varit) << " = " << valList(vals) << endl; | ||
161 | } | ||
162 | } | ||
163 | } | ||
164 | |||
148 | t << "DIST =" << varList("DISTFILES") << endl; | 165 | t << "DIST =" << varList("DISTFILES") << endl; |
@@ -164,5 +181,5 @@ BorlandMakefileGenerator::writeBorlandParts(QTextStream &t) | |||
164 | t << "####### Build rules" << endl << endl; | 181 | t << "####### Build rules" << endl << endl; |
165 | t << "all: " << varGlue("ALL_DEPS",""," "," ") << " $(TARGET)" << endl << endl; | 182 | t << "all: " << fileFixify(Option::output.name()) << " " << varGlue("ALL_DEPS"," "," "," ") << " $(TARGET)" << endl << endl; |
166 | t << "$(TARGET): " << var("PRE_TARGETDEPS") << " $(UICDECLS) $(OBJECTS) $(OBJMOC) " | 183 | t << "$(TARGET): " << var("PRE_TARGETDEPS") << " $(UICDECLS) $(OBJECTS) $(OBJMOC) " |
167 | << var("POST_TARGETDEPS"); | 184 | << extraCompilerDeps << var("POST_TARGETDEPS"); |
168 | if(!project->variables()["QMAKE_APP_OR_DLL"].isEmpty()) { | 185 | if(!project->variables()["QMAKE_APP_OR_DLL"].isEmpty()) { |
@@ -171,3 +188,3 @@ BorlandMakefileGenerator::writeBorlandParts(QTextStream &t) | |||
171 | } else { | 188 | } else { |
172 | t << "\n\t-del $(TARGET)" | 189 | t << "\n\t-$(DEL_FILE) $(TARGET)" |
173 | << "\n\t" << "$(LIB) $(TARGET) @&&|" << " \n+" | 190 | << "\n\t" << "$(LIB) $(TARGET) @&&|" << " \n+" |
@@ -176,2 +193,3 @@ BorlandMakefileGenerator::writeBorlandParts(QTextStream &t) | |||
176 | } | 193 | } |
194 | t << extraCompilerDeps; | ||
177 | t << endl << "|" << endl; | 195 | t << endl << "|" << endl; |
@@ -184,3 +202,3 @@ BorlandMakefileGenerator::writeBorlandParts(QTextStream &t) | |||
184 | for ( QStringList::Iterator dlldir = dlldirs.begin(); dlldir != dlldirs.end(); ++dlldir ) { | 202 | for ( QStringList::Iterator dlldir = dlldirs.begin(); dlldir != dlldirs.end(); ++dlldir ) { |
185 | t << "\n\t" << "-copy $(TARGET) " << *dlldir; | 203 | t << "\n\t" << "-$(COPY_FILE) \"$(TARGET)\" " << *dlldir; |
186 | } | 204 | } |
@@ -194,10 +212,10 @@ BorlandMakefileGenerator::writeBorlandParts(QTextStream &t) | |||
194 | if ( project->isActiveConfig("dll")) { | 212 | if ( project->isActiveConfig("dll")) { |
195 | t << "\n\t" << ("-$(IDC) $(TARGET) /idl tmp\\" + targetfilename + ".idl -version " + version); | 213 | t << "\n\t" << ("-$(IDC) $(TARGET) /idl " + var("OBJECTS_DIR") + 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"); | 214 | t << "\n\t" << ("-$(IDL) /nologo " + var("OBJECTS_DIR") + targetfilename + ".idl /tlb " + var("OBJECTS_DIR") + targetfilename + ".tlb"); |
197 | t << "\n\t" << ("-$(IDC) $(TARGET) /tlb tmp\\" + targetfilename + ".tlb"); | 215 | t << "\n\t" << ("-$(IDC) $(TARGET) /tlb " + var("OBJECTS_DIR") + targetfilename + ".tlb"); |
198 | t << "\n\t" << ("-$(IDC) $(TARGET) /regserver" ); | 216 | t << "\n\t" << ("-$(IDC) $(TARGET) /regserver" ); |
199 | } else { | 217 | } else { |
200 | t << "\n\t" << ("-$(TARGET) -dumpidl tmp\\" + targetfilename + ".idl -version " + version); | 218 | t << "\n\t" << ("-$(TARGET) -dumpidl " + var("OBJECTS_DIR") + 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"); | 219 | t << "\n\t" << ("-$(IDL) /nologo " + var("OBJECTS_DIR") + targetfilename + ".idl /tlb " + var("OBJECTS_DIR") + targetfilename + ".tlb"); |
202 | t << "\n\t" << ("-$(IDC) $(TARGET) /tlb tmp\\" + targetfilename + ".tlb"); | 220 | t << "\n\t" << ("-$(IDC) $(TARGET) /tlb " + var("OBJECTS_DIR") + targetfilename + ".tlb"); |
203 | t << "\n\t" << ("-$(TARGET) -regserver"); | 221 | t << "\n\t" << ("-$(TARGET) -regserver"); |
@@ -211,3 +229,4 @@ BorlandMakefileGenerator::writeBorlandParts(QTextStream &t) | |||
211 | } | 229 | } |
212 | t << "mocables: $(SRCMOC)" << endl << endl; | 230 | t << "mocables: $(SRCMOC)" << endl |
231 | << "uicables: $(UICIMPLS) $(UICDECLS)" << endl << endl; | ||
213 | 232 | ||
@@ -215,24 +234,51 @@ BorlandMakefileGenerator::writeBorlandParts(QTextStream &t) | |||
215 | 234 | ||
235 | QStringList dist_files = Option::mkfile::project_files; | ||
236 | if(!project->isEmpty("QMAKE_INTERNAL_INCLUDED_FILES")) | ||
237 | dist_files += project->variables()["QMAKE_INTERNAL_INCLUDED_FILES"]; | ||
238 | if(!project->isEmpty("TRANSLATIONS")) | ||
239 | dist_files << var("TRANSLATIONS"); | ||
240 | if(!project->isEmpty("FORMS")) { | ||
241 | QStringList &forms = project->variables()["FORMS"]; | ||
242 | for(QStringList::Iterator formit = forms.begin(); formit != forms.end(); ++formit) { | ||
243 | QString ui_h = fileFixify((*formit) + Option::h_ext.first()); | ||
244 | if(QFile::exists(ui_h) ) | ||
245 | dist_files << ui_h; | ||
246 | } | ||
247 | } | ||
216 | t << "dist:" << "\n\t" | 248 | t << "dist:" << "\n\t" |
217 | << "$(ZIP) " << var("PROJECT") << ".zip " << var("PROJECT") << ".pro $(SOURCES) $(HEADERS) $(DIST) $(FORMS)" | 249 | << "$(ZIP) " << var("QMAKE_ORIG_TARGET") << ".zip " << "$(SOURCES) $(HEADERS) $(DIST) $(FORMS) " |
218 | << endl << endl; | 250 | << dist_files.join(" ") << " " << var("TRANSLATIONS") << " " << var("IMAGES") << endl << endl; |
251 | |||
252 | t << "uiclean:"; | ||
253 | QString uiclean = varGlue("UICDECLS" ,"\n\t-$(DEL_FILE) ","\n\t-$(DEL_FILE) ","") + varGlue("UICIMPLS" ,"\n\t-$(DEL_FILE) ","\n\t-$(DEL_FILE) ",""); | ||
254 | if ( uiclean.isEmpty() ) { | ||
255 | // Borland make does not like an empty command section | ||
256 | uiclean = "\n\t@cd ."; | ||
257 | } | ||
258 | t << uiclean << endl; | ||
259 | |||
260 | t << "mocclean:"; | ||
261 | QString mocclean = varGlue("SRCMOC" ,"\n\t-$(DEL_FILE) ","\n\t-$(DEL_FILE) ","") + varGlue("OBJMOC" ,"\n\t-$(DEL_FILE) ","\n\t-$(DEL_FILE) ",""); | ||
262 | if ( mocclean.isEmpty() ) { | ||
263 | // Borland make does not like an empty command section | ||
264 | mocclean = "\n\t@cd ."; | ||
265 | } | ||
266 | t << mocclean << endl; | ||
219 | 267 | ||
220 | t << "clean:\n" | 268 | t << "clean: uiclean mocclean" |
221 | << varGlue("OBJECTS","\t-del ","\n\t-del ","") | 269 | << varGlue("OBJECTS","\n\t-$(DEL_FILE) ","\n\t-$(DEL_FILE) ","") |
222 | << varGlue("SRCMOC" ,"\n\t-del ","\n\t-del ","") | 270 | << varGlue("QMAKE_CLEAN","\n\t-$(DEL_FILE) ","\n\t-$(DEL_FILE) ","") |
223 | << varGlue("OBJMOC" ,"\n\t-del ","\n\t-del ","") | 271 | << varGlue("CLEAN_FILES","\n\t-$(DEL_FILE) ","\n\t-$(DEL_FILE) ",""); |
224 | << varGlue("UICDECLS" ,"\n\t-del ","\n\t-del ","") | ||
225 | << varGlue("UICIMPLS" ,"\n\t-del ","\n\t-del ","") | ||
226 | << varGlue("QMAKE_CLEAN","\n\t-del ","\n\t-del ","") | ||
227 | << varGlue("CLEAN_FILES","\n\t-del ","\n\t-del ",""); | ||
228 | if ( project->isActiveConfig("activeqt")) { | 272 | if ( project->isActiveConfig("activeqt")) { |
229 | t << ("\n\t-del tmp\\" + targetfilename + ".*"); | 273 | t << ("\n\t-$(DEL_FILE) " + var("OBJECTS_DIR") + targetfilename + ".idl"); |
230 | t << "\n\t-del tmp\\dump.*"; | 274 | t << ("\n\t-$(DEL_FILE) " + var("OBJECTS_DIR") + targetfilename + ".tlb"); |
231 | } | 275 | } |
232 | if(!project->isEmpty("IMAGES")) | 276 | if(!project->isEmpty("IMAGES")) |
233 | t << varGlue("QMAKE_IMAGE_COLLECTION", "\n\t-del ", "\n\t-del ", ""); | 277 | t << varGlue("QMAKE_IMAGE_COLLECTION", "\n\t-$(DEL_FILE) ", "\n\t-$(DEL_FILE) ", ""); |
278 | t << endl; | ||
234 | 279 | ||
235 | // blasted user defined targets | 280 | // user defined targets |
281 | QStringList::Iterator it; | ||
236 | QStringList &qut = project->variables()["QMAKE_EXTRA_WIN_TARGETS"]; | 282 | QStringList &qut = project->variables()["QMAKE_EXTRA_WIN_TARGETS"]; |
237 | for(QStringList::Iterator it = qut.begin(); it != qut.end(); ++it) { | 283 | for(it = qut.begin(); it != qut.end(); ++it) { |
238 | QString targ = var((*it) + ".target"), | 284 | QString targ = var((*it) + ".target"), |
@@ -248,2 +294,5 @@ BorlandMakefileGenerator::writeBorlandParts(QTextStream &t) | |||
248 | } | 294 | } |
295 | if(!project->variables()["QMAKE_NOFORCE"].isEmpty() && | ||
296 | project->variables()[(*it) + ".CONFIG"].findIndex("phony") != -1) | ||
297 | deps += QString(" ") + "FORCE"; | ||
249 | t << "\n\n" << targ << ":" << deps << "\n\t" | 298 | t << "\n\n" << targ << ":" << deps << "\n\t" |
@@ -254,4 +303,53 @@ BorlandMakefileGenerator::writeBorlandParts(QTextStream &t) | |||
254 | 303 | ||
304 | QStringList &quc = project->variables()["QMAKE_EXTRA_WIN_COMPILERS"]; | ||
305 | for(it = quc.begin(); it != quc.end(); ++it) { | ||
306 | QString tmp_out = project->variables()[(*it) + ".output"].first(); | ||
307 | QString tmp_cmd = project->variables()[(*it) + ".commands"].join(" "); | ||
308 | QString tmp_dep = project->variables()[(*it) + ".depends"].join(" "); | ||
309 | QStringList &vars = project->variables()[(*it) + ".variables"]; | ||
310 | if(tmp_out.isEmpty() || tmp_cmd.isEmpty()) | ||
311 | continue; | ||
312 | QStringList &tmp = project->variables()[(*it) + ".input"]; | ||
313 | for(QStringList::Iterator it2 = tmp.begin(); it2 != tmp.end(); ++it2) { | ||
314 | QStringList &inputs = project->variables()[(*it2)]; | ||
315 | for(QStringList::Iterator input = inputs.begin(); input != inputs.end(); ++input) { | ||
316 | QFileInfo fi(Option::fixPathToLocalOS((*input))); | ||
317 | QString in = Option::fixPathToTargetOS((*input), FALSE), | ||
318 | out = tmp_out, cmd = tmp_cmd, deps; | ||
319 | out.replace("${QMAKE_FILE_BASE}", fi.baseName()); | ||
320 | out.replace("${QMAKE_FILE_NAME}", fi.fileName()); | ||
321 | cmd.replace("${QMAKE_FILE_BASE}", fi.baseName()); | ||
322 | cmd.replace("${QMAKE_FILE_OUT}", out); | ||
323 | cmd.replace("${QMAKE_FILE_NAME}", fi.fileName()); | ||
324 | for(QStringList::Iterator it3 = vars.begin(); it3 != vars.end(); ++it3) | ||
325 | cmd.replace("$(" + (*it3) + ")", "$(QMAKE_COMP_" + (*it3)+")"); | ||
326 | if(!tmp_dep.isEmpty()) { | ||
327 | char buff[256]; | ||
328 | QString dep_cmd = tmp_dep; | ||
329 | dep_cmd.replace("${QMAKE_FILE_NAME}", fi.fileName()); | ||
330 | if(FILE *proc = QT_POPEN(dep_cmd.latin1(), "r")) { | ||
331 | while(!feof(proc)) { | ||
332 | int read_in = int(fread(buff, 1, 255, proc)); | ||
333 | if(!read_in) | ||
334 | break; | ||
335 | int l = 0; | ||
336 | for(int i = 0; i < read_in; i++) { | ||
337 | if(buff[i] == '\n' || buff[i] == ' ') { | ||
338 | deps += " " + QCString(buff+l, (i - l) + 1); | ||
339 | l = i; | ||
340 | } | ||
341 | } | ||
342 | } | ||
343 | fclose(proc); | ||
344 | } | ||
345 | } | ||
346 | t << out << ": " << in << deps << "\n\t" | ||
347 | << cmd << endl << endl; | ||
348 | } | ||
349 | } | ||
350 | } | ||
351 | t << endl; | ||
352 | |||
255 | t << "distclean: clean" | 353 | t << "distclean: clean" |
256 | << "\n\t-del $(TARGET)" | 354 | << "\n\t-$(DEL_FILE) $(TARGET)" |
257 | << endl << endl; | 355 | << endl << endl; |
@@ -267,3 +365,3 @@ BorlandMakefileGenerator::init() | |||
267 | project->variables()["QMAKE_ORIG_TARGET"] = project->variables()["TARGET"]; | 365 | project->variables()["QMAKE_ORIG_TARGET"] = project->variables()["TARGET"]; |
268 | 366 | ||
269 | /* this should probably not be here, but I'm using it to wrap the .t files */ | 367 | /* this should probably not be here, but I'm using it to wrap the .t files */ |
@@ -281,3 +379,8 @@ BorlandMakefileGenerator::init() | |||
281 | } | 379 | } |
282 | 380 | ||
381 | if(project->isEmpty("QMAKE_INSTALL_FILE")) | ||
382 | project->variables()["QMAKE_INSTALL_FILE"].append("$(COPY_FILE)"); | ||
383 | if(project->isEmpty("QMAKE_INSTALL_DIR")) | ||
384 | project->variables()["QMAKE_INSTALL_DIR"].append("$(COPY_DIR)"); | ||
385 | |||
283 | bool is_qt = (project->first("TARGET") == "qt"QTDLL_POSTFIX || project->first("TARGET") == "qtmt"QTDLL_POSTFIX); | 386 | bool is_qt = (project->first("TARGET") == "qt"QTDLL_POSTFIX || project->first("TARGET") == "qtmt"QTDLL_POSTFIX); |
@@ -288,2 +391,8 @@ BorlandMakefileGenerator::init() | |||
288 | if(configs.findIndex("qt") == -1) configs.append("qt"); | 391 | if(configs.findIndex("qt") == -1) configs.append("qt"); |
392 | if ( project->isActiveConfig("qtopia") ) { | ||
393 | if(configs.findIndex("qtopialib") == -1) | ||
394 | configs.append("qtopialib"); | ||
395 | if(configs.findIndex("qtopiainc") == -1) | ||
396 | configs.append("qtopiainc"); | ||
397 | } | ||
289 | if ( project->isActiveConfig("qt") ) { | 398 | if ( project->isActiveConfig("qt") ) { |
@@ -316,3 +425,3 @@ BorlandMakefileGenerator::init() | |||
316 | if(project->isActiveConfig("qt")) { | 425 | if(project->isActiveConfig("qt")) { |
317 | if ( project->isActiveConfig("thread") ) | 426 | if ( project->isActiveConfig("thread") ) |
318 | project->variables()[is_qt ? "PRL_EXPORT_DEFINES" : "DEFINES"].append("QT_THREAD_SUPPORT"); | 427 | project->variables()[is_qt ? "PRL_EXPORT_DEFINES" : "DEFINES"].append("QT_THREAD_SUPPORT"); |
@@ -327,5 +436,5 @@ BorlandMakefileGenerator::init() | |||
327 | if ( project->isActiveConfig("dll") ) { | 436 | if ( project->isActiveConfig("dll") ) { |
328 | project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_MT_DLLDBG"]; | 437 | project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_MT_DLLDBG"]; |
329 | project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_MT_DLLDBG"]; | 438 | project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_MT_DLLDBG"]; |
330 | } else { | 439 | } else { |
331 | project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_MT_DBG"]; | 440 | project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_MT_DBG"]; |
@@ -358,2 +467,9 @@ BorlandMakefileGenerator::init() | |||
358 | } | 467 | } |
468 | if ( project->isActiveConfig("qtopiainc") ) | ||
469 | project->variables()["INCLUDEPATH"] += project->variables()["QMAKE_INCDIR_QTOPIA"]; | ||
470 | if ( project->isActiveConfig("qtopialib") ) { | ||
471 | if(!project->isEmpty("QMAKE_LIBDIR_QTOPIA")) | ||
472 | project->variables()["QMAKE_LIBDIR"] += project->variables()["QMAKE_LIBDIR_QTOPIA"]; | ||
473 | project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_QTOPIA"]; | ||
474 | } | ||
359 | if ( project->isActiveConfig("qt") ) { | 475 | if ( project->isActiveConfig("qt") ) { |
@@ -362,3 +478,3 @@ BorlandMakefileGenerator::init() | |||
362 | project->variables()["QMAKE_LIBDIR"] += project->variables()["QMAKE_LIBDIR_QT"]; | 478 | project->variables()["QMAKE_LIBDIR"] += project->variables()["QMAKE_LIBDIR_QT"]; |
363 | if ( !project->isActiveConfig("debug") ) | 479 | if ( !project->isActiveConfig("debug") ) |
364 | project->variables()[is_qt ? "PRL_EXPORT_DEFINES" : "DEFINES"].append("QT_NO_DEBUG"); | 480 | project->variables()[is_qt ? "PRL_EXPORT_DEFINES" : "DEFINES"].append("QT_NO_DEBUG"); |
@@ -470,2 +586,16 @@ BorlandMakefileGenerator::init() | |||
470 | project->variables()["QMAKE_LIBS"] += project->variables()["LIBS"]; | 586 | project->variables()["QMAKE_LIBS"] += project->variables()["LIBS"]; |
587 | // Update -lname to name.lib, and -Ldir to | ||
588 | QStringList &libList = project->variables()["QMAKE_LIBS"]; | ||
589 | for( QStringList::Iterator stIt = libList.begin(); stIt != libList.end(); ) { | ||
590 | QString s = *stIt; | ||
591 | if( s.startsWith( "-l" ) ) { | ||
592 | stIt = libList.remove( stIt ); | ||
593 | stIt = libList.insert( stIt, s.mid( 2 ) + ".lib" ); | ||
594 | } else if( s.startsWith( "-L" ) ) { | ||
595 | stIt = libList.remove( stIt ); | ||
596 | project->variables()["QMAKE_LIBDIR"].append(QDir::convertSeparators(s.mid( 2 ))); | ||
597 | } else { | ||
598 | stIt++; | ||
599 | } | ||
600 | } | ||
471 | project->variables()["QMAKE_FILETAGS"] += QStringList::split(' ', | 601 | project->variables()["QMAKE_FILETAGS"] += QStringList::split(' ', |
@@ -473,3 +603,4 @@ BorlandMakefileGenerator::init() | |||
473 | QStringList &l = project->variables()["QMAKE_FILETAGS"]; | 603 | QStringList &l = project->variables()["QMAKE_FILETAGS"]; |
474 | for(QStringList::Iterator it = l.begin(); it != l.end(); ++it) { | 604 | QStringList::Iterator it; |
605 | for(it = l.begin(); it != l.end(); ++it) { | ||
475 | QStringList &gdmf = project->variables()[(*it)]; | 606 | QStringList &gdmf = project->variables()[(*it)]; |
@@ -488,2 +619,3 @@ BorlandMakefileGenerator::init() | |||
488 | project->variables()["POST_TARGETDEPS"] += project->variables()["RES_FILE"]; | 619 | project->variables()["POST_TARGETDEPS"] += project->variables()["RES_FILE"]; |
620 | project->variables()["CLEAN_FILES"] += project->variables()["RES_FILE"]; | ||
489 | } | 621 | } |
@@ -508,2 +640,22 @@ BorlandMakefileGenerator::init() | |||
508 | } | 640 | } |
641 | |||
642 | QStringList &quc = project->variables()["QMAKE_EXTRA_WIN_COMPILERS"]; | ||
643 | for(it = quc.begin(); it != quc.end(); ++it) { | ||
644 | QString tmp_out = project->variables()[(*it) + ".output"].first(); | ||
645 | if(tmp_out.isEmpty()) | ||
646 | continue; | ||
647 | QStringList &tmp = project->variables()[(*it) + ".input"]; | ||
648 | for(QStringList::Iterator it2 = tmp.begin(); it2 != tmp.end(); ++it2) { | ||
649 | QStringList &inputs = project->variables()[(*it2)]; | ||
650 | for(QStringList::Iterator input = inputs.begin(); input != inputs.end(); ++input) { | ||
651 | QFileInfo fi(Option::fixPathToLocalOS((*input))); | ||
652 | QString in = Option::fixPathToTargetOS((*input), FALSE), | ||
653 | out = tmp_out; | ||
654 | out.replace("${QMAKE_FILE_BASE}", fi.baseName()); | ||
655 | out.replace("${QMAKE_FILE_NAME}", fi.fileName()); | ||
656 | if(project->variables()[(*it) + ".CONFIG"].findIndex("no_link") == -1) | ||
657 | project->variables()["OBJCOMP"] += out; | ||
658 | } | ||
659 | } | ||
660 | } | ||
509 | } | 661 | } |
diff --git a/qmake/generators/win32/borland_bmake.h b/qmake/generators/win32/borland_bmake.h index 5ffed58..700e7f7 100644 --- a/qmake/generators/win32/borland_bmake.h +++ b/qmake/generators/win32/borland_bmake.h | |||
@@ -1,11 +1,9 @@ | |||
1 | /**************************************************************************** | 1 | /**************************************************************************** |
2 | ** $Id$ | 2 | ** |
3 | ** | 3 | ** |
4 | ** Definition of ________ class. | 4 | ** Definition of BorlandMakefileGenerator class. |
5 | ** | 5 | ** |
6 | ** Created : 970521 | 6 | ** Copyright (C) 1992-2003 Trolltech AS. All rights reserved. |
7 | ** | 7 | ** |
8 | ** Copyright (C) 1992-2002 Trolltech AS. All rights reserved. | 8 | ** This file is part of qmake. |
9 | ** | ||
10 | ** This file is part of the network module of the Qt GUI Toolkit. | ||
11 | ** | 9 | ** |
@@ -36,2 +34,3 @@ | |||
36 | **********************************************************************/ | 34 | **********************************************************************/ |
35 | |||
37 | #ifndef __BORLAND_BMAKE_H__ | 36 | #ifndef __BORLAND_BMAKE_H__ |
diff --git a/qmake/generators/win32/mingw_make.cpp b/qmake/generators/win32/mingw_make.cpp index 7f58a55..c693d6a 100644 --- a/qmake/generators/win32/mingw_make.cpp +++ b/qmake/generators/win32/mingw_make.cpp | |||
@@ -1,524 +1,708 @@ | |||
1 | /**************************************************************************** | 1 | /**************************************************************************** |
2 | ** $Id$ | 2 | ** |
3 | ** | 3 | ** |
4 | ** Definition of ________ class. | 4 | ** Implementation of MingwMakefileGenerator class. |
5 | ** | 5 | ** |
6 | ** Copyright (C) 1992-2002 Trolltech AS. All rights reserved. | 6 | ** Copyright (C) 1992-2003 Trolltech AS. All rights reserved. |
7 | ** | 7 | ** |
8 | ** This file is part of the network module of the Qt GUI Toolkit. | 8 | ** This file is part of qmake. |
9 | ** | 9 | ** |
10 | ** This file may be distributed under the terms of the Q Public License | 10 | ** This file may be distributed under the terms of the Q Public License |
11 | ** as defined by Trolltech AS of Norway and appearing in the file | 11 | ** as defined by Trolltech AS of Norway and appearing in the file |
12 | ** LICENSE.QPL included in the packaging of this file. | 12 | ** LICENSE.QPL included in the packaging of this file. |
13 | ** | 13 | ** |
14 | ** This file may be distributed and/or modified under the terms of the | 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 | 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 | 16 | ** Foundation and appearing in the file LICENSE.GPL included in the |
17 | ** packaging of this file. | 17 | ** packaging of this file. |
18 | ** | 18 | ** |
19 | ** Licensees holding valid Qt Enterprise Edition licenses may use this | 19 | ** Licensees holding valid Qt Enterprise Edition licenses may use this |
20 | ** file in accordance with the Qt Commercial License Agreement provided | 20 | ** file in accordance with the Qt Commercial License Agreement provided |
21 | ** with the Software. | 21 | ** with the Software. |
22 | ** | 22 | ** |
23 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 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. | 24 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
25 | ** | 25 | ** |
26 | ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for | 26 | ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for |
27 | ** information about Qt Commercial License Agreements. | 27 | ** information about Qt Commercial License Agreements. |
28 | ** See http://www.trolltech.com/qpl/ for QPL licensing information. | 28 | ** See http://www.trolltech.com/qpl/ for QPL licensing information. |
29 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 29 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
30 | ** | 30 | ** |
31 | ** Contact info@trolltech.com if any conditions of this licensing are | 31 | ** Contact info@trolltech.com if any conditions of this licensing are |
32 | ** not clear to you. | 32 | ** not clear to you. |
33 | ** | 33 | ** |
34 | **********************************************************************/ | 34 | **********************************************************************/ |
35 | 35 | ||
36 | #include "mingw_make.h" | 36 | #include "mingw_make.h" |
37 | #include "option.h" | 37 | #include "option.h" |
38 | #include <qregexp.h> | 38 | #include <qregexp.h> |
39 | #include <qdir.h> | 39 | #include <qdir.h> |
40 | #include <stdlib.h> | 40 | #include <stdlib.h> |
41 | #include <time.h> | 41 | #include <time.h> |
42 | 42 | ||
43 | 43 | ||
44 | MingwMakefileGenerator::MingwMakefileGenerator(QMakeProject *p) : Win32MakefileGenerator(p), init_flag(FALSE) | 44 | MingwMakefileGenerator::MingwMakefileGenerator(QMakeProject *p) : Win32MakefileGenerator(p), init_flag(FALSE) |
45 | { | 45 | { |
46 | Option::obj_ext = ".o"; | 46 | Option::obj_ext = ".o"; |
47 | } | 47 | } |
48 | 48 | ||
49 | bool | 49 | bool |
50 | MingwMakefileGenerator::writeMakefile(QTextStream &t) | 50 | MingwMakefileGenerator::findLibraries() // todo - pascal |
51 | { | 51 | { |
52 | writeHeader(t); | 52 | return TRUE; |
53 | if(!project->variables()["QMAKE_FAILED_REQUIREMENTS"].isEmpty()) { | 53 | } |
54 | t << "all clean:" << "\n\t" | 54 | |
55 | << "@echo \"Some of the required modules (" | 55 | bool |
56 | << var("QMAKE_FAILED_REQUIREMENTS") << ") are not available.\"" << "\n\t" | 56 | MingwMakefileGenerator::writeMakefile(QTextStream &t) |
57 | << "@echo \"Skipped.\"" << endl << endl; | 57 | { |
58 | writeMakeQmake(t); | 58 | writeHeader(t); |
59 | return TRUE; | 59 | if(!project->variables()["QMAKE_FAILED_REQUIREMENTS"].isEmpty()) { |
60 | } | 60 | t << "all clean:" << "\n\t" |
61 | 61 | << "@echo \"Some of the required modules (" | |
62 | if(project->first("TEMPLATE") == "app" || | 62 | << var("QMAKE_FAILED_REQUIREMENTS") << ") are not available.\"" << "\n\t" |
63 | project->first("TEMPLATE") == "lib") { | 63 | << "@echo \"Skipped.\"" << endl << endl; |
64 | writeMingwParts(t); | 64 | writeMakeQmake(t); |
65 | return MakefileGenerator::writeMakefile(t); | 65 | return TRUE; |
66 | } | 66 | } |
67 | else if(project->first("TEMPLATE") == "subdirs") { | 67 | |
68 | writeSubDirs(t); | 68 | if(project->first("TEMPLATE") == "app" || |
69 | return TRUE; | 69 | project->first("TEMPLATE") == "lib") { |
70 | } | 70 | writeMingwParts(t); |
71 | return FALSE; | 71 | return MakefileGenerator::writeMakefile(t); |
72 | } | 72 | } |
73 | 73 | else if(project->first("TEMPLATE") == "subdirs") { | |
74 | void | 74 | writeSubDirs(t); |
75 | MingwMakefileGenerator::writeMingwParts(QTextStream &t) | 75 | return TRUE; |
76 | { | 76 | } |
77 | t << "####### Compiler, tools and options" << endl << endl; | 77 | return FALSE; |
78 | t << "CC =" << var("QMAKE_CC") << endl; | 78 | } |
79 | t << "CXX =" << var("QMAKE_CXX") << endl; | 79 | |
80 | t << "LEX = " << var("QMAKE_LEX") << endl; | 80 | void createLdObjectScriptFile(const QString & fileName, QStringList & objList) |
81 | t << "YACC = " << var("QMAKE_YACC") << endl; | 81 | { |
82 | t << "CFLAGS =" << var("QMAKE_CFLAGS") << " " | 82 | QString filePath = Option::output_dir + QDir::separator() + fileName; |
83 | << varGlue("PRL_EXPORT_DEFINES","-D"," -D","") << " " | 83 | QFile file(filePath); |
84 | << varGlue("DEFINES","-D"," -D","") << endl; | 84 | if (file.open(IO_WriteOnly | IO_Translate )) { |
85 | t << "CXXFLAGS =" << var("QMAKE_CXXFLAGS") << " " | 85 | QTextStream t(&file); |
86 | << varGlue("PRL_EXPORT_DEFINES","-D"," -D","") << " " | 86 | t << "INPUT(" << endl; |
87 | << varGlue("DEFINES","-D"," -D","") << endl; | 87 | for (QStringList::Iterator it = objList.begin(); it != objList.end(); ++it ) { |
88 | t << "LEXFLAGS=" << var("QMAKE_LEXFLAGS") << endl; | 88 | t << *it << endl; |
89 | t << "YACCFLAGS=" << var("QMAKE_YACCFLAGS") << endl; | 89 | } |
90 | 90 | t << ");" << endl; | |
91 | t << "INCPATH ="; | 91 | file.close(); |
92 | QStringList &incs = project->variables()["INCLUDEPATH"]; | 92 | } |
93 | for(QStringList::Iterator incit = incs.begin(); incit != incs.end(); ++incit) { | 93 | } |
94 | QString inc = (*incit); | 94 | |
95 | inc.replace(QRegExp("\\\\$"), "\\\\"); | 95 | void |
96 | inc.replace(QRegExp("\""), ""); | 96 | MingwMakefileGenerator::writeMingwParts(QTextStream &t) |
97 | t << " -I" << inc ; | 97 | { |
98 | } | 98 | t << "####### Compiler, tools and options" << endl << endl; |
99 | t << " -I" << specdir() | 99 | t << "CC =" << var("QMAKE_CC") << endl; |
100 | << endl; | 100 | t << "CXX =" << var("QMAKE_CXX") << endl; |
101 | if(!project->variables()["QMAKE_APP_OR_DLL"].isEmpty()) { | 101 | t << "LEX = " << var("QMAKE_LEX") << endl; |
102 | t << "LINK =" << var("QMAKE_LINK") << endl; | 102 | t << "YACC = " << var("QMAKE_YACC") << endl; |
103 | t << "LFLAGS ="; | 103 | t << "CFLAGS =" << var("QMAKE_CFLAGS") << " " |
104 | if ( !project->variables()["QMAKE_LIBDIR"].isEmpty() ) | 104 | << varGlue("PRL_EXPORT_DEFINES","-D"," -D","") << " " |
105 | t << varGlue("QMAKE_LIBDIR","-L",";","") << " "; | 105 | << varGlue("DEFINES","-D"," -D","") << endl; |
106 | t << var("QMAKE_LFLAGS") << endl; | 106 | t << "CXXFLAGS =" << var("QMAKE_CXXFLAGS") << " " |
107 | t << "LIBS =" << var("QMAKE_LIBS").replace(QRegExp("(\\slib|^lib)")," -l") << endl; | 107 | << varGlue("PRL_EXPORT_DEFINES","-D"," -D","") << " " |
108 | } | 108 | << varGlue("DEFINES","-D"," -D","") << endl; |
109 | else { | 109 | t << "LEXFLAGS=" << var("QMAKE_LEXFLAGS") << endl; |
110 | t << "LIB =" << var("QMAKE_LIB") << endl; | 110 | t << "YACCFLAGS=" << var("QMAKE_YACCFLAGS") << endl; |
111 | } | 111 | |
112 | t << "MOC =" << (project->isEmpty("QMAKE_MOC") ? QString("moc") : | 112 | t << "INCPATH ="; |
113 | Option::fixPathToTargetOS(var("QMAKE_MOC"), FALSE)) << endl; | 113 | QStringList &incs = project->variables()["INCLUDEPATH"]; |
114 | t << "UIC =" << (project->isEmpty("QMAKE_UIC") ? QString("uic") : | 114 | for(QStringList::Iterator incit = incs.begin(); incit != incs.end(); ++incit) { |
115 | Option::fixPathToTargetOS(var("QMAKE_UIC"), FALSE)) << endl; | 115 | QString inc = (*incit); |
116 | t << "QMAKE =" << (project->isEmpty("QMAKE_QMAKE") ? QString("qmake") : | 116 | inc.replace(QRegExp("\\\\$"), "\\\\"); |
117 | Option::fixPathToTargetOS(var("QMAKE_QMAKE"), FALSE)) << endl; | 117 | inc.replace(QRegExp("\""), ""); |
118 | t << "IDC =" << (project->isEmpty("QMAKE_IDC") ? QString("idc") : | 118 | t << " -I" << "\"" << inc << "\""; |
119 | Option::fixPathToTargetOS(var("QMAKE_IDC"), FALSE)) << endl; | 119 | } |
120 | t << "IDL =" << (project->isEmpty("QMAKE_IDL") ? QString("midl") : | 120 | t << " -I" << "\"" << specdir() << "\"" << endl; |
121 | Option::fixPathToTargetOS(var("QMAKE_IDL"), FALSE)) << endl; | 121 | if(!project->variables()["QMAKE_APP_OR_DLL"].isEmpty()) { |
122 | t << "ZIP =" << var("QMAKE_ZIP") << endl; | 122 | t << "LINK =" << var("QMAKE_LINK") << endl; |
123 | t << "DEF_FILE =" << varList("DEF_FILE") << endl; | 123 | t << "LFLAGS =" << var("QMAKE_LFLAGS") << endl; |
124 | t << "COPY_FILE= " << var("QMAKE_COPY") << endl; | 124 | t << "LIBS ="; |
125 | t << "COPY_DIR= " << var("QMAKE_COPY") << endl; | 125 | if ( !project->variables()["QMAKE_LIBDIR"].isEmpty() ) |
126 | t << "DEL_FILE= " << var("QMAKE_DEL_FILE") << endl; | 126 | t << varGlue("QMAKE_LIBDIR","-L\"","\" -L\"","\"") << " "; |
127 | t << "DEL_DIR= " << var("QMAKE_DEL_DIR") << endl; | 127 | t << var("QMAKE_LIBS").replace(QRegExp("(\\slib|^lib)")," -l") << endl; |
128 | t << "MOVE = " << var("QMAKE_MOVE") << endl; | 128 | } |
129 | t << "CHK_DIR_EXISTS =" << var("QMAKE_CHK_DIR_EXISTS") << endl; | 129 | else { |
130 | t << "MKDIR =" << var("QMAKE_MKDIR") << endl; | 130 | t << "LIB =" << var("QMAKE_LIB") << endl; |
131 | t << endl; | 131 | } |
132 | 132 | t << "MOC =" << (project->isEmpty("QMAKE_MOC") ? QString("moc") : | |
133 | t << "####### Output directory" << endl << endl; | 133 | Option::fixPathToTargetOS(var("QMAKE_MOC"), FALSE)) << endl; |
134 | if (! project->variables()["OBJECTS_DIR"].isEmpty()) | 134 | t << "UIC =" << (project->isEmpty("QMAKE_UIC") ? QString("uic") : |
135 | t << "OBJECTS_DIR = " << var("OBJECTS_DIR").replace(QRegExp("\\\\$"),"") << endl; | 135 | Option::fixPathToTargetOS(var("QMAKE_UIC"), FALSE)) << endl; |
136 | else | 136 | t << "QMAKE =" << (project->isEmpty("QMAKE_QMAKE") ? QString("qmake") : |
137 | t << "OBJECTS_DIR = . " << endl; | 137 | Option::fixPathToTargetOS(var("QMAKE_QMAKE"), FALSE)) << endl; |
138 | if (! project->variables()["MOC_DIR"].isEmpty()) | 138 | t << "IDC =" << (project->isEmpty("QMAKE_IDC") ? QString("idc") : |
139 | t << "MOC_DIR = " << var("MOC_DIR").replace(QRegExp("\\\\$"),"") << endl; | 139 | Option::fixPathToTargetOS(var("QMAKE_IDC"), FALSE)) << endl; |
140 | else | 140 | t << "IDL =" << (project->isEmpty("QMAKE_IDL") ? QString("midl") : |
141 | t << "MOC_DIR = . " << endl; | 141 | Option::fixPathToTargetOS(var("QMAKE_IDL"), FALSE)) << endl; |
142 | t << endl; | 142 | t << "ZIP =" << var("QMAKE_ZIP") << endl; |
143 | 143 | t << "DEF_FILE =" << varList("DEF_FILE") << endl; | |
144 | t << "####### Files" << endl << endl; | 144 | t << "COPY_FILE= " << var("QMAKE_COPY") << endl; |
145 | t << "HEADERS =" << varList("HEADERS") << endl; | 145 | t << "COPY_DIR= " << var("QMAKE_COPY") << endl; |
146 | t << "SOURCES =" << varList("SOURCES") << endl; | 146 | t << "DEL_FILE= " << var("QMAKE_DEL_FILE") << endl; |
147 | // t << "OBJECTS =" << varList("OBJECTS").replace(QRegExp("\\.obj"),".o") << endl; | 147 | t << "DEL_DIR= " << var("QMAKE_DEL_DIR") << endl; |
148 | t << "OBJECTS =" << varList("OBJECTS") << endl; | 148 | t << "MOVE = " << var("QMAKE_MOVE") << endl; |
149 | t << "FORMS =" << varList("FORMS") << endl; | 149 | t << "CHK_DIR_EXISTS =" << var("QMAKE_CHK_DIR_EXISTS") << endl; |
150 | t << "UICDECLS =" << varList("UICDECLS") << endl; | 150 | t << "MKDIR =" << var("QMAKE_MKDIR") << endl; |
151 | t << "UICIMPLS =" << varList("UICIMPLS") << endl; | 151 | t << "INSTALL_FILE= " << var("QMAKE_INSTALL_FILE") << endl; |
152 | t << "SRCMOC =" << varList("SRCMOC") << endl; | 152 | t << "INSTALL_DIR = " << var("QMAKE_INSTALL_DIR") << endl; |
153 | t << "OBJMOC =" << varList("OBJMOC") << endl; | 153 | t << endl; |
154 | // t << "OBJMOC =" << varList("OBJMOC").replace(QRegExp("\\.obj"),".o") << endl; | 154 | |
155 | t << "DIST =" << varList("DISTFILES") << endl; | 155 | t << "####### Output directory" << endl << endl; |
156 | t << "TARGET ="; | 156 | if (! project->variables()["OBJECTS_DIR"].isEmpty()) |
157 | if( !project->variables()[ "DESTDIR" ].isEmpty() ) | 157 | t << "OBJECTS_DIR = " << var("OBJECTS_DIR").replace(QRegExp("\\\\$"),"") << endl; |
158 | t << varGlue("TARGET",project->first("DESTDIR"),"",project->first("TARGET_EXT")); | 158 | else |
159 | else | 159 | t << "OBJECTS_DIR = . " << endl; |
160 | t << project->variables()[ "TARGET" ].first() << project->variables()[ "TARGET_EXT" ].first(); | 160 | if (! project->variables()["MOC_DIR"].isEmpty()) |
161 | t << endl; | 161 | t << "MOC_DIR = " << var("MOC_DIR").replace(QRegExp("\\\\$"),"") << endl; |
162 | t << endl; | 162 | else |
163 | 163 | t << "MOC_DIR = . " << endl; | |
164 | t << "####### Implicit rules" << endl << endl; | 164 | t << endl; |
165 | t << ".SUFFIXES: .cpp .cxx .cc .C .c" << endl << endl; | 165 | |
166 | t << ".cpp.o:\n\t" << var("QMAKE_RUN_CXX_IMP") << endl << endl; | 166 | t << "####### Files" << endl << endl; |
167 | t << ".cxx.o:\n\t" << var("QMAKE_RUN_CXX_IMP") << endl << endl; | 167 | t << "HEADERS =" << varList("HEADERS") << endl; |
168 | t << ".cc.o:\n\t" << var("QMAKE_RUN_CXX_IMP") << endl << endl; | 168 | t << "SOURCES =" << varList("SOURCES") << endl; |
169 | t << ".C.o:\n\t" << var("QMAKE_RUN_CXX_IMP") << endl << endl; | 169 | QString objectsLinkLine; |
170 | t << ".c.o:\n\t" << var("QMAKE_RUN_CC_IMP") << endl << endl; | 170 | if (!project->variables()["QMAKE_APP_OR_DLL"].isEmpty() && |
171 | 171 | project->variables()["OBJECTS"].count() > var("QMAKE_LINK_OBJECT_MAX").toUInt()) { | |
172 | t << "####### Build rules" << endl << endl; | 172 | createLdObjectScriptFile(var("QMAKE_LINK_OBJECT_SCRIPT"), project->variables()["OBJECTS"]); |
173 | t << "all: " << "$(OBJECTS_DIR) " << "$(MOC_DIR) " << varGlue("ALL_DEPS",""," "," ") << "$(TARGET)" << endl << endl; | 173 | objectsLinkLine = var("QMAKE_LINK_OBJECT_SCRIPT"); |
174 | t << "$(TARGET): " << var("PRE_TARGETDEPS") << " $(UICDECLS) $(OBJECTS) $(OBJMOC) " | 174 | } else { |
175 | << var("POST_TARGETDEPS"); | 175 | objectsLinkLine = "$(OBJECTS)"; |
176 | if(!project->variables()["QMAKE_APP_OR_DLL"].isEmpty()) { | 176 | } |
177 | t << "\n\t" << "$(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(OBJMOC) $(LIBS)"; | 177 | t << "OBJECTS =" << varList("OBJECTS") << endl; |
178 | } else { | 178 | t << "FORMS =" << varList("FORMS") << endl; |
179 | t << "\n\t" << "$(LIB) $(TARGET) $(OBJECTS) $(OBJMOC)"; | 179 | t << "UICDECLS =" << varList("UICDECLS") << endl; |
180 | } | 180 | t << "UICIMPLS =" << varList("UICIMPLS") << endl; |
181 | 181 | t << "SRCMOC =" << varList("SRCMOC") << endl; | |
182 | if(project->isActiveConfig("dll") && !project->variables()["DLLDESTDIR"].isEmpty()) { | 182 | QString objmocLinkLine; |
183 | QStringList dlldirs = project->variables()["DLLDESTDIR"]; | 183 | if (!project->variables()["QMAKE_APP_OR_DLL"].isEmpty() && |
184 | for ( QStringList::Iterator dlldir = dlldirs.begin(); dlldir != dlldirs.end(); ++dlldir ) { | 184 | project->variables()["OBJMOC"].count() > var("QMAKE_LINK_OBJECT_MAX").toUInt()) { |
185 | t << "\n\t" << "copy $(TARGET) " << *dlldir; | 185 | createLdObjectScriptFile(var("QMAKE_LINK_OBJMOC_SCRIPT"), project->variables()["OBJMOC"]); |
186 | } | 186 | objmocLinkLine = var("QMAKE_LINK_OBJMOC_SCRIPT"); |
187 | } | 187 | } else { |
188 | QString targetfilename = project->variables()["TARGET"].first(); | 188 | objmocLinkLine = "$(OBJMOC)"; |
189 | if(project->isActiveConfig("activeqt")) { | 189 | } |
190 | QString version = project->variables()["VERSION"].first(); | 190 | t << "OBJMOC =" << varList("OBJMOC") << endl; |
191 | if ( version.isEmpty() ) | 191 | QString extraCompilerDeps; |
192 | version = "1.0"; | 192 | if(!project->isEmpty("QMAKE_EXTRA_WIN_COMPILERS")) { |
193 | 193 | t << "OBJCOMP = " << varList("OBJCOMP") << endl; | |
194 | if ( project->isActiveConfig("dll")) { | 194 | extraCompilerDeps += " $(OBJCOMP) "; |
195 | t << "\n\t" << ("-$(IDC) $(TARGET) /idl tmp\\" + targetfilename + ".idl -version " + version); | 195 | |
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"); | 196 | QStringList &comps = project->variables()["QMAKE_EXTRA_WIN_COMPILERS"]; |
197 | t << "\n\t" << ("-$(IDC) $(TARGET) /tlb tmp\\" + targetfilename + ".tlb"); | 197 | for(QStringList::Iterator compit = comps.begin(); compit != comps.end(); ++compit) { |
198 | t << "\n\t" << ("-$(IDC) $(TARGET) /regserver" ); | 198 | QStringList &vars = project->variables()[(*compit) + ".variables"]; |
199 | } else { | 199 | for(QStringList::Iterator varit = vars.begin(); varit != vars.end(); ++varit) { |
200 | t << "\n\t" << ("-$(TARGET) -dumpidl tmp\\" + targetfilename + ".idl -version " + version); | 200 | QStringList vals = project->variables()[(*varit)]; |
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"); | 201 | if(!vals.isEmpty()) |
202 | t << "\n\t" << ("-$(IDC) $(TARGET) /tlb tmp\\" + targetfilename + ".tlb"); | 202 | t << "QMAKE_COMP_" << (*varit) << " = " << valList(vals) << endl; |
203 | t << "\n\t" << "-$(TARGET) -regserver"; | 203 | } |
204 | } | 204 | } |
205 | } | 205 | } |
206 | t << endl << endl; | 206 | |
207 | 207 | t << "DIST =" << varList("DISTFILES") << endl; | |
208 | if(!project->variables()["RC_FILE"].isEmpty()) { | 208 | t << "TARGET ="; |
209 | t << var("RES_FILE") << ": " << var("RC_FILE") << "\n\t" | 209 | if( !project->variables()[ "DESTDIR" ].isEmpty() ) |
210 | << var("QMAKE_RC") << " -i " << var("RC_FILE") << " -o " << var("RC_FILE").replace(QRegExp("\\.rc"),".o") << endl << endl; | 210 | t << varGlue("TARGET",project->first("DESTDIR"),"",project->first("TARGET_EXT")); |
211 | } | 211 | else |
212 | project->variables()["RES_FILE"].first().replace(QRegExp("\\.rc"),".o"); | 212 | t << project->variables()[ "TARGET" ].first() << project->variables()[ "TARGET_EXT" ].first(); |
213 | 213 | t << endl; | |
214 | t << "mocables: $(SRCMOC)" << endl << endl; | 214 | t << endl; |
215 | 215 | ||
216 | t << "$(OBJECTS_DIR):" << "\n\t" | 216 | t << "####### Implicit rules" << endl << endl; |
217 | << "@if not exist $(OBJECTS_DIR) mkdir $(OBJECTS_DIR)" << endl << endl; | 217 | t << ".SUFFIXES: .cpp .cxx .cc .C .c" << endl << endl; |
218 | 218 | t << ".cpp.o:\n\t" << var("QMAKE_RUN_CXX_IMP") << endl << endl; | |
219 | t << "$(MOC_DIR):" << "\n\t" | 219 | t << ".cxx.o:\n\t" << var("QMAKE_RUN_CXX_IMP") << endl << endl; |
220 | << "@if not exist $(MOC_DIR) mkdir $(MOC_DIR)" << endl << endl; | 220 | t << ".cc.o:\n\t" << var("QMAKE_RUN_CXX_IMP") << endl << endl; |
221 | 221 | t << ".C.o:\n\t" << var("QMAKE_RUN_CXX_IMP") << endl << endl; | |
222 | writeMakeQmake(t); | 222 | t << ".c.o:\n\t" << var("QMAKE_RUN_CC_IMP") << endl << endl; |
223 | 223 | ||
224 | t << "dist:" << "\n\t" | 224 | t << "####### Build rules" << endl << endl; |
225 | << "$(ZIP) " << var("PROJECT") << ".zip " | 225 | t << "all: " << "$(OBJECTS_DIR) " << "$(MOC_DIR) " << varGlue("ALL_DEPS",""," "," ") << "$(TARGET)" << endl << endl; |
226 | << var("PROJECT") << ".pro $(SOURCES) $(HEADERS) $(DIST) $(FORMS)" << endl << endl; | 226 | t << "$(TARGET): " << var("PRE_TARGETDEPS") << " $(UICDECLS) $(OBJECTS) $(OBJMOC) " |
227 | 227 | << extraCompilerDeps << var("POST_TARGETDEPS"); | |
228 | t << "clean:" | 228 | if(!project->variables()["QMAKE_APP_OR_DLL"].isEmpty()) { |
229 | << varGlue("OBJECTS","\n\t-del ","\n\t-del ","").replace(QRegExp("\\.obj"),".o") | 229 | t << "\n\t" << "$(LINK) $(LFLAGS) -o $(TARGET) " << objectsLinkLine << " " << objmocLinkLine << " $(LIBS)"; |
230 | << varGlue("SRCMOC" ,"\n\t-del ","\n\t-del ","") | 230 | } else { |
231 | << varGlue("OBJMOC" ,"\n\t-del ","\n\t-del ","").replace(QRegExp("\\.obj"),".o") | 231 | t << "\n\t" << "$(LIB) $(TARGET) " << objectsLinkLine << " " << objmocLinkLine; |
232 | << varGlue("UICDECLS" ,"\n\t-del ","\n\t-del ","") | 232 | } |
233 | << varGlue("UICIMPLS" ,"\n\t-del ","\n\t-del ","") | 233 | t << extraCompilerDeps; |
234 | << "\n\t-del $(TARGET)" | 234 | if(project->isActiveConfig("dll") && !project->variables()["DLLDESTDIR"].isEmpty()) { |
235 | << varGlue("QMAKE_CLEAN","\n\t-del ","\n\t-del ","") | 235 | QStringList dlldirs = project->variables()["DLLDESTDIR"]; |
236 | << varGlue("CLEAN_FILES","\n\t-del ","\n\t-del ",""); | 236 | for ( QStringList::Iterator dlldir = dlldirs.begin(); dlldir != dlldirs.end(); ++dlldir ) { |
237 | if ( project->isActiveConfig("activeqt")) { | 237 | t << "\n\t" << "$(COPY_FILE) \"$(TARGET)\" " << *dlldir; |
238 | t << ("\n\t-del tmp\\" + targetfilename + ".*"); | 238 | } |
239 | t << "\n\t-del tmp\\dump.*"; | 239 | } |
240 | } | 240 | QString targetfilename = project->variables()["TARGET"].first(); |
241 | if(project->isActiveConfig("dll") && !project->variables()["DLLDESTDIR"].isEmpty()) | 241 | if(project->isActiveConfig("activeqt")) { |
242 | t << "\n\t-del " << var("DLLDESTDIR") << "\\" << project->variables()[ "TARGET" ].first() << project->variables()[ "TARGET_EXT" ].first(); | 242 | QString version = project->variables()["VERSION"].first(); |
243 | if(!project->isEmpty("IMAGES")) | 243 | if ( version.isEmpty() ) |
244 | t << varGlue("QMAKE_IMAGE_COLLECTION", "\n\t-del ", "\n\t-del ", ""); | 244 | version = "1.0"; |
245 | 245 | ||
246 | // blasted user defined targets | 246 | if ( project->isActiveConfig("dll")) { |
247 | QStringList &qut = project->variables()["QMAKE_EXTRA_WIN_TARGETS"]; | 247 | t << "\n\t" << ("-$(IDC) $(TARGET) /idl " + var("OBJECTS_DIR") + targetfilename + ".idl -version " + version); |
248 | for(QStringList::Iterator it = qut.begin(); it != qut.end(); ++it) { | 248 | t << "\n\t" << ("-$(IDL) /nologo " + var("OBJECTS_DIR") + targetfilename + ".idl /tlb " + var("OBJECTS_DIR") + targetfilename + ".tlb"); |
249 | QString targ = var((*it) + ".target"), | 249 | t << "\n\t" << ("-$(IDC) $(TARGET) /tlb " + var("OBJECTS_DIR") + targetfilename + ".tlb"); |
250 | cmd = var((*it) + ".commands"), deps; | 250 | t << "\n\t" << ("-$(IDC) $(TARGET) /regserver" ); |
251 | if(targ.isEmpty()) | 251 | } else { |
252 | targ = (*it); | 252 | t << "\n\t" << ("-$(TARGET) -dumpidl " + var("OBJECTS_DIR") + targetfilename + ".idl -version " + version); |
253 | QStringList &deplist = project->variables()[(*it) + ".depends"]; | 253 | t << "\n\t" << ("-$(IDL) /nologo " + var("OBJECTS_DIR") + targetfilename + ".idl /tlb " + var("OBJECTS_DIR") + targetfilename + ".tlb"); |
254 | for(QStringList::Iterator dep_it = deplist.begin(); dep_it != deplist.end(); ++dep_it) { | 254 | t << "\n\t" << ("-$(IDC) $(TARGET) /tlb " + var("OBJECTS_DIR") + targetfilename + ".tlb"); |
255 | QString dep = var((*dep_it) + ".target"); | 255 | t << "\n\t" << "-$(TARGET) -regserver"; |
256 | if(dep.isEmpty()) | 256 | } |
257 | dep = (*dep_it); | 257 | } |
258 | deps += " " + dep; | 258 | t << endl << endl; |
259 | } | 259 | |
260 | t << "\n\n" << targ << ":" << deps << "\n\t" | 260 | if(!project->variables()["RC_FILE"].isEmpty()) { |
261 | << cmd; | 261 | t << var("RES_FILE") << ": " << var("RC_FILE") << "\n\t" |
262 | } | 262 | << var("QMAKE_RC") << " -i " << var("RC_FILE") << " -o " << var("RC_FILE").replace(QRegExp("\\.rc"),".o") << " --include-dir=" << QFileInfo(var("RC_FILE")).dirPath() << endl << endl; |
263 | 263 | } | |
264 | t << endl << endl; | 264 | project->variables()["RES_FILE"].first().replace(QRegExp("\\.rc"),".o"); |
265 | } | 265 | |
266 | 266 | t << "mocables: $(SRCMOC)" << endl << endl; | |
267 | 267 | ||
268 | void | 268 | t << "$(OBJECTS_DIR):" << "\n\t" |
269 | MingwMakefileGenerator::init() | 269 | << "@if not exist $(OBJECTS_DIR) $(MKDIR) $(OBJECTS_DIR)" << endl << endl; |
270 | { | 270 | |
271 | if(init_flag) | 271 | t << "$(MOC_DIR):" << "\n\t" |
272 | return; | 272 | << "@if not exist $(MOC_DIR) $(MKDIR) $(MOC_DIR)" << endl << endl; |
273 | init_flag = TRUE; | 273 | |
274 | 274 | writeMakeQmake(t); | |
275 | /* this should probably not be here, but I'm using it to wrap the .t files */ | 275 | |
276 | if(project->first("TEMPLATE") == "app") | 276 | t << "dist:" << "\n\t" |
277 | project->variables()["QMAKE_APP_FLAG"].append("1"); | 277 | << "$(ZIP) " << var("PROJECT") << ".zip " |
278 | else if(project->first("TEMPLATE") == "lib") | 278 | << var("PROJECT") << ".pro $(SOURCES) $(HEADERS) $(DIST) $(FORMS)" << endl << endl; |
279 | project->variables()["QMAKE_LIB_FLAG"].append("1"); | 279 | |
280 | else if(project->first("TEMPLATE") == "subdirs") { | 280 | t << "clean:" |
281 | MakefileGenerator::init(); | 281 | << varGlue("OBJECTS","\n\t-$(DEL_FILE) ","\n\t-$(DEL_FILE) ","").replace(QRegExp("\\.obj"),".o") |
282 | if(project->variables()["MAKEFILE"].isEmpty()) | 282 | << varGlue("SRCMOC" ,"\n\t-$(DEL_FILE) ","\n\t-$(DEL_FILE) ","") |
283 | project->variables()["MAKEFILE"].append("Makefile"); | 283 | << varGlue("OBJMOC" ,"\n\t-$(DEL_FILE) ","\n\t-$(DEL_FILE) ","").replace(QRegExp("\\.obj"),".o") |
284 | if(project->variables()["QMAKE"].isEmpty()) | 284 | << varGlue("UICDECLS" ,"\n\t-$(DEL_FILE) ","\n\t-$(DEL_FILE) ","") |
285 | project->variables()["QMAKE"].append("qmake"); | 285 | << varGlue("UICIMPLS" ,"\n\t-$(DEL_FILE) ","\n\t-$(DEL_FILE) ","") |
286 | return; | 286 | << "\n\t-$(DEL_FILE) $(TARGET)" |
287 | } | 287 | << varGlue("QMAKE_CLEAN","\n\t-$(DEL_FILE) ","\n\t-$(DEL_FILE) ","") |
288 | 288 | << varGlue("CLEAN_FILES","\n\t-$(DEL_FILE) ","\n\t-$(DEL_FILE) ",""); | |
289 | bool is_qt = (project->first("TARGET") == "qt"QTDLL_POSTFIX || project->first("TARGET") == "qt-mt"QTDLL_POSTFIX); | 289 | if ( project->isActiveConfig("activeqt")) { |
290 | project->variables()["QMAKE_ORIG_TARGET"] = project->variables()["TARGET"]; | 290 | t << ("\n\t-$(DEL_FILE) " + var("OBJECTS_DIR") + targetfilename + ".idl"); |
291 | 291 | t << ("\n\t-$(DEL_FILE) " + var("OBJECTS_DIR") + targetfilename + ".tlb"); | |
292 | // LIBS defined in Profile comes first for gcc | 292 | } |
293 | project->variables()["QMAKE_LIBS"] += project->variables()["LIBS"]; | 293 | if(!project->isEmpty("IMAGES")) |
294 | 294 | t << varGlue("QMAKE_IMAGE_COLLECTION", "\n\t-$(DEL_FILE) ", "\n\t-$(DEL_FILE) ", ""); | |
295 | QString targetfilename = project->variables()["TARGET"].first(); | 295 | |
296 | QStringList &configs = project->variables()["CONFIG"]; | 296 | // user defined targets |
297 | if (project->isActiveConfig("qt") && project->isActiveConfig("shared")) | 297 | QStringList::Iterator it; |
298 | project->variables()["DEFINES"].append("QT_DLL"); | 298 | QStringList &qut = project->variables()["QMAKE_EXTRA_WIN_TARGETS"]; |
299 | if (project->isActiveConfig("qt_dll")) | 299 | |
300 | if(configs.findIndex("qt") == -1) configs.append("qt"); | 300 | for(it = qut.begin(); it != qut.end(); ++it) { |
301 | if ( project->isActiveConfig("qt") ) { | 301 | QString targ = var((*it) + ".target"), |
302 | if ( project->isActiveConfig( "plugin" ) ) { | 302 | cmd = var((*it) + ".commands"), deps; |
303 | project->variables()["CONFIG"].append("dll"); | 303 | if(targ.isEmpty()) |
304 | if(project->isActiveConfig("qt")) | 304 | targ = (*it); |
305 | project->variables()["DEFINES"].append("QT_PLUGIN"); | 305 | QStringList &deplist = project->variables()[(*it) + ".depends"]; |
306 | } | 306 | for(QStringList::Iterator dep_it = deplist.begin(); dep_it != deplist.end(); ++dep_it) { |
307 | if ( (project->variables()["DEFINES"].findIndex("QT_NODLL") == -1) && | 307 | QString dep = var((*dep_it) + ".target"); |
308 | ((project->variables()["DEFINES"].findIndex("QT_MAKEDLL") != -1 || | 308 | if(dep.isEmpty()) |
309 | project->variables()["DEFINES"].findIndex("QT_DLL") != -1) || | 309 | dep = (*dep_it); |
310 | (getenv("QT_DLL") && !getenv("QT_NODLL"))) ) { | 310 | deps += " " + dep; |
311 | project->variables()["QMAKE_QT_DLL"].append("1"); | 311 | } |
312 | if ( is_qt && !project->variables()["QMAKE_LIB_FLAG"].isEmpty() ) | 312 | t << "\n\n" << targ << ":" << deps << "\n\t" |
313 | project->variables()["CONFIG"].append("dll"); | 313 | << cmd; |
314 | } | 314 | } |
315 | if ( project->isActiveConfig("thread") ) | 315 | |
316 | project->variables()[is_qt ? "PRL_EXPORT_DEFINES" : "DEFINES"].append("QT_THREAD_SUPPORT"); | 316 | t << endl << endl; |
317 | if ( project->isActiveConfig("accessibility" ) ) | 317 | |
318 | project->variables()[is_qt ? "PRL_EXPORT_DEFINES" : "DEFINES"].append("QT_ACCESSIBILITY_SUPPORT"); | 318 | QStringList &quc = project->variables()["QMAKE_EXTRA_WIN_COMPILERS"]; |
319 | if ( project->isActiveConfig("tablet") ) | 319 | for(it = quc.begin(); it != quc.end(); ++it) { |
320 | project->variables()[is_qt ? "PRL_EXPORT_DEFINES" : "DEFINES"].append("QT_TABLET_SUPPORT"); | 320 | QString tmp_out = project->variables()[(*it) + ".output"].first(); |
321 | } | 321 | QString tmp_cmd = project->variables()[(*it) + ".commands"].join(" "); |
322 | if ( project->isActiveConfig("dll") || !project->variables()["QMAKE_APP_FLAG"].isEmpty() ) { | 322 | QString tmp_dep = project->variables()[(*it) + ".depends"].join(" "); |
323 | project->variables()["CONFIG"].remove("staticlib"); | 323 | QStringList &vars = project->variables()[(*it) + ".variables"]; |
324 | project->variables()["QMAKE_APP_OR_DLL"].append("1"); | 324 | if(tmp_out.isEmpty() || tmp_cmd.isEmpty()) |
325 | } else { | 325 | continue; |
326 | project->variables()["CONFIG"].append("staticlib"); | 326 | QStringList &tmp = project->variables()[(*it) + ".input"]; |
327 | } | 327 | for(QStringList::Iterator it2 = tmp.begin(); it2 != tmp.end(); ++it2) { |
328 | if ( project->isActiveConfig("warn_off") ) { | 328 | QStringList &inputs = project->variables()[(*it2)]; |
329 | project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_WARN_OFF"]; | 329 | for(QStringList::Iterator input = inputs.begin(); input != inputs.end(); ++input) { |
330 | project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_WARN_OFF"]; | 330 | QFileInfo fi(Option::fixPathToLocalOS((*input))); |
331 | } else if ( project->isActiveConfig("warn_on") ) { | 331 | QString in = Option::fixPathToTargetOS((*input), FALSE), |
332 | project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_WARN_ON"]; | 332 | out = tmp_out, cmd = tmp_cmd, deps; |
333 | project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_WARN_ON"]; | 333 | out.replace("${QMAKE_FILE_BASE}", fi.baseName()); |
334 | } | 334 | out.replace("${QMAKE_FILE_NAME}", fi.fileName()); |
335 | if ( project->isActiveConfig("debug") ) { | 335 | cmd.replace("${QMAKE_FILE_BASE}", fi.baseName()); |
336 | if ( project->isActiveConfig("thread") ) { | 336 | cmd.replace("${QMAKE_FILE_OUT}", out); |
337 | // use the DLL RT even here | 337 | cmd.replace("${QMAKE_FILE_NAME}", fi.fileName()); |
338 | if ( project->variables()["DEFINES"].contains("QT_DLL") ) { | 338 | for(QStringList::Iterator it3 = vars.begin(); it3 != vars.end(); ++it3) |
339 | project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_MT_DLLDBG"]; | 339 | cmd.replace("$(" + (*it3) + ")", "$(QMAKE_COMP_" + (*it3)+")"); |
340 | project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_MT_DLLDBG"]; | 340 | if(!tmp_dep.isEmpty()) { |
341 | } else { | 341 | char buff[256]; |
342 | project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_MT_DBG"]; | 342 | QString dep_cmd = tmp_dep; |
343 | project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_MT_DBG"]; | 343 | dep_cmd.replace("${QMAKE_FILE_NAME}", fi.fileName()); |
344 | } | 344 | if(FILE *proc = QT_POPEN(dep_cmd.latin1(), "r")) { |
345 | } | 345 | while(!feof(proc)) { |
346 | project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_DEBUG"]; | 346 | int read_in = int(fread(buff, 1, 255, proc)); |
347 | project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_DEBUG"]; | 347 | if(!read_in) |
348 | project->variables()["QMAKE_LFLAGS"] += project->variables()["QMAKE_LFLAGS_DEBUG"]; | 348 | break; |
349 | } else { | 349 | int l = 0; |
350 | if ( project->isActiveConfig("thread") ) { | 350 | for(int i = 0; i < read_in; i++) { |
351 | if ( project->variables()["DEFINES"].contains("QT_DLL") ) { | 351 | if(buff[i] == '\n' || buff[i] == ' ') { |
352 | project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_MT_DLL"]; | 352 | deps += " " + QCString(buff+l, (i - l) + 1); |
353 | project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_MT_DLL"]; | 353 | l = i; |
354 | } else { | 354 | } |
355 | project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_MT"]; | 355 | } |
356 | project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_MT"]; | 356 | } |
357 | } | 357 | fclose(proc); |
358 | } | 358 | } |
359 | project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_RELEASE"]; | 359 | } |
360 | project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_RELEASE"]; | 360 | t << out << ": " << in << deps << "\n\t" |
361 | project->variables()["QMAKE_LFLAGS"] += project->variables()["QMAKE_LFLAGS_RELEASE"]; | 361 | << cmd << endl << endl; |
362 | } | 362 | } |
363 | 363 | } | |
364 | if ( !project->variables()["QMAKE_INCDIR"].isEmpty()) | 364 | } |
365 | project->variables()["INCLUDEPATH"] += project->variables()["QMAKE_INCDIR"]; | 365 | t << endl; |
366 | if ( project->isActiveConfig("qt") || project->isActiveConfig("opengl") ) | 366 | } |
367 | project->variables()["CONFIG"].append("windows"); | 367 | |
368 | if ( project->isActiveConfig("qt") ) { | 368 | |
369 | project->variables()["CONFIG"].append("moc"); | 369 | void |
370 | project->variables()["INCLUDEPATH"] +=project->variables()["QMAKE_INCDIR_QT"]; | 370 | MingwMakefileGenerator::init() |
371 | project->variables()["QMAKE_LIBDIR"] += project->variables()["QMAKE_LIBDIR_QT"]; | 371 | { |
372 | if ( !project->isActiveConfig("debug") ) | 372 | if(init_flag) |
373 | project->variables()[is_qt ? "PRL_EXPORT_DEFINES" : "DEFINES"].append("QT_NO_DEBUG"); | 373 | return; |
374 | if ( is_qt && !project->variables()["QMAKE_LIB_FLAG"].isEmpty() ) { | 374 | init_flag = TRUE; |
375 | if ( !project->variables()["QMAKE_QT_DLL"].isEmpty()) { | 375 | |
376 | project->variables()["DEFINES"].append("QT_MAKEDLL"); | 376 | /* this should probably not be here, but I'm using it to wrap the .t files */ |
377 | project->variables()["QMAKE_LFLAGS"] += project->variables()["QMAKE_LFLAGS_QT_DLL"]; | 377 | if(project->first("TEMPLATE") == "app") |
378 | } | 378 | project->variables()["QMAKE_APP_FLAG"].append("1"); |
379 | } else { | 379 | else if(project->first("TEMPLATE") == "lib") |
380 | if(project->isActiveConfig("thread")) | 380 | project->variables()["QMAKE_LIB_FLAG"].append("1"); |
381 | project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_QT_THREAD"]; | 381 | else if(project->first("TEMPLATE") == "subdirs") { |
382 | else | 382 | MakefileGenerator::init(); |
383 | project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_QT"]; | 383 | if(project->variables()["MAKEFILE"].isEmpty()) |
384 | if ( !project->variables()["QMAKE_QT_DLL"].isEmpty() ) { | 384 | project->variables()["MAKEFILE"].append("Makefile"); |
385 | int hver = findHighestVersion(project->first("QMAKE_LIBDIR_QT"), "qt"); | 385 | if(project->variables()["QMAKE"].isEmpty()) |
386 | if ( hver == -1 ) | 386 | project->variables()["QMAKE"].append("qmake"); |
387 | hver = findHighestVersion(project->first("QMAKE_LIBDIR_QT"), "qt-mt"); | 387 | return; |
388 | if(hver != -1) { | 388 | } |
389 | QString ver; | 389 | |
390 | ver.sprintf("libqt-%s" QTDLL_POSTFIX "%d.a", (project->isActiveConfig("thread") ? "-mt" : ""), hver); | 390 | if(project->isEmpty("QMAKE_INSTALL_FILE")) |
391 | QStringList &libs = project->variables()["QMAKE_LIBS"]; | 391 | project->variables()["QMAKE_INSTALL_FILE"].append("$(COPY_FILE)"); |
392 | // @@@HGTODO maybe we must change the replace regexp if we understand what's going on | 392 | if(project->isEmpty("QMAKE_INSTALL_DIR")) |
393 | for(QStringList::Iterator libit = libs.begin(); libit != libs.end(); ++libit) | 393 | project->variables()["QMAKE_INSTALL_DIR"].append("$(COPY_DIR)"); |
394 | (*libit).replace(QRegExp("qt(-mt)?\\.lib"), ver); | 394 | |
395 | } | 395 | bool is_qt = (project->first("TARGET") == "qt"QTDLL_POSTFIX || project->first("TARGET") == "qt-mt"QTDLL_POSTFIX); |
396 | } | 396 | project->variables()["QMAKE_ORIG_TARGET"] = project->variables()["TARGET"]; |
397 | if ( project->isActiveConfig( "activeqt" ) ) { | 397 | |
398 | project->variables().remove("QMAKE_LIBS_QT_ENTRY"); | 398 | // LIBS defined in Profile comes first for gcc |
399 | project->variables()["QMAKE_LIBS_QT_ENTRY"] = "qaxserver.lib"; | 399 | project->variables()["QMAKE_LIBS"] += project->variables()["LIBS"]; |
400 | if ( project->isActiveConfig( "dll" ) ) | 400 | |
401 | project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_QT_ENTRY"]; | 401 | QString targetfilename = project->variables()["TARGET"].first(); |
402 | } | 402 | QStringList &configs = project->variables()["CONFIG"]; |
403 | if ( !project->isActiveConfig("dll") && !project->isActiveConfig("plugin") ) { | 403 | |
404 | project->variables()["QMAKE_LIBS"] +=project->variables()["QMAKE_LIBS_QT_ENTRY"]; | 404 | if (project->isActiveConfig("qt") && project->isActiveConfig("shared")) |
405 | } | 405 | project->variables()["DEFINES"].append("QT_DLL"); |
406 | } | 406 | |
407 | } | 407 | if (project->isActiveConfig("qt_dll")) |
408 | if ( project->isActiveConfig("opengl") ) { | 408 | if (configs.findIndex("qt") == -1) |
409 | project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_OPENGL"]; | 409 | configs.append("qt"); |
410 | project->variables()["QMAKE_LFLAGS"] += project->variables()["QMAKE_LFLAGS_OPENGL"]; | 410 | |
411 | } | 411 | if ( project->isActiveConfig("qt") ) { |
412 | if ( project->isActiveConfig("dll") ) { | 412 | if ( project->isActiveConfig( "plugin" ) ) { |
413 | project->variables()["QMAKE_CFLAGS_CONSOLE_ANY"] = project->variables()["QMAKE_CFLAGS_CONSOLE_DLL"]; | 413 | project->variables()["CONFIG"].append("dll"); |
414 | project->variables()["QMAKE_CXXFLAGS_CONSOLE_ANY"] = project->variables()["QMAKE_CXXFLAGS_CONSOLE_DLL"]; | 414 | if(project->isActiveConfig("qt")) |
415 | project->variables()["QMAKE_LFLAGS_CONSOLE_ANY"] = project->variables()["QMAKE_LFLAGS_CONSOLE_DLL"]; | 415 | project->variables()["DEFINES"].append("QT_PLUGIN"); |
416 | project->variables()["QMAKE_LFLAGS_WINDOWS_ANY"] = project->variables()["QMAKE_LFLAGS_WINDOWS_DLL"]; | 416 | } |
417 | if ( !project->variables()["QMAKE_LIB_FLAG"].isEmpty()) { | 417 | if ( (project->variables()["DEFINES"].findIndex("QT_NODLL") == -1) && |
418 | project->variables()["TARGET_EXT"].append( | 418 | ((project->variables()["DEFINES"].findIndex("QT_MAKEDLL") != -1 || |
419 | QStringList::split('.',project->first("VERSION")).join("") + ".dll"); | 419 | project->variables()["DEFINES"].findIndex("QT_DLL") != -1) || |
420 | } else { | 420 | (getenv("QT_DLL") && !getenv("QT_NODLL"))) ) { |
421 | project->variables()["TARGET_EXT"].append(".dll"); | 421 | project->variables()["QMAKE_QT_DLL"].append("1"); |
422 | } | 422 | if ( is_qt && !project->variables()["QMAKE_LIB_FLAG"].isEmpty() ) |
423 | } else { | 423 | project->variables()["CONFIG"].append("dll"); |
424 | project->variables()["QMAKE_CFLAGS_CONSOLE_ANY"] = project->variables()["QMAKE_CFLAGS_CONSOLE"]; | 424 | } |
425 | project->variables()["QMAKE_CXXFLAGS_CONSOLE_ANY"] = project->variables()["QMAKE_CXXFLAGS_CONSOLE"]; | 425 | if ( project->isActiveConfig("thread") ) |
426 | project->variables()["QMAKE_LFLAGS_CONSOLE_ANY"] = project->variables()["QMAKE_LFLAGS_CONSOLE"]; | 426 | project->variables()[is_qt ? "PRL_EXPORT_DEFINES" : "DEFINES"].append("QT_THREAD_SUPPORT"); |
427 | project->variables()["QMAKE_LFLAGS_WINDOWS_ANY"] = project->variables()["QMAKE_LFLAGS_WINDOWS"]; | 427 | if ( project->isActiveConfig("accessibility" ) ) |
428 | if ( !project->variables()["QMAKE_APP_FLAG"].isEmpty()) { | 428 | project->variables()[is_qt ? "PRL_EXPORT_DEFINES" : "DEFINES"].append("QT_ACCESSIBILITY_SUPPORT"); |
429 | project->variables()["TARGET_EXT"].append(".exe"); | 429 | if ( project->isActiveConfig("tablet") ) |
430 | } else { | 430 | project->variables()[is_qt ? "PRL_EXPORT_DEFINES" : "DEFINES"].append("QT_TABLET_SUPPORT"); |
431 | project->variables()["TARGET_EXT"].append(".a"); | 431 | } |
432 | project->variables()["QMAKE_LFLAGS"].append("-static"); | 432 | |
433 | if(project->variables()["TARGET"].first().left(3) != "lib") | 433 | if ( project->isActiveConfig("dll") || !project->variables()["QMAKE_APP_FLAG"].isEmpty() ) { |
434 | project->variables()["TARGET"].first().prepend("lib"); | 434 | project->variables()["CONFIG"].remove("staticlib"); |
435 | } | 435 | project->variables()["QMAKE_APP_OR_DLL"].append("1"); |
436 | } | 436 | } else { |
437 | if ( project->isActiveConfig("windows") ) { | 437 | project->variables()["CONFIG"].append("staticlib"); |
438 | if ( project->isActiveConfig("console") ) { | 438 | } |
439 | project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_CONSOLE_ANY"]; | 439 | |
440 | project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_CONSOLE_ANY"]; | 440 | if ( project->isActiveConfig("warn_off") ) { |
441 | project->variables()["QMAKE_LFLAGS"] += project->variables()["QMAKE_LFLAGS_CONSOLE_ANY"]; | 441 | project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_WARN_OFF"]; |
442 | project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_CONSOLE"]; | 442 | project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_WARN_OFF"]; |
443 | } else { | 443 | } else if ( project->isActiveConfig("warn_on") ) { |
444 | project->variables()["QMAKE_LFLAGS"] += project->variables()["QMAKE_LFLAGS_WINDOWS_ANY"]; | 444 | project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_WARN_ON"]; |
445 | } | 445 | project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_WARN_ON"]; |
446 | project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_WINDOWS"]; | 446 | } |
447 | } else { | 447 | |
448 | project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_CONSOLE_ANY"]; | 448 | if ( project->isActiveConfig("debug") ) { |
449 | project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_CONSOLE_ANY"]; | 449 | if ( project->isActiveConfig("thread") ) { |
450 | project->variables()["QMAKE_LFLAGS"] += project->variables()["QMAKE_LFLAGS_CONSOLE_ANY"]; | 450 | // use the DLL RT even here |
451 | project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_CONSOLE"]; | 451 | if ( project->variables()["DEFINES"].contains("QT_DLL") ) { |
452 | } | 452 | project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_MT_DLLDBG"]; |
453 | 453 | project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_MT_DLLDBG"]; | |
454 | if ( project->isActiveConfig("moc") ) | 454 | } else { |
455 | setMocAware(TRUE); | 455 | project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_MT_DBG"]; |
456 | project->variables()["QMAKE_FILETAGS"] += QStringList::split(' ', | 456 | project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_MT_DBG"]; |
457 | "HEADERS SOURCES DEF_FILE RC_FILE TARGET QMAKE_LIBS DESTDIR DLLDESTDIR INCLUDEPATH"); | 457 | } |
458 | QStringList &l = project->variables()["QMAKE_FILETAGS"]; | 458 | } |
459 | for(QStringList::Iterator it = l.begin(); it != l.end(); ++it) { | 459 | project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_DEBUG"]; |
460 | QStringList &gdmf = project->variables()[(*it)]; | 460 | project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_DEBUG"]; |
461 | for(QStringList::Iterator inner = gdmf.begin(); inner != gdmf.end(); ++inner) | 461 | project->variables()["QMAKE_LFLAGS"] += project->variables()["QMAKE_LFLAGS_DEBUG"]; |
462 | (*inner) = Option::fixPathToTargetOS((*inner), FALSE); | 462 | } else { |
463 | } | 463 | if ( project->isActiveConfig("thread") ) { |
464 | 464 | if ( project->variables()["DEFINES"].contains("QT_DLL") ) { | |
465 | if ( project->isActiveConfig("dll") ) | 465 | project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_MT_DLL"]; |
466 | project->variables()["QMAKE_LFLAGS"].append(QString("-Wl,--out-implib,") + project->first("DESTDIR") + "\\lib"+ project->first("TARGET") + ".a"); | 466 | project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_MT_DLL"]; |
467 | 467 | } else { | |
468 | if ( !project->variables()["DEF_FILE"].isEmpty() ) | 468 | project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_MT"]; |
469 | project->variables()["QMAKE_LFLAGS"].append(QString("-Wl,--output-def,") + project->first("DEF_FILE")); | 469 | project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_MT"]; |
470 | // if(!project->isActiveConfig("incremental")) | 470 | } |
471 | //project->variables()["QMAKE_LFLAGS"].append(QString("/incremental:no")); | 471 | } |
472 | 472 | project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_RELEASE"]; | |
473 | #if 0 | 473 | project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_RELEASE"]; |
474 | if ( !project->variables()["VERSION"].isEmpty() ) { | 474 | project->variables()["QMAKE_LFLAGS"] += project->variables()["QMAKE_LFLAGS_RELEASE"]; |
475 | QString version = project->variables()["VERSION"][0]; | 475 | } |
476 | int firstDot = version.find( "." ); | 476 | |
477 | QString major = version.left( firstDot ); | 477 | if ( !project->variables()["QMAKE_INCDIR"].isEmpty()) |
478 | QString minor = version.right( version.length() - firstDot - 1 ); | 478 | project->variables()["INCLUDEPATH"] += project->variables()["QMAKE_INCDIR"]; |
479 | minor.replace( ".", "" ); | 479 | |
480 | project->variables()["QMAKE_LFLAGS"].append( "/VERSION:" + major + "." + minor ); | 480 | if ( project->isActiveConfig("qt") || project->isActiveConfig("opengl") ) |
481 | } | 481 | project->variables()["CONFIG"].append("windows"); |
482 | #endif | 482 | |
483 | if ( !project->variables()["RC_FILE"].isEmpty()) { | 483 | if ( project->isActiveConfig("qt") ) { |
484 | if ( !project->variables()["RES_FILE"].isEmpty()) { | 484 | project->variables()["CONFIG"].append("moc"); |
485 | fprintf(stderr, "Both .rc and .res file specified.\n"); | 485 | project->variables()["INCLUDEPATH"] +=project->variables()["QMAKE_INCDIR_QT"]; |
486 | fprintf(stderr, "Please specify one of them, not both."); | 486 | project->variables()["QMAKE_LIBDIR"] += project->variables()["QMAKE_LIBDIR_QT"]; |
487 | exit(666); | 487 | if ( !project->isActiveConfig("debug") ) |
488 | } | 488 | project->variables()[is_qt ? "PRL_EXPORT_DEFINES" : "DEFINES"].append("QT_NO_DEBUG"); |
489 | project->variables()["RES_FILE"] = project->variables()["RC_FILE"]; | 489 | if ( is_qt && !project->variables()["QMAKE_LIB_FLAG"].isEmpty() ) { |
490 | project->variables()["RES_FILE"].first().replace(".rc",".o"); | 490 | if ( !project->variables()["QMAKE_QT_DLL"].isEmpty()) { |
491 | project->variables()["POST_TARGETDEPS"] += project->variables()["RES_FILE"]; | 491 | project->variables()["DEFINES"].append("QT_MAKEDLL"); |
492 | } | 492 | project->variables()["QMAKE_LFLAGS"] += project->variables()["QMAKE_LFLAGS_QT_DLL"]; |
493 | if ( !project->variables()["RES_FILE"].isEmpty()) | 493 | } |
494 | project->variables()["QMAKE_LIBS"] += project->variables()["RES_FILE"]; | 494 | } else { |
495 | 495 | ||
496 | MakefileGenerator::init(); | 496 | if(project->isActiveConfig("thread")) |
497 | if ( !project->variables()["VERSION"].isEmpty()) { | 497 | project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_QT_THREAD"]; |
498 | QStringList l = QStringList::split('.', project->first("VERSION")); | 498 | else |
499 | project->variables()["VER_MAJ"].append(l[0]); | 499 | project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_QT"]; |
500 | project->variables()["VER_MIN"].append(l[1]); | 500 | if ( !project->variables()["QMAKE_QT_DLL"].isEmpty() ) { |
501 | } | 501 | int hver = findHighestVersion(project->first("QMAKE_LIBDIR_QT"), "qt"); |
502 | if(project->isActiveConfig("dll")) { | 502 | if ( hver == -1 ) |
503 | project->variables()["QMAKE_CLEAN"].append(project->first("DESTDIR") +"lib" + project->first("TARGET") + ".a"); | 503 | hver = findHighestVersion(project->first("QMAKE_LIBDIR_QT"), "qt-mt"); |
504 | } | 504 | if(hver != -1) { |
505 | } | 505 | QString ver; |
506 | 506 | ver.sprintf("libqt-%s" QTDLL_POSTFIX "%d.a", (project->isActiveConfig("thread") ? "-mt" : ""), hver); | |
507 | void | 507 | QStringList &libs = project->variables()["QMAKE_LIBS"]; |
508 | MingwMakefileGenerator::writeSubDirs(QTextStream &t) | 508 | // @@@HGTODO maybe we must change the replace regexp if we understand what's going on |
509 | { | 509 | for(QStringList::Iterator libit = libs.begin(); libit != libs.end(); ++libit) |
510 | QString qs ; | 510 | (*libit).replace(QRegExp("qt(-mt)?\\.lib"), ver); |
511 | QTextStream ts (&qs, IO_WriteOnly) ; | 511 | } |
512 | Win32MakefileGenerator::writeSubDirs( ts ) ; | 512 | } |
513 | QRegExp rx("(\\n\\tcd [^\\n\\t]+)(\\n\\t.+)\\n\\t@cd ..") ; | 513 | if ( project->isActiveConfig( "activeqt" ) ) { |
514 | rx.setMinimal(true); | 514 | project->variables().remove("QMAKE_LIBS_QT_ENTRY"); |
515 | int pos = 0 ; | 515 | project->variables()["QMAKE_LIBS_QT_ENTRY"] = "-lqaxserver"; |
516 | while ( -1 != (pos = rx.search( qs, pos))) | 516 | if ( project->isActiveConfig( "dll" ) ) { |
517 | { | 517 | project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_QT_ENTRY"]; |
518 | QString qsMatch = rx.cap(2); | 518 | } |
519 | qsMatch.replace("\n\t"," && \\\n\t"); | 519 | } |
520 | qs.replace(pos+rx.cap(1).length(), rx.cap(2).length(), qsMatch ); | 520 | if ( !project->isActiveConfig("dll") && !project->isActiveConfig("plugin") ) { |
521 | pos += (rx.cap(1).length()+qsMatch.length()); | 521 | project->variables()["QMAKE_LIBS"] +=project->variables()["QMAKE_LIBS_QT_ENTRY"]; |
522 | } | 522 | } |
523 | t << qs ; | 523 | |
524 | } | 524 | // QMAKE_LIBS_QT_ENTRY should be first on the link line as it needs qt |
525 | project->variables()["QMAKE_LIBS"].remove(project->variables()["QMAKE_LIBS_QT_ENTRY"].first()); | ||
526 | project->variables()["QMAKE_LIBS"].prepend(project->variables()["QMAKE_LIBS_QT_ENTRY"].first()); | ||
527 | |||
528 | } | ||
529 | } | ||
530 | |||
531 | if ( project->isActiveConfig("opengl") ) { | ||
532 | project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_OPENGL"]; | ||
533 | project->variables()["QMAKE_LFLAGS"] += project->variables()["QMAKE_LFLAGS_OPENGL"]; | ||
534 | } | ||
535 | |||
536 | if ( project->isActiveConfig("dll") ) { | ||
537 | project->variables()["QMAKE_CFLAGS_CONSOLE_ANY"] = project->variables()["QMAKE_CFLAGS_CONSOLE_DLL"]; | ||
538 | project->variables()["QMAKE_CXXFLAGS_CONSOLE_ANY"] = project->variables()["QMAKE_CXXFLAGS_CONSOLE_DLL"]; | ||
539 | project->variables()["QMAKE_LFLAGS_CONSOLE_ANY"] = project->variables()["QMAKE_LFLAGS_CONSOLE_DLL"]; | ||
540 | project->variables()["QMAKE_LFLAGS_WINDOWS_ANY"] = project->variables()["QMAKE_LFLAGS_WINDOWS_DLL"]; | ||
541 | if ( !project->variables()["QMAKE_LIB_FLAG"].isEmpty()) { | ||
542 | project->variables()["TARGET_EXT"].append( | ||
543 | QStringList::split('.',project->first("VERSION")).join("") + ".dll"); | ||
544 | } else { | ||
545 | project->variables()["TARGET_EXT"].append(".dll"); | ||
546 | } | ||
547 | } else { | ||
548 | project->variables()["QMAKE_CFLAGS_CONSOLE_ANY"] = project->variables()["QMAKE_CFLAGS_CONSOLE"]; | ||
549 | project->variables()["QMAKE_CXXFLAGS_CONSOLE_ANY"] = project->variables()["QMAKE_CXXFLAGS_CONSOLE"]; | ||
550 | project->variables()["QMAKE_LFLAGS_CONSOLE_ANY"] = project->variables()["QMAKE_LFLAGS_CONSOLE"]; | ||
551 | project->variables()["QMAKE_LFLAGS_WINDOWS_ANY"] = project->variables()["QMAKE_LFLAGS_WINDOWS"]; | ||
552 | if ( !project->variables()["QMAKE_APP_FLAG"].isEmpty()) { | ||
553 | project->variables()["TARGET_EXT"].append(".exe"); | ||
554 | } else { | ||
555 | project->variables()["TARGET_EXT"].append(".a"); | ||
556 | project->variables()["QMAKE_LFLAGS"].append("-static"); | ||
557 | if(project->variables()["TARGET"].first().left(3) != "lib") | ||
558 | project->variables()["TARGET"].first().prepend("lib"); | ||
559 | } | ||
560 | } | ||
561 | |||
562 | if ( project->isActiveConfig("windows") ) { | ||
563 | if ( project->isActiveConfig("console") ) { | ||
564 | project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_CONSOLE_ANY"]; | ||
565 | project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_CONSOLE_ANY"]; | ||
566 | project->variables()["QMAKE_LFLAGS"] += project->variables()["QMAKE_LFLAGS_CONSOLE_ANY"]; | ||
567 | project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_CONSOLE"]; | ||
568 | } else { | ||
569 | project->variables()["QMAKE_LFLAGS"] += project->variables()["QMAKE_LFLAGS_WINDOWS_ANY"]; | ||
570 | } | ||
571 | project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_WINDOWS"]; | ||
572 | } else { | ||
573 | project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_CONSOLE_ANY"]; | ||
574 | project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_CONSOLE_ANY"]; | ||
575 | project->variables()["QMAKE_LFLAGS"] += project->variables()["QMAKE_LFLAGS_CONSOLE_ANY"]; | ||
576 | project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_CONSOLE"]; | ||
577 | } | ||
578 | |||
579 | if ( project->isActiveConfig("exceptions") ) { | ||
580 | project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_EXCEPTIONS_ON"]; | ||
581 | project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_EXCEPTIONS_ON"]; | ||
582 | } else { | ||
583 | project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_EXCEPTIONS_OFF"]; | ||
584 | project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_EXCEPTIONS_OFF"]; | ||
585 | } | ||
586 | |||
587 | if ( project->isActiveConfig("rtti") ) { | ||
588 | project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_RTTI_ON"]; | ||
589 | project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_RTTI_ON"]; | ||
590 | } else { | ||
591 | project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_RTTI_OFF"]; | ||
592 | project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_RTTI_OFF"]; | ||
593 | } | ||
594 | |||
595 | if ( project->isActiveConfig("moc") ) | ||
596 | setMocAware(TRUE); | ||
597 | |||
598 | // add -L libs to libdir | ||
599 | QStringList &libs = project->variables()["QMAKE_LIBS"]; | ||
600 | for ( QStringList::Iterator libit = libs.begin(); libit != libs.end(); ) { | ||
601 | if ( (*libit).startsWith( "-L" ) ) { | ||
602 | project->variables()["QMAKE_LIBDIR"] += (*libit).mid(2); | ||
603 | libit = libs.remove( libit ); | ||
604 | } else { | ||
605 | ++libit; | ||
606 | } | ||
607 | } | ||
608 | |||
609 | project->variables()["QMAKE_FILETAGS"] += QStringList::split(' ', | ||
610 | "HEADERS SOURCES DEF_FILE RC_FILE TARGET QMAKE_LIBS DESTDIR DLLDESTDIR INCLUDEPATH"); | ||
611 | QStringList &l = project->variables()["QMAKE_FILETAGS"]; | ||
612 | QStringList::Iterator it; | ||
613 | for(it = l.begin(); it != l.end(); ++it) { | ||
614 | QStringList &gdmf = project->variables()[(*it)]; | ||
615 | for(QStringList::Iterator inner = gdmf.begin(); inner != gdmf.end(); ++inner) | ||
616 | (*inner) = Option::fixPathToTargetOS((*inner), FALSE); | ||
617 | } | ||
618 | |||
619 | if ( project->isActiveConfig("dll") ) { | ||
620 | QString destDir = ""; | ||
621 | if (!project->first("DESTDIR").isEmpty()) | ||
622 | destDir = project->first("DESTDIR") + Option::dir_sep; | ||
623 | project->variables()["QMAKE_LFLAGS"].append(QString("-Wl,--out-implib,") + | ||
624 | destDir + "lib" + project->first("TARGET") + ".a"); | ||
625 | } | ||
626 | |||
627 | if ( !project->variables()["DEF_FILE"].isEmpty() ) | ||
628 | project->variables()["QMAKE_LFLAGS"].append(QString("-Wl,") + project->first("DEF_FILE")); | ||
629 | // if(!project->isActiveConfig("incremental")) | ||
630 | //project->variables()["QMAKE_LFLAGS"].append(QString("/incremental:no")); | ||
631 | |||
632 | #if 0 | ||
633 | if ( !project->variables()["VERSION"].isEmpty() ) { | ||
634 | QString version = project->variables()["VERSION"][0]; | ||
635 | int firstDot = version.find( "." ); | ||
636 | QString major = version.left( firstDot ); | ||
637 | QString minor = version.right( version.length() - firstDot - 1 ); | ||
638 | minor.replace( ".", "" ); | ||
639 | project->variables()["QMAKE_LFLAGS"].append( "/VERSION:" + major + "." + minor ); | ||
640 | } | ||
641 | #endif | ||
642 | |||
643 | if ( !project->variables()["RC_FILE"].isEmpty()) { | ||
644 | if ( !project->variables()["RES_FILE"].isEmpty()) { | ||
645 | fprintf(stderr, "Both .rc and .res file specified.\n"); | ||
646 | fprintf(stderr, "Please specify one of them, not both."); | ||
647 | exit(666); | ||
648 | } | ||
649 | project->variables()["RES_FILE"] = project->variables()["RC_FILE"]; | ||
650 | project->variables()["RES_FILE"].first().replace(".rc",".o"); | ||
651 | project->variables()["POST_TARGETDEPS"] += project->variables()["RES_FILE"]; | ||
652 | project->variables()["CLEAN_FILES"] += project->variables()["RES_FILE"]; | ||
653 | } | ||
654 | |||
655 | if ( !project->variables()["RES_FILE"].isEmpty()) | ||
656 | project->variables()["QMAKE_LIBS"] += project->variables()["RES_FILE"]; | ||
657 | |||
658 | MakefileGenerator::init(); | ||
659 | |||
660 | if ( !project->variables()["VERSION"].isEmpty()) { | ||
661 | QStringList l = QStringList::split('.', project->first("VERSION")); | ||
662 | project->variables()["VER_MAJ"].append(l[0]); | ||
663 | project->variables()["VER_MIN"].append(l[1]); | ||
664 | } | ||
665 | |||
666 | if(project->isActiveConfig("dll")) { | ||
667 | project->variables()["QMAKE_CLEAN"].append(project->first("DESTDIR") +"lib" + project->first("TARGET") + ".a"); | ||
668 | } | ||
669 | |||
670 | QStringList &quc = project->variables()["QMAKE_EXTRA_WIN_COMPILERS"]; | ||
671 | for(it = quc.begin(); it != quc.end(); ++it) { | ||
672 | QString tmp_out = project->variables()[(*it) + ".output"].first(); | ||
673 | if(tmp_out.isEmpty()) | ||
674 | continue; | ||
675 | QStringList &tmp = project->variables()[(*it) + ".input"]; | ||
676 | for(QStringList::Iterator it2 = tmp.begin(); it2 != tmp.end(); ++it2) { | ||
677 | QStringList &inputs = project->variables()[(*it2)]; | ||
678 | for(QStringList::Iterator input = inputs.begin(); input != inputs.end(); ++input) { | ||
679 | QFileInfo fi(Option::fixPathToLocalOS((*input))); | ||
680 | QString in = Option::fixPathToTargetOS((*input), FALSE), | ||
681 | out = tmp_out; | ||
682 | out.replace("${QMAKE_FILE_BASE}", fi.baseName()); | ||
683 | out.replace("${QMAKE_FILE_NAME}", fi.fileName()); | ||
684 | if(project->variables()[(*it) + ".CONFIG"].findIndex("no_link") == -1) | ||
685 | project->variables()["OBJCOMP"] += out; | ||
686 | } | ||
687 | } | ||
688 | } | ||
689 | } | ||
690 | |||
691 | void | ||
692 | MingwMakefileGenerator::writeSubDirs(QTextStream &t) | ||
693 | { | ||
694 | QString qs ; | ||
695 | QTextStream ts (&qs, IO_WriteOnly) ; | ||
696 | Win32MakefileGenerator::writeSubDirs( ts ) ; | ||
697 | QRegExp rx("(\\n\\tcd [^\\n\\t]+)(\\n\\t.+)\\n\\t@cd ..") ; | ||
698 | rx.setMinimal(TRUE); | ||
699 | int pos = 0 ; | ||
700 | while ( -1 != (pos = rx.search( qs, pos))) | ||
701 | { | ||
702 | QString qsMatch = rx.cap(2); | ||
703 | qsMatch.replace("\n\t"," && \\\n\t"); | ||
704 | qs.replace(pos+rx.cap(1).length(), rx.cap(2).length(), qsMatch ); | ||
705 | pos += (rx.cap(1).length()+qsMatch.length()); | ||
706 | } | ||
707 | t << qs ; | ||
708 | } | ||
diff --git a/qmake/generators/win32/mingw_make.h b/qmake/generators/win32/mingw_make.h index c00bf1b..d971e3a 100644 --- a/qmake/generators/win32/mingw_make.h +++ b/qmake/generators/win32/mingw_make.h | |||
@@ -1,58 +1,61 @@ | |||
1 | /**************************************************************************** | 1 | /**************************************************************************** |
2 | ** $Id$ | 2 | ** |
3 | ** | 3 | ** |
4 | ** Definition of ________ class. | 4 | ** Definition of MingwMakefileGenerator class. |
5 | ** | 5 | ** |
6 | ** Copyright (C) 1992-2002 Trolltech AS. All rights reserved. | 6 | ** Copyright (C) 1992-2003 Trolltech AS. All rights reserved. |
7 | ** | 7 | ** |
8 | ** This file is part of the network module of the Qt GUI Toolkit. | 8 | ** This file is part of qmake. |
9 | ** | 9 | ** |
10 | ** This file may be distributed under the terms of the Q Public License | 10 | ** This file may be distributed under the terms of the Q Public License |
11 | ** as defined by Trolltech AS of Norway and appearing in the file | 11 | ** as defined by Trolltech AS of Norway and appearing in the file |
12 | ** LICENSE.QPL included in the packaging of this file. | 12 | ** LICENSE.QPL included in the packaging of this file. |
13 | ** | 13 | ** |
14 | ** This file may be distributed and/or modified under the terms of the | 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 | 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 | 16 | ** Foundation and appearing in the file LICENSE.GPL included in the |
17 | ** packaging of this file. | 17 | ** packaging of this file. |
18 | ** | 18 | ** |
19 | ** Licensees holding valid Qt Enterprise Edition licenses may use this | 19 | ** Licensees holding valid Qt Enterprise Edition licenses may use this |
20 | ** file in accordance with the Qt Commercial License Agreement provided | 20 | ** file in accordance with the Qt Commercial License Agreement provided |
21 | ** with the Software. | 21 | ** with the Software. |
22 | ** | 22 | ** |
23 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 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. | 24 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
25 | ** | 25 | ** |
26 | ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for | 26 | ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for |
27 | ** information about Qt Commercial License Agreements. | 27 | ** information about Qt Commercial License Agreements. |
28 | ** See http://www.trolltech.com/qpl/ for QPL licensing information. | 28 | ** See http://www.trolltech.com/qpl/ for QPL licensing information. |
29 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 29 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
30 | ** | 30 | ** |
31 | ** Contact info@trolltech.com if any conditions of this licensing are | 31 | ** Contact info@trolltech.com if any conditions of this licensing are |
32 | ** not clear to you. | 32 | ** not clear to you. |
33 | ** | 33 | ** |
34 | **********************************************************************/ | 34 | **********************************************************************/ |
35 | #ifndef __MINGW_MAKE_H__ | 35 | |
36 | #define __MINGW_MAKE_H__ | 36 | #ifndef __MINGW_MAKE_H__ |
37 | 37 | #define __MINGW_MAKE_H__ | |
38 | #include "winmakefile.h" | 38 | |
39 | 39 | #include "winmakefile.h" | |
40 | class MingwMakefileGenerator : public Win32MakefileGenerator | 40 | |
41 | { | 41 | class MingwMakefileGenerator : public Win32MakefileGenerator |
42 | bool init_flag; | 42 | { |
43 | void writeMingwParts(QTextStream &); | 43 | bool init_flag; |
44 | void writeSubDirs(QTextStream &t) ; | 44 | void writeMingwParts(QTextStream &); |
45 | 45 | void writeSubDirs(QTextStream &t) ; | |
46 | bool writeMakefile(QTextStream &); | 46 | |
47 | void init(); | 47 | bool writeMakefile(QTextStream &); |
48 | 48 | void init(); | |
49 | public: | 49 | |
50 | MingwMakefileGenerator(QMakeProject *p); | 50 | virtual bool findLibraries(); |
51 | ~MingwMakefileGenerator(); | 51 | |
52 | 52 | public: | |
53 | }; | 53 | MingwMakefileGenerator(QMakeProject *p); |
54 | 54 | ~MingwMakefileGenerator(); | |
55 | inline MingwMakefileGenerator::~MingwMakefileGenerator() | 55 | |
56 | { } | 56 | }; |
57 | 57 | ||
58 | #endif /* __MINGW_MAKE_H__ */ | 58 | inline MingwMakefileGenerator::~MingwMakefileGenerator() |
59 | { } | ||
60 | |||
61 | #endif /* __MINGW_MAKE_H__ */ | ||
diff --git a/qmake/generators/win32/msvc_dsp.cpp b/qmake/generators/win32/msvc_dsp.cpp index 3fa0496..d2abac6 100644 --- a/qmake/generators/win32/msvc_dsp.cpp +++ b/qmake/generators/win32/msvc_dsp.cpp | |||
@@ -1,11 +1,9 @@ | |||
1 | /**************************************************************************** | 1 | /**************************************************************************** |
2 | ** $Id$ | 2 | ** |
3 | ** | 3 | ** |
4 | ** Definition of ________ class. | 4 | ** Implementation of DspMakefileGenerator class. |
5 | ** | 5 | ** |
6 | ** Created : 970521 | 6 | ** Copyright (C) 1992-2003 Trolltech AS. All rights reserved. |
7 | ** | 7 | ** |
8 | ** Copyright (C) 1992-2002 Trolltech AS. All rights reserved. | 8 | ** This file is part of qmake. |
9 | ** | ||
10 | ** This file is part of the network module of the Qt GUI Toolkit. | ||
11 | ** | 9 | ** |
@@ -80,2 +78,4 @@ DspMakefileGenerator::writeDspParts(QTextStream &t) | |||
80 | } | 78 | } |
79 | if (dspfile.startsWith("\"") && dspfile.endsWith("\"")) | ||
80 | dspfile = dspfile.mid(1, dspfile.length() - 2); | ||
81 | QString dspfile_loc = findTemplate(dspfile); | 81 | QString dspfile_loc = findTemplate(dspfile); |
@@ -89,2 +89,26 @@ DspMakefileGenerator::writeDspParts(QTextStream &t) | |||
89 | 89 | ||
90 | QString platform = "Win32"; | ||
91 | if ( !project->variables()["QMAKE_PLATFORM"].isEmpty() ) | ||
92 | platform = varGlue("QMAKE_PLATFORM", "", " ", ""); | ||
93 | |||
94 | // Setup PCH variables | ||
95 | precompH = project->first("PRECOMPILED_HEADER"); | ||
96 | QString namePCH = QFileInfo(precompH).fileName(); | ||
97 | usePCH = !precompH.isEmpty() && project->isActiveConfig("precompile_header"); | ||
98 | if (usePCH) { | ||
99 | // Created files | ||
100 | QString origTarget = project->first("QMAKE_ORIG_TARGET"); | ||
101 | origTarget.replace(QRegExp("-"), "_"); | ||
102 | precompObj = "\"$(IntDir)\\" + origTarget + Option::obj_ext + "\""; | ||
103 | precompPch = "\"$(IntDir)\\" + origTarget + ".pch\""; | ||
104 | // Add PRECOMPILED_HEADER to HEADERS | ||
105 | if (!project->variables()["HEADERS"].contains(precompH)) | ||
106 | project->variables()["HEADERS"] += precompH; | ||
107 | // Add precompile compiler options | ||
108 | project->variables()["PRECOMPILED_FLAGS_REL"] = "/Yu\"" + namePCH + "\" /FI\"" + namePCH + "\" "; | ||
109 | project->variables()["PRECOMPILED_FLAGS_DEB"] = "/Yu\"" + namePCH + "\" /FI\"" + namePCH + "\" "; | ||
110 | // Return to variable pool | ||
111 | project->variables()["PRECOMPILED_OBJECT"] = precompObj; | ||
112 | project->variables()["PRECOMPILED_PCH"] = precompPch; | ||
113 | } | ||
90 | int rep; | 114 | int rep; |
@@ -113,3 +137,5 @@ DspMakefileGenerator::writeDspParts(QTextStream &t) | |||
113 | t << "# Begin Source File\n\nSOURCE=" << (*it) << endl; | 137 | t << "# Begin Source File\n\nSOURCE=" << (*it) << endl; |
114 | if ( project->isActiveConfig("moc") && (*it).endsWith(Option::moc_ext)) { | 138 | if (usePCH && (*it).endsWith(".c")) |
139 | t << "# SUBTRACT CPP /FI\"" << namePCH << "\" /Yu\"" << namePCH << "\" /Fp" << endl; | ||
140 | if ( project->isActiveConfig("moc") && (*it).endsWith(Option::cpp_moc_ext)) { | ||
115 | QString base = (*it); | 141 | QString base = (*it); |
@@ -126,4 +152,4 @@ DspMakefileGenerator::writeDspParts(QTextStream &t) | |||
126 | 152 | ||
127 | t << "!IF \"$(CFG)\" == \"" << var("MSVCDSP_PROJECT") << " - Win32 Release\"" << build | 153 | t << "!IF \"$(CFG)\" == \"" << var("MSVCDSP_PROJECT") << " - " << platform << " Release\"" << build |
128 | << "!ELSEIF \"$(CFG)\" == \"" << var("MSVCDSP_PROJECT") << " - Win32 Debug\"" | 154 | << "!ELSEIF \"$(CFG)\" == \"" << var("MSVCDSP_PROJECT") << " - " << platform << " Debug\"" |
129 | << build << "!ENDIF " << endl << endl; | 155 | << build << "!ENDIF " << endl << endl; |
@@ -148,21 +174,73 @@ DspMakefileGenerator::writeDspParts(QTextStream &t) | |||
148 | t << "# Begin Source File\n\nSOURCE=" << (*it) << endl << endl; | 174 | t << "# Begin Source File\n\nSOURCE=" << (*it) << endl << endl; |
149 | if ( project->isActiveConfig("moc") && !findMocDestination((*it)).isEmpty()) { | 175 | QString compilePCH; |
150 | QString base = (*it); | 176 | QStringList customDependencies; |
177 | QString createMOC; | ||
178 | QString buildCmdsR, buildCmdsD; | ||
179 | QString buildCmds = "\nBuildCmds= \\\n"; | ||
180 | // Create unique baseID | ||
181 | QString base = (*it); | ||
182 | { | ||
151 | base.replace(QRegExp("\\..*$"), "").upper(); | 183 | base.replace(QRegExp("\\..*$"), "").upper(); |
152 | base.replace(QRegExp("[^a-zA-Z]"), "_"); | 184 | base.replace(QRegExp("[^a-zA-Z]"), "_"); |
185 | } | ||
186 | if (usePCH && precompH.endsWith(*it)) { | ||
187 | QString basicBuildCmd = QString("\tcl.exe /TP /W3 /FD /c /D \"WIN32\" /Yc /Fp\"%1\" /Fo\"%2\" %3 %4 %5 %6 %7 %8 %9 /D \"") | ||
188 | .arg(precompPch) | ||
189 | .arg(precompObj) | ||
190 | .arg(var("MSVCDSP_INCPATH")) | ||
191 | .arg(var("MSVCDSP_DEFINES")) | ||
192 | .arg(var("MSVCDSP_CXXFLAGS")); | ||
193 | buildCmdsR = basicBuildCmd | ||
194 | .arg("/D \"NDEBUG\"") | ||
195 | .arg(var("QMAKE_CXXFLAGS_RELEASE")) | ||
196 | .arg(var("MSVCDSP_MTDEF")) | ||
197 | .arg(var("MSVCDSP_RELDEFS")); | ||
198 | buildCmdsD = basicBuildCmd | ||
199 | .arg("/D \"_DEBUG\" /Od") | ||
200 | .arg(var("QMAKE_CXXFLAGS_DEBUG")) | ||
201 | .arg(var("MSVCDSP_MTDEFD")) | ||
202 | .arg(var("MSVCDSP_DEBUG_OPT")); | ||
203 | if (project->first("TEMPLATE") == "vcapp") {// App | ||
204 | buildCmdsR += var("MSVCDSP_WINCONDEF"); | ||
205 | buildCmdsD += var("MSVCDSP_WINCONDEF"); | ||
206 | } else if (project->isActiveConfig("dll")) {// Dll | ||
207 | buildCmdsR += "_WINDOWS\" /D \"_USRDLL"; | ||
208 | buildCmdsD += "_WINDOWS\" /D \"_USRDLL"; | ||
209 | } else { // Lib | ||
210 | buildCmdsR += "_LIB"; | ||
211 | buildCmdsD += "_LIB"; | ||
212 | } | ||
213 | buildCmdsR += "\" /Fd\"$(IntDir)\\\\\" " + (*it) + " \\\n"; | ||
214 | buildCmdsD += "\" /Fd\"$(IntDir)\\\\\" " + (*it) + " \\\n"; | ||
215 | |||
216 | compilePCH = precompPch + " : $(SOURCE) \"$(INTDIR)\" \"$(OUTDIR)\"\n $(BuildCmds)\n\n"; | ||
153 | 217 | ||
218 | QStringList &tmp = findDependencies(precompH); | ||
219 | if(!tmp.isEmpty()) // Got Deps for PCH | ||
220 | customDependencies += tmp; | ||
221 | } | ||
222 | if (project->isActiveConfig("moc") && !findMocDestination((*it)).isEmpty()) { | ||
154 | QString mocpath = var( "QMAKE_MOC" ); | 223 | QString mocpath = var( "QMAKE_MOC" ); |
155 | mocpath = mocpath.replace( QRegExp( "\\..*$" ), "" ) + " "; | 224 | mocpath = mocpath.replace( QRegExp( "\\..*$" ), "" ) + " "; |
156 | 225 | buildCmds += "\t" + mocpath + (*it) + " -o " + findMocDestination((*it)) + " \\\n"; | |
157 | QString build = "\n\n# Begin Custom Build - Moc'ing " + (*it) + | 226 | createMOC = "\"" + findMocDestination((*it)) +"\" : $(SOURCE) \"$(INTDIR)\" \"$(OUTDIR)\"\n $(BuildCmds)\n\n"; |
158 | "...\n" "InputPath=.\\" + (*it) + "\n\n" "\"" + findMocDestination((*it)) + | 227 | customDependencies += "\"$(QTDIR)\\bin\\moc.exe\""; |
159 | "\"" " : $(SOURCE) \"$(INTDIR)\" \"$(OUTDIR)\"\n" | 228 | } |
160 | "\t" + mocpath + (*it) + " -o " + | 229 | if (!createMOC.isEmpty() || !compilePCH.isEmpty()) { |
161 | findMocDestination((*it)) + "\n\n" "# End Custom Build\n\n"; | 230 | bool doMOC = !createMOC.isEmpty(); |
162 | 231 | bool doPCH = !compilePCH.isEmpty(); | |
163 | t << "USERDEP_" << base << "=\"$(QTDIR)\\bin\\moc.exe\"" << endl << endl; | 232 | QString build = "\n\n# Begin Custom Build - "+ |
164 | 233 | QString(doMOC?"Moc'ing ":"") + | |
165 | t << "!IF \"$(CFG)\" == \"" << var("MSVCDSP_PROJECT") << " - Win32 Release\"" << build | 234 | QString((doMOC&&doPCH)?" and ":"") + |
166 | << "!ELSEIF \"$(CFG)\" == \"" << var("MSVCDSP_PROJECT") << " - Win32 Debug\"" | 235 | QString(doPCH?"Creating PCH cpp from ":"") + |
167 | << build << "!ENDIF " << endl << endl; | 236 | (*it) + "...\nInputPath=.\\" + (*it) + "\n\n" + |
237 | buildCmds + "%1\n" + | ||
238 | createMOC + | ||
239 | compilePCH + | ||
240 | "# End Custom Build\n\n"; | ||
241 | |||
242 | t << "USERDEP_" << base << "=" << valGlue(customDependencies, "\"", "\" \"", "\"") << endl << endl; | ||
243 | t << "!IF \"$(CFG)\" == \"" << var("MSVCDSP_PROJECT") << " - " << platform << " Release\"" << build.arg(buildCmdsR) | ||
244 | << "!ELSEIF \"$(CFG)\" == \"" << var("MSVCDSP_PROJECT") << " - " << platform << " Debug\"" << build.arg(buildCmdsD) | ||
245 | << "!ENDIF " << endl << endl; | ||
168 | } | 246 | } |
@@ -254,3 +332,3 @@ DspMakefileGenerator::writeDspParts(QTextStream &t) | |||
254 | t << "# Begin Source File\n\nSOURCE=" << (*it) << endl; | 332 | t << "# Begin Source File\n\nSOURCE=" << (*it) << endl; |
255 | if ( project->isActiveConfig("moc") && (*it).endsWith(Option::moc_ext)) { | 333 | if ( project->isActiveConfig("moc") && (*it).endsWith(Option::cpp_moc_ext)) { |
256 | QString base = (*it); | 334 | QString base = (*it); |
@@ -267,4 +345,4 @@ DspMakefileGenerator::writeDspParts(QTextStream &t) | |||
267 | 345 | ||
268 | t << "!IF \"$(CFG)\" == \"" << var("MSVCDSP_PROJECT") << " - Win32 Release\"" << build | 346 | t << "!IF \"$(CFG)\" == \"" << var("MSVCDSP_PROJECT") << " - " << platform << " Release\"" << build |
269 | << "!ELSEIF \"$(CFG)\" == \"" << var("MSVCDSP_PROJECT") << " - Win32 Debug\"" | 347 | << "!ELSEIF \"$(CFG)\" == \"" << var("MSVCDSP_PROJECT") << " - " << platform << " Debug\"" |
270 | << build << "!ENDIF " << endl << endl; | 348 | << build << "!ENDIF " << endl << endl; |
@@ -389,3 +467,4 @@ DspMakefileGenerator::writeDspParts(QTextStream &t) | |||
389 | " -i " + fname + ".h -o " + uiSourcesDir + fname + ".cpp \\\n" | 467 | " -i " + fname + ".h -o " + uiSourcesDir + fname + ".cpp \\\n" |
390 | "\t" + mocpath + uiHeadersDir + fname + ".h -o " + mocFile + "moc_" + fname + ".cpp \\\n"; | 468 | "\t" + mocpath + " " + uiHeadersDir + |
469 | fname + ".h -o " + mocFile + Option::h_moc_mod + fname + Option::h_moc_ext + " \\\n"; | ||
391 | 470 | ||
@@ -395,3 +474,3 @@ DspMakefileGenerator::writeDspParts(QTextStream &t) | |||
395 | "\t$(BuildCmds)\n\n" | 474 | "\t$(BuildCmds)\n\n" |
396 | "\"" + mocFile + "moc_" + fname + ".cpp\" : \"$(SOURCE)\" \"$(INTDIR)\" \"$(OUTDIR)\"" "\n" | 475 | "\"" + mocFile + Option::h_moc_mod + fname + Option::h_moc_ext + "\" : \"$(SOURCE)\" \"$(INTDIR)\" \"$(OUTDIR)\"" "\n" |
397 | "\t$(BuildCmds)\n\n"); | 476 | "\t$(BuildCmds)\n\n"); |
@@ -400,4 +479,4 @@ DspMakefileGenerator::writeDspParts(QTextStream &t) | |||
400 | 479 | ||
401 | t << "!IF \"$(CFG)\" == \"" << var("MSVCDSP_PROJECT") << " - Win32 Release\"" << build | 480 | t << "!IF \"$(CFG)\" == \"" << var("MSVCDSP_PROJECT") << " - " << platform << " Release\"" << build |
402 | << "!ELSEIF \"$(CFG)\" == \"" << var("MSVCDSP_PROJECT") << " - Win32 Debug\"" << build | 481 | << "!ELSEIF \"$(CFG)\" == \"" << var("MSVCDSP_PROJECT") << " - " << platform << " Debug\"" << build |
403 | << "!ENDIF \n\n" << "# End Source File" << endl; | 482 | << "!ENDIF \n\n" << "# End Source File" << endl; |
@@ -431,4 +510,4 @@ DspMakefileGenerator::writeDspParts(QTextStream &t) | |||
431 | "# End Custom Build\n\n"; | 510 | "# End Custom Build\n\n"; |
432 | t << "!IF \"$(CFG)\" == \"" << var("MSVCDSP_PROJECT") << " - Win32 Release\"" << build | 511 | t << "!IF \"$(CFG)\" == \"" << var("MSVCDSP_PROJECT") << " - " << platform << " Release\"" << build |
433 | << "!ELSEIF \"$(CFG)\" == \"" << var("MSVCDSP_PROJECT") << " - Win32 Debug\"" << build | 512 | << "!ELSEIF \"$(CFG)\" == \"" << var("MSVCDSP_PROJECT") << " - " << platform << " Debug\"" << build |
434 | << "!ENDIF \n\n" << build | 513 | << "!ENDIF \n\n" << build |
@@ -467,4 +546,4 @@ DspMakefileGenerator::writeDspParts(QTextStream &t) | |||
467 | 546 | ||
468 | t << "!IF \"$(CFG)\" == \"" << var("MSVCDSP_PROJECT") << " - Win32 Release\"" << build | 547 | t << "!IF \"$(CFG)\" == \"" << var("MSVCDSP_PROJECT") << " - " << platform << " Release\"" << build |
469 | << "!ELSEIF \"$(CFG)\" == \"" << var("MSVCDSP_PROJECT") << " - Win32 Debug\"" << build | 548 | << "!ELSEIF \"$(CFG)\" == \"" << var("MSVCDSP_PROJECT") << " - " << platform << " Debug\"" << build |
470 | << "!ENDIF \n\n" | 549 | << "!ENDIF \n\n" |
@@ -534,2 +613,3 @@ DspMakefileGenerator::init() | |||
534 | 613 | ||
614 | |||
535 | /* this should probably not be here, but I'm using it to wrap the .t files */ | 615 | /* this should probably not be here, but I'm using it to wrap the .t files */ |
@@ -550,2 +630,8 @@ DspMakefileGenerator::init() | |||
550 | if(configs.findIndex("qt") == -1) configs.append("qt"); | 630 | if(configs.findIndex("qt") == -1) configs.append("qt"); |
631 | if ( project->isActiveConfig("qtopia") ) { | ||
632 | if(configs.findIndex("qtopialib") == -1) | ||
633 | configs.append("qtopialib"); | ||
634 | if(configs.findIndex("qtopiainc") == -1) | ||
635 | configs.append("qtopiainc"); | ||
636 | } | ||
551 | if ( project->isActiveConfig("qt") ) { | 637 | if ( project->isActiveConfig("qt") ) { |
@@ -583,2 +669,10 @@ DspMakefileGenerator::init() | |||
583 | 669 | ||
670 | if ( project->isActiveConfig("qtopiainc") ) | ||
671 | project->variables()["INCLUDEPATH"] += project->variables()["QMAKE_INCDIR_QTOPIA"]; | ||
672 | if ( project->isActiveConfig("qtopialib") ) { | ||
673 | if(!project->isEmpty("QMAKE_LIBDIR_QTOPIA")) | ||
674 | project->variables()["QMAKE_LIBDIR"] += project->variables()["QMAKE_LIBDIR_QTOPIA"]; | ||
675 | project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_QTOPIA"]; | ||
676 | } | ||
677 | |||
584 | if ( project->isActiveConfig("qt") ) { | 678 | if ( project->isActiveConfig("qt") ) { |
@@ -636,2 +730,4 @@ DspMakefileGenerator::init() | |||
636 | project->variables()["MSVCDSP_OBJECTSDIRREL"] = project->first("OBJECTS_DIR"); | 730 | project->variables()["MSVCDSP_OBJECTSDIRREL"] = project->first("OBJECTS_DIR"); |
731 | else | ||
732 | project->variables()["MSVCDSP_OBJECTSDIRREL"] = "Release"; | ||
637 | project->variables()["MSVCDSP_OBJECTSDIRDEB"] = "Debug"; | 733 | project->variables()["MSVCDSP_OBJECTSDIRDEB"] = "Debug"; |
@@ -672,2 +768,6 @@ DspMakefileGenerator::init() | |||
672 | if ( project->isActiveConfig("dll") ) { | 768 | if ( project->isActiveConfig("dll") ) { |
769 | project->variables()["QMAKE_CFLAGS_CONSOLE_ANY"] = project->variables()["QMAKE_CFLAGS_CONSOLE_DLL"]; | ||
770 | project->variables()["QMAKE_CXXFLAGS_CONSOLE_ANY"] = project->variables()["QMAKE_CXXFLAGS_CONSOLE_DLL"]; | ||
771 | project->variables()["QMAKE_LFLAGS_CONSOLE_ANY"] = project->variables()["QMAKE_LFLAGS_CONSOLE_DLL"]; | ||
772 | project->variables()["QMAKE_LFLAGS_WINDOWS_ANY"] = project->variables()["QMAKE_LFLAGS_WINDOWS_DLL"]; | ||
673 | if ( !project->variables()["QMAKE_LIB_FLAG"].isEmpty() ) { | 773 | if ( !project->variables()["QMAKE_LIB_FLAG"].isEmpty() ) { |
@@ -680,2 +780,6 @@ DspMakefileGenerator::init() | |||
680 | } else { | 780 | } else { |
781 | project->variables()["QMAKE_CFLAGS_CONSOLE_ANY"] = project->variables()["QMAKE_CFLAGS_CONSOLE"]; | ||
782 | project->variables()["QMAKE_CXXFLAGS_CONSOLE_ANY"] = project->variables()["QMAKE_CXXFLAGS_CONSOLE"]; | ||
783 | project->variables()["QMAKE_LFLAGS_CONSOLE_ANY"] = project->variables()["QMAKE_LFLAGS_CONSOLE"]; | ||
784 | project->variables()["QMAKE_LFLAGS_WINDOWS_ANY"] = project->variables()["QMAKE_LFLAGS_WINDOWS"]; | ||
681 | if ( !project->variables()["QMAKE_APP_FLAG"].isEmpty() ) | 785 | if ( !project->variables()["QMAKE_APP_FLAG"].isEmpty() ) |
@@ -686,2 +790,19 @@ DspMakefileGenerator::init() | |||
686 | 790 | ||
791 | if ( project->isActiveConfig("windows") ) { | ||
792 | if ( project->isActiveConfig("console") ) { | ||
793 | project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_CONSOLE_ANY"]; | ||
794 | project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_CONSOLE_ANY"]; | ||
795 | project->variables()["QMAKE_LFLAGS"] += project->variables()["QMAKE_LFLAGS_CONSOLE_ANY"]; | ||
796 | project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_CONSOLE"]; | ||
797 | } else { | ||
798 | project->variables()["QMAKE_LFLAGS"] += project->variables()["QMAKE_LFLAGS_WINDOWS_ANY"]; | ||
799 | } | ||
800 | project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_WINDOWS"]; | ||
801 | } else { | ||
802 | project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_CONSOLE_ANY"]; | ||
803 | project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_CONSOLE_ANY"]; | ||
804 | project->variables()["QMAKE_LFLAGS"] += project->variables()["QMAKE_LFLAGS_CONSOLE_ANY"]; | ||
805 | project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_CONSOLE"]; | ||
806 | } | ||
807 | |||
687 | project->variables()["MSVCDSP_VER"] = "6.00"; | 808 | project->variables()["MSVCDSP_VER"] = "6.00"; |
@@ -734,3 +855,2 @@ DspMakefileGenerator::init() | |||
734 | project->variables()["MSVCDSP_DSPTYPE"].append("0x0103"); | 855 | project->variables()["MSVCDSP_DSPTYPE"].append("0x0103"); |
735 | project->variables()["MSVCDSP_SUBSYSTEM"].append("console"); | ||
736 | } else { | 856 | } else { |
@@ -739,3 +859,2 @@ DspMakefileGenerator::init() | |||
739 | project->variables()["MSVCDSP_DSPTYPE"].append("0x0101"); | 859 | project->variables()["MSVCDSP_DSPTYPE"].append("0x0101"); |
740 | project->variables()["MSVCDSP_SUBSYSTEM"].append("windows"); | ||
741 | } | 860 | } |
@@ -750,3 +869,16 @@ DspMakefileGenerator::init() | |||
750 | project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_WINDOWS"]; | 869 | project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_WINDOWS"]; |
870 | |||
871 | processPrlFiles(); | ||
751 | 872 | ||
873 | // Update -lname to name.lib, | ||
874 | QStringList &libs2 = project->variables()["QMAKE_LIBS"]; | ||
875 | for ( QStringList::Iterator libit2 = libs2.begin(); libit2 != libs2.end(); ++libit2 ) { | ||
876 | if ( (*libit2).startsWith( "-l" ) ) { | ||
877 | (*libit2) = (*libit2).mid( 2 ) + ".lib"; | ||
878 | } else if ( (*libit2).startsWith( "-L" ) ) { | ||
879 | project->variables()["QMAKE_LIBDIR"] += (*libit2).mid(2); | ||
880 | libit2 = libs2.remove( libit2 ); | ||
881 | } | ||
882 | } | ||
883 | |||
752 | project->variables()["MSVCDSP_LFLAGS" ] += project->variables()["QMAKE_LFLAGS"]; | 884 | project->variables()["MSVCDSP_LFLAGS" ] += project->variables()["QMAKE_LFLAGS"]; |
@@ -758,3 +890,5 @@ DspMakefileGenerator::init() | |||
758 | 890 | ||
759 | processPrlFiles(); | 891 | if (!project->variables()["RES_FILE"].isEmpty()) |
892 | project->variables()["QMAKE_LIBS"] += project->variables()["RES_FILE"]; | ||
893 | |||
760 | QStringList &libs = project->variables()["QMAKE_LIBS"]; | 894 | QStringList &libs = project->variables()["QMAKE_LIBS"]; |
@@ -770,2 +904,4 @@ DspMakefileGenerator::init() | |||
770 | inc.replace("\"", ""); | 904 | inc.replace("\"", ""); |
905 | if(inc.endsWith("\\")) // Remove trailing \'s from paths | ||
906 | inc.truncate(inc.length()-1); | ||
771 | project->variables()["MSVCDSP_INCPATH"].append("/I \"" + inc + "\""); | 907 | project->variables()["MSVCDSP_INCPATH"].append("/I \"" + inc + "\""); |
@@ -822,11 +958,8 @@ DspMakefileGenerator::init() | |||
822 | version = "1.0"; | 958 | version = "1.0"; |
823 | 959 | project->variables()["MSVCDSP_IDLSOURCES"].append( var("OBJECTS_DIR") + targetfilename + ".idl" ); | |
824 | project->variables()["MSVCDSP_IDLSOURCES"].append( "tmp\\" + targetfilename + ".idl" ); | ||
825 | project->variables()["MSVCDSP_IDLSOURCES"].append( "tmp\\" + targetfilename + ".tlb" ); | ||
826 | project->variables()["MSVCDSP_IDLSOURCES"].append( "tmp\\" + targetfilename + ".midl" ); | ||
827 | if ( project->isActiveConfig( "dll" ) ) { | 960 | if ( project->isActiveConfig( "dll" ) ) { |
828 | activeQtStepPreCopyDll += | 961 | activeQtStepPreCopyDll += |
829 | "\t" + idc + " %1 -idl tmp\\" + targetfilename + ".idl -version " + version + | 962 | "\t" + idc + " %1 -idl " + var("OBJECTS_DIR") + targetfilename + ".idl -version " + version + |
830 | "\t" + idl + " tmp\\" + targetfilename + ".idl /nologo /o tmp\\" + targetfilename + ".midl /tlb tmp\\" + targetfilename + ".tlb /iid tmp\\dump.midl /dlldata tmp\\dump.midl /cstub tmp\\dump.midl /header tmp\\dump.midl /proxy tmp\\dump.midl /sstub tmp\\dump.midl" | 963 | "\t" + idl + " /nologo " + var("OBJECTS_DIR") + targetfilename + ".idl /tlb " + var("OBJECTS_DIR") + targetfilename + ".tlb" + |
831 | "\t" + idc + " %1 /tlb tmp\\" + targetfilename + ".tlb"; | 964 | "\t" + idc + " %2 /tlb " + var("OBJECTS_DIR") + targetfilename + ".tlb"; |
832 | activeQtStepPostCopyDll += | 965 | activeQtStepPostCopyDll += |
@@ -843,5 +976,5 @@ DspMakefileGenerator::init() | |||
843 | activeQtStepPreCopyDll += | 976 | activeQtStepPreCopyDll += |
844 | "\t%1 -dumpidl tmp\\" + targetfilename + ".idl -version " + version + | 977 | "\t%1 -dumpidl " + var("OBJECTS_DIR") + targetfilename + ".idl -version " + version + |
845 | "\t" + idl + " tmp\\" + targetfilename + ".idl /nologo /o tmp\\" + targetfilename + ".midl /tlb tmp\\" + targetfilename + ".tlb /iid tmp\\dump.midl /dlldata tmp\\dump.midl /cstub tmp\\dump.midl /header tmp\\dump.midl /proxy tmp\\dump.midl /sstub tmp\\dump.midl" | 978 | "\t" + idl + " /nologo " + var("OBJECTS_DIR") + targetfilename + ".idl /tlb " + var("OBJECTS_DIR") + targetfilename + ".tlb" + |
846 | "\t" + idc + " %1 /tlb tmp\\" + targetfilename + ".tlb"; | 979 | "\t" + idc + " %2 /tlb " + var("OBJECTS_DIR") + targetfilename + ".tlb"; |
847 | activeQtStepPostCopyDll += | 980 | activeQtStepPostCopyDll += |
@@ -883,3 +1016,3 @@ DspMakefileGenerator::init() | |||
883 | } | 1016 | } |
884 | project->variables()["QMAKE_INTERNAL_PRL_LIBS"] << "MSVCDSP_LIBS"; | 1017 | project->variables()["QMAKE_INTERNAL_PRL_LIBS"] << "MSVCDSP_LIBS"; |
885 | } | 1018 | } |
@@ -921,3 +1054,2 @@ DspMakefileGenerator::beginGroupForFile(QString file, QTextStream &t, | |||
921 | return; | 1054 | return; |
922 | |||
923 | fileFixify(file, QDir::currentDirPath(), QDir::currentDirPath(), TRUE); | 1055 | fileFixify(file, QDir::currentDirPath(), QDir::currentDirPath(), TRUE); |
@@ -933,9 +1065,12 @@ DspMakefileGenerator::beginGroupForFile(QString file, QTextStream &t, | |||
933 | } | 1065 | } |
934 | if(file.startsWith(currentGroup)) | 1066 | |
935 | file = file.mid(currentGroup.length()); | 1067 | QString tempFile = file; |
1068 | if(tempFile.startsWith(currentGroup)) | ||
1069 | tempFile = tempFile.mid(currentGroup.length()); | ||
936 | int dirSep = currentGroup.findRev( Option::dir_sep ); | 1070 | int dirSep = currentGroup.findRev( Option::dir_sep ); |
937 | while( !file.startsWith( currentGroup ) && dirSep != -1 ) { | 1071 | |
1072 | while( !tempFile.startsWith( currentGroup ) && dirSep != -1 ) { | ||
938 | currentGroup.truncate( dirSep ); | 1073 | currentGroup.truncate( dirSep ); |
939 | dirSep = currentGroup.findRev( Option::dir_sep ); | 1074 | dirSep = currentGroup.findRev( Option::dir_sep ); |
940 | if ( !file.startsWith( currentGroup ) && dirSep != -1 ) | 1075 | if ( !tempFile.startsWith( currentGroup ) && dirSep != -1 ) |
941 | t << "\n# End Group\n"; | 1076 | t << "\n# End Group\n"; |
@@ -946,2 +1081,3 @@ DspMakefileGenerator::beginGroupForFile(QString file, QTextStream &t, | |||
946 | } | 1081 | } |
1082 | |||
947 | QStringList dirs = QStringList::split(Option::dir_sep, file.right( file.length() - currentGroup.length() ) ); | 1083 | QStringList dirs = QStringList::split(Option::dir_sep, file.right( file.length() - currentGroup.length() ) ); |
@@ -975,2 +1111,4 @@ DspMakefileGenerator::openOutput(QFile &file) const | |||
975 | if(!file.name().isEmpty()) { | 1111 | if(!file.name().isEmpty()) { |
1112 | if(QDir::isRelativePath(file.name())) | ||
1113 | file.setName(Option::output_dir + file.name()); //pwd when qmake was run | ||
976 | QFileInfo fi(file); | 1114 | QFileInfo fi(file); |
diff --git a/qmake/generators/win32/msvc_dsp.h b/qmake/generators/win32/msvc_dsp.h index 3a7d18e..0e86539 100644 --- a/qmake/generators/win32/msvc_dsp.h +++ b/qmake/generators/win32/msvc_dsp.h | |||
@@ -1,11 +1,9 @@ | |||
1 | /**************************************************************************** | 1 | /**************************************************************************** |
2 | ** $Id$ | 2 | ** |
3 | ** | 3 | ** |
4 | ** Definition of ________ class. | 4 | ** Definition of DspMakefileGenerator class. |
5 | ** | 5 | ** |
6 | ** Created : 970521 | 6 | ** Copyright (C) 1992-2003 Trolltech AS. All rights reserved. |
7 | ** | 7 | ** |
8 | ** Copyright (C) 1992-2002 Trolltech AS. All rights reserved. | 8 | ** This file is part of qmake. |
9 | ** | ||
10 | ** This file is part of the network module of the Qt GUI Toolkit. | ||
11 | ** | 9 | ** |
@@ -36,2 +34,3 @@ | |||
36 | **********************************************************************/ | 34 | **********************************************************************/ |
35 | |||
37 | #ifndef __MSVC_DSP_H__ | 36 | #ifndef __MSVC_DSP_H__ |
@@ -64,2 +63,6 @@ protected: | |||
64 | virtual bool findLibraries(); | 63 | virtual bool findLibraries(); |
64 | |||
65 | QString precompH, | ||
66 | precompObj, precompPch; | ||
67 | bool usePCH; | ||
65 | }; | 68 | }; |
diff --git a/qmake/generators/win32/msvc_nmake.cpp b/qmake/generators/win32/msvc_nmake.cpp index ecef34d..528cb19 100644 --- a/qmake/generators/win32/msvc_nmake.cpp +++ b/qmake/generators/win32/msvc_nmake.cpp | |||
@@ -1,11 +1,9 @@ | |||
1 | /**************************************************************************** | 1 | /**************************************************************************** |
2 | ** $Id$ | 2 | ** |
3 | ** | 3 | ** |
4 | ** Definition of ________ class. | 4 | ** Implementation of NmakeMakefileGenerator class. |
5 | ** | 5 | ** |
6 | ** Created : 970521 | 6 | ** Copyright (C) 1992-2003 Trolltech AS. All rights reserved. |
7 | ** | 7 | ** |
8 | ** Copyright (C) 1992-2002 Trolltech AS. All rights reserved. | 8 | ** This file is part of qmake. |
9 | ** | ||
10 | ** This file is part of the network module of the Qt GUI Toolkit. | ||
11 | ** | 9 | ** |
@@ -45,3 +43,2 @@ | |||
45 | 43 | ||
46 | |||
47 | NmakeMakefileGenerator::NmakeMakefileGenerator(QMakeProject *p) : Win32MakefileGenerator(p), init_flag(FALSE) | 44 | NmakeMakefileGenerator::NmakeMakefileGenerator(QMakeProject *p) : Win32MakefileGenerator(p), init_flag(FALSE) |
@@ -56,2 +53,7 @@ NmakeMakefileGenerator::writeMakefile(QTextStream &t) | |||
56 | if(!project->variables()["QMAKE_FAILED_REQUIREMENTS"].isEmpty()) { | 53 | if(!project->variables()["QMAKE_FAILED_REQUIREMENTS"].isEmpty()) { |
54 | { //write the extra unix targets.. | ||
55 | QStringList &qut = project->variables()["QMAKE_EXTRA_WIN_TARGETS"]; | ||
56 | for(QStringList::ConstIterator it = qut.begin(); it != qut.end(); ++it) | ||
57 | t << *it << " "; | ||
58 | } | ||
57 | t << "all clean:" << "\n\t" | 59 | t << "all clean:" << "\n\t" |
@@ -76,2 +78,20 @@ NmakeMakefileGenerator::writeMakefile(QTextStream &t) | |||
76 | 78 | ||
79 | QStringList | ||
80 | &NmakeMakefileGenerator::findDependencies(const QString &file) | ||
81 | { | ||
82 | QStringList &aList = MakefileGenerator::findDependencies(file); | ||
83 | // Note: The QMAKE_IMAGE_COLLECTION file have all images | ||
84 | // as dependency, so don't add precompiled header then | ||
85 | if (file == project->first("QMAKE_IMAGE_COLLECTION")) | ||
86 | return aList; | ||
87 | for(QStringList::Iterator it = Option::cpp_ext.begin(); it != Option::cpp_ext.end(); ++it) { | ||
88 | if(file.endsWith(*it)) { | ||
89 | if(!aList.contains(precompH)) | ||
90 | aList += precompH; | ||
91 | break; | ||
92 | } | ||
93 | } | ||
94 | return aList; | ||
95 | } | ||
96 | |||
77 | void | 97 | void |
@@ -97,4 +117,4 @@ NmakeMakefileGenerator::writeNmakeParts(QTextStream &t) | |||
97 | QString inc = (*incit); | 117 | QString inc = (*incit); |
98 | inc.replace(QRegExp("\\\\$"), "\\\\"); | 118 | if (inc.endsWith("\\")) |
99 | inc.replace("\"", ""); | 119 | inc.truncate(inc.length()-1); |
100 | t << " -I\"" << inc << "\""; | 120 | t << " -I\"" << inc << "\""; |
@@ -113,4 +133,4 @@ NmakeMakefileGenerator::writeNmakeParts(QTextStream &t) | |||
113 | QString lib = (*libit); | 133 | QString lib = (*libit); |
114 | lib.replace(QRegExp("\\\\$"), "\\\\"); | 134 | if (lib.endsWith("\\")) |
115 | lib.replace(QRegExp("\""), ""); | 135 | lib.truncate(lib.length()-1); |
116 | t << " \"" << lib << "\""; | 136 | t << " \"" << lib << "\""; |
@@ -140,2 +160,4 @@ NmakeMakefileGenerator::writeNmakeParts(QTextStream &t) | |||
140 | t << "MKDIR =" << var("QMAKE_MKDIR") << endl; | 160 | t << "MKDIR =" << var("QMAKE_MKDIR") << endl; |
161 | t << "INSTALL_FILE= " << var("QMAKE_INSTALL_FILE") << endl; | ||
162 | t << "INSTALL_DIR = " << var("QMAKE_INSTALL_DIR") << endl; | ||
141 | t << endl; | 163 | t << endl; |
@@ -151,2 +173,19 @@ NmakeMakefileGenerator::writeNmakeParts(QTextStream &t) | |||
151 | t << "OBJMOC =" << varList("OBJMOC") << endl; | 173 | t << "OBJMOC =" << varList("OBJMOC") << endl; |
174 | |||
175 | QString extraCompilerDeps; | ||
176 | if(!project->isEmpty("QMAKE_EXTRA_WIN_COMPILERS")) { | ||
177 | t << "OBJCOMP = " << varList("OBJCOMP") << endl; | ||
178 | extraCompilerDeps += " $(OBJCOMP) "; | ||
179 | |||
180 | QStringList &comps = project->variables()["QMAKE_EXTRA_WIN_COMPILERS"]; | ||
181 | for(QStringList::Iterator compit = comps.begin(); compit != comps.end(); ++compit) { | ||
182 | QStringList &vars = project->variables()[(*compit) + ".variables"]; | ||
183 | for(QStringList::Iterator varit = vars.begin(); varit != vars.end(); ++varit) { | ||
184 | QStringList vals = project->variables()[(*varit)]; | ||
185 | if(!vals.isEmpty()) | ||
186 | t << "QMAKE_COMP_" << (*varit) << " = " << valList(vals) << endl; | ||
187 | } | ||
188 | } | ||
189 | } | ||
190 | |||
152 | t << "DIST =" << varList("DISTFILES") << endl; | 191 | t << "DIST =" << varList("DISTFILES") << endl; |
@@ -166,2 +205,3 @@ NmakeMakefileGenerator::writeNmakeParts(QTextStream &t) | |||
166 | t << endl << endl; | 205 | t << endl << endl; |
206 | |||
167 | if(!project->isActiveConfig("no_batch")) { | 207 | if(!project->isActiveConfig("no_batch")) { |
@@ -173,8 +213,10 @@ NmakeMakefileGenerator::writeNmakeParts(QTextStream &t) | |||
173 | source_directories.insert(".", (void*)1); | 213 | source_directories.insert(".", (void*)1); |
174 | if(!project->isEmpty("MOC_DIR")) | 214 | QString directories[] = { QString("MOC_DIR"), QString("UI_SOURCES_DIR"), QString("UI_DIR"), QString::null }; |
175 | source_directories.insert(project->first("MOC_DIR"), (void*)1); | 215 | for(int y = 0; !directories[y].isNull(); y++) { |
176 | if(!project->isEmpty("UI_SOURCES_DIR")) | 216 | QString dirTemp = project->first(directories[y]); |
177 | source_directories.insert(project->first("UI_SOURCES_DIR"), (void*)1); | 217 | if (dirTemp.endsWith("\\")) |
178 | else if(!project->isEmpty("UI_DIR")) | 218 | dirTemp.truncate(dirTemp.length()-1); |
179 | source_directories.insert(project->first("UI_DIR"), (void*)1); | 219 | if(!dirTemp.isEmpty()) |
220 | source_directories.insert(dirTemp, (void*)1); | ||
221 | } | ||
180 | QString srcs[] = { QString("SOURCES"), QString("UICIMPLS"), QString("SRCMOC"), QString::null }; | 222 | QString srcs[] = { QString("SOURCES"), QString("UICIMPLS"), QString("SRCMOC"), QString::null }; |
@@ -208,5 +250,5 @@ NmakeMakefileGenerator::writeNmakeParts(QTextStream &t) | |||
208 | t << "####### Build rules" << endl << endl; | 250 | t << "####### Build rules" << endl << endl; |
209 | t << "all: " << varGlue("ALL_DEPS",""," "," ") << "$(TARGET)" << endl << endl; | 251 | t << "all: " << fileFixify(Option::output.name()) << " " << varGlue("ALL_DEPS"," "," "," ") << "$(TARGET)" << endl << endl; |
210 | t << "$(TARGET): " << var("PRE_TARGETDEPS") << " $(UICDECLS) $(OBJECTS) $(OBJMOC) " | 252 | t << "$(TARGET): " << var("PRE_TARGETDEPS") << " $(UICDECLS) $(OBJECTS) $(OBJMOC) " |
211 | << var("POST_TARGETDEPS"); | 253 | << extraCompilerDeps << var("POST_TARGETDEPS"); |
212 | if(!project->variables()["QMAKE_APP_OR_DLL"].isEmpty()) { | 254 | if(!project->variables()["QMAKE_APP_OR_DLL"].isEmpty()) { |
@@ -218,2 +260,3 @@ NmakeMakefileGenerator::writeNmakeParts(QTextStream &t) | |||
218 | } | 260 | } |
261 | t << extraCompilerDeps; | ||
219 | t << endl << "<<" << endl; | 262 | t << endl << "<<" << endl; |
@@ -224,3 +267,3 @@ NmakeMakefileGenerator::writeNmakeParts(QTextStream &t) | |||
224 | for ( QStringList::Iterator dlldir = dlldirs.begin(); dlldir != dlldirs.end(); ++dlldir ) { | 267 | for ( QStringList::Iterator dlldir = dlldirs.begin(); dlldir != dlldirs.end(); ++dlldir ) { |
225 | t << "\n\t" << "-copy $(TARGET) " << *dlldir; | 268 | t << "\n\t" << "-$(COPY_FILE) \"$(TARGET)\" " << *dlldir; |
226 | } | 269 | } |
@@ -234,10 +277,10 @@ NmakeMakefileGenerator::writeNmakeParts(QTextStream &t) | |||
234 | if ( project->isActiveConfig("dll")) { | 277 | if ( project->isActiveConfig("dll")) { |
235 | t << "\n\t" << ("-$(IDC) $(TARGET) /idl tmp\\" + targetfilename + ".idl -version " + version); | 278 | t << "\n\t" << ("-$(IDC) $(TARGET) /idl " + var("OBJECTS_DIR") + targetfilename + ".idl -version " + version); |
236 | 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"); | 279 | t << "\n\t" << ("-$(IDL) /nologo " + var("OBJECTS_DIR") + targetfilename + ".idl /tlb " + var("OBJECTS_DIR") + targetfilename + ".tlb"); |
237 | t << "\n\t" << ("-$(IDC) $(TARGET) /tlb tmp\\" + targetfilename + ".tlb"); | 280 | t << "\n\t" << ("-$(IDC) $(TARGET) /tlb " + var("OBJECTS_DIR") + targetfilename + ".tlb"); |
238 | t << "\n\t" << ("-$(IDC) $(TARGET) /regserver" ); | 281 | t << "\n\t" << ("-$(IDC) $(TARGET) /regserver" ); |
239 | } else { | 282 | } else { |
240 | t << "\n\t" << ("-$(TARGET) -dumpidl tmp\\" + targetfilename + ".idl -version " + version); | 283 | t << "\n\t" << ("-$(TARGET) -dumpidl " + var("OBJECTS_DIR") + targetfilename + ".idl -version " + version); |
241 | 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"); | 284 | t << "\n\t" << ("-$(IDL) /nologo " + var("OBJECTS_DIR") + targetfilename + ".idl /tlb " + var("OBJECTS_DIR") + targetfilename + ".tlb"); |
242 | t << "\n\t" << ("-$(IDC) $(TARGET) /tlb tmp\\" + targetfilename + ".tlb"); | 285 | t << "\n\t" << ("-$(IDC) $(TARGET) /tlb " + var("OBJECTS_DIR") + targetfilename + ".tlb"); |
243 | t << "\n\t" << "-$(TARGET) -regserver"; | 286 | t << "\n\t" << "-$(TARGET) -regserver"; |
@@ -252,3 +295,4 @@ NmakeMakefileGenerator::writeNmakeParts(QTextStream &t) | |||
252 | 295 | ||
253 | t << "mocables: $(SRCMOC)" << endl << endl; | 296 | t << "mocables: $(SRCMOC)" << endl |
297 | << "uicables: $(UICIMPLS) $(UICDECLS)" << endl << endl; | ||
254 | 298 | ||
@@ -256,25 +300,44 @@ NmakeMakefileGenerator::writeNmakeParts(QTextStream &t) | |||
256 | 300 | ||
301 | QStringList dist_files = Option::mkfile::project_files; | ||
302 | if(!project->isEmpty("QMAKE_INTERNAL_INCLUDED_FILES")) | ||
303 | dist_files += project->variables()["QMAKE_INTERNAL_INCLUDED_FILES"]; | ||
304 | if(!project->isEmpty("TRANSLATIONS")) | ||
305 | dist_files << var("TRANSLATIONS"); | ||
306 | if(!project->isEmpty("FORMS")) { | ||
307 | QStringList &forms = project->variables()["FORMS"]; | ||
308 | for(QStringList::Iterator formit = forms.begin(); formit != forms.end(); ++formit) { | ||
309 | QString ui_h = fileFixify((*formit) + Option::h_ext.first()); | ||
310 | if(QFile::exists(ui_h) ) | ||
311 | dist_files << ui_h; | ||
312 | } | ||
313 | } | ||
257 | t << "dist:" << "\n\t" | 314 | t << "dist:" << "\n\t" |
258 | << "$(ZIP) " << var("PROJECT") << ".zip " | 315 | << "$(ZIP) " << var("QMAKE_ORIG_TARGET") << ".zip " << "$(SOURCES) $(HEADERS) $(DIST) $(FORMS) " |
259 | << var("PROJECT") << ".pro $(SOURCES) $(HEADERS) $(DIST) $(FORMS)" << endl << endl; | 316 | << dist_files.join(" ") << " " << var("TRANSLATIONS") << " " << var("IMAGES") << endl << endl; |
260 | 317 | ||
261 | t << "clean:" | 318 | t << "uiclean:" |
262 | << varGlue("OBJECTS","\n\t-del ","\n\t-del ","") | 319 | << varGlue("UICDECLS" ,"\n\t-$(DEL_FILE) ","\n\t-$(DEL_FILE) ","") |
263 | << varGlue("SRCMOC" ,"\n\t-del ","\n\t-del ","") | 320 | << varGlue("UICIMPLS" ,"\n\t-$(DEL_FILE) ","\n\t-$(DEL_FILE) ","") << endl; |
264 | << varGlue("OBJMOC" ,"\n\t-del ","\n\t-del ","") | 321 | |
265 | << varGlue("UICDECLS" ,"\n\t-del ","\n\t-del ","") | 322 | t << "mocclean:" |
266 | << varGlue("UICIMPLS" ,"\n\t-del ","\n\t-del ","") | 323 | << varGlue("SRCMOC" ,"\n\t-$(DEL_FILE) ","\n\t-$(DEL_FILE) ","") |
267 | << varGlue("QMAKE_CLEAN","\n\t-del ","\n\t-del ","") | 324 | << varGlue("OBJMOC" ,"\n\t-$(DEL_FILE) ","\n\t-$(DEL_FILE) ","") << endl; |
268 | << varGlue("CLEAN_FILES","\n\t-del ","\n\t-del ",""); | 325 | |
269 | 326 | t << "clean: uiclean mocclean" | |
327 | << varGlue("OBJECTS","\n\t-$(DEL_FILE) ","\n\t-$(DEL_FILE) ","") | ||
328 | << varGlue("QMAKE_CLEAN","\n\t-$(DEL_FILE) ","\n\t-$(DEL_FILE) ","\n") | ||
329 | << varGlue("CLEAN_FILES","\n\t-$(DEL_FILE) ","\n\t-$(DEL_FILE) ","\n"); | ||
270 | if ( project->isActiveConfig("activeqt")) { | 330 | if ( project->isActiveConfig("activeqt")) { |
271 | t << ("\n\t-del tmp\\" + targetfilename + ".*"); | 331 | t << ("\n\t-$(DEL_FILE) " + var("OBJECTS_DIR") + targetfilename + ".idl"); |
272 | t << "\n\t-del tmp\\dump.*"; | 332 | t << ("\n\t-$(DEL_FILE) " + var("OBJECTS_DIR") + targetfilename + ".tlb"); |
273 | } | 333 | } |
274 | if(!project->isEmpty("IMAGES")) | 334 | if(!project->isEmpty("IMAGES")) |
275 | t << varGlue("QMAKE_IMAGE_COLLECTION", "\n\t-del ", "\n\t-del ", ""); | 335 | t << varGlue("QMAKE_IMAGE_COLLECTION", "\n\t-$(DEL_FILE) ", "\n\t-$(DEL_FILE) ", ""); |
336 | t << endl; | ||
337 | |||
338 | // user defined targets | ||
276 | 339 | ||
277 | // blasted user defined targets | 340 | QStringList::Iterator it; |
278 | QStringList &qut = project->variables()["QMAKE_EXTRA_WIN_TARGETS"]; | 341 | QStringList &qut = project->variables()["QMAKE_EXTRA_WIN_TARGETS"]; |
279 | for(QStringList::Iterator it = qut.begin(); it != qut.end(); ++it) { | 342 | for(it = qut.begin(); it != qut.end(); ++it) { |
280 | QString targ = var((*it) + ".target"), | 343 | QString targ = var((*it) + ".target"), |
@@ -290,2 +353,5 @@ NmakeMakefileGenerator::writeNmakeParts(QTextStream &t) | |||
290 | } | 353 | } |
354 | if(!project->variables()["QMAKE_NOFORCE"].isEmpty() && | ||
355 | project->variables()[(*it) + ".CONFIG"].findIndex("phony") != -1) | ||
356 | deps += QString(" ") + "FORCE"; | ||
291 | t << "\n\n" << targ << ":" << deps << "\n\t" | 357 | t << "\n\n" << targ << ":" << deps << "\n\t" |
@@ -293,10 +359,95 @@ NmakeMakefileGenerator::writeNmakeParts(QTextStream &t) | |||
293 | } | 359 | } |
294 | |||
295 | t << endl << endl; | 360 | t << endl << endl; |
296 | 361 | ||
362 | QStringList &quc = project->variables()["QMAKE_EXTRA_WIN_COMPILERS"]; | ||
363 | for(it = quc.begin(); it != quc.end(); ++it) { | ||
364 | QString tmp_out = project->variables()[(*it) + ".output"].first(); | ||
365 | QString tmp_cmd = project->variables()[(*it) + ".commands"].join(" "); | ||
366 | QString tmp_dep = project->variables()[(*it) + ".depends"].join(" "); | ||
367 | QStringList &vars = project->variables()[(*it) + ".variables"]; | ||
368 | if(tmp_out.isEmpty() || tmp_cmd.isEmpty()) | ||
369 | continue; | ||
370 | QStringList &tmp = project->variables()[(*it) + ".input"]; | ||
371 | for(QStringList::Iterator it2 = tmp.begin(); it2 != tmp.end(); ++it2) { | ||
372 | QStringList &inputs = project->variables()[(*it2)]; | ||
373 | for(QStringList::Iterator input = inputs.begin(); input != inputs.end(); ++input) { | ||
374 | QFileInfo fi(Option::fixPathToLocalOS((*input))); | ||
375 | QString in = Option::fixPathToTargetOS((*input), FALSE), | ||
376 | out = tmp_out, cmd = tmp_cmd, deps; | ||
377 | out.replace("${QMAKE_FILE_BASE}", fi.baseName()); | ||
378 | out.replace("${QMAKE_FILE_NAME}", fi.fileName()); | ||
379 | cmd.replace("${QMAKE_FILE_BASE}", fi.baseName()); | ||
380 | cmd.replace("${QMAKE_FILE_OUT}", out); | ||
381 | cmd.replace("${QMAKE_FILE_NAME}", fi.fileName()); | ||
382 | for(QStringList::Iterator it3 = vars.begin(); it3 != vars.end(); ++it3) | ||
383 | cmd.replace("$(" + (*it3) + ")", "$(QMAKE_COMP_" + (*it3)+")"); | ||
384 | if(!tmp_dep.isEmpty()) { | ||
385 | char buff[256]; | ||
386 | QString dep_cmd = tmp_dep; | ||
387 | dep_cmd.replace("${QMAKE_FILE_NAME}", fi.fileName()); | ||
388 | if(FILE *proc = QT_POPEN(dep_cmd.latin1(), "r")) { | ||
389 | while(!feof(proc)) { | ||
390 | int read_in = int(fread(buff, 1, 255, proc)); | ||
391 | if(!read_in) | ||
392 | break; | ||
393 | int l = 0; | ||
394 | for(int i = 0; i < read_in; i++) { | ||
395 | if(buff[i] == '\n' || buff[i] == ' ') { | ||
396 | deps += " " + QCString(buff+l, (i - l) + 1); | ||
397 | l = i; | ||
398 | } | ||
399 | } | ||
400 | } | ||
401 | fclose(proc); | ||
402 | } | ||
403 | } | ||
404 | t << out << ": " << in << deps << "\n\t" | ||
405 | << cmd << endl << endl; | ||
406 | } | ||
407 | } | ||
408 | } | ||
409 | t << endl; | ||
410 | |||
411 | if(project->variables()["QMAKE_NOFORCE"].isEmpty()) | ||
412 | t << "FORCE:" << endl << endl; | ||
413 | |||
297 | t << "distclean: clean" | 414 | t << "distclean: clean" |
298 | << "\n\t-del $(TARGET)" | 415 | << "\n\t-$(DEL_FILE) $(TARGET)" |
299 | << endl << endl; | 416 | << endl << endl; |
417 | |||
418 | // precompiled header | ||
419 | if(usePCH) { | ||
420 | QString precompRule = QString("-c -Yc -Fp%1 -Fo%2").arg(precompPch).arg(precompObj); | ||
421 | t << precompObj << ": " << precompH << " " << findDependencies(precompH).join(" \\\n\t\t") | ||
422 | << "\n\t" << "$(CXX) " + precompRule +" $(CXXFLAGS) $(INCPATH) -TP " << precompH << endl << endl; | ||
423 | } | ||
300 | } | 424 | } |
301 | 425 | ||
426 | QString | ||
427 | NmakeMakefileGenerator::var(const QString &value) | ||
428 | { | ||
429 | if (usePCH) { | ||
430 | if ((value == "QMAKE_RUN_CXX_IMP_BATCH" | ||
431 | || value == "QMAKE_RUN_CXX_IMP" | ||
432 | || value == "QMAKE_RUN_CXX")) { | ||
433 | QFileInfo precompHInfo(precompH); | ||
434 | QString precompRule = QString("-c -FI%1 -Yu%2 -Fp%3") | ||
435 | .arg(precompHInfo.fileName()) | ||
436 | .arg(precompHInfo.fileName()) | ||
437 | .arg(precompPch); | ||
438 | QString p = MakefileGenerator::var(value); | ||
439 | p.replace("-c", precompRule); | ||
440 | // Cannot use -Gm with -FI & -Yu, as this gives an | ||
441 | // internal compiler error, on the newer compilers | ||
442 | p.remove("-Gm"); | ||
443 | return p; | ||
444 | } else if (value == "QMAKE_CXXFLAGS") { | ||
445 | // Remove internal compiler error option | ||
446 | return MakefileGenerator::var(value).remove("-Gm"); | ||
447 | } | ||
448 | } | ||
449 | |||
450 | // Normal val | ||
451 | return MakefileGenerator::var(value); | ||
452 | } | ||
302 | 453 | ||
@@ -323,2 +474,7 @@ NmakeMakefileGenerator::init() | |||
323 | 474 | ||
475 | if(project->isEmpty("QMAKE_INSTALL_FILE")) | ||
476 | project->variables()["QMAKE_INSTALL_FILE"].append("$(COPY_FILE)"); | ||
477 | if(project->isEmpty("QMAKE_INSTALL_DIR")) | ||
478 | project->variables()["QMAKE_INSTALL_DIR"].append("$(COPY_DIR)"); | ||
479 | |||
324 | bool is_qt = (project->first("TARGET") == "qt"QTDLL_POSTFIX || project->first("TARGET") == "qt-mt"QTDLL_POSTFIX); | 480 | bool is_qt = (project->first("TARGET") == "qt"QTDLL_POSTFIX || project->first("TARGET") == "qt-mt"QTDLL_POSTFIX); |
@@ -332,2 +488,8 @@ NmakeMakefileGenerator::init() | |||
332 | if(configs.findIndex("qt") == -1) configs.append("qt"); | 488 | if(configs.findIndex("qt") == -1) configs.append("qt"); |
489 | if ( project->isActiveConfig("qtopia") ) { | ||
490 | if(configs.findIndex("qtopialib") == -1) | ||
491 | configs.append("qtopialib"); | ||
492 | if(configs.findIndex("qtopiainc") == -1) | ||
493 | configs.append("qtopiainc"); | ||
494 | } | ||
333 | if ( project->isActiveConfig("qt") ) { | 495 | if ( project->isActiveConfig("qt") ) { |
@@ -403,2 +565,9 @@ NmakeMakefileGenerator::init() | |||
403 | project->variables()["CONFIG"].append("windows"); | 565 | project->variables()["CONFIG"].append("windows"); |
566 | if ( project->isActiveConfig("qtopiainc") ) | ||
567 | project->variables()["INCLUDEPATH"] += project->variables()["QMAKE_INCDIR_QTOPIA"]; | ||
568 | if ( project->isActiveConfig("qtopialib") ) { | ||
569 | if(!project->isEmpty("QMAKE_LIBDIR_QTOPIA")) | ||
570 | project->variables()["QMAKE_LIBDIR"] += project->variables()["QMAKE_LIBDIR_QTOPIA"]; | ||
571 | project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_QTOPIA"]; | ||
572 | } | ||
404 | if ( project->isActiveConfig("qt") ) { | 573 | if ( project->isActiveConfig("qt") ) { |
@@ -510,2 +679,17 @@ NmakeMakefileGenerator::init() | |||
510 | project->variables()["QMAKE_LIBS"] += project->variables()["LIBS"]; | 679 | project->variables()["QMAKE_LIBS"] += project->variables()["LIBS"]; |
680 | |||
681 | QStringList &libList = project->variables()["QMAKE_LIBS"]; | ||
682 | for( QStringList::Iterator stIt = libList.begin(); stIt != libList.end(); ) { | ||
683 | QString s = *stIt; | ||
684 | if( s.startsWith( "-l" ) ) { | ||
685 | stIt = libList.remove( stIt ); | ||
686 | stIt = libList.insert( stIt, s.mid( 2 ) + ".lib" ); | ||
687 | } else if( s.startsWith( "-L" ) ) { | ||
688 | stIt = libList.remove( stIt ); | ||
689 | project->variables()["QMAKE_LIBDIR"].append(QDir::convertSeparators(s.mid( 2 ))); | ||
690 | } else { | ||
691 | stIt++; | ||
692 | } | ||
693 | } | ||
694 | |||
511 | project->variables()["QMAKE_FILETAGS"] += QStringList::split(' ', | 695 | project->variables()["QMAKE_FILETAGS"] += QStringList::split(' ', |
@@ -513,3 +697,4 @@ NmakeMakefileGenerator::init() | |||
513 | QStringList &l = project->variables()["QMAKE_FILETAGS"]; | 697 | QStringList &l = project->variables()["QMAKE_FILETAGS"]; |
514 | for(QStringList::Iterator it = l.begin(); it != l.end(); ++it) { | 698 | QStringList::Iterator it; |
699 | for(it = l.begin(); it != l.end(); ++it) { | ||
515 | QStringList &gdmf = project->variables()[(*it)]; | 700 | QStringList &gdmf = project->variables()[(*it)]; |
@@ -541,2 +726,3 @@ NmakeMakefileGenerator::init() | |||
541 | project->variables()["POST_TARGETDEPS"] += project->variables()["RES_FILE"]; | 726 | project->variables()["POST_TARGETDEPS"] += project->variables()["RES_FILE"]; |
727 | project->variables()["CLEAN_FILES"] += project->variables()["RES_FILE"]; | ||
542 | } | 728 | } |
@@ -545,3 +731,21 @@ NmakeMakefileGenerator::init() | |||
545 | 731 | ||
732 | // Base class init! | ||
546 | MakefileGenerator::init(); | 733 | MakefileGenerator::init(); |
734 | |||
735 | // Setup PCH variables | ||
736 | precompH = project->first("PRECOMPILED_HEADER"); | ||
737 | usePCH = !precompH.isEmpty() && project->isActiveConfig("precompile_header"); | ||
738 | if (usePCH) { | ||
739 | // Created files | ||
740 | precompObj = var("OBJECTS_DIR") + project->first("TARGET") + "_pch" + Option::obj_ext; | ||
741 | precompPch = var("OBJECTS_DIR") + project->first("TARGET") + "_pch.pch"; | ||
742 | // Add linking of precompObj (required for whole precompiled classes) | ||
743 | project->variables()["OBJECTS"] += precompObj; | ||
744 | // Add pch file to cleanup | ||
745 | project->variables()["QMAKE_CLEAN"] += precompPch; | ||
746 | // Return to variable pool | ||
747 | project->variables()["PRECOMPILED_OBJECT"] = precompObj; | ||
748 | project->variables()["PRECOMPILED_PCH"] = precompPch; | ||
749 | } | ||
750 | |||
547 | if ( !project->variables()["VERSION"].isEmpty()) { | 751 | if ( !project->variables()["VERSION"].isEmpty()) { |
@@ -560,2 +764,23 @@ NmakeMakefileGenerator::init() | |||
560 | project->variables()["QMAKE_CLEAN"].append("vc*.pdb"); | 764 | project->variables()["QMAKE_CLEAN"].append("vc*.pdb"); |
765 | project->variables()["QMAKE_CLEAN"].append("vc*.idb"); | ||
766 | } | ||
767 | |||
768 | QStringList &quc = project->variables()["QMAKE_EXTRA_WIN_COMPILERS"]; | ||
769 | for(it = quc.begin(); it != quc.end(); ++it) { | ||
770 | QString tmp_out = project->variables()[(*it) + ".output"].first(); | ||
771 | if(tmp_out.isEmpty()) | ||
772 | continue; | ||
773 | QStringList &tmp = project->variables()[(*it) + ".input"]; | ||
774 | for(QStringList::Iterator it2 = tmp.begin(); it2 != tmp.end(); ++it2) { | ||
775 | QStringList &inputs = project->variables()[(*it2)]; | ||
776 | for(QStringList::Iterator input = inputs.begin(); input != inputs.end(); ++input) { | ||
777 | QFileInfo fi(Option::fixPathToLocalOS((*input))); | ||
778 | QString in = Option::fixPathToTargetOS((*input), FALSE), | ||
779 | out = tmp_out; | ||
780 | out.replace("${QMAKE_FILE_BASE}", fi.baseName()); | ||
781 | out.replace("${QMAKE_FILE_NAME}", fi.fileName()); | ||
782 | if(project->variables()[(*it) + ".CONFIG"].findIndex("no_link") == -1) | ||
783 | project->variables()["OBJCOMP"] += out; | ||
784 | } | ||
785 | } | ||
561 | } | 786 | } |
diff --git a/qmake/generators/win32/msvc_nmake.h b/qmake/generators/win32/msvc_nmake.h index 579fc35..f2996cd 100644 --- a/qmake/generators/win32/msvc_nmake.h +++ b/qmake/generators/win32/msvc_nmake.h | |||
@@ -1,11 +1,9 @@ | |||
1 | /**************************************************************************** | 1 | /**************************************************************************** |
2 | ** $Id$ | 2 | ** |
3 | ** | 3 | ** |
4 | ** Definition of ________ class. | 4 | ** Definition of NmakeMakefileGenerator class. |
5 | ** | 5 | ** |
6 | ** Created : 970521 | 6 | ** Copyright (C) 1992-2003 Trolltech AS. All rights reserved. |
7 | ** | 7 | ** |
8 | ** Copyright (C) 1992-2002 Trolltech AS. All rights reserved. | 8 | ** This file is part of qmake. |
9 | ** | ||
10 | ** This file is part of the network module of the Qt GUI Toolkit. | ||
11 | ** | 9 | ** |
@@ -36,2 +34,3 @@ | |||
36 | **********************************************************************/ | 34 | **********************************************************************/ |
35 | |||
37 | #ifndef __MSVC_NMAKE_H__ | 36 | #ifndef __MSVC_NMAKE_H__ |
@@ -49,2 +48,8 @@ class NmakeMakefileGenerator : public Win32MakefileGenerator | |||
49 | 48 | ||
49 | protected: | ||
50 | QStringList &findDependencies(const QString &file); | ||
51 | QString var(const QString &value); | ||
52 | QString precompH, precompObj, precompPch; | ||
53 | bool usePCH; | ||
54 | |||
50 | public: | 55 | public: |
diff --git a/qmake/generators/win32/msvc_objectmodel.cpp b/qmake/generators/win32/msvc_objectmodel.cpp index 7ffe4f7..a672c2d 100644 --- a/qmake/generators/win32/msvc_objectmodel.cpp +++ b/qmake/generators/win32/msvc_objectmodel.cpp | |||
@@ -1,9 +1,9 @@ | |||
1 | /**************************************************************************** | 1 | /**************************************************************************** |
2 | ** $Id$ | 2 | ** |
3 | ** | 3 | ** |
4 | ** Definition of ________ class. | 4 | ** Implementation of VCProject class. |
5 | ** | 5 | ** |
6 | ** Copyright (C) 2002 Trolltech AS. All rights reserved. | 6 | ** Copyright (C) 2002-2003 Trolltech AS. All rights reserved. |
7 | ** | 7 | ** |
8 | ** This file is part of the network module of the Qt GUI Toolkit. | 8 | ** This file is part of qmake. |
9 | ** | 9 | ** |
@@ -39,17 +39,3 @@ | |||
39 | #include <qstringlist.h> | 39 | #include <qstringlist.h> |
40 | #include <quuid.h> | 40 | #include <qfileinfo.h> |
41 | |||
42 | #if defined(Q_OS_WIN32) | ||
43 | #include <objbase.h> | ||
44 | #ifndef GUID_DEFINED | ||
45 | #define GUID_DEFINED | ||
46 | typedef struct _GUID | ||
47 | { | ||
48 | ulong Data1; | ||
49 | ushort Data2; | ||
50 | ushort Data3; | ||
51 | uchar Data4[8]; | ||
52 | } GUID; | ||
53 | #endif | ||
54 | #endif | ||
55 | 41 | ||
@@ -283,3 +269,2 @@ struct XPair { | |||
283 | 269 | ||
284 | |||
285 | // Streaming operators for property Pairs --------------------------- | 270 | // Streaming operators for property Pairs --------------------------- |
@@ -320,3 +305,3 @@ QTextStream &operator<<( QTextStream &strm, const SPair &prop ) | |||
320 | if ( !prop.value.isEmpty() ) | 305 | if ( !prop.value.isEmpty() ) |
321 | strm << prop.name << prop.value.latin1() << "\""; | 306 | strm << prop.name << QString(prop.value).remove("\"") << "\""; |
322 | return strm; | 307 | return strm; |
@@ -336,3 +321,3 @@ VCCLCompilerTool::VCCLCompilerTool() | |||
336 | BrowseInformation( brInfoNone ), | 321 | BrowseInformation( brInfoNone ), |
337 | BufferSecurityCheck( unset ), | 322 | BufferSecurityCheck( _False ), |
338 | CallingConvention( callConventionDefault ), | 323 | CallingConvention( callConventionDefault ), |
@@ -348,3 +333,3 @@ VCCLCompilerTool::VCCLCompilerTool() | |||
348 | EnableIntrinsicFunctions( unset ), | 333 | EnableIntrinsicFunctions( unset ), |
349 | ExceptionHandling( unset ), | 334 | ExceptionHandling( _False ), |
350 | ExpandAttributedSource( unset ), | 335 | ExpandAttributedSource( unset ), |
@@ -356,3 +341,3 @@ VCCLCompilerTool::VCCLCompilerTool() | |||
356 | ImproveFloatingPointConsistency( unset ), | 341 | ImproveFloatingPointConsistency( unset ), |
357 | InlineFunctionExpansion( expandOnlyInline ), | 342 | InlineFunctionExpansion( expandDefault ), |
358 | KeepComments( unset ), | 343 | KeepComments( unset ), |
@@ -360,5 +345,6 @@ VCCLCompilerTool::VCCLCompilerTool() | |||
360 | OmitFramePointers( unset ), | 345 | OmitFramePointers( unset ), |
361 | Optimization( optimizeDisabled ), | 346 | Optimization( optimizeCustom ), |
362 | OptimizeForProcessor( procOptimizeBlended ), | 347 | OptimizeForProcessor( procOptimizeBlended ), |
363 | OptimizeForWindowsApplication( unset ), | 348 | OptimizeForWindowsApplication( unset ), |
349 | ProgramDataBaseFileName( "" ), | ||
364 | RuntimeLibrary( rtMultiThreaded ), | 350 | RuntimeLibrary( rtMultiThreaded ), |
@@ -373,3 +359,3 @@ VCCLCompilerTool::VCCLCompilerTool() | |||
373 | UndefineAllPreprocessorDefinitions( unset ), | 359 | UndefineAllPreprocessorDefinitions( unset ), |
374 | UsePrecompiledHeader( pchGenerateAuto ), | 360 | UsePrecompiledHeader( pchNone ), |
375 | WarnAsError( unset ), | 361 | WarnAsError( unset ), |
@@ -397,3 +383,3 @@ QTextStream &operator<<( QTextStream &strm, const VCCLCompilerTool &tool ) | |||
397 | strm << TPair( _CompileOnly, tool.CompileOnly ); | 383 | strm << TPair( _CompileOnly, tool.CompileOnly ); |
398 | strm << EPair( _DebugInformationFormat, tool.DebugInformationFormat ); | 384 | if ( tool.DebugInformationFormat != debugUnknown ) strm << EPair( _DebugInformationFormat, tool.DebugInformationFormat ); |
399 | strm << TPair( _DefaultCharIsUnsigned, tool.DefaultCharIsUnsigned ); | 385 | strm << TPair( _DefaultCharIsUnsigned, tool.DefaultCharIsUnsigned ); |
@@ -411,3 +397,3 @@ QTextStream &operator<<( QTextStream &strm, const VCCLCompilerTool &tool ) | |||
411 | strm << XPair( _ForcedUsingFiles, tool.ForcedUsingFiles ); | 397 | strm << XPair( _ForcedUsingFiles, tool.ForcedUsingFiles ); |
412 | strm << EPair( _GeneratePreprocessedFile, tool.GeneratePreprocessedFile ); | 398 | if ( tool.GeneratePreprocessedFile != preprocessUnknown)strm << EPair( _GeneratePreprocessedFile, tool.GeneratePreprocessedFile ); |
413 | strm << TPair( _GlobalOptimizations, tool.GlobalOptimizations ); | 399 | strm << TPair( _GlobalOptimizations, tool.GlobalOptimizations ); |
@@ -415,3 +401,3 @@ QTextStream &operator<<( QTextStream &strm, const VCCLCompilerTool &tool ) | |||
415 | strm << TPair( _ImproveFloatingPointConsistency, tool.ImproveFloatingPointConsistency ); | 401 | strm << TPair( _ImproveFloatingPointConsistency, tool.ImproveFloatingPointConsistency ); |
416 | strm << EPair( _InlineFunctionExpansion, tool.InlineFunctionExpansion ); | 402 | if ( tool.InlineFunctionExpansion != expandDefault ) strm << EPair( _InlineFunctionExpansion, tool.InlineFunctionExpansion ); |
417 | strm << TPair( _KeepComments, tool.KeepComments ); | 403 | strm << TPair( _KeepComments, tool.KeepComments ); |
@@ -420,3 +406,3 @@ QTextStream &operator<<( QTextStream &strm, const VCCLCompilerTool &tool ) | |||
420 | strm << TPair( _OmitFramePointers, tool.OmitFramePointers ); | 406 | strm << TPair( _OmitFramePointers, tool.OmitFramePointers ); |
421 | strm << EPair( _Optimization, tool.Optimization ); | 407 | if ( tool.Optimization != optimizeDefault ) strm << EPair( _Optimization, tool.Optimization ); |
422 | if ( tool.OptimizeForProcessor != procOptimizeBlended ) strm << EPair( _OptimizeForProcessor, tool.OptimizeForProcessor ); | 408 | if ( tool.OptimizeForProcessor != procOptimizeBlended ) strm << EPair( _OptimizeForProcessor, tool.OptimizeForProcessor ); |
@@ -427,4 +413,4 @@ QTextStream &operator<<( QTextStream &strm, const VCCLCompilerTool &tool ) | |||
427 | strm << XPair( _PreprocessorDefinitions, tool.PreprocessorDefinitions ); | 413 | strm << XPair( _PreprocessorDefinitions, tool.PreprocessorDefinitions ); |
428 | strm << SPair( _ProgramDataBaseFileName, tool.ProgramDataBaseFileName ); | 414 | if ( !tool.ProgramDataBaseFileName.isNull() ) strm << _ProgramDataBaseFileName << tool.ProgramDataBaseFileName.latin1() << "\""; |
429 | strm << EPair( _RuntimeLibrary, tool.RuntimeLibrary ); | 415 | if ( tool.RuntimeLibrary != rtUnknown ) strm << EPair( _RuntimeLibrary, tool.RuntimeLibrary ); |
430 | strm << TPair( _RuntimeTypeInfo, tool.RuntimeTypeInfo ); | 416 | strm << TPair( _RuntimeTypeInfo, tool.RuntimeTypeInfo ); |
@@ -443,3 +429,3 @@ QTextStream &operator<<( QTextStream &strm, const VCCLCompilerTool &tool ) | |||
443 | strm << TPair( _WarnAsError, tool.WarnAsError ); | 429 | strm << TPair( _WarnAsError, tool.WarnAsError ); |
444 | strm << EPair( _WarningLevel, tool.WarningLevel ); | 430 | if ( tool.WarningLevel != warningLevelUnknown ) strm << EPair( _WarningLevel, tool.WarningLevel ); |
445 | strm << TPair( _WholeProgramOptimization, tool.WholeProgramOptimization ); | 431 | strm << TPair( _WholeProgramOptimization, tool.WholeProgramOptimization ); |
@@ -476,3 +462,3 @@ bool VCCLCompilerTool::parseOption( const char* option ) | |||
476 | } | 462 | } |
477 | AdditionalUsingDirectories += option+2; | 463 | AdditionalUsingDirectories += option+3; |
478 | break; | 464 | break; |
@@ -482,3 +468,3 @@ bool VCCLCompilerTool::parseOption( const char* option ) | |||
482 | case 'D': | 468 | case 'D': |
483 | PreprocessorDefinitions += option+1; | 469 | PreprocessorDefinitions += option+2; |
484 | break; | 470 | break; |
@@ -486,3 +472,5 @@ bool VCCLCompilerTool::parseOption( const char* option ) | |||
486 | if ( second == 'H' ) { | 472 | if ( second == 'H' ) { |
487 | if ( third == 'a' || third == 'c' || third == 's' ) { | 473 | if ( third == 'a' |
474 | || (third == 'c' && fourth != 's') | ||
475 | || (third == 's' && fourth != 'c') ) { | ||
488 | // ExceptionHandling must be false, or it will override | 476 | // ExceptionHandling must be false, or it will override |
@@ -492,2 +480,7 @@ bool VCCLCompilerTool::parseOption( const char* option ) | |||
492 | break; | 480 | break; |
481 | } else if ( (third == 'c' && fourth == 's') | ||
482 | || (third == 's' && fourth == 'c') ) { | ||
483 | ExceptionHandling = _True; | ||
484 | AdditionalOptions += option; | ||
485 | break; | ||
493 | } | 486 | } |
@@ -593,2 +586,5 @@ bool VCCLCompilerTool::parseOption( const char* option ) | |||
593 | case 'X': | 586 | case 'X': |
587 | // ExceptionHandling == true will override with | ||
588 | // an /EHsc option, which is correct with /GX | ||
589 | ExceptionHandling = _True; // Fall-through | ||
594 | case 'Z': | 590 | case 'Z': |
@@ -956,6 +952,6 @@ VCLinkerTool::VCLinkerTool() | |||
956 | IgnoreEmbeddedIDL( unset ), | 952 | IgnoreEmbeddedIDL( unset ), |
957 | IgnoreImportLibrary( unset ), | 953 | IgnoreImportLibrary( _True ), |
958 | LargeAddressAware( addrAwareDefault ), | 954 | LargeAddressAware( addrAwareDefault ), |
959 | LinkDLL( unset ), | 955 | LinkDLL( unset ), |
960 | LinkIncremental( linkIncrementalYes ), | 956 | LinkIncremental( linkIncrementalDefault ), |
961 | LinkTimeCodeGeneration( unset ), | 957 | LinkTimeCodeGeneration( unset ), |
@@ -1021,3 +1017,3 @@ QTextStream &operator<<( QTextStream &strm, const VCLinkerTool &tool ) | |||
1021 | strm << SPair( _OutputFile, tool.OutputFile ); | 1017 | strm << SPair( _OutputFile, tool.OutputFile ); |
1022 | strm << SPair( _ProgramDatabaseFile, tool.ProgramDatabaseFile ); | 1018 | strm << _ProgramDatabaseFile << tool.ProgramDatabaseFile << "\""; |
1023 | strm << TPair( _RegisterOutput, tool.RegisterOutput ); | 1019 | strm << TPair( _RegisterOutput, tool.RegisterOutput ); |
@@ -1709,5 +1705,5 @@ QTextStream &operator<<( QTextStream &strm, const VCCustomBuildTool &tool ) | |||
1709 | strm << XPair( _AdditionalDependencies4, tool.AdditionalDependencies, ";" ); | 1705 | strm << XPair( _AdditionalDependencies4, tool.AdditionalDependencies, ";" ); |
1710 | strm << SPair( _CommandLine4, tool.CommandLine ); | 1706 | strm << XPair( _CommandLine4, tool.CommandLine, "\n" ); |
1711 | strm << SPair( _Description4, tool.Description ); | 1707 | strm << SPair( _Description4, tool.Description ); |
1712 | strm << SPair( _Outputs4, tool.Outputs ); | 1708 | strm << XPair( _Outputs4, tool.Outputs, ";" ); |
1713 | strm << SPair( _ToolPath, tool.ToolPath ); | 1709 | strm << SPair( _ToolPath, tool.ToolPath ); |
@@ -1828,39 +1824,35 @@ VCFilter::VCFilter() | |||
1828 | { | 1824 | { |
1825 | useCustomBuildTool = FALSE; | ||
1826 | useCompilerTool = FALSE; | ||
1829 | } | 1827 | } |
1830 | 1828 | ||
1831 | void VCFilter::generateMOC( QTextStream &strm, QString str ) const | 1829 | void VCFilter::addMOCstage( QTextStream &strm, QString filename ) |
1832 | { | 1830 | { |
1833 | QString mocOutput = Project->findMocDestination( str ); | 1831 | QString mocOutput = Project->findMocDestination( filename ); |
1834 | QString mocApp = Project->var( "QMAKE_MOC" ); | 1832 | QString mocApp = Project->var( "QMAKE_MOC" ); |
1835 | 1833 | ||
1836 | if( mocOutput.isEmpty() ) { | 1834 | if( mocOutput.isEmpty() && filename.endsWith(".moc") ) { |
1837 | // In specialcases we DO moc .cpp files | 1835 | // In specialcases we DO moc .cpp files |
1838 | // when the result is an .moc file | 1836 | // when the result is an .moc file |
1839 | if ( !str.endsWith(".moc") ) | 1837 | mocOutput = filename; |
1840 | return; | 1838 | filename = Project->findMocSource( mocOutput ); |
1841 | mocOutput = str; | ||
1842 | str = Project->findMocSource( mocOutput ); | ||
1843 | } | 1839 | } |
1844 | 1840 | ||
1845 | strm << _begFileConfiguration; | 1841 | if (mocOutput.isEmpty()) |
1846 | strm << _Name5; | 1842 | return; |
1847 | strm << Config->Name; | 1843 | |
1848 | strm << "\">"; | 1844 | CustomBuildTool = VCCustomBuildTool(); |
1849 | strm << _begTool5; | 1845 | useCustomBuildTool = TRUE; |
1850 | strm << _VCCustomBuildTool; | 1846 | CustomBuildTool.Description = "Moc'ing " + filename + "..."; |
1851 | strm << _Description6; | 1847 | CustomBuildTool.CommandLine += (mocApp + " " |
1852 | strm << "Moc'ing " << str << "...\""; | 1848 | + filename + " -o " + mocOutput); |
1853 | strm << _CommandLine6; | 1849 | CustomBuildTool.AdditionalDependencies = mocApp; |
1854 | strm << mocApp; | 1850 | CustomBuildTool.Outputs += mocOutput; |
1855 | strm << " " << str << " -o " << mocOutput << "\""; | ||
1856 | strm << _AdditionalDependencies6; | ||
1857 | strm << mocApp << "\""; | ||
1858 | strm << _Outputs6; | ||
1859 | strm << mocOutput << "\""; | ||
1860 | strm << "/>"; | ||
1861 | strm << _endFileConfiguration; | ||
1862 | } | 1851 | } |
1863 | 1852 | ||
1864 | void VCFilter::generateUIC( QTextStream &strm, const QString& str ) const | 1853 | void VCFilter::addUICstage( QTextStream &strm, QString str ) |
1865 | { | 1854 | { |
1855 | CustomBuildTool = VCCustomBuildTool(); | ||
1856 | useCustomBuildTool = TRUE; | ||
1857 | |||
1866 | QString uicApp = Project->var("QMAKE_UIC"); | 1858 | QString uicApp = Project->var("QMAKE_UIC"); |
@@ -1897,23 +1889,99 @@ void VCFilter::generateUIC( QTextStream &strm, const QString& str ) const | |||
1897 | 1889 | ||
1898 | strm << _begFileConfiguration; | 1890 | if ( mocDir.isEmpty() ) |
1899 | strm << _Name5; | 1891 | mocDir = pname; |
1900 | strm << Config->Name; | 1892 | |
1901 | strm << "\">"; | 1893 | CustomBuildTool.Description = ("Uic'ing " + str + "...\""); |
1902 | strm << _begTool5; | 1894 | CustomBuildTool.CommandLine += // Create .h from .ui file |
1903 | strm << _VCCustomBuildTool; | 1895 | uicApp + " " + str + " -o " + uiHeaders + fname + ".h"; |
1904 | strm << _Description6; | 1896 | CustomBuildTool.CommandLine += // Create .cpp from .ui file |
1905 | strm << "Uic'ing " << str << "...\""; | 1897 | uicApp + " " + str + " -i " + fname + ".h -o " + uiSources + fname + ".cpp"; |
1906 | strm << _CommandLine6; | 1898 | CustomBuildTool.CommandLine += // Moc the headerfile |
1907 | strm << uicApp << " " << str << " -o " << uiHeaders << fname << ".h && "; // Create .h from .ui file | 1899 | mocApp + " " + uiHeaders + fname + ".h -o " + mocDir + Option::h_moc_mod + fname + Option::h_moc_ext; |
1908 | strm << uicApp << " " << str << " -i " << fname << ".h -o " << uiSources << fname << ".cpp && ";// Create .cpp from .ui file | 1900 | |
1909 | strm << mocApp << " " << uiHeaders << fname << ".h -o " << mocDir << "moc_" << fname << ".cpp\""; | 1901 | CustomBuildTool.AdditionalDependencies += mocApp; |
1910 | strm << _AdditionalDependencies6; | 1902 | CustomBuildTool.AdditionalDependencies += uicApp; |
1911 | strm << mocApp << ";" << uicApp << "\""; | 1903 | CustomBuildTool.Outputs += |
1912 | strm << _Outputs6; | 1904 | uiHeaders + fname + ".h;" + uiSources + fname + ".cpp;" + mocDir + Option::h_moc_mod + fname + Option::h_moc_ext; |
1913 | strm << uiHeaders << fname << ".h;" << uiSources << fname << ".cpp;" << mocDir << "moc_" << fname << ".cpp\""; | ||
1914 | strm << "/>"; | ||
1915 | strm << _endFileConfiguration; | ||
1916 | } | 1905 | } |
1917 | 1906 | ||
1918 | QTextStream &operator<<( QTextStream &strm, const VCFilter &tool ) | 1907 | void VCFilter::modifyPCHstage( QTextStream &strm, QString str ) |
1908 | { | ||
1909 | bool isCFile = str.endsWith(".c"); | ||
1910 | bool isHFile = (str.endsWith(".h") && str == Project->precompH); | ||
1911 | |||
1912 | if (!isCFile && !isHFile) | ||
1913 | return; | ||
1914 | |||
1915 | CompilerTool = VCCLCompilerTool(); | ||
1916 | useCompilerTool = TRUE; | ||
1917 | |||
1918 | // Unset some default options | ||
1919 | CompilerTool.BufferSecurityCheck = unset; | ||
1920 | CompilerTool.DebugInformationFormat = debugUnknown; | ||
1921 | CompilerTool.ExceptionHandling = unset; | ||
1922 | CompilerTool.GeneratePreprocessedFile = preprocessUnknown; | ||
1923 | CompilerTool.Optimization = optimizeDefault; | ||
1924 | CompilerTool.ProgramDataBaseFileName = QString::null; | ||
1925 | CompilerTool.RuntimeLibrary = rtUnknown; | ||
1926 | CompilerTool.WarningLevel = warningLevelUnknown; | ||
1927 | |||
1928 | // Setup PCH options | ||
1929 | CompilerTool.UsePrecompiledHeader = (isCFile ? pchNone : pchCreateUsingSpecific); | ||
1930 | CompilerTool.PrecompiledHeaderThrough = "$(NOINHERIT)"; | ||
1931 | CompilerTool.ForcedIncludeFiles = "$(NOINHERIT)"; | ||
1932 | } | ||
1933 | |||
1934 | bool VCFilter::addIMGstage( QTextStream &strm, QString str ) | ||
1935 | { | ||
1936 | bool isCorH = FALSE; | ||
1937 | if (str.endsWith(".c") || str.endsWith(".rc")) | ||
1938 | isCorH = TRUE; | ||
1939 | QStringList::Iterator it; | ||
1940 | for(it = Option::cpp_ext.begin(); it != Option::cpp_ext.end(); ++it) | ||
1941 | if(str.endsWith(*it)) | ||
1942 | isCorH = TRUE; | ||
1943 | for(it = Option::h_ext.begin(); it != Option::h_ext.end(); ++it) | ||
1944 | if(str.endsWith(*it)) | ||
1945 | isCorH = TRUE; | ||
1946 | |||
1947 | QString collectionName = Project->project->first("QMAKE_IMAGE_COLLECTION"); | ||
1948 | if (str.isEmpty() || isCorH || collectionName.isEmpty()) | ||
1949 | return FALSE; | ||
1950 | |||
1951 | CustomBuildTool = VCCustomBuildTool(); | ||
1952 | useCustomBuildTool = TRUE; | ||
1953 | |||
1954 | // Some projects (like designer core) may have too many images to | ||
1955 | // call uic directly. Therefor we have to create a temporary | ||
1956 | // file, with the image list, and call uic with the -f option. | ||
1957 | QString tmpFileCmd = "echo "; | ||
1958 | QString tmpImageFilename = ".imgcol"; | ||
1959 | QStringList& list = Project->project->variables()["IMAGES"]; | ||
1960 | bool firstOutput = TRUE; | ||
1961 | it = list.begin(); | ||
1962 | while( it!=list.end() ) { | ||
1963 | tmpFileCmd += (*it) + " "; | ||
1964 | ++it; | ||
1965 | if (tmpFileCmd.length()>250 || it==list.end()) { | ||
1966 | CustomBuildTool.CommandLine += tmpFileCmd | ||
1967 | + (firstOutput?"> ":">> ") | ||
1968 | + tmpImageFilename; | ||
1969 | tmpFileCmd = "echo "; | ||
1970 | firstOutput = FALSE; | ||
1971 | } | ||
1972 | } | ||
1973 | |||
1974 | QString uicApp = Project->var("QMAKE_UIC"); | ||
1975 | CustomBuildTool.Description = ("Generate imagecollection"); | ||
1976 | CustomBuildTool.CommandLine += | ||
1977 | uicApp + " -embed " + Project->project->first("QMAKE_ORIG_TARGET") | ||
1978 | + " -f .imgcol -o " + collectionName; | ||
1979 | CustomBuildTool.AdditionalDependencies += uicApp; | ||
1980 | CustomBuildTool.AdditionalDependencies += list; | ||
1981 | CustomBuildTool.Outputs = collectionName; | ||
1982 | CustomBuildTool.Outputs += tmpImageFilename; | ||
1983 | return TRUE; | ||
1984 | } | ||
1985 | |||
1986 | QTextStream &operator<<( QTextStream &strm, VCFilter &tool ) | ||
1919 | { | 1987 | { |
@@ -1927,3 +1995,49 @@ QTextStream &operator<<( QTextStream &strm, const VCFilter &tool ) | |||
1927 | strm << ">"; | 1995 | strm << ">"; |
1996 | |||
1997 | bool resourceBuild = FALSE; | ||
1998 | int currentLevels = 0; | ||
1999 | QStringList currentDirs; | ||
1928 | for ( QStringList::ConstIterator it = tool.Files.begin(); it != tool.Files.end(); ++it ) { | 2000 | for ( QStringList::ConstIterator it = tool.Files.begin(); it != tool.Files.end(); ++it ) { |
2001 | if ( !tool.flat_files ) { | ||
2002 | QStringList newDirs = QStringList::split('\\',(*it)); | ||
2003 | newDirs.pop_back(); // Skip the filename | ||
2004 | |||
2005 | int newLevels = int(newDirs.count()); | ||
2006 | int equalLevels = 0; | ||
2007 | for (int i = 0; i<currentLevels; i++, equalLevels++ ) | ||
2008 | if (currentDirs[i] != newDirs[i]) | ||
2009 | break; | ||
2010 | int closeFilters = currentLevels - equalLevels; | ||
2011 | int openFilters = newLevels - equalLevels; | ||
2012 | |||
2013 | // close previous non-equal filter | ||
2014 | while ( closeFilters-- ) | ||
2015 | strm << _endFilter; | ||
2016 | |||
2017 | // open new non-equal filters | ||
2018 | newLevels = 0; | ||
2019 | while ( openFilters-- ) { | ||
2020 | strm << _begFilter; | ||
2021 | strm << SPair( _Name3, newDirs[equalLevels + newLevels] ); | ||
2022 | strm << _Filter << "\">"; // Blank filter | ||
2023 | ++newLevels; | ||
2024 | } | ||
2025 | currentDirs = newDirs; | ||
2026 | currentLevels = int(newDirs.count()); | ||
2027 | } | ||
2028 | |||
2029 | tool.useCustomBuildTool = FALSE; | ||
2030 | tool.useCompilerTool = FALSE; | ||
2031 | // Add UIC, MOC and PCH stages to file | ||
2032 | if ( tool.CustomBuild == moc ) | ||
2033 | tool.addMOCstage( strm, *it ); | ||
2034 | else if ( tool.CustomBuild == uic ) | ||
2035 | tool.addUICstage( strm, *it ); | ||
2036 | else if ( tool.CustomBuild == resource ) { | ||
2037 | if (!resourceBuild) | ||
2038 | resourceBuild = tool.addIMGstage(strm, *it); | ||
2039 | } | ||
2040 | if (tool.Project->usePCH) | ||
2041 | tool.modifyPCHstage( strm, *it ); | ||
2042 | |||
1929 | strm << _begFile; | 2043 | strm << _begFile; |
@@ -1931,9 +2045,23 @@ QTextStream &operator<<( QTextStream &strm, const VCFilter &tool ) | |||
1931 | strm << ">"; | 2045 | strm << ">"; |
1932 | if ( tool.CustomBuild == moc ) | 2046 | // Output custom build and compiler options |
1933 | tool.generateMOC( strm, *it ); | 2047 | // for all configurations |
1934 | else if ( tool.CustomBuild == uic ) | 2048 | if (tool.useCustomBuildTool || tool.useCompilerTool) { |
1935 | tool.generateUIC( strm, *it ); | 2049 | for ( uint i = 0; i < tool.Config->count(); i++ ) { |
2050 | strm << _begFileConfiguration; | ||
2051 | strm << _Name5; | ||
2052 | strm << (*tool.Config)[i].Name; | ||
2053 | strm << "\">"; | ||
2054 | if (tool.useCustomBuildTool) | ||
2055 | strm << tool.CustomBuildTool; | ||
2056 | if (tool.useCompilerTool) | ||
2057 | strm << tool.CompilerTool; | ||
2058 | strm << _endFileConfiguration; | ||
2059 | } | ||
2060 | } | ||
1936 | strm << _endFile; | 2061 | strm << _endFile; |
1937 | } | 2062 | } |
1938 | 2063 | // close remaining open filters, in non-flat mode | |
2064 | while ( !tool.flat_files && currentLevels-- ) { | ||
2065 | strm << _endFilter; | ||
2066 | } | ||
1939 | strm << _endFilter; | 2067 | strm << _endFilter; |
@@ -1945,13 +2073,5 @@ VCProject::VCProject() | |||
1945 | { | 2073 | { |
1946 | #if defined(Q_WS_WIN32) | 2074 | VCConfiguration conf; |
1947 | GUID guid; | 2075 | Configuration += conf ; // Release |
1948 | QUuid uniqueId; | 2076 | //Configuration += conf ; // Debug added later, after Release init |
1949 | HRESULT h = CoCreateGuid( &guid ); | ||
1950 | if ( h == S_OK ) | ||
1951 | uniqueId = QUuid( guid ); | ||
1952 | ProjectGUID = uniqueId.toString(); | ||
1953 | #else | ||
1954 | // Qt doesn't support GUID on other platforms yet | ||
1955 | ProjectGUID = ""; | ||
1956 | #endif | ||
1957 | } | 2077 | } |
@@ -1975,13 +2095,14 @@ QTextStream &operator<<( QTextStream &strm, const VCProject &tool ) | |||
1975 | strm << _begConfigurations; | 2095 | strm << _begConfigurations; |
1976 | strm << tool.Configuration; | 2096 | for ( uint i = 0; i < tool.Configuration.count(); i++ ) |
2097 | strm << tool.Configuration[i]; | ||
1977 | strm << _endConfigurations; | 2098 | strm << _endConfigurations; |
1978 | strm << _begFiles; | 2099 | strm << _begFiles; |
1979 | strm << tool.SourceFiles; | 2100 | strm << (VCFilter&)tool.SourceFiles; |
1980 | strm << tool.HeaderFiles; | 2101 | strm << (VCFilter&)tool.HeaderFiles; |
1981 | strm << tool.MOCFiles; | 2102 | strm << (VCFilter&)tool.MOCFiles; |
1982 | strm << tool.UICFiles; | 2103 | strm << (VCFilter&)tool.UICFiles; |
1983 | strm << tool.FormFiles; | 2104 | strm << (VCFilter&)tool.FormFiles; |
1984 | strm << tool.TranslationFiles; | 2105 | strm << (VCFilter&)tool.TranslationFiles; |
1985 | strm << tool.LexYaccFiles; | 2106 | strm << (VCFilter&)tool.LexYaccFiles; |
1986 | strm << tool.ResourceFiles; | 2107 | strm << (VCFilter&)tool.ResourceFiles; |
1987 | strm << _endFiles; | 2108 | strm << _endFiles; |
diff --git a/qmake/generators/win32/msvc_objectmodel.h b/qmake/generators/win32/msvc_objectmodel.h index 1dca68d..9ce38d2 100644 --- a/qmake/generators/win32/msvc_objectmodel.h +++ b/qmake/generators/win32/msvc_objectmodel.h | |||
@@ -1,9 +1,9 @@ | |||
1 | /**************************************************************************** | 1 | /**************************************************************************** |
2 | ** $Id$ | 2 | ** |
3 | ** | 3 | ** |
4 | ** Definition of ________ class. | 4 | ** Definition of VCProject class. |
5 | ** | 5 | ** |
6 | ** Copyright (C) 2002 Trolltech AS. All rights reserved. | 6 | ** Copyright (C) 2002-2003 Trolltech AS. All rights reserved. |
7 | ** | 7 | ** |
8 | ** This file is part of the network module of the Qt GUI Toolkit. | 8 | ** This file is part of qmake. |
9 | ** | 9 | ** |
@@ -34,2 +34,3 @@ | |||
34 | **********************************************************************/ | 34 | **********************************************************************/ |
35 | |||
35 | #ifndef __MSVC_OBJECTMODEL_H__ | 36 | #ifndef __MSVC_OBJECTMODEL_H__ |
@@ -58,3 +59,4 @@ enum customBuildCheck { | |||
58 | uic, | 59 | uic, |
59 | lexyacc | 60 | lexyacc, |
61 | resource | ||
60 | }; | 62 | }; |
@@ -116,2 +118,3 @@ enum ConfigurationTypes { | |||
116 | enum debugOption { | 118 | enum debugOption { |
119 | debugUnknown = -1, | ||
117 | debugDisabled, | 120 | debugDisabled, |
@@ -242,3 +245,4 @@ enum inlineExpansionOption { | |||
242 | expandOnlyInline, | 245 | expandOnlyInline, |
243 | expandAnySuitable | 246 | expandAnySuitable, |
247 | expandDefault // Not useful number, but stops the output | ||
244 | }; | 248 | }; |
@@ -298,3 +302,4 @@ enum optimizeOption { | |||
298 | optimizeFull, | 302 | optimizeFull, |
299 | optimizeCustom | 303 | optimizeCustom, |
304 | optimizeDefault // Not useful number, but stops the output | ||
300 | }; | 305 | }; |
@@ -317,2 +322,3 @@ enum pchOption { | |||
317 | enum preprocessOption { | 322 | enum preprocessOption { |
323 | preprocessUnknown = -1, | ||
318 | preprocessNo, | 324 | preprocessNo, |
@@ -332,2 +338,3 @@ enum RemoteDebuggerType { | |||
332 | enum runtimeLibraryOption { | 338 | enum runtimeLibraryOption { |
339 | rtUnknown = -1, | ||
333 | rtMultiThreaded, | 340 | rtMultiThreaded, |
@@ -381,2 +388,3 @@ enum useOfMfc { | |||
381 | enum warningLevelOption { | 388 | enum warningLevelOption { |
389 | warningLevelUnknown = -1, | ||
382 | warningLevel_0, | 390 | warningLevel_0, |
@@ -613,5 +621,5 @@ public: | |||
613 | QStringList AdditionalDependencies; | 621 | QStringList AdditionalDependencies; |
614 | QString CommandLine; | 622 | QStringList CommandLine; |
615 | QString Description; | 623 | QString Description; |
616 | QString Outputs; | 624 | QStringList Outputs; |
617 | QString ToolName; | 625 | QString ToolName; |
@@ -721,4 +729,6 @@ public: | |||
721 | ~VCFilter(){} | 729 | ~VCFilter(){} |
722 | void generateMOC( QTextStream &strm, QString str ) const; | 730 | void addMOCstage( QTextStream &strm, QString str ); |
723 | void generateUIC( QTextStream &strm, const QString& str ) const; | 731 | void addUICstage( QTextStream &strm, QString str ); |
732 | bool addIMGstage( QTextStream &strm, QString str ); | ||
733 | void modifyPCHstage( QTextStream &strm, QString str ); | ||
724 | 734 | ||
@@ -730,4 +740,9 @@ public: | |||
730 | VcprojGenerator*Project; | 740 | VcprojGenerator*Project; |
731 | VCConfiguration*Config; | 741 | QValueList<VCConfiguration> *Config; |
732 | customBuildCheckCustomBuild; | 742 | customBuildCheckCustomBuild; |
743 | bool useCustomBuildTool; | ||
744 | VCCustomBuildTool CustomBuildTool; | ||
745 | bool useCompilerTool; | ||
746 | VCCLCompilerTool CompilerTool; | ||
747 | bool flat_files; | ||
733 | }; | 748 | }; |
@@ -750,3 +765,3 @@ public: | |||
750 | // XML sub-parts | 765 | // XML sub-parts |
751 | VCConfigurationConfiguration; | 766 | QValueList<VCConfiguration> Configuration; |
752 | VCFilter SourceFiles; | 767 | VCFilter SourceFiles; |
@@ -769,3 +784,3 @@ QTextStream &operator<<( QTextStream &, const VCEventTool & ); | |||
769 | QTextStream &operator<<( QTextStream &, const VCConfiguration & ); | 784 | QTextStream &operator<<( QTextStream &, const VCConfiguration & ); |
770 | QTextStream &operator<<( QTextStream &, const VCFilter & ); | 785 | QTextStream &operator<<( QTextStream &, VCFilter & ); |
771 | QTextStream &operator<<( QTextStream &, const VCProject & ); | 786 | QTextStream &operator<<( QTextStream &, const VCProject & ); |
diff --git a/qmake/generators/win32/msvc_vcproj.cpp b/qmake/generators/win32/msvc_vcproj.cpp index d2cbc31..aa8fe16 100644 --- a/qmake/generators/win32/msvc_vcproj.cpp +++ b/qmake/generators/win32/msvc_vcproj.cpp | |||
@@ -1,11 +1,9 @@ | |||
1 | /**************************************************************************** | 1 | /**************************************************************************** |
2 | ** $Id$ | 2 | ** |
3 | ** | 3 | ** |
4 | ** Definition of VcprojGenerator class. | 4 | ** Implementation of VcprojGenerator class. |
5 | ** | 5 | ** |
6 | ** Created : 970521 | 6 | ** Copyright (C) 1992-2003 Trolltech AS. All rights reserved. |
7 | ** | 7 | ** |
8 | ** Copyright (C) 1992-2002 Trolltech AS. All rights reserved. | 8 | ** This file is part of qmake. |
9 | ** | ||
10 | ** This file is part of the network module of the Qt GUI Toolkit. | ||
11 | ** | 9 | ** |
@@ -39,2 +37,3 @@ | |||
39 | #include "option.h" | 37 | #include "option.h" |
38 | #include "qtmd5.h" // SG's MD5 addon | ||
40 | #include <qdir.h> | 39 | #include <qdir.h> |
@@ -44,19 +43,58 @@ | |||
44 | #include <stdlib.h> | 43 | #include <stdlib.h> |
44 | #include <qsettings.h> | ||
45 | |||
46 | //#define DEBUG_SOLUTION_GEN | ||
47 | //#define DEBUG_PROJECT_GEN | ||
48 | |||
49 | // Registry keys for .NET version detection ------------------------- | ||
50 | const char* _regNet2002 = "Microsoft\\VisualStudio\\7.0\\Setup\\VC\\ProductDir"; | ||
51 | const char* _regNet2003 = "Microsoft\\VisualStudio\\7.1\\Setup\\VC\\ProductDir"; | ||
45 | 52 | ||
46 | #if defined(Q_OS_WIN32) | 53 | bool use_net2003_version() |
47 | #include <objbase.h> | ||
48 | #ifndef GUID_DEFINED | ||
49 | #define GUID_DEFINED | ||
50 | typedef struct _GUID | ||
51 | { | 54 | { |
52 | ulong Data1; | 55 | #ifndef Q_OS_WIN32 |
53 | ushort Data2; | 56 | return FALSE; // Always generate 7.0 versions on other platforms |
54 | ushort Data3; | 57 | #else |
55 | uchar Data4[8]; | 58 | // Only search for the version once |
56 | } GUID; | 59 | static int current_version = -1; |
57 | #endif | 60 | if (current_version!=-1) |
61 | return (current_version==71); | ||
62 | |||
63 | // Fallback to .NET 2002 | ||
64 | current_version = 70; | ||
65 | |||
66 | // Get registry entries for both versions | ||
67 | bool ok = false; | ||
68 | QSettings setting; | ||
69 | QString path2002 = setting.readEntry(_regNet2002); | ||
70 | QString path2003 = setting.readEntry(_regNet2003); | ||
71 | |||
72 | if ( path2002.isNull() || path2003.isNull() ) { | ||
73 | // Only have one MSVC, so use that one | ||
74 | current_version = (path2003.isNull() ? 70 : 71); | ||
75 | } else { | ||
76 | // Have both, so figure out the current | ||
77 | QString paths = getenv("PATH"); | ||
78 | QStringList pathlist = QStringList::split(";", paths.lower()); | ||
79 | |||
80 | path2003 = path2003.lower(); | ||
81 | QStringList::iterator it; | ||
82 | for(it=pathlist.begin(); it!=pathlist.end(); ++it) { | ||
83 | if ((*it).contains(path2003)) { | ||
84 | current_version = 71; | ||
85 | } else if ((*it).contains(path2002) | ||
86 | && current_version == 71) { | ||
87 | fprintf( stderr, "Both .NET 2002 & .NET 2003 directories for VC found in you PATH variable!\nFallback to .NET 2002 project generation" ); | ||
88 | current_version = 70; | ||
89 | break; | ||
90 | } | ||
91 | } | ||
92 | } | ||
93 | return (current_version==71); | ||
58 | #endif | 94 | #endif |
95 | }; | ||
59 | 96 | ||
60 | // Flatfile Tags ---------------------------------------------------- | 97 | // Flatfile Tags ---------------------------------------------------- |
61 | const char* _snlHeader = "Microsoft Visual Studio Solution File, Format Version 7.00"; | 98 | const char* _slnHeader70= "Microsoft Visual Studio Solution File, Format Version 7.00"; |
99 | const char* _slnHeader71= "Microsoft Visual Studio Solution File, Format Version 8.00"; | ||
62 | // The following UUID _may_ change for later servicepacks... | 100 | // The following UUID _may_ change for later servicepacks... |
@@ -68,18 +106,21 @@ const char* _snlHeader = "Microsoft Visual Studio Solution File, Format Version | |||
68 | // platforms are actually usable. | 106 | // platforms are actually usable. |
69 | const char* _snlMSVCvcprojGUID = "{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}"; | 107 | const char* _slnMSVCvcprojGUID = "{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}"; |
70 | const char* _snlProjectBeg= "\nProject(\""; | 108 | const char* _slnProjectBeg= "\nProject(\""; |
71 | const char* _snlProjectMid= "\") = "; | 109 | const char* _slnProjectMid= "\") = "; |
72 | const char* _snlProjectEnd= "\nEndProject"; | 110 | const char* _slnProjectEnd= "\nEndProject"; |
73 | const char* _snlGlobalBeg= "\nGlobal"; | 111 | const char* _slnGlobalBeg= "\nGlobal"; |
74 | const char* _snlGlobalEnd= "\nEndGlobal"; | 112 | const char* _slnGlobalEnd= "\nEndGlobal"; |
75 | const char* _snlSolutionConf= "\n\tGlobalSection(SolutionConfiguration) = preSolution" | 113 | const char* _slnSolutionConf= "\n\tGlobalSection(SolutionConfiguration) = preSolution" |
76 | "\n\t\tConfigName.0 = Release" | 114 | "\n\t\tConfigName.0 = Debug" |
115 | "\n\t\tConfigName.1 = Release" | ||
77 | "\n\tEndGlobalSection"; | 116 | "\n\tEndGlobalSection"; |
78 | const char* _snlProjDepBeg= "\n\tGlobalSection(ProjectDependencies) = postSolution"; | 117 | const char* _slnProjDepBeg= "\n\tGlobalSection(ProjectDependencies) = postSolution"; |
79 | const char* _snlProjDepEnd= "\n\tEndGlobalSection"; | 118 | const char* _slnProjDepEnd= "\n\tEndGlobalSection"; |
80 | const char* _snlProjConfBeg= "\n\tGlobalSection(ProjectConfiguration) = postSolution"; | 119 | const char* _slnProjConfBeg= "\n\tGlobalSection(ProjectConfiguration) = postSolution"; |
81 | const char* _snlProjConfTag1= ".Release.ActiveCfg = Release|Win32"; | 120 | const char* _slnProjRelConfTag1= ".Release.ActiveCfg = Release|Win32"; |
82 | const char* _snlProjConfTag2= ".Release.Build.0 = Release|Win32"; | 121 | const char* _slnProjRelConfTag2= ".Release.Build.0 = Release|Win32"; |
83 | const char* _snlProjConfEnd= "\n\tEndGlobalSection"; | 122 | const char* _slnProjDbgConfTag1= ".Debug.ActiveCfg = Debug|Win32"; |
84 | const char* _snlExtSections= "\n\tGlobalSection(ExtensibilityGlobals) = postSolution" | 123 | const char* _slnProjDbgConfTag2= ".Debug.Build.0 = Debug|Win32"; |
124 | const char* _slnProjConfEnd= "\n\tEndGlobalSection"; | ||
125 | const char* _slnExtSections= "\n\tGlobalSection(ExtensibilityGlobals) = postSolution" | ||
85 | "\n\tEndGlobalSection" | 126 | "\n\tEndGlobalSection" |
@@ -128,2 +169,3 @@ struct VcsolutionDepend { | |||
128 | ::target targetType; | 169 | ::target targetType; |
170 | bool debugBuild; | ||
129 | QStringList dependencies; | 171 | QStringList dependencies; |
@@ -131,2 +173,31 @@ struct VcsolutionDepend { | |||
131 | 173 | ||
174 | QUuid VcprojGenerator::getProjectUUID(const QString &filename) | ||
175 | { | ||
176 | bool validUUID = true; | ||
177 | |||
178 | // Read GUID from variable-space | ||
179 | QUuid uuid = project->first("GUID"); | ||
180 | |||
181 | // If none, create one based on the MD5 of absolute project path | ||
182 | if (uuid.isNull() || !filename.isNull()) { | ||
183 | QString abspath = filename.isNull()?project->first("QMAKE_MAKEFILE"):filename; | ||
184 | qtMD5(abspath.utf8(), (unsigned char*)(&uuid)); | ||
185 | validUUID = !uuid.isNull(); | ||
186 | uuid.data4[0] = (uuid.data4[0] & 0x3F) | 0x80; // UV_DCE variant | ||
187 | uuid.data3 = (uuid.data3 & 0x0FFF) | (QUuid::Name<<12); | ||
188 | } | ||
189 | |||
190 | // If still not valid, generate new one, and suggest adding to .pro | ||
191 | if (uuid.isNull() || !validUUID) { | ||
192 | uuid = QUuid::createUuid(); | ||
193 | fprintf(stderr, | ||
194 | "qmake couldn't create a GUID based on filepath, and we couldn't\nfind a valid GUID in the .pro file (Consider adding\n'GUID = %s' to the .pro file)\n", | ||
195 | uuid.toString().upper().latin1()); | ||
196 | } | ||
197 | |||
198 | // Store GUID in variable-space | ||
199 | project->values("GUID") = uuid.toString().upper(); | ||
200 | return uuid; | ||
201 | } | ||
202 | |||
132 | QUuid VcprojGenerator::increaseUUID( const QUuid &id ) | 203 | QUuid VcprojGenerator::increaseUUID( const QUuid &id ) |
@@ -165,20 +236,13 @@ void VcprojGenerator::writeSubDirs(QTextStream &t) | |||
165 | 236 | ||
166 | t << _snlHeader; | 237 | t << (use_net2003_version() ? _slnHeader71 : _slnHeader70); |
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 | 238 | ||
179 | QDict<VcsolutionDepend> solution_depends; | 239 | QDict<VcsolutionDepend> solution_depends; |
240 | |||
180 | QPtrList<VcsolutionDepend> solution_cleanup; | 241 | QPtrList<VcsolutionDepend> solution_cleanup; |
181 | solution_cleanup.setAutoDelete(TRUE); | 242 | solution_cleanup.setAutoDelete(TRUE); |
243 | |||
244 | |||
182 | QStringList subdirs = project->variables()["SUBDIRS"]; | 245 | QStringList subdirs = project->variables()["SUBDIRS"]; |
183 | QString oldpwd = QDir::currentDirPath(); | 246 | QString oldpwd = QDir::currentDirPath(); |
247 | |||
184 | for(QStringList::Iterator it = subdirs.begin(); it != subdirs.end(); ++it) { | 248 | for(QStringList::Iterator it = subdirs.begin(); it != subdirs.end(); ++it) { |
@@ -201,4 +265,3 @@ void VcprojGenerator::writeSubDirs(QTextStream &t) | |||
201 | if(tmp_proj.first("TEMPLATE") == "vcsubdirs") { | 265 | if(tmp_proj.first("TEMPLATE") == "vcsubdirs") { |
202 | QStringList tmp_subdirs = fileFixify(tmp_proj.variables()["SUBDIRS"]); | 266 | subdirs += fileFixify(tmp_proj.variables()["SUBDIRS"]); |
203 | subdirs += tmp_subdirs; | ||
204 | } else if(tmp_proj.first("TEMPLATE") == "vcapp" || tmp_proj.first("TEMPLATE") == "vclib") { | 267 | } else if(tmp_proj.first("TEMPLATE") == "vcapp" || tmp_proj.first("TEMPLATE") == "vclib") { |
@@ -225,3 +288,3 @@ void VcprojGenerator::writeSubDirs(QTextStream &t) | |||
225 | if(!QFile::exists(QDir::currentDirPath() + Option::dir_sep + vcproj)) { | 288 | if(!QFile::exists(QDir::currentDirPath() + Option::dir_sep + vcproj)) { |
226 | qDebug( "Ignored (not found) '%s'", QString(QDir::currentDirPath() + Option::dir_sep + vcproj).latin1() ); | 289 | warn_msg(WarnLogic, "Ignored (not found) '%s'", QString(QDir::currentDirPath() + Option::dir_sep + vcproj).latin1() ); |
227 | goto nextfile; // # Dirty! | 290 | goto nextfile; // # Dirty! |
@@ -232,24 +295,44 @@ void VcprojGenerator::writeSubDirs(QTextStream &t) | |||
232 | newDep->orig_target = tmp_proj.first("QMAKE_ORIG_TARGET"); | 295 | newDep->orig_target = tmp_proj.first("QMAKE_ORIG_TARGET"); |
233 | newDep->target = tmp_proj.first("TARGET").section(Option::dir_sep, -1); | 296 | newDep->target = tmp_proj.first("MSVCPROJ_TARGET").section(Option::dir_sep, -1); |
234 | newDep->targetType = tmp_vcproj.projectTarget; | 297 | newDep->targetType = tmp_vcproj.projectTarget; |
235 | { | 298 | newDep->debugBuild = tmp_proj.isActiveConfig("debug"); |
236 | static QUuid uuid = solutionGUID; | 299 | newDep->uuid = getProjectUUID(Option::fixPathToLocalOS(QDir::currentDirPath() + QDir::separator() + vcproj)).toString().upper(); |
237 | uuid = increaseUUID( uuid ); | 300 | |
238 | newDep->uuid = uuid.toString().upper(); | 301 | // We want to store it as the .lib name. |
239 | } | ||
240 | if(newDep->target.endsWith(".dll")) | 302 | if(newDep->target.endsWith(".dll")) |
241 | newDep->target = newDep->target.left(newDep->target.length()-3) + "lib"; | 303 | newDep->target = newDep->target.left(newDep->target.length()-3) + "lib"; |
304 | |||
305 | // All projects using Forms are dependent on uic.exe | ||
242 | if(!tmp_proj.isEmpty("FORMS")) | 306 | if(!tmp_proj.isEmpty("FORMS")) |
243 | newDep->dependencies << "uic.exe"; | 307 | newDep->dependencies << "uic.exe"; |
244 | { | 308 | |
245 | QStringList where("QMAKE_LIBS"); | 309 | // Add all unknown libs to the deps |
246 | if(!tmp_proj.isEmpty("QMAKE_INTERNAL_PRL_LIBS")) | 310 | QStringList where("QMAKE_LIBS"); |
247 | where = tmp_proj.variables()["QMAKE_INTERNAL_PRL_LIBS"]; | 311 | if(!tmp_proj.isEmpty("QMAKE_INTERNAL_PRL_LIBS")) |
248 | for(QStringList::iterator wit = where.begin(); | 312 | where = tmp_proj.variables()["QMAKE_INTERNAL_PRL_LIBS"]; |
249 | wit != where.end(); ++wit) { | 313 | for(QStringList::iterator wit = where.begin(); |
250 | QStringList &l = tmp_proj.variables()[(*wit)]; | 314 | wit != where.end(); ++wit) { |
251 | for(QStringList::Iterator it = l.begin(); it != l.end(); ++it) { | 315 | QStringList &l = tmp_proj.variables()[(*wit)]; |
252 | QString opt = (*it); | 316 | for(QStringList::Iterator it = l.begin(); it != l.end(); ++it) { |
253 | if(!opt.startsWith("/")) //Not a switch | 317 | QString opt = (*it); |
254 | newDep->dependencies << opt.section(Option::dir_sep, -1); | 318 | if(!opt.startsWith("/") && // Not a switch |
319 | opt != newDep->target && // Not self | ||
320 | opt != "opengl32.lib" && // We don't care about these libs | ||
321 | opt != "glu32.lib" && // to make depgen alittle faster | ||
322 | opt != "kernel32.lib" && | ||
323 | opt != "user32.lib" && | ||
324 | opt != "gdi32.lib" && | ||
325 | opt != "comdlg32.lib" && | ||
326 | opt != "advapi32.lib" && | ||
327 | opt != "shell32.lib" && | ||
328 | opt != "ole32.lib" && | ||
329 | opt != "oleaut32.lib" && | ||
330 | opt != "uuid.lib" && | ||
331 | opt != "imm32.lib" && | ||
332 | opt != "winmm.lib" && | ||
333 | opt != "wsock32.lib" && | ||
334 | opt != "winspool.lib" && | ||
335 | opt != "delayimp.lib" ) | ||
336 | { | ||
337 | newDep->dependencies << opt.section(Option::dir_sep, -1); | ||
255 | } | 338 | } |
@@ -257,14 +340,11 @@ void VcprojGenerator::writeSubDirs(QTextStream &t) | |||
257 | } | 340 | } |
341 | #ifdef DEBUG_SOLUTION_GEN | ||
342 | qDebug( "Deps for %20s: [%s]", newDep->target.latin1(), newDep->dependencies.join(" :: " ).latin1() ); | ||
343 | #endif | ||
258 | solution_cleanup.append(newDep); | 344 | solution_cleanup.append(newDep); |
259 | solution_depends.insert(newDep->target, newDep); | 345 | solution_depends.insert(newDep->target, newDep); |
260 | { | 346 | t << _slnProjectBeg << _slnMSVCvcprojGUID << _slnProjectMid |
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 | 347 | << "\"" << newDep->orig_target << "\", \"" << newDep->vcprojFile |
268 | << "\", \"" << newDep->uuid << "\""; | 348 | << "\", \"" << newDep->uuid << "\""; |
269 | t << _snlProjectEnd; | 349 | t << _slnProjectEnd; |
270 | } | 350 | } |
@@ -276,6 +356,10 @@ nextfile: | |||
276 | } | 356 | } |
277 | t << _snlGlobalBeg; | 357 | t << _slnGlobalBeg; |
278 | t << _snlSolutionConf; | 358 | t << _slnSolutionConf; |
279 | t << _snlProjDepBeg; | 359 | t << _slnProjDepBeg; |
360 | |||
361 | // Figure out dependencies | ||
280 | for(solution_cleanup.first(); solution_cleanup.current(); solution_cleanup.next()) { | 362 | for(solution_cleanup.first(); solution_cleanup.current(); solution_cleanup.next()) { |
363 | if(solution_cleanup.current()->targetType == StaticLib) | ||
364 | continue; // Shortcut, Static libs are not dep. | ||
281 | int cnt = 0; | 365 | int cnt = 0; |
@@ -283,19 +367,20 @@ nextfile: | |||
283 | dit != solution_cleanup.current()->dependencies.end(); | 367 | dit != solution_cleanup.current()->dependencies.end(); |
284 | ++dit) { | 368 | ++dit) |
285 | VcsolutionDepend *vc; | 369 | { |
286 | if((vc=solution_depends[*dit])) { | 370 | VcsolutionDepend *vc = solution_depends[*dit]; |
287 | if(solution_cleanup.current()->targetType != StaticLib || vc->targetType == Application) | 371 | if(vc) |
288 | t << "\n\t\t" << solution_cleanup.current()->uuid << "." << cnt++ << " = " << vc->uuid; | 372 | t << "\n\t\t" << solution_cleanup.current()->uuid << "." << cnt++ << " = " << vc->uuid; |
289 | } | ||
290 | } | 373 | } |
291 | } | 374 | } |
292 | t << _snlProjDepEnd; | 375 | t << _slnProjDepEnd; |
293 | t << _snlProjConfBeg; | 376 | t << _slnProjConfBeg; |
294 | for(solution_cleanup.first(); solution_cleanup.current(); solution_cleanup.next()) { | 377 | for(solution_cleanup.first(); solution_cleanup.current(); solution_cleanup.next()) { |
295 | t << "\n\t\t" << solution_cleanup.current()->uuid << _snlProjConfTag1; | 378 | t << "\n\t\t" << solution_cleanup.current()->uuid << _slnProjDbgConfTag1; |
296 | t << "\n\t\t" << solution_cleanup.current()->uuid << _snlProjConfTag2; | 379 | t << "\n\t\t" << solution_cleanup.current()->uuid << _slnProjDbgConfTag2; |
380 | t << "\n\t\t" << solution_cleanup.current()->uuid << _slnProjRelConfTag1; | ||
381 | t << "\n\t\t" << solution_cleanup.current()->uuid << _slnProjRelConfTag2; | ||
297 | } | 382 | } |
298 | t << _snlProjConfEnd; | 383 | t << _slnProjConfEnd; |
299 | t << _snlExtSections; | 384 | t << _slnExtSections; |
300 | t << _snlGlobalEnd; | 385 | t << _slnGlobalEnd; |
301 | } | 386 | } |
@@ -371,2 +456,20 @@ void VcprojGenerator::init() | |||
371 | } | 456 | } |
457 | |||
458 | // Setup PCH variables | ||
459 | precompH = project->first("PRECOMPILED_HEADER"); | ||
460 | usePCH = !precompH.isEmpty() && project->isActiveConfig("precompile_header"); | ||
461 | if (usePCH) { | ||
462 | precompHFilename = QFileInfo(precompH).fileName(); | ||
463 | // Created files | ||
464 | QString origTarget = project->first("QMAKE_ORIG_TARGET"); | ||
465 | precompObj = origTarget + Option::obj_ext; | ||
466 | precompPch = origTarget + ".pch"; | ||
467 | // Add PRECOMPILED_HEADER to HEADERS | ||
468 | if (!project->variables()["HEADERS"].contains(precompH)) | ||
469 | project->variables()["HEADERS"] += precompH; | ||
470 | // Return to variable pool | ||
471 | project->variables()["PRECOMPILED_OBJECT"] = precompObj; | ||
472 | project->variables()["PRECOMPILED_PCH"] = precompPch; | ||
473 | } | ||
474 | |||
372 | initProject(); // Fills the whole project with proper data | 475 | initProject(); // Fills the whole project with proper data |
@@ -391,4 +494,5 @@ void VcprojGenerator::initProject() | |||
391 | vcProject.Name = project->first("QMAKE_ORIG_TARGET"); | 494 | vcProject.Name = project->first("QMAKE_ORIG_TARGET"); |
392 | vcProject.Version = "7.00"; | 495 | vcProject.Version = use_net2003_version() ? "7.10" : "7.00"; |
393 | vcProject.PlatformName = ( vcProject.Configuration.idl.TargetEnvironment == midlTargetWin64 ? "Win64" : "Win32" ); | 496 | vcProject.ProjectGUID = getProjectUUID().toString().upper(); |
497 | vcProject.PlatformName = ( vcProject.Configuration[0].idl.TargetEnvironment == midlTargetWin64 ? "Win64" : "Win32" ); | ||
394 | // These are not used by Qt, but may be used by customers | 498 | // These are not used by Qt, but may be used by customers |
@@ -414,6 +518,6 @@ void VcprojGenerator::initConfiguration() | |||
414 | case SharedLib: | 518 | case SharedLib: |
415 | vcProject.Configuration.ConfigurationType = typeDynamicLibrary; | 519 | vcProject.Configuration[0].ConfigurationType = typeDynamicLibrary; |
416 | break; | 520 | break; |
417 | case StaticLib: | 521 | case StaticLib: |
418 | vcProject.Configuration.ConfigurationType = typeStaticLibrary; | 522 | vcProject.Configuration[0].ConfigurationType = typeStaticLibrary; |
419 | break; | 523 | break; |
@@ -421,24 +525,26 @@ void VcprojGenerator::initConfiguration() | |||
421 | default: | 525 | default: |
422 | vcProject.Configuration.ConfigurationType = typeApplication; | 526 | vcProject.Configuration[0].ConfigurationType = typeApplication; |
423 | break; | 527 | break; |
424 | } | 528 | } |
425 | vcProject.Configuration.Name = ( project->isActiveConfig( "debug" ) ? "Debug|" : "Release|" ); | 529 | |
426 | vcProject.Configuration.Name += ( vcProject.Configuration.idl.TargetEnvironment == midlTargetWin64 ? "Win64" : "Win32" ); | 530 | // Release version of the Configuration --------------- |
427 | vcProject.Configuration.ATLMinimizesCRunTimeLibraryUsage = ( project->first("ATLMinimizesCRunTimeLibraryUsage").isEmpty() ? _False : _True ); | 531 | VCConfiguration &RConf = vcProject.Configuration[0]; |
428 | vcProject.Configuration.BuildBrowserInformation = triState( temp.isEmpty() ? (short)unset : temp.toShort() ); | 532 | RConf.Name = "Release"; |
533 | RConf.Name += ( RConf.idl.TargetEnvironment == midlTargetWin64 ? "|Win64" : "|Win32" ); | ||
534 | RConf.ATLMinimizesCRunTimeLibraryUsage = ( project->first("ATLMinimizesCRunTimeLibraryUsage").isEmpty() ? _False : _True ); | ||
535 | RConf.BuildBrowserInformation = triState( temp.isEmpty() ? (short)unset : temp.toShort() ); | ||
429 | temp = project->first("CharacterSet"); | 536 | temp = project->first("CharacterSet"); |
430 | vcProject.Configuration.CharacterSet = charSet( temp.isEmpty() ? (short)charSetNotSet : temp.toShort() ); | 537 | RConf.CharacterSet = charSet( temp.isEmpty() ? (short)charSetNotSet : temp.toShort() ); |
431 | vcProject.Configuration.DeleteExtensionsOnClean = project->first("DeleteExtensionsOnClean"); | 538 | RConf.DeleteExtensionsOnClean = project->first("DeleteExtensionsOnClean"); |
432 | vcProject.Configuration.ImportLibrary = vcProject.Configuration.linker.ImportLibrary; | 539 | RConf.ImportLibrary = RConf.linker.ImportLibrary; |
433 | vcProject.Configuration.IntermediateDirectory = project->first("OBJECTS_DIR"); | 540 | RConf.IntermediateDirectory = project->first("OBJECTS_DIR"); |
434 | // temp = (projectTarget == StaticLib) ? project->first("DESTDIR"):project->first("DLLDESTDIR"); | 541 | RConf.OutputDirectory = "."; |
435 | vcProject.Configuration.OutputDirectory = "."; //( temp.isEmpty() ? QString(".") : temp ); | 542 | RConf.PrimaryOutput = project->first("PrimaryOutput"); |
436 | vcProject.Configuration.PrimaryOutput = project->first("PrimaryOutput"); | 543 | RConf.WholeProgramOptimization = RConf.compiler.WholeProgramOptimization; |
437 | vcProject.Configuration.WholeProgramOptimization = vcProject.Configuration.compiler.WholeProgramOptimization; | ||
438 | temp = project->first("UseOfATL"); | 544 | temp = project->first("UseOfATL"); |
439 | if ( !temp.isEmpty() ) | 545 | if ( !temp.isEmpty() ) |
440 | vcProject.Configuration.UseOfATL = useOfATL( temp.toShort() ); | 546 | RConf.UseOfATL = useOfATL( temp.toShort() ); |
441 | temp = project->first("UseOfMfc"); | 547 | temp = project->first("UseOfMfc"); |
442 | if ( !temp.isEmpty() ) | 548 | if ( !temp.isEmpty() ) |
443 | vcProject.Configuration.UseOfMfc = useOfMfc( temp.toShort() ); | 549 | RConf.UseOfMfc = useOfMfc( temp.toShort() ); |
444 | 550 | ||
@@ -450,2 +556,35 @@ void VcprojGenerator::initConfiguration() | |||
450 | initPreLinkEventTools(); | 556 | initPreLinkEventTools(); |
557 | |||
558 | // Debug version of the Configuration ----------------- | ||
559 | VCConfiguration DConf = vcProject.Configuration[0]; // Create copy configuration for debug | ||
560 | DConf.Name = "Debug"; | ||
561 | DConf.Name += ( DConf.idl.TargetEnvironment == midlTargetWin64 ? "|Win64" : "|Win32" ); | ||
562 | |||
563 | // Set definite values in both configurations | ||
564 | DConf.compiler.PreprocessorDefinitions.remove("NDEBUG"); | ||
565 | RConf.compiler.PreprocessorDefinitions += "NDEBUG"; | ||
566 | RConf.linker.GenerateDebugInformation = _False; | ||
567 | DConf.linker.GenerateDebugInformation = _True; | ||
568 | |||
569 | // Modify configurations, based on Qt build | ||
570 | if ( project->isActiveConfig("debug") ) { | ||
571 | RConf.IntermediateDirectory = | ||
572 | RConf.compiler.AssemblerListingLocation = | ||
573 | RConf.compiler.ObjectFile = "Release\\"; | ||
574 | RConf.librarian.OutputFile = | ||
575 | RConf.linker.OutputFile = RConf.IntermediateDirectory + "\\" + project->first("MSVCPROJ_TARGET"); | ||
576 | RConf.linker.parseOptions(project->variables()["QMAKE_LFLAGS_RELEASE"]); | ||
577 | RConf.compiler.parseOptions(project->variables()["QMAKE_CFLAGS_RELEASE"]); | ||
578 | } else { | ||
579 | DConf.IntermediateDirectory = | ||
580 | DConf.compiler.AssemblerListingLocation = | ||
581 | DConf.compiler.ObjectFile = "Debug\\"; | ||
582 | DConf.librarian.OutputFile = | ||
583 | DConf.linker.OutputFile = DConf.IntermediateDirectory + "\\" + project->first("MSVCPROJ_TARGET"); | ||
584 | DConf.linker.DelayLoadDLLs.clear(); | ||
585 | DConf.compiler.parseOptions(project->variables()["QMAKE_CFLAGS_DEBUG"]); | ||
586 | } | ||
587 | |||
588 | // Add Debug configuration to project | ||
589 | vcProject.Configuration += DConf; | ||
451 | } | 590 | } |
@@ -458,6 +597,19 @@ void VcprojGenerator::initCompilerTool() | |||
458 | 597 | ||
459 | vcProject.Configuration.compiler.AssemblerListingLocation = placement ; | 598 | VCConfiguration &RConf = vcProject.Configuration[0]; |
460 | vcProject.Configuration.compiler.ProgramDataBaseFileName = placement ; | 599 | RConf.compiler.AssemblerListingLocation = placement ; |
461 | vcProject.Configuration.compiler.ObjectFile = placement ; | 600 | RConf.compiler.ProgramDataBaseFileName = ".\\" ; |
462 | vcProject.Configuration.compiler.PrecompiledHeaderFile = placement + project->first("QMAKE_ORIG_TARGET") + ".pch"; | 601 | RConf.compiler.ObjectFile = placement ; |
602 | // PCH | ||
603 | if ( usePCH ) { | ||
604 | RConf.compiler.UsePrecompiledHeader = pchUseUsingSpecific; | ||
605 | RConf.compiler.PrecompiledHeaderFile = "$(IntDir)\\" + precompPch; | ||
606 | RConf.compiler.PrecompiledHeaderThrough = precompHFilename; | ||
607 | RConf.compiler.ForcedIncludeFiles = precompHFilename; | ||
608 | // Minimal build option triggers an Internal Compiler Error | ||
609 | // when used in conjunction with /FI and /Yu, so remove it | ||
610 | project->variables()["QMAKE_CFLAGS_DEBUG"].remove("-Gm"); | ||
611 | project->variables()["QMAKE_CFLAGS_DEBUG"].remove("/Gm"); | ||
612 | project->variables()["QMAKE_CXXFLAGS_DEBUG"].remove("-Gm"); | ||
613 | project->variables()["QMAKE_CXXFLAGS_DEBUG"].remove("/Gm"); | ||
614 | } | ||
463 | 615 | ||
@@ -465,11 +617,11 @@ void VcprojGenerator::initCompilerTool() | |||
465 | // Debug version | 617 | // Debug version |
466 | vcProject.Configuration.compiler.parseOptions( project->variables()["QMAKE_CXXFLAGS"] ); | 618 | RConf.compiler.parseOptions( project->variables()["QMAKE_CXXFLAGS"] ); |
467 | vcProject.Configuration.compiler.parseOptions( project->variables()["QMAKE_CXXFLAGS_DEBUG"] ); | 619 | RConf.compiler.parseOptions( project->variables()["QMAKE_CXXFLAGS_DEBUG"] ); |
468 | if ( project->isActiveConfig("thread") ) { | 620 | if ( project->isActiveConfig("thread") ) { |
469 | if ( (projectTarget == Application) || (projectTarget == StaticLib) ) | 621 | if ( (projectTarget == Application) || (projectTarget == StaticLib) ) |
470 | vcProject.Configuration.compiler.parseOptions( project->variables()["QMAKE_CXXFLAGS_MT_DBG"] ); | 622 | RConf.compiler.parseOptions( project->variables()["QMAKE_CXXFLAGS_MT_DBG"] ); |
471 | else | 623 | else |
472 | vcProject.Configuration.compiler.parseOptions( project->variables()["QMAKE_CXXFLAGS_MT_DLLDBG"] ); | 624 | RConf.compiler.parseOptions( project->variables()["QMAKE_CXXFLAGS_MT_DLLDBG"] ); |
473 | } else { | 625 | } else { |
474 | vcProject.Configuration.compiler.parseOptions( project->variables()["QMAKE_CXXFLAGS_ST_DBG"] ); | 626 | RConf.compiler.parseOptions( project->variables()["QMAKE_CXXFLAGS_MT_DBG"] ); |
475 | } | 627 | } |
@@ -477,13 +629,13 @@ void VcprojGenerator::initCompilerTool() | |||
477 | // Release version | 629 | // Release version |
478 | vcProject.Configuration.compiler.parseOptions( project->variables()["QMAKE_CXXFLAGS"] ); | 630 | RConf.compiler.parseOptions( project->variables()["QMAKE_CXXFLAGS"] ); |
479 | vcProject.Configuration.compiler.parseOptions( project->variables()["QMAKE_CXXFLAGS_RELEASE"] ); | 631 | RConf.compiler.parseOptions( project->variables()["QMAKE_CXXFLAGS_RELEASE"] ); |
480 | vcProject.Configuration.compiler.PreprocessorDefinitions += "QT_NO_DEBUG"; | 632 | RConf.compiler.PreprocessorDefinitions += "QT_NO_DEBUG"; |
481 | vcProject.Configuration.compiler.PreprocessorDefinitions += "NDEBUG"; | 633 | RConf.compiler.PreprocessorDefinitions += "NDEBUG"; |
482 | if ( project->isActiveConfig("thread") ) { | 634 | if ( project->isActiveConfig("thread") ) { |
483 | if ( (projectTarget == Application) || (projectTarget == StaticLib) ) | 635 | if ( (projectTarget == Application) || (projectTarget == StaticLib) ) |
484 | vcProject.Configuration.compiler.parseOptions( project->variables()["QMAKE_CXXFLAGS_MT"] ); | 636 | RConf.compiler.parseOptions( project->variables()["QMAKE_CXXFLAGS_MT"] ); |
485 | else | 637 | else |
486 | vcProject.Configuration.compiler.parseOptions( project->variables()["QMAKE_CXXFLAGS_MT_DLL"] ); | 638 | RConf.compiler.parseOptions( project->variables()["QMAKE_CXXFLAGS_MT_DLL"] ); |
487 | } else { | 639 | } else { |
488 | vcProject.Configuration.compiler.parseOptions( project->variables()["QMAKE_CXXFLAGS_ST"] ); | 640 | RConf.compiler.parseOptions( project->variables()["QMAKE_CXXFLAGS_MT"] ); |
489 | } | 641 | } |
@@ -493,7 +645,7 @@ void VcprojGenerator::initCompilerTool() | |||
493 | if ( project->isActiveConfig("warn_off") ) | 645 | if ( project->isActiveConfig("warn_off") ) |
494 | vcProject.Configuration.compiler.parseOptions( project->variables()["QMAKE_CXXFLAGS_WARN_OFF"] ); | 646 | RConf.compiler.parseOptions( project->variables()["QMAKE_CXXFLAGS_WARN_OFF"] ); |
495 | else if ( project->isActiveConfig("warn_on") ) | 647 | else if ( project->isActiveConfig("warn_on") ) |
496 | vcProject.Configuration.compiler.parseOptions( project->variables()["QMAKE_CXXFLAGS_WARN_ON"] ); | 648 | RConf.compiler.parseOptions( project->variables()["QMAKE_CXXFLAGS_WARN_ON"] ); |
497 | if ( project->isActiveConfig("windows") ) | 649 | if ( project->isActiveConfig("windows") ) |
498 | vcProject.Configuration.compiler.PreprocessorDefinitions += project->variables()["MSVCPROJ_WINCONDEF"]; | 650 | RConf.compiler.PreprocessorDefinitions += project->variables()["MSVCPROJ_WINCONDEF"]; |
499 | 651 | ||
@@ -502,7 +654,13 @@ void VcprojGenerator::initCompilerTool() | |||
502 | if ( projectTarget == SharedLib ) | 654 | if ( projectTarget == SharedLib ) |
503 | vcProject.Configuration.compiler.PreprocessorDefinitions += "_WINDOWS"; | 655 | RConf.compiler.PreprocessorDefinitions += "_WINDOWS"; |
504 | 656 | ||
505 | vcProject.Configuration.compiler.PreprocessorDefinitions += project->variables()["DEFINES"]; | 657 | RConf.compiler.PreprocessorDefinitions += project->variables()["DEFINES"]; |
506 | vcProject.Configuration.compiler.PreprocessorDefinitions += project->variables()["PRL_EXPORT_DEFINES"]; | 658 | RConf.compiler.PreprocessorDefinitions += project->variables()["PRL_EXPORT_DEFINES"]; |
507 | vcProject.Configuration.compiler.parseOptions( project->variables()["MSVCPROJ_INCPATH"] ); | 659 | QStringList::iterator it; |
660 | for(it=RConf.compiler.PreprocessorDefinitions.begin(); | ||
661 | it!=RConf.compiler.PreprocessorDefinitions.end(); | ||
662 | ++it) | ||
663 | (*it).replace('\"', """); | ||
664 | |||
665 | RConf.compiler.parseOptions( project->variables()["MSVCPROJ_INCPATH"] ); | ||
508 | } | 666 | } |
@@ -511,10 +669,11 @@ void VcprojGenerator::initLibrarianTool() | |||
511 | { | 669 | { |
512 | vcProject.Configuration.librarian.OutputFile = project->first( "DESTDIR" ); | 670 | VCConfiguration &RConf = vcProject.Configuration[0]; |
513 | if( vcProject.Configuration.librarian.OutputFile.isEmpty() ) | 671 | RConf.librarian.OutputFile = project->first( "DESTDIR" ); |
514 | vcProject.Configuration.librarian.OutputFile = ".\\"; | 672 | if( RConf.librarian.OutputFile.isEmpty() ) |
673 | RConf.librarian.OutputFile = ".\\"; | ||
515 | 674 | ||
516 | if( !vcProject.Configuration.librarian.OutputFile.endsWith("\\") ) | 675 | if( !RConf.librarian.OutputFile.endsWith("\\") ) |
517 | vcProject.Configuration.librarian.OutputFile += '\\'; | 676 | RConf.librarian.OutputFile += '\\'; |
518 | 677 | ||
519 | vcProject.Configuration.librarian.OutputFile += project->first("MSVCPROJ_TARGET"); | 678 | RConf.librarian.OutputFile += project->first("MSVCPROJ_TARGET"); |
520 | } | 679 | } |
@@ -523,4 +682,5 @@ void VcprojGenerator::initLinkerTool() | |||
523 | { | 682 | { |
524 | vcProject.Configuration.linker.parseOptions( project->variables()["MSVCPROJ_LFLAGS"] ); | 683 | VCConfiguration &RConf = vcProject.Configuration[0]; |
525 | vcProject.Configuration.linker.AdditionalDependencies += project->variables()["MSVCPROJ_LIBS"]; | 684 | RConf.linker.parseOptions( project->variables()["MSVCPROJ_LFLAGS"] ); |
685 | RConf.linker.AdditionalDependencies += project->variables()["MSVCPROJ_LIBS"]; | ||
526 | 686 | ||
@@ -528,7 +688,7 @@ void VcprojGenerator::initLinkerTool() | |||
528 | case Application: | 688 | case Application: |
529 | vcProject.Configuration.linker.OutputFile = project->first( "DESTDIR" ); | 689 | RConf.linker.OutputFile = project->first( "DESTDIR" ); |
530 | break; | 690 | break; |
531 | case SharedLib: | 691 | case SharedLib: |
532 | vcProject.Configuration.linker.parseOptions( project->variables()["MSVCPROJ_LIBOPTIONS"] ); | 692 | RConf.linker.parseOptions( project->variables()["MSVCPROJ_LIBOPTIONS"] ); |
533 | vcProject.Configuration.linker.OutputFile = project->first( "DLLDESTDIR" ); | 693 | RConf.linker.OutputFile = project->first( "DESTDIR" ); |
534 | break; | 694 | break; |
@@ -538,15 +698,14 @@ void VcprojGenerator::initLinkerTool() | |||
538 | 698 | ||
539 | if( vcProject.Configuration.linker.OutputFile.isEmpty() ) | 699 | if( RConf.linker.OutputFile.isEmpty() ) |
540 | vcProject.Configuration.linker.OutputFile = ".\\"; | 700 | RConf.linker.OutputFile = ".\\"; |
541 | 701 | ||
542 | if( !vcProject.Configuration.linker.OutputFile.endsWith("\\") ) | 702 | if( !RConf.linker.OutputFile.endsWith("\\") ) |
543 | vcProject.Configuration.linker.OutputFile += '\\'; | 703 | RConf.linker.OutputFile += '\\'; |
544 | 704 | ||
545 | vcProject.Configuration.linker.OutputFile += project->first("MSVCPROJ_TARGET"); | 705 | RConf.linker.OutputFile += project->first("MSVCPROJ_TARGET"); |
546 | vcProject.Configuration.linker.ProgramDatabaseFile = project->first("OBJECTS_DIR") + project->first("QMAKE_ORIG_TARGET") + ".pdb"; | ||
547 | 706 | ||
548 | if ( project->isActiveConfig("debug") ){ | 707 | if ( project->isActiveConfig("debug") ){ |
549 | vcProject.Configuration.linker.parseOptions( project->variables()["QMAKE_LFLAGS_DEBUG"] ); | 708 | RConf.linker.parseOptions( project->variables()["QMAKE_LFLAGS_DEBUG"] ); |
550 | } else { | 709 | } else { |
551 | vcProject.Configuration.linker.parseOptions( project->variables()["QMAKE_LFLAGS_RELEASE"] ); | 710 | RConf.linker.parseOptions( project->variables()["QMAKE_LFLAGS_RELEASE"] ); |
552 | } | 711 | } |
@@ -554,3 +713,3 @@ void VcprojGenerator::initLinkerTool() | |||
554 | if ( project->isActiveConfig("dll") ){ | 713 | if ( project->isActiveConfig("dll") ){ |
555 | vcProject.Configuration.linker.parseOptions( project->variables()["QMAKE_LFLAGS_QT_DLL"] ); | 714 | RConf.linker.parseOptions( project->variables()["QMAKE_LFLAGS_QT_DLL"] ); |
556 | } | 715 | } |
@@ -558,5 +717,5 @@ void VcprojGenerator::initLinkerTool() | |||
558 | if ( project->isActiveConfig("console") ){ | 717 | if ( project->isActiveConfig("console") ){ |
559 | vcProject.Configuration.linker.parseOptions( project->variables()["QMAKE_LFLAGS_CONSOLE"] ); | 718 | RConf.linker.parseOptions( project->variables()["QMAKE_LFLAGS_CONSOLE"] ); |
560 | } else { | 719 | } else { |
561 | vcProject.Configuration.linker.parseOptions( project->variables()["QMAKE_LFLAGS_WINDOWS"] ); | 720 | RConf.linker.parseOptions( project->variables()["QMAKE_LFLAGS_WINDOWS"] ); |
562 | } | 721 | } |
@@ -575,21 +734,2 @@ void VcprojGenerator::initPreBuildEventTools() | |||
575 | { | 734 | { |
576 | QString collectionName = project->first("QMAKE_IMAGE_COLLECTION"); | ||
577 | if( !collectionName.isEmpty() ) { | ||
578 | QStringList& list = project->variables()["IMAGES"]; | ||
579 | vcProject.Configuration.preBuild.Description = "Generate imagecollection"; | ||
580 | //vcProject.Configuration.preBuild.AdditionalDependencies += list; | ||
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; | ||
592 | //vcProject.Configuration.preBuild.Outputs = collectionName; | ||
593 | |||
594 | } | ||
595 | } | 735 | } |
@@ -598,5 +738,14 @@ void VcprojGenerator::initPostBuildEventTools() | |||
598 | { | 738 | { |
739 | VCConfiguration &RConf = vcProject.Configuration[0]; | ||
599 | if ( !project->variables()["QMAKE_POST_LINK"].isEmpty() ) { | 740 | if ( !project->variables()["QMAKE_POST_LINK"].isEmpty() ) { |
600 | vcProject.Configuration.postBuild.Description = var("QMAKE_POST_LINK"); | 741 | RConf.postBuild.Description = var("QMAKE_POST_LINK"); |
601 | vcProject.Configuration.postBuild.CommandLine = var("QMAKE_POST_LINK"); | 742 | RConf.postBuild.CommandLine = var("QMAKE_POST_LINK"); |
743 | RConf.postBuild.Description.replace(" && ", " && "); | ||
744 | RConf.postBuild.CommandLine.replace(" && ", " && "); | ||
745 | } | ||
746 | if ( !project->variables()["MSVCPROJ_COPY_DLL"].isEmpty() ) { | ||
747 | if ( !RConf.postBuild.CommandLine.isEmpty() ) | ||
748 | RConf.postBuild.CommandLine += " && "; | ||
749 | RConf.postBuild.Description += var("MSVCPROJ_COPY_DLL_DESC"); | ||
750 | RConf.postBuild.CommandLine += var("MSVCPROJ_COPY_DLL"); | ||
602 | } | 751 | } |
@@ -608,30 +757,26 @@ void VcprojGenerator::initPostBuildEventTools() | |||
608 | 757 | ||
609 | vcProject.Configuration.postBuild.Description = "Finalizing ActiveQt server..."; | 758 | RConf.postBuild.Description = "Finalizing ActiveQt server..."; |
610 | if ( !vcProject.Configuration.postBuild.CommandLine.isEmpty() ) | 759 | if ( !RConf.postBuild.CommandLine.isEmpty() ) |
611 | vcProject.Configuration.postBuild.CommandLine += " && "; | 760 | RConf.postBuild.CommandLine += " && "; |
612 | 761 | ||
613 | if( project->isActiveConfig( "dll" ) ) { // In process | 762 | if( project->isActiveConfig( "dll" ) ) { // In process |
614 | vcProject.Configuration.postBuild.CommandLine += | 763 | RConf.postBuild.CommandLine += |
615 | // call idc to generate .idl file from .dll | 764 | // call idc to generate .idl file from .dll |
616 | idc + " " + vcProject.Configuration.OutputDirectory + "\\" + nameext + " -idl " + objdir + name + ".idl -version 1.0 && " + | 765 | idc + " "$(TargetPath)" -idl " + objdir + name + ".idl -version 1.0 && " + |
617 | // call midl to create implementations of the .idl file | 766 | // call midl to create implementations of the .idl file |
618 | project->first( "QMAKE_IDL" ) + " " + objdir + name + ".idl /nologo /o " + objdir + name + ".midl /tlb " + objdir + name + ".tlb /iid " + objdir + | 767 | project->first( "QMAKE_IDL" ) + " /nologo " + objdir + name + ".idl /tlb " + objdir + name + ".tlb && " + |
619 | "dump.midl /dlldata " + objdir + "dump.midl /cstub " + objdir + "dump.midl /header " + objdir + "dump.midl /proxy " + objdir + "dump.midl /sstub " + | ||
620 | objdir + "dump.midl && " + | ||
621 | // call idc to replace tlb... | 768 | // call idc to replace tlb... |
622 | idc + " " + vcProject.Configuration.OutputDirectory + "\\" + nameext + " /tlb " + objdir + name + ".tlb && " + | 769 | idc + " "$(TargetPath)" /tlb " + objdir + name + ".tlb && " + |
623 | // register server | 770 | // register server |
624 | idc + " " + vcProject.Configuration.OutputDirectory + "\\" + nameext + " /regserver"; | 771 | idc + " "$(TargetPath)" /regserver"; |
625 | } else { // out of process | 772 | } else { // out of process |
626 | vcProject.Configuration.postBuild.CommandLine = | 773 | RConf.postBuild.CommandLine = |
627 | // call application to dump idl | 774 | // call application to dump idl |
628 | vcProject.Configuration.OutputDirectory + "\\" + nameext + " -dumpidl " + objdir + name + ".idl -version 1.0 && " + | 775 | ""$(TargetPath)" -dumpidl " + objdir + name + ".idl -version 1.0 && " + |
629 | // call midl to create implementations of the .idl file | 776 | // call midl to create implementations of the .idl file |
630 | project->first( "QMAKE_IDL" ) + " " + objdir + name + ".idl /nologo /o " + objdir + name + ".midl /tlb " + objdir + name + ".tlb /iid " + objdir + | 777 | project->first( "QMAKE_IDL" ) + " /nologo " + objdir + name + ".idl /tlb " + objdir + name + ".tlb && " + |
631 | "dump.midl /dlldata " + objdir + "dump.midl /cstub " + objdir + "dump.midl /header " + objdir + "dump.midl /proxy " + objdir + "dump.midl /sstub " + | ||
632 | objdir + "dump.midl && " + | ||
633 | // call idc to replace tlb... | 778 | // call idc to replace tlb... |
634 | idc + " " + vcProject.Configuration.OutputDirectory + "\\" + nameext + " /tlb " + objdir + name + ".tlb && " + | 779 | idc + " "$(TargetPath)" /tlb " + objdir + name + ".tlb && " + |
635 | // call app to register | 780 | // call app to register |
636 | vcProject.Configuration.OutputDirectory + "\\" + nameext + " -regserver"; | 781 | ""$(TargetPath)" -regserver"; |
637 | } | 782 | } |
@@ -644,4 +789,79 @@ void VcprojGenerator::initPreLinkEventTools() | |||
644 | 789 | ||
790 | |||
791 | // ------------------------------------------------------------------ | ||
792 | // Helper functions to do proper sorting of the | ||
793 | // qstringlists, for both flat and non-flat modes. | ||
794 | inline bool XLessThanY( QString &x, QString &y, bool flat_mode ) | ||
795 | { | ||
796 | if ( flat_mode ) { | ||
797 | QString subX = x.mid( x.findRev('\\')+1 ); | ||
798 | QString subY = y.mid( y.findRev('\\')+1 ); | ||
799 | return QString::compare(subX, subY) < 0; | ||
800 | } | ||
801 | |||
802 | int xPos = 0; | ||
803 | int yPos = 0; | ||
804 | int xSlashPos; | ||
805 | int ySlashPos; | ||
806 | for (;;) { | ||
807 | xSlashPos = x.find('\\', xPos); | ||
808 | ySlashPos = y.find('\\', yPos); | ||
809 | |||
810 | if (xSlashPos == -1 && ySlashPos != -1) { | ||
811 | return false; | ||
812 | } else if (xSlashPos != -1 && ySlashPos == -1) { | ||
813 | return true; | ||
814 | } else if (xSlashPos == -1 /* && yySlashPos == -1 */) { | ||
815 | QString subX = x.mid(xPos); | ||
816 | QString subY = y.mid(yPos); | ||
817 | return QString::compare(subX, subY) < 0; | ||
818 | } else { | ||
819 | QString subX = x.mid(xPos, xSlashPos - xPos); | ||
820 | QString subY = y.mid(yPos, ySlashPos - yPos); | ||
821 | int cmp = QString::compare(subX, subY); | ||
822 | if (cmp != 0) | ||
823 | return cmp < 0; | ||
824 | } | ||
825 | xPos = xSlashPos + 1; | ||
826 | yPos = ySlashPos + 1; | ||
827 | } | ||
828 | return false; | ||
829 | } | ||
830 | void nonflatDir_BubbleSort( QStringList& list, bool flat_mode ) | ||
831 | { | ||
832 | QStringList::Iterator b = list.begin(); | ||
833 | QStringList::Iterator e = list.end(); | ||
834 | QStringList::Iterator last = e; | ||
835 | --last; // goto last | ||
836 | if ( last == b )// shortcut | ||
837 | return; | ||
838 | while( b != last ) {// sort them | ||
839 | bool swapped = FALSE; | ||
840 | QStringList::Iterator swap_pos = b; | ||
841 | QStringList::Iterator x = e; | ||
842 | QStringList::Iterator y = x; | ||
843 | --y; | ||
844 | QString swap_str; | ||
845 | do { | ||
846 | --x; | ||
847 | --y; | ||
848 | if ( XLessThanY(*x,*y, flat_mode) ) { | ||
849 | swapped = TRUE; | ||
850 | swap_str = (*x); // Swap ------- | ||
851 | (*x) = (*y); | ||
852 | (*y) = swap_str; // ------------ | ||
853 | swap_pos = y; | ||
854 | } | ||
855 | } while( y != b ); | ||
856 | if ( !swapped ) | ||
857 | return; | ||
858 | b = swap_pos; | ||
859 | ++b; | ||
860 | } | ||
861 | } | ||
862 | // ------------------------------------------------------------------ | ||
863 | |||
645 | void VcprojGenerator::initSourceFiles() | 864 | void VcprojGenerator::initSourceFiles() |
646 | { | 865 | { |
866 | vcProject.SourceFiles.flat_files = project->isActiveConfig("flat"); | ||
647 | vcProject.SourceFiles.Name = "Source Files"; | 867 | vcProject.SourceFiles.Name = "Source Files"; |
@@ -649,3 +869,4 @@ void VcprojGenerator::initSourceFiles() | |||
649 | vcProject.SourceFiles.Files += project->variables()["SOURCES"]; | 869 | vcProject.SourceFiles.Files += project->variables()["SOURCES"]; |
650 | vcProject.SourceFiles.Files.sort(); | 870 | nonflatDir_BubbleSort( vcProject.SourceFiles.Files, |
871 | vcProject.SourceFiles.flat_files ); | ||
651 | vcProject.SourceFiles.Project = this; | 872 | vcProject.SourceFiles.Project = this; |
@@ -657,2 +878,3 @@ void VcprojGenerator::initHeaderFiles() | |||
657 | { | 878 | { |
879 | vcProject.HeaderFiles.flat_files = project->isActiveConfig("flat"); | ||
658 | vcProject.HeaderFiles.Name = "Header Files"; | 880 | vcProject.HeaderFiles.Name = "Header Files"; |
@@ -660,3 +882,8 @@ void VcprojGenerator::initHeaderFiles() | |||
660 | vcProject.HeaderFiles.Files += project->variables()["HEADERS"]; | 882 | vcProject.HeaderFiles.Files += project->variables()["HEADERS"]; |
661 | vcProject.HeaderFiles.Files.sort(); | 883 | if (usePCH) { // Generated PCH cpp file |
884 | if (!vcProject.HeaderFiles.Files.contains(precompH)) | ||
885 | vcProject.HeaderFiles.Files += precompH; | ||
886 | } | ||
887 | nonflatDir_BubbleSort( vcProject.HeaderFiles.Files, | ||
888 | vcProject.HeaderFiles.flat_files ); | ||
662 | vcProject.HeaderFiles.Project = this; | 889 | vcProject.HeaderFiles.Project = this; |
@@ -668,2 +895,3 @@ void VcprojGenerator::initMOCFiles() | |||
668 | { | 895 | { |
896 | vcProject.MOCFiles.flat_files = project->isActiveConfig("flat"); | ||
669 | vcProject.MOCFiles.Name = "Generated MOC Files"; | 897 | vcProject.MOCFiles.Name = "Generated MOC Files"; |
@@ -671,3 +899,4 @@ void VcprojGenerator::initMOCFiles() | |||
671 | vcProject.MOCFiles.Files += project->variables()["SRCMOC"]; | 899 | vcProject.MOCFiles.Files += project->variables()["SRCMOC"]; |
672 | vcProject.MOCFiles.Files.sort(); | 900 | nonflatDir_BubbleSort( vcProject.MOCFiles.Files, |
901 | vcProject.MOCFiles.flat_files ); | ||
673 | vcProject.MOCFiles.Project = this; | 902 | vcProject.MOCFiles.Project = this; |
@@ -679,3 +908,4 @@ void VcprojGenerator::initUICFiles() | |||
679 | { | 908 | { |
680 | vcProject.UICFiles.Name = "Generated UI Files"; | 909 | vcProject.UICFiles.flat_files = project->isActiveConfig("flat"); |
910 | vcProject.UICFiles.Name = "Generated Form Files"; | ||
681 | vcProject.UICFiles.Filter = "cpp;c;cxx;h;hpp;hxx;"; | 911 | vcProject.UICFiles.Filter = "cpp;c;cxx;h;hpp;hxx;"; |
@@ -684,3 +914,4 @@ void VcprojGenerator::initUICFiles() | |||
684 | vcProject.UICFiles.Files += project->variables()["UICIMPLS"]; | 914 | vcProject.UICFiles.Files += project->variables()["UICIMPLS"]; |
685 | vcProject.UICFiles.Files.sort(); | 915 | nonflatDir_BubbleSort( vcProject.UICFiles.Files, |
916 | vcProject.UICFiles.flat_files ); | ||
686 | vcProject.UICFiles.Config = &(vcProject.Configuration); | 917 | vcProject.UICFiles.Config = &(vcProject.Configuration); |
@@ -691,2 +922,3 @@ void VcprojGenerator::initFormsFiles() | |||
691 | { | 922 | { |
923 | vcProject.FormFiles.flat_files = project->isActiveConfig("flat"); | ||
692 | vcProject.FormFiles.Name = "Forms"; | 924 | vcProject.FormFiles.Name = "Forms"; |
@@ -695,3 +927,4 @@ void VcprojGenerator::initFormsFiles() | |||
695 | vcProject.FormFiles.Files += project->variables()["FORMS"]; | 927 | vcProject.FormFiles.Files += project->variables()["FORMS"]; |
696 | vcProject.FormFiles.Files.sort(); | 928 | nonflatDir_BubbleSort( vcProject.FormFiles.Files, |
929 | vcProject.FormFiles.flat_files ); | ||
697 | vcProject.FormFiles.Project = this; | 930 | vcProject.FormFiles.Project = this; |
@@ -703,2 +936,3 @@ void VcprojGenerator::initTranslationFiles() | |||
703 | { | 936 | { |
937 | vcProject.TranslationFiles.flat_files = project->isActiveConfig("flat"); | ||
704 | vcProject.TranslationFiles.Name = "Translations Files"; | 938 | vcProject.TranslationFiles.Name = "Translations Files"; |
@@ -707,3 +941,4 @@ void VcprojGenerator::initTranslationFiles() | |||
707 | vcProject.TranslationFiles.Files += project->variables()["TRANSLATIONS"]; | 941 | vcProject.TranslationFiles.Files += project->variables()["TRANSLATIONS"]; |
708 | vcProject.TranslationFiles.Files.sort(); | 942 | nonflatDir_BubbleSort( vcProject.TranslationFiles.Files, |
943 | vcProject.TranslationFiles.flat_files ); | ||
709 | vcProject.TranslationFiles.Project = this; | 944 | vcProject.TranslationFiles.Project = this; |
@@ -715,2 +950,3 @@ void VcprojGenerator::initLexYaccFiles() | |||
715 | { | 950 | { |
951 | vcProject.LexYaccFiles.flat_files = project->isActiveConfig("flat"); | ||
716 | vcProject.LexYaccFiles.Name = "Lex / Yacc Files"; | 952 | vcProject.LexYaccFiles.Name = "Lex / Yacc Files"; |
@@ -720,4 +956,6 @@ void VcprojGenerator::initLexYaccFiles() | |||
720 | vcProject.LexYaccFiles.Files += project->variables()["YACCSOURCES"]; | 956 | vcProject.LexYaccFiles.Files += project->variables()["YACCSOURCES"]; |
721 | vcProject.LexYaccFiles.Files.sort(); | 957 | nonflatDir_BubbleSort( vcProject.LexYaccFiles.Files, |
958 | vcProject.LexYaccFiles.flat_files ); | ||
722 | vcProject.LexYaccFiles.Project = this; | 959 | vcProject.LexYaccFiles.Project = this; |
960 | vcProject.LexYaccFiles.Config = &(vcProject.Configuration); | ||
723 | vcProject.LexYaccFiles.CustomBuild = lexyacc; | 961 | vcProject.LexYaccFiles.CustomBuild = lexyacc; |
@@ -727,2 +965,3 @@ void VcprojGenerator::initResourceFiles() | |||
727 | { | 965 | { |
966 | vcProject.ResourceFiles.flat_files = project->isActiveConfig("flat"); | ||
728 | vcProject.ResourceFiles.Name = "Resources"; | 967 | vcProject.ResourceFiles.Name = "Resources"; |
@@ -734,5 +973,7 @@ void VcprojGenerator::initResourceFiles() | |||
734 | vcProject.ResourceFiles.Files += project->variables()["IDLSOURCES"]; | 973 | vcProject.ResourceFiles.Files += project->variables()["IDLSOURCES"]; |
735 | vcProject.ResourceFiles.Files.sort(); | 974 | nonflatDir_BubbleSort( vcProject.ResourceFiles.Files, |
975 | vcProject.ResourceFiles.flat_files ); | ||
736 | vcProject.ResourceFiles.Project = this; | 976 | vcProject.ResourceFiles.Project = this; |
737 | vcProject.ResourceFiles.CustomBuild = none; | 977 | vcProject.ResourceFiles.Config = &(vcProject.Configuration); |
978 | vcProject.ResourceFiles.CustomBuild = resource; | ||
738 | } | 979 | } |
@@ -867,3 +1108,2 @@ void VcprojGenerator::initOld() | |||
867 | project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_QT_ENTRY"]; | 1108 | project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_QT_ENTRY"]; |
868 | project->variables()["MSVCPROJ_LFLAGS"].append("/DEF:"+project->first("DEF_FILE")); | ||
869 | } | 1109 | } |
@@ -941,2 +1181,11 @@ void VcprojGenerator::initOld() | |||
941 | 1181 | ||
1182 | // /VERSION:x.yz ------------------------------------------------- | ||
1183 | if ( !project->variables()["VERSION"].isEmpty() ) { | ||
1184 | QString version = project->variables()["VERSION"][0]; | ||
1185 | int firstDot = version.find( "." ); | ||
1186 | QString major = version.left( firstDot ); | ||
1187 | QString minor = version.right( version.length() - firstDot - 1 ); | ||
1188 | minor.replace( ".", "" ); | ||
1189 | project->variables()["QMAKE_LFLAGS"].append( "/VERSION:" + major + "." + minor ); | ||
1190 | } | ||
942 | 1191 | ||
@@ -951,2 +1200,3 @@ void VcprojGenerator::initOld() | |||
951 | } else if( s.startsWith( "-L" ) ) { | 1200 | } else if( s.startsWith( "-L" ) ) { |
1201 | project->variables()["QMAKE_LIBDIR"] += (*it).mid(2); | ||
952 | it = libList.remove( it ); | 1202 | it = libList.remove( it ); |
@@ -1052,10 +1302,2 @@ void VcprojGenerator::initOld() | |||
1052 | project->variables()["MSVCPROJ_TARGET"] = dest; | 1302 | project->variables()["MSVCPROJ_TARGET"] = dest; |
1053 | if ( project->isActiveConfig("dll") ) { | ||
1054 | QString imp = project->first( "DESTDIR" ); | ||
1055 | if( !imp.isNull() && !imp.endsWith( "\\" ) ) | ||
1056 | imp += "\\"; | ||
1057 | imp += dest; | ||
1058 | imp.replace(QRegExp("\\.dll"), ".lib"); | ||
1059 | project->variables()["MSVCPROJ_LIBOPTIONS"] += QString("/IMPLIB:") + imp; | ||
1060 | } | ||
1061 | 1303 | ||
@@ -1064,15 +1306,20 @@ void VcprojGenerator::initOld() | |||
1064 | QStringList dlldirs = project->variables()["DLLDESTDIR"]; | 1306 | QStringList dlldirs = project->variables()["DLLDESTDIR"]; |
1065 | QString copydll = "# Begin Special Build Tool\n" | 1307 | QString copydll(""); |
1066 | "TargetPath=" + dest + "\n" | 1308 | QStringList::Iterator dlldir; |
1067 | "SOURCE=$(InputPath)\n" | 1309 | for ( dlldir = dlldirs.begin(); dlldir != dlldirs.end(); ++dlldir ) { |
1068 | "PostBuild_Desc=Copy DLL to " + project->first("DLLDESTDIR") + "\n" | 1310 | if ( !copydll.isEmpty() ) |
1069 | "PostBuild_Cmds="; | 1311 | copydll += " && "; |
1070 | 1312 | copydll += "copy "$(TargetPath)" "" + *dlldir + """; | |
1071 | for ( QStringList::Iterator dlldir = dlldirs.begin(); dlldir != dlldirs.end(); ++dlldir ) { | ||
1072 | copydll += "copy \"" + dest + "\" \"" + *dlldir + "\"\t"; | ||
1073 | } | 1313 | } |
1074 | 1314 | ||
1075 | copydll += "\n# End Special Build Tool"; | 1315 | QString deststr( "Copy " + dest + " to " ); |
1076 | project->variables()["MSVCPROJ_COPY_DLL_REL"].append( copydll ); | 1316 | for ( dlldir = dlldirs.begin(); dlldir != dlldirs.end(); ) { |
1077 | project->variables()["MSVCPROJ_COPY_DLL_DBG"].append( copydll ); | 1317 | deststr += *dlldir; |
1318 | ++dlldir; | ||
1319 | if ( dlldir != dlldirs.end() ) | ||
1320 | deststr += ", "; | ||
1321 | } | ||
1322 | |||
1323 | project->variables()["MSVCPROJ_COPY_DLL"].append( copydll ); | ||
1324 | project->variables()["MSVCPROJ_COPY_DLL_DESC"].append( deststr ); | ||
1078 | } | 1325 | } |
@@ -1087,5 +1334,4 @@ void VcprojGenerator::initOld() | |||
1087 | 1334 | ||
1088 | project->variables()["MSVCPROJ_IDLSOURCES"].append( "tmp\\" + targetfilename + ".idl" ); | 1335 | QString objdir = project->first( "OBJECTS_DIR" ); |
1089 | project->variables()["MSVCPROJ_IDLSOURCES"].append( "tmp\\" + targetfilename + ".tlb" ); | 1336 | project->variables()["MSVCPROJ_IDLSOURCES"].append( objdir + targetfilename + ".idl" ); |
1090 | project->variables()["MSVCPROJ_IDLSOURCES"].append( "tmp\\" + targetfilename + ".midl" ); | ||
1091 | if ( project->isActiveConfig( "dll" ) ) { | 1337 | if ( project->isActiveConfig( "dll" ) ) { |
@@ -1096,5 +1342,5 @@ void VcprojGenerator::initOld() | |||
1096 | "PostBuild_Cmds=" + | 1342 | "PostBuild_Cmds=" + |
1097 | idc + " %1 -idl tmp\\" + targetfilename + ".idl -version " + version + | 1343 | idc + " %1 -idl " + objdir + targetfilename + ".idl -version " + version + |
1098 | "\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" | 1344 | "\t" + idl + " /nologo " + objdir + targetfilename + ".idl /tlb " + objdir + targetfilename + ".tlb" + |
1099 | "\t" + idc + " %1 /tlb tmp\\" + targetfilename + ".tlb" | 1345 | "\t" + idc + " %1 /tlb " + objdir + targetfilename + ".tlb" |
1100 | "\tregsvr32 /s %1\n" | 1346 | "\tregsvr32 /s %1\n" |
@@ -1113,5 +1359,5 @@ void VcprojGenerator::initOld() | |||
1113 | "PostBuild_Cmds=" | 1359 | "PostBuild_Cmds=" |
1114 | "%1 -dumpidl tmp\\" + targetfilename + ".idl -version " + version + | 1360 | "%1 -dumpidl " + objdir + targetfilename + ".idl -version " + version + |
1115 | "\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" | 1361 | "\t" + idl + " /nologo " + objdir + targetfilename + ".idl /tlb " + objdir + targetfilename + ".tlb" |
1116 | "\t" + idc + " %1 /tlb tmp\\" + targetfilename + ".tlb" | 1362 | "\t" + idc + " %1 /tlb " + objdir + targetfilename + ".tlb" |
1117 | "\t%1 -regserver\n" | 1363 | "\t%1 -regserver\n" |
@@ -1125,5 +1371,7 @@ void VcprojGenerator::initOld() | |||
1125 | } | 1371 | } |
1126 | |||
1127 | } | 1372 | } |
1128 | 1373 | ||
1374 | if ( !project->variables()["DEF_FILE"].isEmpty() ) | ||
1375 | project->variables()["MSVCPROJ_LFLAGS"].append("/DEF:"+project->first("DEF_FILE")); | ||
1376 | |||
1129 | // FORMS --------------------------------------------------------- | 1377 | // FORMS --------------------------------------------------------- |
diff --git a/qmake/generators/win32/msvc_vcproj.h b/qmake/generators/win32/msvc_vcproj.h index 69e0c02..d1ca666 100644 --- a/qmake/generators/win32/msvc_vcproj.h +++ b/qmake/generators/win32/msvc_vcproj.h | |||
@@ -1,3 +1,4 @@ | |||
1 | |||
1 | /**************************************************************************** | 2 | /**************************************************************************** |
2 | ** $Id$ | 3 | ** |
3 | ** | 4 | ** |
@@ -5,7 +6,5 @@ | |||
5 | ** | 6 | ** |
6 | ** Created : 970521 | 7 | ** Copyright (C) 1992-2003 Trolltech AS. All rights reserved. |
7 | ** | ||
8 | ** Copyright (C) 1992-2002 Trolltech AS. All rights reserved. | ||
9 | ** | 8 | ** |
10 | ** This file is part of the network module of the Qt GUI Toolkit. | 9 | ** This file is part of qmake. |
11 | ** | 10 | ** |
@@ -36,2 +35,3 @@ | |||
36 | **********************************************************************/ | 35 | **********************************************************************/ |
36 | |||
37 | #ifndef __MSVC_VCPROJ_H__ | 37 | #ifndef __MSVC_VCPROJ_H__ |
@@ -65,2 +65,5 @@ public: | |||
65 | virtual bool doDepends() const { return FALSE; } //never necesary | 65 | virtual bool doDepends() const { return FALSE; } //never necesary |
66 | QString precompH, precompHFilename, | ||
67 | precompObj, precompPch; | ||
68 | bool usePCH; | ||
66 | 69 | ||
@@ -97,2 +100,3 @@ protected: | |||
97 | private: | 100 | private: |
101 | QUuid getProjectUUID(const QString &filename=QString::null); | ||
98 | QUuid increaseUUID(const QUuid &id); | 102 | QUuid increaseUUID(const QUuid &id); |
diff --git a/qmake/generators/win32/winmakefile.cpp b/qmake/generators/win32/winmakefile.cpp index bc3fed9..cd733c6 100644 --- a/qmake/generators/win32/winmakefile.cpp +++ b/qmake/generators/win32/winmakefile.cpp | |||
@@ -1,11 +1,9 @@ | |||
1 | /**************************************************************************** | 1 | /**************************************************************************** |
2 | ** $Id$ | 2 | ** |
3 | ** | 3 | ** |
4 | ** Definition of ________ class. | 4 | ** Implementation of Win32MakefileGenerator class. |
5 | ** | 5 | ** |
6 | ** Created : 970521 | 6 | ** Copyright (C) 1992-2003 Trolltech AS. All rights reserved. |
7 | ** | 7 | ** |
8 | ** Copyright (C) 1992-2000 Trolltech AS. All rights reserved. | 8 | ** This file is part of qmake. |
9 | ** | ||
10 | ** This file is part of the network module of the Qt GUI Toolkit. | ||
11 | ** | 9 | ** |
@@ -40,2 +38,3 @@ | |||
40 | #include "project.h" | 38 | #include "project.h" |
39 | #include "meta.h" | ||
41 | #include <qtextstream.h> | 40 | #include <qtextstream.h> |
@@ -99,4 +98,3 @@ Win32MakefileGenerator::writeSubDirs(QTextStream &t) | |||
99 | 98 | ||
100 | if(!project->isEmpty("MAKEFILE")) | 99 | t << "MAKEFILE = " << (project->isEmpty("MAKEFILE") ? QString("Makefile") : var("MAKEFILE")) << endl; |
101 | t << "MAKEFILE=" << var("MAKEFILE") << endl; | ||
102 | t << "QMAKE =" << (project->isEmpty("QMAKE_QMAKE") ? QString("qmake") : var("QMAKE_QMAKE")) << endl; | 100 | t << "QMAKE =" << (project->isEmpty("QMAKE_QMAKE") ? QString("qmake") : var("QMAKE_QMAKE")) << endl; |
@@ -106,3 +104,3 @@ Win32MakefileGenerator::writeSubDirs(QTextStream &t) | |||
106 | t << endl << endl; | 104 | t << endl << endl; |
107 | t << "all: qmake_all $(SUBTARGETS)" << endl << endl; | 105 | t << "all: $(MAKEFILE) $(SUBTARGETS)" << endl << endl; |
108 | 106 | ||
@@ -116,4 +114,2 @@ Win32MakefileGenerator::writeSubDirs(QTextStream &t) | |||
116 | t << mkfile << ":"; | 114 | t << mkfile << ":"; |
117 | if(project->variables()["QMAKE_NOFORCE"].isEmpty()) | ||
118 | t << " FORCE"; | ||
119 | if(have_dir) | 115 | if(have_dir) |
@@ -147,2 +143,12 @@ Win32MakefileGenerator::writeSubDirs(QTextStream &t) | |||
147 | 143 | ||
144 | if (project->isActiveConfig("ordered")) { // generate dependencies | ||
145 | for( it.toFirst(); it.current(); ) { | ||
146 | QString tar = it.current()->target; | ||
147 | ++it; | ||
148 | if (it.current()) | ||
149 | t << it.current()->target << ": " << tar << endl; | ||
150 | } | ||
151 | t << endl; | ||
152 | } | ||
153 | |||
148 | if(project->variables()["QMAKE_INTERNAL_QMAKE_DEPS"].findIndex("qmake_all") == -1) | 154 | if(project->variables()["QMAKE_INTERNAL_QMAKE_DEPS"].findIndex("qmake_all") == -1) |
@@ -177,7 +183,14 @@ Win32MakefileGenerator::writeSubDirs(QTextStream &t) | |||
177 | 183 | ||
178 | QString targs[] = { QString("clean"), QString("install"), QString("mocclean"), QString::null }; | 184 | QStringList targs; |
179 | for(int x = 0; targs[x] != QString::null; x++) { | 185 | targs << "clean" << "install_subdirs" << "mocables" << "uicables" << "uiclean" << "mocclean"; |
180 | t << targs[x] << ": qmake_all"; | 186 | targs += project->values("SUBDIR_TARGETS"); |
181 | if(targs[x] == "clean") | 187 | for(QStringList::Iterator targ_it = targs.begin(); targ_it != targs.end(); ++targ_it) { |
182 | t << varGlue("QMAKE_CLEAN","\n\t-del ","\n\t-del ", ""); | 188 | t << (*targ_it) << ": qmake_all"; |
189 | QString targ = (*targ_it); | ||
190 | if(targ == "install_subdirs") | ||
191 | targ = "install"; | ||
192 | else if(targ == "uninstall_subdirs") | ||
193 | targ = "uninstall"; | ||
194 | if(targ == "clean") | ||
195 | t << varGlue("QMAKE_CLEAN","\n\t-$(DEL_FILE) ","\n\t-$(DEL_FILE) ", ""); | ||
183 | if (!subdirs.isEmpty()) { | 196 | if (!subdirs.isEmpty()) { |
@@ -189,3 +202,3 @@ Win32MakefileGenerator::writeSubDirs(QTextStream &t) | |||
189 | QString in_file = " -f " + (*it)->makefile; | 202 | QString in_file = " -f " + (*it)->makefile; |
190 | t << "\n\t" << "$(MAKE) " << in_file << " " << targs[x]; | 203 | t << "\n\t" << "$(MAKE) " << in_file << " " << targ; |
191 | if(have_dir) { | 204 | if(have_dir) { |
@@ -204,2 +217,28 @@ Win32MakefileGenerator::writeSubDirs(QTextStream &t) | |||
204 | 217 | ||
218 | //installations | ||
219 | project->variables()["INSTALLDEPS"] += "install_subdirs"; | ||
220 | project->variables()["UNINSTALLDEPS"] += "uninstall_subdirs"; | ||
221 | writeInstalls(t, "INSTALLS"); | ||
222 | |||
223 | // user defined targets | ||
224 | QStringList &qut = project->variables()["QMAKE_EXTRA_WIN_TARGETS"]; | ||
225 | for(QStringList::Iterator sit = qut.begin(); sit != qut.end(); ++sit) { | ||
226 | QString targ = var((*sit) + ".target"), | ||
227 | cmd = var((*sit) + ".commands"), deps; | ||
228 | if(targ.isEmpty()) | ||
229 | targ = (*sit); | ||
230 | QStringList &deplist = project->variables()[(*sit) + ".depends"]; | ||
231 | for(QStringList::Iterator dep_it = deplist.begin(); dep_it != deplist.end(); ++dep_it) { | ||
232 | QString dep = var((*dep_it) + ".target"); | ||
233 | if(dep.isEmpty()) | ||
234 | dep = (*dep_it); | ||
235 | deps += " " + dep; | ||
236 | } | ||
237 | if(!project->variables()["QMAKE_NOFORCE"].isEmpty() && | ||
238 | project->variables()[(*sit) + ".CONFIG"].findIndex("phony") != -1) | ||
239 | deps += QString(" ") + "FORCE"; | ||
240 | t << "\n\n" << targ << ":" << deps << "\n\t" | ||
241 | << cmd; | ||
242 | } | ||
243 | |||
205 | if(project->variables()["QMAKE_NOFORCE"].isEmpty()) | 244 | if(project->variables()["QMAKE_NOFORCE"].isEmpty()) |
@@ -228,8 +267,6 @@ Win32MakefileGenerator::findHighestVersion(const QString &d, const QString &stem | |||
228 | } | 267 | } |
229 | if(dir.exists(dllStem + Option::prl_ext)) { | 268 | QMakeMetaInfo libinfo; |
230 | QMakeProject proj; | 269 | if(libinfo.readLib(bd + dllStem)) { |
231 | if(proj.read(bd + dllStem + Option::prl_ext, QDir::currentDirPath(), TRUE)) { | 270 | if(!libinfo.isEmpty("QMAKE_PRL_VERSION")) |
232 | if(!proj.isEmpty("QMAKE_PRL_VERSION")) | 271 | biggest = QMAX(biggest, libinfo.first("QMAKE_PRL_VERSION").replace(".", "").toInt()); |
233 | biggest = QMAX(biggest, proj.first("QMAKE_PRL_VERSION").replace(".", "").toInt()); | ||
234 | } | ||
235 | } | 272 | } |
@@ -238,2 +275,38 @@ Win32MakefileGenerator::findHighestVersion(const QString &d, const QString &stem | |||
238 | 275 | ||
276 | QString | ||
277 | Win32MakefileGenerator::findDependency(const QString &dep) | ||
278 | { | ||
279 | { | ||
280 | QStringList &qut = project->variables()["QMAKE_EXTRA_WIN_TARGETS"]; | ||
281 | for(QStringList::Iterator it = qut.begin(); it != qut.end(); ++it) { | ||
282 | QString targ = var((*it) + ".target"); | ||
283 | if(targ.isEmpty()) | ||
284 | targ = (*it); | ||
285 | if(targ.endsWith(dep)) | ||
286 | return targ; | ||
287 | } | ||
288 | } | ||
289 | { | ||
290 | QStringList &quc = project->variables()["QMAKE_EXTRA_WIN_COMPILERS"]; | ||
291 | for(QStringList::Iterator it = quc.begin(); it != quc.end(); ++it) { | ||
292 | QString tmp_out = project->variables()[(*it) + ".output"].first(); | ||
293 | QString tmp_cmd = project->variables()[(*it) + ".commands"].join(" "); | ||
294 | if(tmp_out.isEmpty() || tmp_cmd.isEmpty()) | ||
295 | continue; | ||
296 | QStringList &tmp = project->variables()[(*it) + ".input"]; | ||
297 | for(QStringList::Iterator it2 = tmp.begin(); it2 != tmp.end(); ++it2) { | ||
298 | QStringList &inputs = project->variables()[(*it2)]; | ||
299 | for(QStringList::Iterator input = inputs.begin(); input != inputs.end(); ++input) { | ||
300 | QString out = tmp_out; | ||
301 | QFileInfo fi(Option::fixPathToLocalOS((*input))); | ||
302 | out.replace("${QMAKE_FILE_BASE}", fi.baseName()); | ||
303 | out.replace("${QMAKE_FILE_NAME}", fi.fileName()); | ||
304 | if(out.endsWith(dep)) | ||
305 | return out; | ||
306 | } | ||
307 | } | ||
308 | } | ||
309 | } | ||
310 | return MakefileGenerator::findDependency(dep); | ||
311 | } | ||
239 | 312 | ||
@@ -280,3 +353,3 @@ Win32MakefileGenerator::findLibraries(const QString &where) | |||
280 | extension += ".lib"; | 353 | extension += ".lib"; |
281 | if(QFile::exists(mdd->local_dir + Option::dir_sep + lib + Option::prl_ext) || | 354 | if(QMakeMetaInfo::libExists(mdd->local_dir + Option::dir_sep + lib) || |
282 | QFile::exists(mdd->local_dir + Option::dir_sep + lib + extension)) { | 355 | QFile::exists(mdd->local_dir + Option::dir_sep + lib + extension)) { |
@@ -305,22 +378,24 @@ Win32MakefileGenerator::findLibraries(const QString &where) | |||
305 | } | 378 | } |
306 | if(file.endsWith(".lib")) { | 379 | if (!project->variables()["QMAKE_QT_DLL"].isEmpty()) { |
307 | file = file.left(file.length() - 4); | 380 | if(file.endsWith(".lib")) { |
308 | if(!file.at(file.length()-1).isNumber()) { | 381 | file = file.left(file.length() - 4); |
309 | for(MakefileDependDir *mdd = lib_dirs.first(); mdd; mdd = lib_dirs.next() ) { | 382 | if(!file.at(file.length()-1).isNumber()) { |
310 | QString lib_tmpl(file + "%1" + ".lib"); | 383 | for(MakefileDependDir *mdd = lib_dirs.first(); mdd; mdd = lib_dirs.next() ) { |
311 | int ver = findHighestVersion(mdd->local_dir, file); | 384 | QString lib_tmpl(file + "%1" + ".lib"); |
312 | if(ver != -1) { | 385 | int ver = findHighestVersion(mdd->local_dir, file); |
313 | if(ver) | 386 | if(ver != -1) { |
314 | lib_tmpl = lib_tmpl.arg(ver); | 387 | if(ver) |
315 | else | 388 | lib_tmpl = lib_tmpl.arg(ver); |
316 | lib_tmpl = lib_tmpl.arg(""); | 389 | else |
317 | if(slsh != -1) { | 390 | lib_tmpl = lib_tmpl.arg(""); |
318 | QString dir = mdd->real_dir; | 391 | if(slsh != -1) { |
319 | if(!dir.endsWith(Option::dir_sep)) | 392 | QString dir = mdd->real_dir; |
320 | dir += Option::dir_sep; | 393 | if(!dir.endsWith(Option::dir_sep)) |
321 | lib_tmpl.prepend(dir); | 394 | dir += Option::dir_sep; |
395 | lib_tmpl.prepend(dir); | ||
396 | } | ||
397 | modified_opt = TRUE; | ||
398 | (*it) = lib_tmpl; | ||
399 | break; | ||
322 | } | 400 | } |
323 | modified_opt = TRUE; | ||
324 | (*it) = lib_tmpl; | ||
325 | break; | ||
326 | } | 401 | } |
diff --git a/qmake/generators/win32/winmakefile.h b/qmake/generators/win32/winmakefile.h index 75ba0e0..dac4a99 100644 --- a/qmake/generators/win32/winmakefile.h +++ b/qmake/generators/win32/winmakefile.h | |||
@@ -1,11 +1,9 @@ | |||
1 | /**************************************************************************** | 1 | /**************************************************************************** |
2 | ** $Id$ | 2 | ** |
3 | ** | 3 | ** |
4 | ** Definition of ________ class. | 4 | ** Definition of Win32MakefileGenerator class. |
5 | ** | 5 | ** |
6 | ** Created : 970521 | 6 | ** Copyright (C) 1992-2003 Trolltech AS. All rights reserved. |
7 | ** | 7 | ** |
8 | ** Copyright (C) 1992-2000 Trolltech AS. All rights reserved. | 8 | ** This file is part of qmake. |
9 | ** | ||
10 | ** This file is part of the network module of the Qt GUI Toolkit. | ||
11 | ** | 9 | ** |
@@ -36,2 +34,3 @@ | |||
36 | **********************************************************************/ | 34 | **********************************************************************/ |
35 | |||
37 | #ifndef __WINMAKEFILE_H__ | 36 | #ifndef __WINMAKEFILE_H__ |
@@ -55,2 +54,3 @@ protected: | |||
55 | bool findLibraries(const QString &); | 54 | bool findLibraries(const QString &); |
55 | QString findDependency(const QString &); | ||
56 | virtual bool findLibraries(); | 56 | virtual bool findLibraries(); |