summaryrefslogtreecommitdiff
path: root/qmake/generators/win32/msvc_vcproj.cpp
Unidiff
Diffstat (limited to 'qmake/generators/win32/msvc_vcproj.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--qmake/generators/win32/msvc_vcproj.cpp712
1 files changed, 480 insertions, 232 deletions
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,13 +1,11 @@
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**
12** This file may be distributed under the terms of the Q Public License 10** This file may be distributed under the terms of the Q Public License
13** as defined by Trolltech AS of Norway and appearing in the file 11** as defined by Trolltech AS of Norway and appearing in the file
@@ -37,28 +35,68 @@
37 35
38#include "msvc_vcproj.h" 36#include "msvc_vcproj.h"
39#include "option.h" 37#include "option.h"
38#include "qtmd5.h" // SG's MD5 addon
40#include <qdir.h> 39#include <qdir.h>
41#include <qregexp.h> 40#include <qregexp.h>
42#include <qdict.h> 41#include <qdict.h>
43#include <quuid.h> 42#include <quuid.h>
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) 53bool use_net2003_version()
47#include <objbase.h>
48#ifndef GUID_DEFINED
49#define GUID_DEFINED
50typedef 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...
63 // If so we need to search through the registry at 101 // If so we need to search through the registry at
64 // HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\7.0\Projects 102 // HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\7.0\Projects
@@ -66,22 +104,25 @@ const char* _snlHeader = "Microsoft Visual Studio Solution File, Format Version
66 // containing "vcproj"... 104 // containing "vcproj"...
67 // Use the hardcoded value for now so projects generated on other 105 // Use the hardcoded value for now so projects generated on other
68 // platforms are actually usable. 106 // platforms are actually usable.
69const char* _snlMSVCvcprojGUID = "{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}"; 107const 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"
86 "\n\tGlobalSection(ExtensibilityAddIns) = postSolution" 127 "\n\tGlobalSection(ExtensibilityAddIns) = postSolution"
87 "\n\tEndGlobalSection"; 128 "\n\tEndGlobalSection";
@@ -126,9 +167,39 @@ struct VcsolutionDepend {
126 QString uuid; 167 QString uuid;
127 QString vcprojFile, orig_target, target; 168 QString vcprojFile, orig_target, target;
128 ::target targetType; 169 ::target targetType;
170 bool debugBuild;
129 QStringList dependencies; 171 QStringList dependencies;
130}; 172};
131 173
174QUuid 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
132QUuid VcprojGenerator::increaseUUID( const QUuid &id ) 203QUuid VcprojGenerator::increaseUUID( const QUuid &id )
133{ 204{
134 QUuid result( id ); 205 QUuid result( id );
@@ -163,24 +234,17 @@ void VcprojGenerator::writeSubDirs(QTextStream &t)
163 return; 234 return;
164 } 235 }
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) {
185 QFileInfo fi(Option::fixPathToLocalOS((*it), TRUE)); 249 QFileInfo fi(Option::fixPathToLocalOS((*it), TRUE));
186 if(fi.exists()) { 250 if(fi.exists()) {
@@ -199,8 +263,7 @@ void VcprojGenerator::writeSubDirs(QTextStream &t)
199 } 263 }
200 if(tmp_proj.read(fn, oldpwd)) { 264 if(tmp_proj.read(fn, oldpwd)) {
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") {
205 // Initialize a 'fake' project to get the correct variables 268 // Initialize a 'fake' project to get the correct variables
206 // and to be able to extract all the dependencies 269 // and to be able to extract all the dependencies
@@ -223,50 +286,67 @@ void VcprojGenerator::writeSubDirs(QTextStream &t)
223 // If file doesn't exsist, then maybe the users configuration 286 // If file doesn't exsist, then maybe the users configuration
224 // doesn't allow it to be created. Skip to next... 287 // doesn't allow it to be created. Skip to next...
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!
228 } 291 }
229 292
230 VcsolutionDepend *newDep = new VcsolutionDepend; 293 VcsolutionDepend *newDep = new VcsolutionDepend;
231 newDep->vcprojFile = fileFixify(vcproj); 294 newDep->vcprojFile = fileFixify(vcproj);
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 }
256 } 339 }
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 }
271 } 351 }
272nextfile: 352nextfile:
@@ -274,30 +354,35 @@ nextfile:
274 } 354 }
275 } 355 }
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;
282 for(QStringList::iterator dit = solution_cleanup.current()->dependencies.begin(); 366 for(QStringList::iterator dit = solution_cleanup.current()->dependencies.begin();
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}
302 387
303// ------------------------------------------------------------------------------------------------ 388// ------------------------------------------------------------------------------------------------
@@ -369,6 +454,24 @@ void VcprojGenerator::init()
369 else 454 else
370 projectTarget = SharedLib; 455 projectTarget = SharedLib;
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
373} 476}
374 477
@@ -389,8 +492,9 @@ void VcprojGenerator::initProject()
389 492
390 // Own elements ----------------------------- 493 // Own elements -----------------------------
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
395 vcProject.SccProjectName = project->first("SCCPROJECTNAME"); 499 vcProject.SccProjectName = project->first("SCCPROJECTNAME");
396 vcProject.SccLocalPath = project->first("SCCLOCALPATH"); 500 vcProject.SccLocalPath = project->first("SCCLOCALPATH");
@@ -412,35 +516,37 @@ void VcprojGenerator::initConfiguration()
412 QString temp = project->first("BuildBrowserInformation"); 516 QString temp = project->first("BuildBrowserInformation");
413 switch ( projectTarget ) { 517 switch ( projectTarget ) {
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;
420 case Application: 524 case Application:
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
445 // Configuration does not need parameters from 551 // Configuration does not need parameters from
446 // these sub XML items; 552 // these sub XML items;
@@ -448,6 +554,39 @@ void VcprojGenerator::initConfiguration()
448 initPreBuildEventTools(); 554 initPreBuildEventTools();
449 initPostBuildEventTools(); 555 initPostBuildEventTools();
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}
452 591
453void VcprojGenerator::initCompilerTool() 592void VcprojGenerator::initCompilerTool()
@@ -456,109 +595,129 @@ void VcprojGenerator::initCompilerTool()
456 if ( placement.isEmpty() ) 595 if ( placement.isEmpty() )
457 placement = ".\\"; 596 placement = ".\\";
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
464 if ( project->isActiveConfig("debug") ){ 616 if ( project->isActiveConfig("debug") ){
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 }
476 } else { 628 } else {
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 }
490 } 642 }
491 643
492 // Common for both release and debug 644 // Common for both release and debug
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
500 // Can this be set for ALL configs? 652 // Can this be set for ALL configs?
501 // If so, use qmake.conf! 653 // If so, use qmake.conf!
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('\"', "&quot;");
664
665 RConf.compiler.parseOptions( project->variables()["MSVCPROJ_INCPATH"] );
508} 666}
509 667
510void VcprojGenerator::initLibrarianTool() 668void 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}
521 680
522void VcprojGenerator::initLinkerTool() 681void 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
527 switch ( projectTarget ) { 687 switch ( projectTarget ) {
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;
535 case StaticLib: //unhandled - added to remove warnings.. 695 case StaticLib: //unhandled - added to remove warnings..
536 break; 696 break;
537 } 697 }
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 }
553 712
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 }
557 716
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 }
563 722
564} 723}
@@ -573,32 +732,22 @@ void VcprojGenerator::initCustomBuildTool()
573 732
574void VcprojGenerator::initPreBuildEventTools() 733void 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}
596 736
597void VcprojGenerator::initPostBuildEventTools() 737void 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(" && ", " &amp;&amp; ");
744 RConf.postBuild.CommandLine.replace(" && ", " &amp;&amp; ");
745 }
746 if ( !project->variables()["MSVCPROJ_COPY_DLL"].isEmpty() ) {
747 if ( !RConf.postBuild.CommandLine.isEmpty() )
748 RConf.postBuild.CommandLine += " &amp;&amp; ";
749 RConf.postBuild.Description += var("MSVCPROJ_COPY_DLL_DESC");
750 RConf.postBuild.CommandLine += var("MSVCPROJ_COPY_DLL");
602 } 751 }
603 if( project->isActiveConfig( "activeqt" ) ) { 752 if( project->isActiveConfig( "activeqt" ) ) {
604 QString name = project->first( "QMAKE_ORIG_TARGET" ); 753 QString name = project->first( "QMAKE_ORIG_TARGET" );
@@ -606,34 +755,30 @@ void VcprojGenerator::initPostBuildEventTools()
606 QString objdir = project->first( "OBJECTS_DIR" ); 755 QString objdir = project->first( "OBJECTS_DIR" );
607 QString idc = project->first( "QMAKE_IDC" ); 756 QString idc = project->first( "QMAKE_IDC" );
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 += " &amp;&amp; "; 760 RConf.postBuild.CommandLine += " &amp;&amp; ";
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 &amp;&amp; " + 765 idc + " &quot;$(TargetPath)&quot; -idl " + objdir + name + ".idl -version 1.0 &amp;&amp; " +
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 &amp;&amp; " +
619 "dump.midl /dlldata " + objdir + "dump.midl /cstub " + objdir + "dump.midl /header " + objdir + "dump.midl /proxy " + objdir + "dump.midl /sstub " +
620 objdir + "dump.midl &amp;&amp; " +
621 // call idc to replace tlb... 768 // call idc to replace tlb...
622 idc + " " + vcProject.Configuration.OutputDirectory + "\\" + nameext + " /tlb " + objdir + name + ".tlb &amp;&amp; " + 769 idc + " &quot;$(TargetPath)&quot; /tlb " + objdir + name + ".tlb &amp;&amp; " +
623 // register server 770 // register server
624 idc + " " + vcProject.Configuration.OutputDirectory + "\\" + nameext + " /regserver"; 771 idc + " &quot;$(TargetPath)&quot; /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 &amp;&amp; " + 775 "&quot;$(TargetPath)&quot; -dumpidl " + objdir + name + ".idl -version 1.0 &amp;&amp; " +
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 &amp;&amp; " +
631 "dump.midl /dlldata " + objdir + "dump.midl /cstub " + objdir + "dump.midl /header " + objdir + "dump.midl /proxy " + objdir + "dump.midl /sstub " +
632 objdir + "dump.midl &amp;&amp; " +
633 // call idc to replace tlb... 778 // call idc to replace tlb...
634 idc + " " + vcProject.Configuration.OutputDirectory + "\\" + nameext + " /tlb " + objdir + name + ".tlb &amp;&amp; " + 779 idc + " &quot;$(TargetPath)&quot; /tlb " + objdir + name + ".tlb &amp;&amp; " +
635 // call app to register 780 // call app to register
636 vcProject.Configuration.OutputDirectory + "\\" + nameext + " -regserver"; 781 "&quot;$(TargetPath)&quot; -regserver";
637 } 782 }
638 } 783 }
639} 784}
@@ -642,12 +787,88 @@ void VcprojGenerator::initPreLinkEventTools()
642{ 787{
643} 788}
644 789
790
791// ------------------------------------------------------------------
792// Helper functions to do proper sorting of the
793// qstringlists, for both flat and non-flat modes.
794inline 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}
830void 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
645void VcprojGenerator::initSourceFiles() 864void VcprojGenerator::initSourceFiles()
646{ 865{
866 vcProject.SourceFiles.flat_files = project->isActiveConfig("flat");
647 vcProject.SourceFiles.Name = "Source Files"; 867 vcProject.SourceFiles.Name = "Source Files";
648 vcProject.SourceFiles.Filter = "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"; 868 vcProject.SourceFiles.Filter = "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat";
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;
652 vcProject.SourceFiles.Config = &(vcProject.Configuration); 873 vcProject.SourceFiles.Config = &(vcProject.Configuration);
653 vcProject.SourceFiles.CustomBuild = none; 874 vcProject.SourceFiles.CustomBuild = none;
@@ -655,10 +876,16 @@ void VcprojGenerator::initSourceFiles()
655 876
656void VcprojGenerator::initHeaderFiles() 877void VcprojGenerator::initHeaderFiles()
657{ 878{
879 vcProject.HeaderFiles.flat_files = project->isActiveConfig("flat");
658 vcProject.HeaderFiles.Name = "Header Files"; 880 vcProject.HeaderFiles.Name = "Header Files";
659 vcProject.HeaderFiles.Filter = "h;hpp;hxx;hm;inl"; 881 vcProject.HeaderFiles.Filter = "h;hpp;hxx;hm;inl";
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;
663 vcProject.HeaderFiles.Config = &(vcProject.Configuration); 890 vcProject.HeaderFiles.Config = &(vcProject.Configuration);
664 vcProject.HeaderFiles.CustomBuild = moc; 891 vcProject.HeaderFiles.CustomBuild = moc;
@@ -666,10 +893,12 @@ void VcprojGenerator::initHeaderFiles()
666 893
667void VcprojGenerator::initMOCFiles() 894void 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";
670 vcProject.MOCFiles.Filter = "cpp;c;cxx;moc"; 898 vcProject.MOCFiles.Filter = "cpp;c;cxx;moc";
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;
674 vcProject.MOCFiles.Config = &(vcProject.Configuration); 903 vcProject.MOCFiles.Config = &(vcProject.Configuration);
675 vcProject.MOCFiles.CustomBuild = moc; 904 vcProject.MOCFiles.CustomBuild = moc;
@@ -677,23 +906,27 @@ void VcprojGenerator::initMOCFiles()
677 906
678void VcprojGenerator::initUICFiles() 907void 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;";
682 vcProject.UICFiles.Project = this; 912 vcProject.UICFiles.Project = this;
683 vcProject.UICFiles.Files += project->variables()["UICDECLS"]; 913 vcProject.UICFiles.Files += project->variables()["UICDECLS"];
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);
687 vcProject.UICFiles.CustomBuild = none; 918 vcProject.UICFiles.CustomBuild = none;
688} 919}
689 920
690void VcprojGenerator::initFormsFiles() 921void VcprojGenerator::initFormsFiles()
691{ 922{
923 vcProject.FormFiles.flat_files = project->isActiveConfig("flat");
692 vcProject.FormFiles.Name = "Forms"; 924 vcProject.FormFiles.Name = "Forms";
693 vcProject.FormFiles.ParseFiles = _False; 925 vcProject.FormFiles.ParseFiles = _False;
694 vcProject.FormFiles.Filter = "ui"; 926 vcProject.FormFiles.Filter = "ui";
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;
698 vcProject.FormFiles.Config = &(vcProject.Configuration); 931 vcProject.FormFiles.Config = &(vcProject.Configuration);
699 vcProject.FormFiles.CustomBuild = uic; 932 vcProject.FormFiles.CustomBuild = uic;
@@ -701,11 +934,13 @@ void VcprojGenerator::initFormsFiles()
701 934
702void VcprojGenerator::initTranslationFiles() 935void VcprojGenerator::initTranslationFiles()
703{ 936{
937 vcProject.TranslationFiles.flat_files = project->isActiveConfig("flat");
704 vcProject.TranslationFiles.Name = "Translations Files"; 938 vcProject.TranslationFiles.Name = "Translations Files";
705 vcProject.TranslationFiles.ParseFiles = _False; 939 vcProject.TranslationFiles.ParseFiles = _False;
706 vcProject.TranslationFiles.Filter = "ts"; 940 vcProject.TranslationFiles.Filter = "ts";
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;
710 vcProject.TranslationFiles.Config = &(vcProject.Configuration); 945 vcProject.TranslationFiles.Config = &(vcProject.Configuration);
711 vcProject.TranslationFiles.CustomBuild = none; 946 vcProject.TranslationFiles.CustomBuild = none;
@@ -713,18 +948,22 @@ void VcprojGenerator::initTranslationFiles()
713 948
714void VcprojGenerator::initLexYaccFiles() 949void 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";
717 vcProject.LexYaccFiles.ParseFiles = _False; 953 vcProject.LexYaccFiles.ParseFiles = _False;
718 vcProject.LexYaccFiles.Filter = "l;y"; 954 vcProject.LexYaccFiles.Filter = "l;y";
719 vcProject.LexYaccFiles.Files += project->variables()["LEXSOURCES"]; 955 vcProject.LexYaccFiles.Files += project->variables()["LEXSOURCES"];
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;
724} 962}
725 963
726void VcprojGenerator::initResourceFiles() 964void VcprojGenerator::initResourceFiles()
727{ 965{
966 vcProject.ResourceFiles.flat_files = project->isActiveConfig("flat");
728 vcProject.ResourceFiles.Name = "Resources"; 967 vcProject.ResourceFiles.Name = "Resources";
729 vcProject.ResourceFiles.ParseFiles = _False; 968 vcProject.ResourceFiles.ParseFiles = _False;
730 vcProject.ResourceFiles.Filter = "cpp;ico;png;jpg;jpeg;gif;xpm;bmp;rc;ts"; 969 vcProject.ResourceFiles.Filter = "cpp;ico;png;jpg;jpeg;gif;xpm;bmp;rc;ts";
@@ -732,9 +971,11 @@ void VcprojGenerator::initResourceFiles()
732 vcProject.ResourceFiles.Files += project->variables()["QMAKE_IMAGE_COLLECTION"]; 971 vcProject.ResourceFiles.Files += project->variables()["QMAKE_IMAGE_COLLECTION"];
733 vcProject.ResourceFiles.Files += project->variables()["IMAGES"]; 972 vcProject.ResourceFiles.Files += project->variables()["IMAGES"];
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}
739 980
740/* \internal 981/* \internal
@@ -865,7 +1106,6 @@ void VcprojGenerator::initOld()
865 project->variables()["QMAKE_LIBS_QT_ENTRY"] = "qaxserver.lib"; 1106 project->variables()["QMAKE_LIBS_QT_ENTRY"] = "qaxserver.lib";
866 if ( project->isActiveConfig( "dll" ) ) { 1107 if ( project->isActiveConfig( "dll" ) ) {
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 }
870 } 1110 }
871 if ( !project->isActiveConfig("dll") && !project->isActiveConfig("plugin") ) { 1111 if ( !project->isActiveConfig("dll") && !project->isActiveConfig("plugin") ) {
@@ -939,6 +1179,15 @@ void VcprojGenerator::initOld()
939 if ( project->isActiveConfig("moc") ) 1179 if ( project->isActiveConfig("moc") )
940 setMocAware(TRUE); 1180 setMocAware(TRUE);
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
943 project->variables()["QMAKE_LIBS"] += project->variables()["LIBS"]; 1192 project->variables()["QMAKE_LIBS"] += project->variables()["LIBS"];
944 // Update -lname to name.lib, and -Ldir to 1193 // Update -lname to name.lib, and -Ldir to
@@ -949,6 +1198,7 @@ void VcprojGenerator::initOld()
949 it = libList.remove( it ); 1198 it = libList.remove( it );
950 it = libList.insert( it, s.mid( 2 ) + ".lib" ); 1199 it = libList.insert( it, s.mid( 2 ) + ".lib" );
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 );
953 } else { 1203 } else {
954 it++; 1204 it++;
@@ -1050,31 +1300,28 @@ void VcprojGenerator::initOld()
1050 if ( project->first("TARGET").startsWith("$(QTDIR)") ) 1300 if ( project->first("TARGET").startsWith("$(QTDIR)") )
1051 dest.replace( QRegExp("\\$\\(QTDIR\\)"), getenv("QTDIR") ); 1301 dest.replace( QRegExp("\\$\\(QTDIR\\)"), getenv("QTDIR") );
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
1062 // DLL COPY ------------------------------------------------------ 1304 // DLL COPY ------------------------------------------------------
1063 if ( project->isActiveConfig("dll") && !project->variables()["DLLDESTDIR"].isEmpty() ) { 1305 if ( project->isActiveConfig("dll") && !project->variables()["DLLDESTDIR"].isEmpty() ) {
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 &quot;$(TargetPath)&quot; &quot;" + *dlldir + "&quot;";
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 }
1079 1326
1080 // ACTIVEQT ------------------------------------------------------ 1327 // ACTIVEQT ------------------------------------------------------
@@ -1085,18 +1332,17 @@ void VcprojGenerator::initOld()
1085 if ( version.isEmpty() ) 1332 if ( version.isEmpty() )
1086 version = "1.0"; 1333 version = "1.0";
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" ) ) {
1092 QString regcmd = "# Begin Special Build Tool\n" 1338 QString regcmd = "# Begin Special Build Tool\n"
1093 "TargetPath=" + targetfilename + "\n" 1339 "TargetPath=" + targetfilename + "\n"
1094 "SOURCE=$(InputPath)\n" 1340 "SOURCE=$(InputPath)\n"
1095 "PostBuild_Desc=Finalizing ActiveQt server...\n" 1341 "PostBuild_Desc=Finalizing ActiveQt server...\n"
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"
1101 "# End Special Build Tool"; 1347 "# End Special Build Tool";
1102 1348
@@ -1111,9 +1357,9 @@ void VcprojGenerator::initOld()
1111 "SOURCE=$(InputPath)\n" 1357 "SOURCE=$(InputPath)\n"
1112 "PostBuild_Desc=Finalizing ActiveQt server...\n" 1358 "PostBuild_Desc=Finalizing ActiveQt server...\n"
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"
1118 "# End Special Build Tool"; 1364 "# End Special Build Tool";
1119 1365
@@ -1123,9 +1369,11 @@ void VcprojGenerator::initOld()
1123 executable = project->variables()["MSVCPROJ_TARGETDIRDEB"].first() + "\\" + project->variables()["TARGET"].first(); 1369 executable = project->variables()["MSVCPROJ_TARGETDIRDEB"].first() + "\\" + project->variables()["TARGET"].first();
1124 project->variables()["MSVCPROJ_REGSVR_DBG"].append( regcmd.arg(executable).arg(executable).arg(executable) ); 1370 project->variables()["MSVCPROJ_REGSVR_DBG"].append( regcmd.arg(executable).arg(executable).arg(executable) );
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 ---------------------------------------------------------
1130 QStringList &list = project->variables()["FORMS"]; 1378 QStringList &list = project->variables()["FORMS"];
1131 for( it = list.begin(); it != list.end(); ++it ) { 1379 for( it = list.begin(); it != list.end(); ++it ) {