source: trunk/qmake/generators/win32/msvc_objectmodel.cpp

Last change on this file was 2, checked in by dmik, 20 years ago

Imported xplatform parts of the official release 3.3.1 from Trolltech

  • Property svn:keywords set to Id
File size: 77.7 KB
Line 
1/****************************************************************************
2** $Id: msvc_objectmodel.cpp 2 2005-11-16 15:49:26Z dmik $
3**
4** Implementation of VCProject class.
5**
6** Copyright (C) 2002-2003 Trolltech AS. All rights reserved.
7**
8** This file is part of qmake.
9**
10** This file may be distributed under the terms of the Q Public License
11** as defined by Trolltech AS of Norway and appearing in the file
12** LICENSE.QPL included in the packaging of this file.
13**
14** This file may be distributed and/or modified under the terms of the
15** GNU General Public License version 2 as published by the Free Software
16** Foundation and appearing in the file LICENSE.GPL included in the
17** packaging of this file.
18**
19** Licensees holding valid Qt Enterprise Edition licenses may use this
20** file in accordance with the Qt Commercial License Agreement provided
21** with the Software.
22**
23** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
24** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
25**
26** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
27** information about Qt Commercial License Agreements.
28** See http://www.trolltech.com/qpl/ for QPL licensing information.
29** See http://www.trolltech.com/gpl/ for GPL licensing information.
30**
31** Contact info@trolltech.com if any conditions of this licensing are
32** not clear to you.
33**
34**********************************************************************/
35
36#include "msvc_objectmodel.h"
37#include "msvc_vcproj.h"
38#include <qtextstream.h>
39#include <qstringlist.h>
40#include <qfileinfo.h>
41
42// XML Tags ---------------------------------------------------------
43const char* _xmlInit = "<?xml version=\"1.0\" encoding = \"Windows-1252\"?>";
44const char* _begConfiguration = "\n\t\t<Configuration";
45const char* _begConfigurations = "\n\t<Configurations>";
46const char* _begFile = "\n\t\t\t<File";
47const char* _begFileConfiguration = "\n\t\t\t\t<FileConfiguration";
48const char* _begFiles = "\n\t<Files>";
49const char* _begFilter = "\n\t\t<Filter";
50const char* _begGlobals = "\n\t<Globals>";
51const char* _begPlatform = "\n\t\t<Platform";
52const char* _begPlatforms = "\n\t<Platforms>";
53const char* _begTool3 = "\n\t\t\t<Tool";
54const char* _begTool5 = "\n\t\t\t\t\t<Tool";
55const char* _begVisualStudioProject = "\n<VisualStudioProject";
56const char* _endConfiguration = "\n\t\t</Configuration>";
57const char* _endConfigurations = "\n\t</Configurations>";
58const char* _endFile = "\n\t\t\t</File>";
59const char* _endFileConfiguration = "\n\t\t\t\t</FileConfiguration>";
60const char* _endFiles = "\n\t</Files>";
61const char* _endFilter = "\n\t\t</Filter>";
62const char* _endGlobals = "\n\t</Globals>";
63const char* _endPlatforms = "\n\t</Platforms>";
64const char* _endVisualStudioProject = "\n</VisualStudioProject>";
65
66// XML Properties ---------------------------------------------------
67const char* _AddModuleNamesToAssembly = "\n\t\t\t\tAddModuleNamesToAssembly=\"";
68const char* _AdditionalDependencies4 = "\n\t\t\t\tAdditionalDependencies=\"";
69const char* _AdditionalDependencies6 = "\n\t\t\t\t\t\tAdditionalDependencies=\"";
70const char* _AdditionalIncludeDirectories = "\n\t\t\t\tAdditionalIncludeDirectories=\"";
71const char* _AdditionalLibraryDirectories = "\n\t\t\t\tAdditionalLibraryDirectories=\"";
72const char* _AdditionalOptions = "\n\t\t\t\tAdditionalOptions=\"";
73const char* _AdditionalUsingDirectories = "\n\t\t\t\tAdditionalUsingDirectories=\"";
74const char* _AssemblerListingLocation = "\n\t\t\t\tAssemblerListingLocation=\"";
75const char* _AssemblerOutput = "\n\t\t\t\tAssemblerOutput=\"";
76const char* _ATLMinimizesCRunTimeLibraryUsage = "\n\t\t\tATLMinimizesCRunTimeLibraryUsage=\"";
77const char* _BaseAddress = "\n\t\t\t\tBaseAddress=\"";
78const char* _BasicRuntimeChecks = "\n\t\t\t\tBasicRuntimeChecks=\"";
79const char* _BrowseInformation = "\n\t\t\t\tBrowseInformation=\"";
80const char* _BrowseInformationFile = "\n\t\t\t\tBrowseInformationFile=\"";
81const char* _BufferSecurityCheck = "\n\t\t\t\tBufferSecurityCheck=\"";
82const char* _BuildBrowserInformation = "\n\t\t\tBuildBrowserInformation=\"";
83const char* _CPreprocessOptions = "\n\t\t\t\tCPreprocessOptions=\"";
84const char* _CallingConvention = "\n\t\t\t\tCallingConvention=\"";
85const char* _CharacterSet = "\n\t\t\tCharacterSet=\"";
86const char* _CommandLine4 = "\n\t\t\t\tCommandLine=\"";
87const char* _CommandLine6 = "\n\t\t\t\t\t\tCommandLine=\"";
88const char* _CompileAs = "\n\t\t\t\tCompileAs=\"";
89const char* _CompileAsManaged = "\n\t\t\t\tCompileAsManaged=\"";
90const char* _CompileOnly = "\n\t\t\t\tCompileOnly=\"";
91const char* _ConfigurationType = "\n\t\t\tConfigurationType=\"";
92const char* _Culture = "\n\t\t\t\tCulture=\"";
93const char* _DLLDataFileName = "\n\t\t\t\tDLLDataFileName=\"";
94const char* _DebugInformationFormat = "\n\t\t\t\tDebugInformationFormat=\"";
95const char* _DefaultCharIsUnsigned = "\n\t\t\t\tDefaultCharIsUnsigned=\"";
96const char* _DefaultCharType = "\n\t\t\t\tDefaultCharType=\"";
97const char* _DelayLoadDLLs = "\n\t\t\t\tDelayLoadDLLs=\"";
98const char* _DeleteExtensionsOnClean = "\n\t\t\tDeleteExtensionsOnClean=\"";
99const char* _Description4 = "\n\t\t\t\tDescription=\"";
100const char* _Description6 = "\n\t\t\t\t\t\tDescription=\"";
101const char* _Detect64BitPortabilityProblems = "\n\t\t\t\tDetect64BitPortabilityProblems=\"";
102const char* _DisableLanguageExtensions = "\n\t\t\t\tDisableLanguageExtensions=\"";
103const char* _DisableSpecificWarnings = "\n\t\t\t\tDisableSpecificWarnings=\"";
104const char* _EnableCOMDATFolding = "\n\t\t\t\tEnableCOMDATFolding=\"";
105const char* _EnableErrorChecks = "\n\t\t\t\tEnableErrorChecks=\"";
106const char* _EnableFiberSafeOptimizations = "\n\t\t\t\tEnableFiberSafeOptimizations=\"";
107const char* _EnableFunctionLevelLinking = "\n\t\t\t\tEnableFunctionLevelLinking=\"";
108const char* _EnableIntrinsicFunctions = "\n\t\t\t\tEnableIntrinsicFunctions=\"";
109const char* _EntryPointSymbol = "\n\t\t\t\tEntryPointSymbol=\"";
110const char* _ErrorCheckAllocations = "\n\t\t\t\tErrorCheckAllocations=\"";
111const char* _ErrorCheckBounds = "\n\t\t\t\tErrorCheckBounds=\"";
112const char* _ErrorCheckEnumRange = "\n\t\t\t\tErrorCheckEnumRange=\"";
113const char* _ErrorCheckRefPointers = "\n\t\t\t\tErrorCheckRefPointers=\"";
114const char* _ErrorCheckStubData = "\n\t\t\t\tErrorCheckStubData=\"";
115const char* _ExceptionHandling = "\n\t\t\t\tExceptionHandling=\"";
116const char* _ExcludedFromBuild = "\n\t\t\t\tExcludedFromBuild=\"";
117const char* _ExpandAttributedSource = "\n\t\t\t\tExpandAttributedSource=\"";
118const char* _ExportNamedFunctions = "\n\t\t\t\tExportNamedFunctions=\"";
119const char* _FavorSizeOrSpeed = "\n\t\t\t\tFavorSizeOrSpeed=\"";
120const char* _Filter = "\n\t\t\tFilter=\"";
121const char* _ForceConformanceInForLoopScope = "\n\t\t\t\tForceConformanceInForLoopScope=\"";
122const char* _ForceSymbolReferences = "\n\t\t\t\tForceSymbolReferences=\"";
123const char* _ForcedIncludeFiles = "\n\t\t\t\tForcedIncludeFiles=\"";
124const char* _ForcedUsingFiles = "\n\t\t\t\tForcedUsingFiles=\"";
125const char* _FullIncludePath = "\n\t\t\t\tFullIncludePath=\"";
126const char* _FunctionOrder = "\n\t\t\t\tFunctionOrder=\"";
127const char* _GenerateDebugInformation = "\n\t\t\t\tGenerateDebugInformation=\"";
128const char* _GenerateMapFile = "\n\t\t\t\tGenerateMapFile=\"";
129const char* _GeneratePreprocessedFile = "\n\t\t\t\tGeneratePreprocessedFile=\"";
130const char* _GenerateStublessProxies = "\n\t\t\t\tGenerateStublessProxies=\"";
131const char* _GenerateTypeLibrary = "\n\t\t\t\tGenerateTypeLibrary=\"";
132const char* _GlobalOptimizations = "\n\t\t\t\tGlobalOptimizations=\"";
133const char* _HeaderFileName = "\n\t\t\t\tHeaderFileName=\"";
134const char* _HeapCommitSize = "\n\t\t\t\tHeapCommitSize=\"";
135const char* _HeapReserveSize = "\n\t\t\t\tHeapReserveSize=\"";
136const char* _IgnoreAllDefaultLibraries = "\n\t\t\t\tIgnoreAllDefaultLibraries=\"";
137const char* _IgnoreDefaultLibraryNames = "\n\t\t\t\tIgnoreDefaultLibraryNames=\"";
138const char* _IgnoreEmbeddedIDL = "\n\t\t\t\tIgnoreEmbeddedIDL=\"";
139const char* _IgnoreImportLibrary = "\n\t\t\t\tIgnoreImportLibrary=\"";
140const char* _IgnoreStandardIncludePath = "\n\t\t\t\tIgnoreStandardIncludePath=\"";
141const char* _ImportLibrary = "\n\t\t\t\tImportLibrary=\"";
142const char* _ImproveFloatingPointConsistency = "\n\t\t\t\tImproveFloatingPointConsistency=\"";
143const char* _InlineFunctionExpansion = "\n\t\t\t\tInlineFunctionExpansion=\"";
144const char* _InterfaceIdentifierFileName = "\n\t\t\t\tInterfaceIdentifierFileName=\"";
145const char* _IntermediateDirectory = "\n\t\t\tIntermediateDirectory=\"";
146const char* _KeepComments = "\n\t\t\t\tKeepComments=\"";
147const char* _LargeAddressAware = "\n\t\t\t\tLargeAddressAware=\"";
148const char* _LinkDLL = "\n\t\t\t\tLinkDLL=\"";
149const char* _LinkIncremental = "\n\t\t\t\tLinkIncremental=\"";
150const char* _LinkTimeCodeGeneration = "\n\t\t\t\tLinkTimeCodeGeneration=\"";
151const char* _LinkToManagedResourceFile = "\n\t\t\t\tLinkToManagedResourceFile=\"";
152const char* _MapExports = "\n\t\t\t\tMapExports=\"";
153const char* _MapFileName = "\n\t\t\t\tMapFileName=\"";
154const char* _MapLines = "\n\t\t\t\tMapLines =\"";
155const char* _MergeSections = "\n\t\t\t\tMergeSections=\"";
156const char* _MergedIDLBaseFileName = "\n\t\t\t\tMergedIDLBaseFileName=\"";
157const char* _MidlCommandFile = "\n\t\t\t\tMidlCommandFile=\"";
158const char* _MinimalRebuild = "\n\t\t\t\tMinimalRebuild=\"";
159const char* _MkTypLibCompatible = "\n\t\t\t\tMkTypLibCompatible=\"";
160const char* _ModuleDefinitionFile = "\n\t\t\t\tModuleDefinitionFile=\"";
161const char* _Name1 = "\n\tName=\"";
162const char* _Name2 = "\n\t\tName=\"";
163const char* _Name3 = "\n\t\t\tName=\"";
164const char* _Name4 = "\n\t\t\t\tName=\"";
165const char* _Name5 = "\n\t\t\t\t\tName=\"";
166const char* _ObjectFile = "\n\t\t\t\tObjectFile=\"";
167const char* _OmitFramePointers = "\n\t\t\t\tOmitFramePointers=\"";
168const char* _Optimization = "\n\t\t\t\tOptimization =\"";
169const char* _OptimizeForProcessor = "\n\t\t\t\tOptimizeForProcessor=\"";
170const char* _OptimizeForWindows98 = "\n\t\t\t\tOptimizeForWindows98=\"";
171const char* _OptimizeForWindowsApplication = "\n\t\t\t\tOptimizeForWindowsApplication=\"";
172const char* _OptimizeReferences = "\n\t\t\t\tOptimizeReferences=\"";
173const char* _OutputDirectory3 = "\n\t\t\tOutputDirectory=\"";
174const char* _OutputDirectory4 = "\n\t\t\t\tOutputDirectory=\"";
175const char* _OutputFile = "\n\t\t\t\tOutputFile=\"";
176const char* _Outputs4 = "\n\t\t\t\tOutputs=\"";
177const char* _Outputs6 = "\n\t\t\t\t\t\tOutputs=\"";
178const char* _ParseFiles = "\n\t\t\tParseFiles=\"";
179const char* _PrecompiledHeaderFile = "\n\t\t\t\tPrecompiledHeaderFile=\"";
180const char* _PrecompiledHeaderThrough = "\n\t\t\t\tPrecompiledHeaderThrough=\"";
181const char* _PreprocessorDefinitions = "\n\t\t\t\tPreprocessorDefinitions=\"";
182const char* _PrimaryOutput = "\n\t\t\tPrimaryOutput=\"";
183const char* _ProjectGUID = "\n\tProjectGUID=\"";
184const char* _ProjectType = "\n\tProjectType=\"Visual C++\"";
185const char* _ProgramDatabase = "\n\t\t\tProgramDatabase=\"";
186const char* _ProgramDataBaseFileName = "\n\t\t\t\tProgramDataBaseFileName=\"";
187const char* _ProgramDatabaseFile = "\n\t\t\t\tProgramDatabaseFile=\"";
188const char* _ProxyFileName = "\n\t\t\t\tProxyFileName=\"";
189const char* _RedirectOutputAndErrors = "\n\t\t\t\tRedirectOutputAndErrors=\"";
190const char* _RegisterOutput = "\n\t\t\t\tRegisterOutput=\"";
191const char* _RelativePath = "\n\t\t\t\tRelativePath=\"";
192const char* _ResourceOnlyDLL = "\n\t\t\t\tResourceOnlyDLL=\"";
193const char* _ResourceOutputFileName = "\n\t\t\t\tResourceOutputFileName=\"";
194const char* _RuntimeLibrary = "\n\t\t\t\tRuntimeLibrary=\"";
195const char* _RuntimeTypeInfo = "\n\t\t\t\tRuntimeTypeInfo=\"";
196const char* _SccProjectName = "\n\tSccProjectName=\"";
197const char* _SccLocalPath = "\n\tSccLocalPath=\"";
198const char* _SetChecksum = "\n\t\t\t\tSetChecksum=\"";
199const char* _ShowIncludes = "\n\t\t\t\tShowIncludes=\"";
200const char* _ShowProgress = "\n\t\t\t\tShowProgress=\"";
201const char* _SmallerTypeCheck = "\n\t\t\t\tSmallerTypeCheck=\"";
202const char* _StackCommitSize = "\n\t\t\t\tStackCommitSize=\"";
203const char* _StackReserveSize = "\n\t\t\t\tStackReserveSize=\"";
204const char* _StringPooling = "\n\t\t\t\tStringPooling=\"";
205const char* _StripPrivateSymbols = "\n\t\t\t\tStripPrivateSymbols=\"";
206const char* _StructMemberAlignment = "\n\t\t\t\tStructMemberAlignment=\"";
207const char* _SubSystem = "\n\t\t\t\tSubSystem=\"";
208const char* _SupportUnloadOfDelayLoadedDLL = "\n\t\t\t\tSupportUnloadOfDelayLoadedDLL=\"";
209const char* _SuppressStartupBanner = "\n\t\t\t\tSuppressStartupBanner=\"";
210const char* _SwapRunFromCD = "\n\t\t\t\tSwapRunFromCD=\"";
211const char* _SwapRunFromNet = "\n\t\t\t\tSwapRunFromNet=\"";
212const char* _TargetEnvironment = "\n\t\t\t\tTargetEnvironment=\"";
213const char* _TargetMachine = "\n\t\t\t\tTargetMachine=\"";
214const char* _TerminalServerAware = "\n\t\t\t\tTerminalServerAware=\"";
215const char* _ToolName = "\n\t\t\t\tName=\"";
216const char* _ToolPath = "\n\t\t\t\tPath=\"";
217const char* _TreatWChar_tAsBuiltInType = "\n\t\t\t\tTreatWChar_tAsBuiltInType=\"";
218const char* _TurnOffAssemblyGeneration = "\n\t\t\t\tTurnOffAssemblyGeneration=\"";
219const char* _TypeLibraryFile = "\n\t\t\t\tTypeLibraryFile=\"";
220const char* _TypeLibraryName = "\n\t\t\t\tTypeLibraryName=\"";
221const char* _TypeLibraryResourceID = "\n\t\t\t\tTypeLibraryResourceID=\"";
222const char* _UndefineAllPreprocessorDefinitions = "\n\t\t\t\tUndefineAllPreprocessorDefinitions=\"";
223const char* _UndefinePreprocessorDefinitions = "\n\t\t\t\tUndefinePreprocessorDefinitions=\"";
224const char* _UseOfATL = "\n\t\t\tUseOfATL=\"";
225const char* _UseOfMfc = "\n\t\t\tUseOfMfc=\"";
226const char* _UsePrecompiledHeader = "\n\t\t\t\tUsePrecompiledHeader=\"";
227const char* _ValidateParameters = "\n\t\t\t\tValidateParameters=\"";
228const char* _VCCLCompilerToolName = "\n\t\t\t\tName=\"VCCLCompilerTool\"";
229const char* _VCCustomBuildTool = "\n\t\t\t\t\t\tName=\"VCCustomBuildTool\"";
230const char* _VCLinkerToolName = "\n\t\t\t\tName=\"VCLinkerTool\"";
231const char* _VCResourceCompilerToolName = "\n\t\t\t\tName=\"VCResourceCompilerTool\"";
232const char* _VCMIDLToolName = "\n\t\t\t\tName=\"VCMIDLTool\"";
233const char* _Version1 = "\n\tVersion=\"";
234const char* _Version4 = "\n\t\t\t\tVersion=\"";
235const char* _WarnAsError = "\n\t\t\t\tWarnAsError=\"";
236const char* _WarnLevel = "\n\t\t\t\tWarnLevel=\"";
237const char* _WarningLevel = "\n\t\t\t\tWarningLevel=\"";
238const char* _WholeProgramOptimization = "\n\t\t\t\tWholeProgramOptimization=\"";
239
240// Property name and value as Pairs ---------------------------------
241struct TPair {
242 TPair( const char* n, const triState v ) : name(n), value(v) {};
243 const char* name;
244 const triState value;
245};
246struct EPair {
247 EPair( const char* n, const int v ) : name(n), value(v) {};
248 const char* name;
249 const int value;
250};
251struct LPair {
252 LPair( const char* n, const long v ) : name(n), value(v) {};
253 const char* name;
254 const long value;
255};
256struct SPair {
257 SPair( const char* n, const QString& v ) : name(n), value(v) {};
258 const char* name;
259 const QString& value;
260};
261struct XPair {
262 XPair( const char* n, const QStringList& v, const char* s = "," ) : name(n), value(v), sep(s) {};
263 const char* name;
264 const QStringList& value;
265 const char* sep;
266};
267
268// void streamSPair( QTextStream &strm, const char *n, const QString &s )
269
270// Streaming operators for property Pairs ---------------------------
271QTextStream &operator<<( QTextStream &strm, const TPair &prop )
272{
273 switch( prop.value ) {
274 case _False:
275 strm << prop.name << "FALSE\"";
276 break;
277 case _True:
278 strm << prop.name << "TRUE\"";
279 break;
280 case unset:
281 default:
282 break;
283 }
284 return strm;
285}
286
287/* Be sure to check that each enum is not set to
288 default before streaming it out. Defaults seem
289 to not be in the XML file.
290*/
291QTextStream &operator<<( QTextStream &strm, const EPair &prop )
292{
293 strm << prop.name << prop.value << "\"";
294 return strm;
295}
296
297QTextStream &operator<<( QTextStream &strm, const LPair &prop )
298{
299 strm << prop.name << prop.value << "\"";
300 return strm;
301}
302
303QTextStream &operator<<( QTextStream &strm, const SPair &prop )
304{
305 if ( !prop.value.isEmpty() )
306 strm << prop.name << QString(prop.value).remove("\"") << "\"";
307 return strm;
308}
309
310QTextStream &operator<<( QTextStream &strm, const XPair &prop )
311{
312 if ( !prop.value.isEmpty() )
313 strm << prop.name << prop.value.join(prop.sep).latin1() << "\"";
314 return strm;
315}
316
317// VCCLCompilerTool -------------------------------------------------
318VCCLCompilerTool::VCCLCompilerTool()
319 : AssemblerOutput( asmListingNone ),
320 BasicRuntimeChecks( runtimeBasicCheckNone ),
321 BrowseInformation( brInfoNone ),
322 BufferSecurityCheck( _False ),
323 CallingConvention( callConventionDefault ),
324 CompileAs( compileAsDefault ),
325 CompileAsManaged( managedDefault ),
326 CompileOnly( unset ),
327 DebugInformationFormat( debugDisabled ),
328 DefaultCharIsUnsigned( unset ),
329 Detect64BitPortabilityProblems( unset ),
330 DisableLanguageExtensions( unset ),
331 EnableFiberSafeOptimizations( unset ),
332 EnableFunctionLevelLinking( unset ),
333 EnableIntrinsicFunctions( unset ),
334 ExceptionHandling( _False ),
335 ExpandAttributedSource( unset ),
336 FavorSizeOrSpeed( favorNone ),
337 ForceConformanceInForLoopScope( unset ),
338 GeneratePreprocessedFile( preprocessNo ),
339 GlobalOptimizations( unset ),
340 IgnoreStandardIncludePath( unset ),
341 ImproveFloatingPointConsistency( unset ),
342 InlineFunctionExpansion( expandDefault ),
343 KeepComments( unset ),
344 MinimalRebuild( unset ),
345 OmitFramePointers( unset ),
346 Optimization( optimizeCustom ),
347 OptimizeForProcessor( procOptimizeBlended ),
348 OptimizeForWindowsApplication( unset ),
349 ProgramDataBaseFileName( "" ),
350 RuntimeLibrary( rtMultiThreaded ),
351 RuntimeTypeInfo( unset ),
352 ShowIncludes( unset ),
353 SmallerTypeCheck( unset ),
354 StringPooling( unset ),
355 StructMemberAlignment( alignNotSet ),
356 SuppressStartupBanner( unset ),
357 TreatWChar_tAsBuiltInType( unset ),
358 TurnOffAssemblyGeneration( unset ),
359 UndefineAllPreprocessorDefinitions( unset ),
360 UsePrecompiledHeader( pchNone ),
361 WarnAsError( unset ),
362 WarningLevel( warningLevel_0 ),
363 WholeProgramOptimization( unset )
364{
365}
366
367QTextStream &operator<<( QTextStream &strm, const VCCLCompilerTool &tool )
368{
369 strm << _begTool3;
370 strm << _VCCLCompilerToolName;
371 strm << XPair( _AdditionalIncludeDirectories, tool.AdditionalIncludeDirectories );
372 strm << XPair( _AdditionalOptions, tool.AdditionalOptions, " " );
373 strm << XPair( _AdditionalUsingDirectories, tool.AdditionalUsingDirectories );
374 strm << SPair( _AssemblerListingLocation, tool.AssemblerListingLocation );
375 if ( tool.AssemblerOutput != asmListingNone ) strm << EPair( _AssemblerOutput, tool.AssemblerOutput );
376 if ( tool.BasicRuntimeChecks != runtimeBasicCheckNone ) strm << EPair( _BasicRuntimeChecks, tool.BasicRuntimeChecks );
377 if ( tool.BrowseInformation != brInfoNone ) strm << EPair( _BrowseInformation, tool.BrowseInformation );
378 strm << SPair( _BrowseInformationFile, tool.BrowseInformationFile );
379 strm << TPair( _BufferSecurityCheck, tool.BufferSecurityCheck );
380 if ( tool.CallingConvention != callConventionDefault ) strm << EPair( _CallingConvention, tool.CallingConvention );
381 if ( tool.CompileAs != compileAsDefault ) strm << EPair( _CompileAs, tool.CompileAs );
382 if ( tool.CompileAsManaged != managedDefault ) strm << EPair( _CompileAsManaged, tool.CompileAsManaged );
383 strm << TPair( _CompileOnly, tool.CompileOnly );
384 if ( tool.DebugInformationFormat != debugUnknown ) strm << EPair( _DebugInformationFormat, tool.DebugInformationFormat );
385 strm << TPair( _DefaultCharIsUnsigned, tool.DefaultCharIsUnsigned );
386 strm << TPair( _Detect64BitPortabilityProblems, tool.Detect64BitPortabilityProblems );
387 strm << TPair( _DisableLanguageExtensions, tool.DisableLanguageExtensions );
388 strm << XPair( _DisableSpecificWarnings, tool.DisableSpecificWarnings );
389 strm << TPair( _EnableFiberSafeOptimizations, tool.EnableFiberSafeOptimizations );
390 strm << TPair( _EnableFunctionLevelLinking, tool.EnableFunctionLevelLinking );
391 strm << TPair( _EnableIntrinsicFunctions, tool.EnableIntrinsicFunctions );
392 strm << TPair( _ExceptionHandling, tool.ExceptionHandling );
393 strm << TPair( _ExpandAttributedSource, tool.ExpandAttributedSource );
394 if ( tool.FavorSizeOrSpeed != favorNone ) strm << EPair( _FavorSizeOrSpeed, tool.FavorSizeOrSpeed );
395 strm << TPair( _ForceConformanceInForLoopScope, tool.ForceConformanceInForLoopScope );
396 strm << XPair( _ForcedIncludeFiles, tool.ForcedIncludeFiles );
397 strm << XPair( _ForcedUsingFiles, tool.ForcedUsingFiles );
398 if ( tool.GeneratePreprocessedFile != preprocessUnknown)strm << EPair( _GeneratePreprocessedFile, tool.GeneratePreprocessedFile );
399 strm << TPair( _GlobalOptimizations, tool.GlobalOptimizations );
400 strm << TPair( _IgnoreStandardIncludePath, tool.IgnoreStandardIncludePath );
401 strm << TPair( _ImproveFloatingPointConsistency, tool.ImproveFloatingPointConsistency );
402 if ( tool.InlineFunctionExpansion != expandDefault ) strm << EPair( _InlineFunctionExpansion, tool.InlineFunctionExpansion );
403 strm << TPair( _KeepComments, tool.KeepComments );
404 strm << TPair( _MinimalRebuild, tool.MinimalRebuild );
405 strm << SPair( _ObjectFile, tool.ObjectFile );
406 strm << TPair( _OmitFramePointers, tool.OmitFramePointers );
407 if ( tool.Optimization != optimizeDefault ) strm << EPair( _Optimization, tool.Optimization );
408 if ( tool.OptimizeForProcessor != procOptimizeBlended ) strm << EPair( _OptimizeForProcessor, tool.OptimizeForProcessor );
409 strm << TPair( _OptimizeForWindowsApplication, tool.OptimizeForWindowsApplication );
410 strm << SPair( _OutputFile, tool.OutputFile );
411 strm << SPair( _PrecompiledHeaderFile, tool.PrecompiledHeaderFile );
412 strm << SPair( _PrecompiledHeaderThrough, tool.PrecompiledHeaderThrough );
413 strm << XPair( _PreprocessorDefinitions, tool.PreprocessorDefinitions );
414 if ( !tool.ProgramDataBaseFileName.isNull() ) strm << _ProgramDataBaseFileName << tool.ProgramDataBaseFileName.latin1() << "\"";
415 if ( tool.RuntimeLibrary != rtUnknown ) strm << EPair( _RuntimeLibrary, tool.RuntimeLibrary );
416 strm << TPair( _RuntimeTypeInfo, tool.RuntimeTypeInfo );
417 strm << TPair( _ShowIncludes, tool.ShowIncludes );
418 strm << TPair( _SmallerTypeCheck, tool.SmallerTypeCheck );
419 strm << TPair( _StringPooling, tool.StringPooling );
420 if ( tool.StructMemberAlignment != alignNotSet ) strm << EPair( _StructMemberAlignment, tool.StructMemberAlignment );
421 strm << TPair( _SuppressStartupBanner, tool.SuppressStartupBanner );
422 strm << TPair( _TreatWChar_tAsBuiltInType, tool.TreatWChar_tAsBuiltInType );
423 strm << TPair( _TurnOffAssemblyGeneration, tool.TurnOffAssemblyGeneration );
424 strm << TPair( _UndefineAllPreprocessorDefinitions, tool.UndefineAllPreprocessorDefinitions );
425 strm << XPair( _UndefinePreprocessorDefinitions, tool.UndefinePreprocessorDefinitions );
426 if ( !tool.PrecompiledHeaderFile.isEmpty() ||
427 !tool.PrecompiledHeaderThrough.isEmpty() )
428 strm << EPair( _UsePrecompiledHeader, tool.UsePrecompiledHeader );
429 strm << TPair( _WarnAsError, tool.WarnAsError );
430 if ( tool.WarningLevel != warningLevelUnknown ) strm << EPair( _WarningLevel, tool.WarningLevel );
431 strm << TPair( _WholeProgramOptimization, tool.WholeProgramOptimization );
432 strm << "/>";
433return strm;
434}
435
436bool VCCLCompilerTool::parseOption( const char* option )
437{
438 // skip index 0 ('/' or '-')
439 char first = option[1];
440 char second = option[2];
441 char third = option[3];
442 char fourth = option[4];
443 bool found = TRUE;
444
445 switch ( first ) {
446 case '?':
447 case 'h':
448 qWarning( "Generator: Option '/?', '/help': MSVC.NET projects do not support outputting help info" );
449 found = FALSE;
450 break;
451 case '@':
452 qWarning( "Generator: Option '/@': MSVC.NET projects do not support the use of a response file" );
453 found = FALSE;
454 break;
455 case 'l':
456 qWarning( "Generator: Option '/link': qmake generator does not support passing link options through the compiler tool" );
457 found = FALSE;
458 break;
459 case 'A':
460 if ( second != 'I' ) {
461 found = FALSE; break;
462 }
463 AdditionalUsingDirectories += option+3;
464 break;
465 case 'C':
466 KeepComments = _True;
467 break;
468 case 'D':
469 PreprocessorDefinitions += option+2;
470 break;
471 case 'E':
472 if ( second == 'H' ) {
473 if ( third == 'a'
474 || (third == 'c' && fourth != 's')
475 || (third == 's' && fourth != 'c') ) {
476 // ExceptionHandling must be false, or it will override
477 // with an /EHsc option
478 ExceptionHandling = _False;
479 AdditionalOptions += option;
480 break;
481 } else if ( (third == 'c' && fourth == 's')
482 || (third == 's' && fourth == 'c') ) {
483 ExceptionHandling = _True;
484 AdditionalOptions += option;
485 break;
486 }
487 found = FALSE; break;
488 }
489 GeneratePreprocessedFile = preprocessYes;
490 break;
491 case 'F':
492 if ( second <= '9' && second >= '0' ) {
493 AdditionalOptions += option;
494 break;
495 } else {
496 switch ( second ) {
497 case 'A':
498 if ( third == 'c' ) {
499 AssemblerOutput = asmListingAsmMachine;
500 if ( fourth == 's' )
501 AssemblerOutput = asmListingAsmMachineSrc;
502 } else if ( third == 's' ) {
503 AssemblerOutput = asmListingAsmSrc;
504 } else {
505 AssemblerOutput = asmListingAssemblyOnly;
506 }
507 break;
508 case 'a':
509 AssemblerListingLocation = option+3;
510 break;
511 case 'I':
512 ForcedIncludeFiles += option+3;
513 break;
514 case 'R':
515 BrowseInformation = brAllInfo;
516 BrowseInformationFile = option+3;
517 break;
518 case 'r':
519 BrowseInformation = brNoLocalSymbols;
520 BrowseInformationFile = option+3;
521 break;
522 case 'U':
523 ForcedUsingFiles += option+3;
524 break;
525 case 'd':
526 ProgramDataBaseFileName = option+3;
527 break;
528 case 'e':
529 OutputFile = option+3;
530 break;
531 case 'm':
532 AdditionalOptions += option;
533 break;
534 case 'o':
535 ObjectFile = option+3;
536 break;
537 case 'p':
538 PrecompiledHeaderFile = option+3;
539 break;
540 case 'x':
541 ExpandAttributedSource = _True;
542 break;
543 default:
544 found = FALSE; break;
545 }
546 }
547 break;
548 case 'G':
549 switch ( second ) {
550 case '3':
551 case '4':
552 qWarning( "Option '/G3' and '/G4' were phased out in Visual C++ 5.0" );
553 found = FALSE; break;
554 case '5':
555 OptimizeForProcessor = procOptimizePentium;
556 break;
557 case '6':
558 case 'B':
559 OptimizeForProcessor = procOptimizePentiumProAndAbove;
560 break;
561 case 'A':
562 OptimizeForWindowsApplication = _True;
563 break;
564 case 'F':
565 StringPooling = _True;
566 break;
567 case 'H':
568 AdditionalOptions += option;
569 break;
570 case 'L':
571 WholeProgramOptimization = _True;
572 if ( third == '-' )
573 WholeProgramOptimization = _False;
574 break;
575 case 'R':
576 RuntimeTypeInfo = _True;
577 if ( third == '-' )
578 RuntimeTypeInfo = _False;
579 break;
580 case 'S':
581 BufferSecurityCheck = _True;
582 break;
583 case 'T':
584 EnableFiberSafeOptimizations = _True;
585 break;
586 case 'X':
587 // ExceptionHandling == true will override with
588 // an /EHsc option, which is correct with /GX
589 ExceptionHandling = _True; // Fall-through
590 case 'Z':
591 case 'e':
592 case 'h':
593 AdditionalOptions += option;
594 break;
595 case 'd':
596 CallingConvention = callConventionCDecl;
597 break;
598 case 'f':
599 StringPooling = _True;
600 AdditionalOptions += option;
601 break;
602 case 'm':
603 MinimalRebuild = _True;
604 if ( third == '-' )
605 MinimalRebuild = _False;
606 break;
607 case 'r':
608 CallingConvention = callConventionFastCall;
609 break;
610 case 's':
611 // Warning: following [num] is not used,
612 // were should we put it?
613 BufferSecurityCheck = _True;
614 break;
615 case 'y':
616 EnableFunctionLevelLinking = _True;
617 break;
618 case 'z':
619 CallingConvention = callConventionStdCall;
620 break;
621 default:
622 found = FALSE; break;
623 }
624 break;
625 case 'H':
626 AdditionalOptions += option;
627 break;
628 case 'I':
629 AdditionalIncludeDirectories += option+2;
630 break;
631 case 'L':
632 if ( second == 'D' ) {
633 AdditionalOptions += option;
634 break;
635 }
636 found = FALSE; break;
637 case 'M':
638 if ( second == 'D' ) {
639 RuntimeLibrary = rtMultiThreadedDLL;
640 if ( third == 'd' )
641 RuntimeLibrary = rtMultiThreadedDebugDLL;
642 break;
643 } else if ( second == 'L' ) {
644 RuntimeLibrary = rtSingleThreaded;
645 if ( third == 'd' )
646 RuntimeLibrary = rtSingleThreadedDebug;
647 break;
648 } else if ( second == 'T' ) {
649 RuntimeLibrary = rtMultiThreaded;
650 if ( third == 'd' )
651 RuntimeLibrary = rtMultiThreadedDebug;
652 break;
653 }
654 found = FALSE; break;
655 case 'O':
656 switch ( second ) {
657 case '1':
658 Optimization = optimizeMinSpace;
659 break;
660 case '2':
661 Optimization = optimizeMaxSpeed;
662 break;
663 case 'a':
664 AdditionalOptions += option;
665 break;
666 case 'b':
667 if ( third == '0' )
668 InlineFunctionExpansion = expandDisable;
669 else if ( third == '1' )
670 InlineFunctionExpansion = expandOnlyInline;
671 else if ( third == '2' )
672 InlineFunctionExpansion = expandAnySuitable;
673 else
674 found = FALSE;
675 break;
676 case 'd':
677 Optimization = optimizeDisabled;
678 break;
679 case 'g':
680 GlobalOptimizations = _True;
681 break;
682 case 'i':
683 EnableIntrinsicFunctions = _True;
684 break;
685 case 'p':
686 ImproveFloatingPointConsistency = _True;
687 if ( third == '-' )
688 ImproveFloatingPointConsistency = _False;
689 break;
690 case 's':
691 FavorSizeOrSpeed = favorSize;
692 break;
693 case 't':
694 FavorSizeOrSpeed = favorSpeed;
695 break;
696 case 'w':
697 AdditionalOptions += option;
698 break;
699 case 'x':
700 Optimization = optimizeFull;
701 break;
702 case 'y':
703 OmitFramePointers = _True;
704 if ( third == '-' )
705 OmitFramePointers = _False;
706 break;
707 default:
708 found = FALSE; break;
709 }
710 break;
711 case 'P':
712 GeneratePreprocessedFile = preprocessYes;
713 break;
714 case 'Q':
715 if ( second == 'I' ) {
716 AdditionalOptions += option;
717 break;
718 }
719 found = FALSE; break;
720 case 'R':
721 if ( second == 'T' && third == 'C' ) {
722 if ( fourth == '1' )
723 BasicRuntimeChecks = runtimeBasicCheckAll;
724 else if ( fourth == 'c' )
725 SmallerTypeCheck = _True;
726 else if ( fourth == 's' )
727 BasicRuntimeChecks = runtimeCheckStackFrame;
728 else if ( fourth == 'u' )
729 BasicRuntimeChecks = runtimeCheckUninitVariables;
730 else
731 found = FALSE; break;
732 }
733 break;
734 case 'T':
735 if ( second == 'C' ) {
736 CompileAs = compileAsC;
737 } else if ( second == 'P' ) {
738 CompileAs = compileAsCPlusPlus;
739 } else {
740 qWarning( "Generator: Options '/Tp<filename>' and '/Tc<filename>' are not supported by qmake" );
741 found = FALSE; break;
742 }
743 break;
744 case 'U':
745 UndefinePreprocessorDefinitions += option+2;
746 break;
747 case 'V':
748 AdditionalOptions += option;
749 break;
750 case 'W':
751 switch ( second ) {
752 case 'a':
753 case '4':
754 WarningLevel = warningLevel_4;
755 break;
756 case '3':
757 WarningLevel = warningLevel_3;
758 break;
759 case '2':
760 WarningLevel = warningLevel_2;
761 break;
762 case '1':
763 WarningLevel = warningLevel_1;
764 break;
765 case '0':
766 WarningLevel = warningLevel_0;
767 break;
768 case 'L':
769 AdditionalOptions += option;
770 break;
771 case 'X':
772 WarnAsError = _True;
773 break;
774 case 'p':
775 if ( third == '6' && fourth == '4' ) {
776 Detect64BitPortabilityProblems = _True;
777 break;
778 }
779 // Fallthrough
780 default:
781 found = FALSE; break;
782 }
783 break;
784 case 'X':
785 IgnoreStandardIncludePath = _True;
786 break;
787 case 'Y':
788 switch ( second ) {
789 case '\0':
790 case '-':
791 AdditionalOptions += option;
792 break;
793 case 'X':
794 UsePrecompiledHeader = pchGenerateAuto;
795 PrecompiledHeaderFile = option+3;
796 break;
797 case 'c':
798 UsePrecompiledHeader = pchCreateUsingSpecific;
799 PrecompiledHeaderFile = option+3;
800 break;
801 case 'd':
802 case 'l':
803 AdditionalOptions =+ option;
804 break;
805 case 'u':
806 UsePrecompiledHeader = pchUseUsingSpecific;
807 PrecompiledHeaderFile = option+3;
808 break;
809 default:
810 found = FALSE; break;
811 }
812 break;
813 case 'Z':
814 switch ( second ) {
815 case '7':
816 DebugInformationFormat = debugOldStyleInfo;
817 break;
818 case 'I':
819 DebugInformationFormat = debugEditAndContinue;
820 break;
821 case 'd':
822 DebugInformationFormat = debugLineInfoOnly;
823 break;
824 case 'i':
825 DebugInformationFormat = debugEnabled;
826 break;
827 case 'l':
828 DebugInformationFormat = debugEditAndContinue;
829 break;
830 case 'a':
831 DisableLanguageExtensions = _True;
832 break;
833 case 'e':
834 DisableLanguageExtensions = _False;
835 break;
836 case 'c':
837 if ( third == ':' ) {
838 if ( fourth == 'f' )
839 ForceConformanceInForLoopScope = _True;
840 else if ( fourth == 'w' )
841 TreatWChar_tAsBuiltInType = _True;
842 else
843 found = FALSE;
844 } else {
845 found = FALSE; break;
846 }
847 break;
848 case 'g':
849 case 'm':
850 case 's':
851 AdditionalOptions += option;
852 break;
853 case 'p':
854 switch ( third )
855 {
856 case '\0':
857 case '1':
858 StructMemberAlignment = alignSingleByte;
859 if ( fourth == '6' )
860 StructMemberAlignment = alignSixteenBytes;
861 break;
862 case '2':
863 StructMemberAlignment = alignTwoBytes;
864 break;
865 case '4':
866 StructMemberAlignment = alignFourBytes;
867 break;
868 case '8':
869 StructMemberAlignment = alignEightBytes;
870 break;
871 default:
872 found = FALSE; break;
873 }
874 break;
875 default:
876 found = FALSE; break;
877 }
878 break;
879 case 'c':
880 if ( second == '\0' ) {
881 CompileOnly = _True;
882 } else if ( second == 'l' ) {
883 if ( *(option+5) == 'n' ) {
884 CompileAsManaged = managedAssembly;
885 TurnOffAssemblyGeneration = _True;
886 } else {
887 CompileAsManaged = managedAssembly;
888 }
889 } else {
890 found = FALSE; break;
891 }
892 break;
893 case 'd':
894 if ( second != 'r' ) {
895 found = FALSE; break;
896 }
897 CompileAsManaged = managedAssembly;
898 break;
899 case 'n':
900 if ( second == 'o' && third == 'B' && fourth == 'o' ) {
901 AdditionalOptions += "/noBool";
902 break;
903 }
904 if ( second == 'o' && third == 'l' && fourth == 'o' ) {
905 SuppressStartupBanner = _True;
906 break;
907 }
908 found = FALSE; break;
909 case 's':
910 if ( second == 'h' && third == 'o' && fourth == 'w' ) {
911 ShowIncludes = _True;
912 break;
913 }
914 found = FALSE; break;
915 case 'u':
916 UndefineAllPreprocessorDefinitions = _True;
917 break;
918 case 'v':
919 if ( second == 'd' || second == 'm' ) {
920 AdditionalOptions += option;
921 break;
922 }
923 found = FALSE; break;
924 case 'w':
925 switch ( second ) {
926 case '\0':
927 WarningLevel = warningLevel_0;
928 break;
929 case 'd':
930 DisableSpecificWarnings += option+3;
931 break;
932 default:
933 AdditionalOptions += option;
934 }
935 break;
936 default:
937 found = FALSE; break;
938 }
939 if( !found )
940 warn_msg( WarnLogic, "Could not parse Compiler option: %s", option );
941 return TRUE;
942}
943
944// VCLinkerTool -----------------------------------------------------
945VCLinkerTool::VCLinkerTool()
946 : EnableCOMDATFolding( optFoldingDefault ),
947 GenerateDebugInformation( unset ),
948 GenerateMapFile( unset ),
949 HeapCommitSize( -1 ),
950 HeapReserveSize( -1 ),
951 IgnoreAllDefaultLibraries( unset ),
952 IgnoreEmbeddedIDL( unset ),
953 IgnoreImportLibrary( _True ),
954 LargeAddressAware( addrAwareDefault ),
955 LinkDLL( unset ),
956 LinkIncremental( linkIncrementalDefault ),
957 LinkTimeCodeGeneration( unset ),
958 MapExports( unset ),
959 MapLines( unset ),
960 OptimizeForWindows98( optWin98Default ),
961 OptimizeReferences( optReferencesDefault ),
962 RegisterOutput( unset ),
963 ResourceOnlyDLL( unset ),
964 SetChecksum( unset ),
965 ShowProgress( linkProgressNotSet ),
966 StackCommitSize( -1 ),
967 StackReserveSize( -1 ),
968 SubSystem( subSystemNotSet ),
969 SupportUnloadOfDelayLoadedDLL( unset ),
970 SuppressStartupBanner( unset ),
971 SwapRunFromCD( unset ),
972 SwapRunFromNet( unset ),
973 TargetMachine( machineNotSet ),
974 TerminalServerAware( termSvrAwareDefault ),
975 TurnOffAssemblyGeneration( unset ),
976 TypeLibraryResourceID( 0 )
977{
978}
979
980QTextStream &operator<<( QTextStream &strm, const VCLinkerTool &tool )
981{
982 strm << _begTool3;
983 strm << _VCLinkerToolName;
984 strm << XPair( _AdditionalDependencies4, tool.AdditionalDependencies, " " );
985 strm << XPair( _AdditionalLibraryDirectories, tool.AdditionalLibraryDirectories );
986 strm << XPair( _AdditionalOptions, tool.AdditionalOptions, " " );
987 strm << XPair( _AddModuleNamesToAssembly, tool.AddModuleNamesToAssembly );
988 strm << SPair( _BaseAddress, tool.BaseAddress );
989 strm << XPair( _DelayLoadDLLs, tool.DelayLoadDLLs );
990 if ( tool.EnableCOMDATFolding != optFoldingDefault ) strm << EPair( _EnableCOMDATFolding, tool.EnableCOMDATFolding );
991 strm << SPair( _EntryPointSymbol, tool.EntryPointSymbol );
992 strm << XPair( _ForceSymbolReferences, tool.ForceSymbolReferences );
993 strm << SPair( _FunctionOrder, tool.FunctionOrder );
994 strm << TPair( _GenerateDebugInformation, tool.GenerateDebugInformation );
995 strm << TPair( _GenerateMapFile, tool.GenerateMapFile );
996 if ( tool.HeapCommitSize != -1 ) strm << LPair( _HeapCommitSize, tool.HeapCommitSize );
997 if ( tool.HeapReserveSize != -1 ) strm << LPair( _HeapReserveSize, tool.HeapReserveSize );
998 strm << TPair( _IgnoreAllDefaultLibraries, tool.IgnoreAllDefaultLibraries );
999 strm << XPair( _IgnoreDefaultLibraryNames, tool.IgnoreDefaultLibraryNames );
1000 strm << TPair( _IgnoreEmbeddedIDL, tool.IgnoreEmbeddedIDL );
1001 strm << TPair( _IgnoreImportLibrary, tool.IgnoreImportLibrary );
1002 strm << SPair( _ImportLibrary, tool.ImportLibrary );
1003 if ( tool.LargeAddressAware != addrAwareDefault ) strm << EPair( _LargeAddressAware, tool.LargeAddressAware );
1004 strm << TPair( _LinkDLL, tool.LinkDLL );
1005 if ( tool.LinkIncremental != linkIncrementalDefault ) strm << EPair( _LinkIncremental, tool.LinkIncremental );
1006 strm << TPair( _LinkTimeCodeGeneration, tool.LinkTimeCodeGeneration );
1007 strm << SPair( _LinkToManagedResourceFile, tool.LinkToManagedResourceFile );
1008 strm << TPair( _MapExports, tool.MapExports );
1009 strm << SPair( _MapFileName, tool.MapFileName );
1010 strm << TPair( _MapLines, tool.MapLines );
1011 strm << SPair( _MergedIDLBaseFileName, tool.MergedIDLBaseFileName );
1012 strm << SPair( _MergeSections, tool.MergeSections );
1013 strm << SPair( _MidlCommandFile, tool.MidlCommandFile );
1014 strm << SPair( _ModuleDefinitionFile, tool.ModuleDefinitionFile );
1015 if ( tool.OptimizeForWindows98 != optWin98Default ) strm << EPair( _OptimizeForWindows98, tool.OptimizeForWindows98 );
1016 if ( tool.OptimizeReferences != optReferencesDefault ) strm << EPair( _OptimizeReferences, tool.OptimizeReferences );
1017 strm << SPair( _OutputFile, tool.OutputFile );
1018 strm << _ProgramDatabaseFile << tool.ProgramDatabaseFile << "\"";
1019 strm << TPair( _RegisterOutput, tool.RegisterOutput );
1020 strm << TPair( _ResourceOnlyDLL, tool.ResourceOnlyDLL );
1021 strm << TPair( _SetChecksum, tool.SetChecksum );
1022 if ( tool.ShowProgress != linkProgressNotSet ) strm << EPair( _ShowProgress, tool.ShowProgress );
1023 if ( tool.StackCommitSize != -1 ) strm << LPair( _StackCommitSize, tool.StackCommitSize );
1024 if ( tool.StackReserveSize != -1 ) strm << LPair( _StackReserveSize, tool.StackReserveSize );
1025 strm << SPair( _StripPrivateSymbols, tool.StripPrivateSymbols );
1026 strm << EPair( _SubSystem, tool.SubSystem );
1027 strm << TPair( _SupportUnloadOfDelayLoadedDLL, tool.SupportUnloadOfDelayLoadedDLL );
1028 strm << TPair( _SuppressStartupBanner, tool.SuppressStartupBanner );
1029 strm << TPair( _SwapRunFromCD, tool.SwapRunFromCD );
1030 strm << TPair( _SwapRunFromNet, tool.SwapRunFromNet );
1031 if ( tool.TargetMachine != machineNotSet ) strm << EPair( _TargetMachine, tool.TargetMachine );
1032 if ( tool.TerminalServerAware != termSvrAwareDefault ) strm << EPair( _TerminalServerAware, tool.TerminalServerAware );
1033 strm << TPair( _TurnOffAssemblyGeneration, tool.TurnOffAssemblyGeneration );
1034 strm << SPair( _TypeLibraryFile, tool.TypeLibraryFile );
1035 if ( tool.TypeLibraryResourceID != rcUseDefault ) strm << LPair( _TypeLibraryResourceID, tool.TypeLibraryResourceID );
1036 strm << SPair( _Version4, tool.Version );
1037 strm << "/>";
1038 return strm;
1039}
1040
1041// Hashing routine to do fast option lookups ----
1042// Slightly rewritten to stop on ':' ',' and '\0'
1043// Original routine in qtranslator.cpp ----------
1044static uint elfHash( const char* name )
1045{
1046 const uchar *k;
1047 uint h = 0;
1048 uint g;
1049
1050 if ( name ) {
1051 k = (const uchar *) name;
1052 while ( (*k) &&
1053 (*k)!= ':' &&
1054 (*k)!=',' &&
1055 (*k)!=' ' ) {
1056 h = ( h << 4 ) + *k++;
1057 if ( (g = (h & 0xf0000000)) != 0 )
1058 h ^= g >> 24;
1059 h &= ~g;
1060 }
1061 }
1062 if ( !h )
1063 h = 1;
1064 return h;
1065}
1066
1067//#define USE_DISPLAY_HASH
1068#ifdef USE_DISPLAY_HASH
1069static void displayHash( const char* str )
1070{
1071 printf( "case 0x%07x: // %s\n break;\n", elfHash(str), str );
1072}
1073#endif
1074
1075bool VCLinkerTool::parseOption( const char* option )
1076{
1077#ifdef USE_DISPLAY_HASH
1078 // Main options
1079 displayHash( "/ALIGN" ); displayHash( "/ALLOWBIND" ); displayHash( "/ASSEMBLYMODULE" );
1080 displayHash( "/ASSEMBLYRESOURCE" ); displayHash( "/BASE" ); displayHash( "/DEBUG" );
1081 displayHash( "/DEF" ); displayHash( "/DEFAULTLIB" ); displayHash( "/DELAY" );
1082 displayHash( "/DELAYLOAD" ); displayHash( "/DLL" ); displayHash( "/DRIVER" );
1083 displayHash( "/ENTRY" ); displayHash( "/EXETYPE" ); displayHash( "/EXPORT" );
1084 displayHash( "/FIXED" ); displayHash( "/FORCE" ); displayHash( "/HEAP" );
1085 displayHash( "/IDLOUT" ); displayHash( "/IGNOREIDL" ); displayHash( "/IMPLIB" );
1086 displayHash( "/INCLUDE" ); displayHash( "/INCREMENTAL" ); displayHash( "/LARGEADDRESSAWARE" );
1087 displayHash( "/LIBPATH" ); displayHash( "/LTCG" ); displayHash( "/MACHINE" );
1088 displayHash( "/MAP" ); displayHash( "/MAPINFO" ); displayHash( "/MERGE" );
1089 displayHash( "/MIDL" ); displayHash( "/NOASSEMBLY" ); displayHash( "/NODEFAULTLIB" );
1090 displayHash( "/NOENTRY" ); displayHash( "/NOLOGO" ); displayHash( "/OPT" );
1091 displayHash( "/ORDER" ); displayHash( "/OUT" ); displayHash( "/PDB" );
1092 displayHash( "/PDBSTRIPPED" ); displayHash( "/RELEASE" ); displayHash( "/SECTION" );
1093 displayHash( "/STACK" ); displayHash( "/STUB" ); displayHash( "/SUBSYSTEM" );
1094 displayHash( "/SWAPRUN" ); displayHash( "/TLBID" ); displayHash( "/TLBOUT" );
1095 displayHash( "/TSAWARE" ); displayHash( "/VERBOSE" ); displayHash( "/VERSION" );
1096 displayHash( "/VXD" ); displayHash( "/WS " );
1097#endif
1098#ifdef USE_DISPLAY_HASH
1099 // Sub options
1100 displayHash( "UNLOAD" ); displayHash( "NOBIND" ); displayHash( "no" ); displayHash( "NOSTATUS" ); displayHash( "STATUS" );
1101 displayHash( "AM33" ); displayHash( "ARM" ); displayHash( "CEE" ); displayHash( "IA64" ); displayHash( "X86" ); displayHash( "M32R" );
1102 displayHash( "MIPS" ); displayHash( "MIPS16" ); displayHash( "MIPSFPU" ); displayHash( "MIPSFPU16" ); displayHash( "MIPSR41XX" ); displayHash( "PPC" );
1103 displayHash( "SH3" ); displayHash( "SH4" ); displayHash( "SH5" ); displayHash( "THUMB" ); displayHash( "TRICORE" ); displayHash( "EXPORTS" );
1104 displayHash( "LINES" ); displayHash( "REF" ); displayHash( "NOREF" ); displayHash( "ICF" ); displayHash( "WIN98" ); displayHash( "NOWIN98" );
1105 displayHash( "CONSOLE" ); displayHash( "EFI_APPLICATION" ); displayHash( "EFI_BOOT_SERVICE_DRIVER" ); displayHash( "EFI_ROM" ); displayHash( "EFI_RUNTIME_DRIVER" ); displayHash( "NATIVE" );
1106 displayHash( "POSIX" ); displayHash( "WINDOWS" ); displayHash( "WINDOWSCE" ); displayHash( "NET" ); displayHash( "CD" ); displayHash( "NO" );
1107#endif
1108 bool found = TRUE;
1109 switch ( elfHash(option) ) {
1110 case 0x3360dbe: // /ALIGN[:number]
1111 case 0x1485c34: // /ALLOWBIND[:NO]
1112 case 0x6b21972: // /DEFAULTLIB:library
1113 case 0x396ea92: // /DRIVER[:UPONLY | :WDM]
1114 case 0xaca9d75: // /EXETYPE[:DYNAMIC | :DEV386]
1115 case 0x3ad5444: // /EXPORT:entryname[,@ordinal[,NONAME]][,DATA]
1116 case 0x33aec94: // /FIXED[:NO]
1117 case 0x33b4675: // /FORCE:[MULTIPLE|UNRESOLVED]
1118 case 0x7988f7e: // /SECTION:name,[E][R][W][S][D][K][L][P][X][,ALIGN=#]
1119 case 0x0348992: // /STUB:filename
1120 case 0x0034bc4: // /VXD
1121 case 0x0034c50: // /WS
1122 AdditionalOptions += option;
1123 break;
1124 case 0x679c075: // /ASSEMBLYMODULE:filename
1125 AddModuleNamesToAssembly += option+15;
1126 break;
1127 case 0x062d065: // /ASSEMBLYRESOURCE:filename
1128 LinkToManagedResourceFile = option+18;
1129 break;
1130 case 0x0336675: // /BASE:{address | @filename,key}
1131 // Do we need to do a manual lookup when '@filename,key'?
1132 // Seems BaseAddress only can contain the location...
1133 // We don't use it in Qt, so keep it simple for now
1134 BaseAddress = option+6;
1135 break;
1136 case 0x3389797: // /DEBUG
1137 GenerateDebugInformation = _True;
1138 break;
1139 case 0x0033896: // /DEF:filename
1140 ModuleDefinitionFile = option+5;
1141 break;
1142 case 0x338a069: // /DELAY:{UNLOAD | NOBIND}
1143 // MS documentation does not specify what to do with
1144 // this option, so we'll put it in AdditionalOptions
1145 AdditionalOptions += option;
1146 break;
1147 case 0x06f4bf4: // /DELAYLOAD:dllname
1148 DelayLoadDLLs += option+11;
1149 break;
1150 // case 0x003390c: // /DLL
1151 // This option is not used for vcproj files
1152 // break;
1153 case 0x33a3979: // /ENTRY:function
1154 EntryPointSymbol = option+7;
1155 break;
1156 case 0x033c960: // /HEAP:reserve[,commit]
1157 {
1158 QStringList both = QStringList::split( ",", option+6 );
1159 HeapReserveSize = both[0].toLong();
1160 if ( both.count() == 2 )
1161 HeapCommitSize = both[1].toLong();
1162 }
1163 break;
1164 case 0x3d91494: // /IDLOUT:[path\]filename
1165 MergedIDLBaseFileName = option+8;
1166 break;
1167 case 0x345a04c: // /IGNOREIDL
1168 IgnoreEmbeddedIDL = _True;
1169 break;
1170 case 0x3e250e2: // /IMPLIB:filename
1171 ImportLibrary = option+8;
1172 break;
1173 case 0xe281ab5: // /INCLUDE:symbol
1174 ForceSymbolReferences += option+9;
1175 break;
1176 case 0xb28103c: // /INCREMENTAL[:no]
1177 if ( *(option+12) == ':' &&
1178 *(option+13) == 'n' )
1179 LinkIncremental = linkIncrementalNo;
1180 else
1181 LinkIncremental = linkIncrementalYes;
1182 break;
1183 case 0x26e4675: // /LARGEADDRESSAWARE[:no]
1184 if ( *(option+18) == ':' &&
1185 *(option+19) == 'n' )
1186 LargeAddressAware = addrAwareNoLarge;
1187 else
1188 LargeAddressAware = addrAwareLarge;
1189 break;
1190 case 0x0d745c8: // /LIBPATH:dir
1191 AdditionalLibraryDirectories += option+9;
1192 break;
1193 case 0x0341877: // /LTCG[:NOSTATUS|:STATUS]
1194 config->WholeProgramOptimization = _True;
1195 LinkTimeCodeGeneration = _True;
1196 if ( *(option+5) == ':' &&
1197 *(option+6) == 'S' )
1198 ShowProgress = linkProgressAll;
1199 break;
1200 case 0x157cf65: // /MACHINE:{AM33|ARM|CEE|IA64|X86|M32R|MIPS|MIPS16|MIPSFPU|MIPSFPU16|MIPSR41XX|PPC|SH3|SH4|SH5|THUMB|TRICORE}
1201 switch ( elfHash(option+9) ) {
1202 // Very limited documentation on all options but X86,
1203 // so we put the others in AdditionalOptions...
1204 case 0x0046063: // AM33
1205 case 0x000466d: // ARM
1206 case 0x0004795: // CEE
1207 case 0x004d494: // IA64
1208 case 0x0050672: // M32R
1209 case 0x0051e53: // MIPS
1210 case 0x51e5646: // MIPS16
1211 case 0x1e57b05: // MIPSFPU
1212 case 0x57b09a6: // MIPSFPU16
1213 case 0x5852738: // MIPSR41XX
1214 case 0x0005543: // PPC
1215 case 0x00057b3: // SH3
1216 case 0x00057b4: // SH4
1217 case 0x00057b5: // SH5
1218 case 0x058da12: // THUMB
1219 case 0x96d8435: // TRICORE
1220 AdditionalOptions += option;
1221 break;
1222 case 0x0005bb6: // X86
1223 TargetMachine = machineX86;
1224 break;
1225 default:
1226 found = FALSE;
1227 }
1228 break;
1229 case 0x0034160: // /MAP[:filename]
1230 GenerateMapFile = _True;
1231 MapFileName = option+5;
1232 break;
1233 case 0x164e1ef: // /MAPINFO:{EXPORTS|LINES}
1234 if ( *(option+9) == 'E' )
1235 MapExports = _True;
1236 else if ( *(option+9) == 'L' )
1237 MapLines = _True;
1238 break;
1239 case 0x341a6b5: // /MERGE:from=to
1240 MergeSections = option+7;
1241 break;
1242 case 0x0341d8c: // /MIDL:@file
1243 MidlCommandFile = option+7;
1244 break;
1245 case 0x84e2679: // /NOASSEMBLY
1246 TurnOffAssemblyGeneration = _True;
1247 break;
1248 case 0x2b21942: // /NODEFAULTLIB[:library]
1249 if ( *(option+13) == '\0' )
1250 IgnoreAllDefaultLibraries = _True;
1251 else
1252 IgnoreDefaultLibraryNames += option+14;
1253 break;
1254 case 0x33a3a39: // /NOENTRY
1255 ResourceOnlyDLL = _True;
1256 break;
1257 case 0x434138f: // /NOLOGO
1258 SuppressStartupBanner = _True;
1259 break;
1260 case 0x0034454: // /OPT:{REF | NOREF | ICF[=iterations] | NOICF | WIN98 | NOWIN98}
1261 {
1262 char third = *(option+7);
1263 switch ( third ) {
1264 case 'F': // REF
1265 if ( *(option+5) == 'R' ) {
1266 OptimizeReferences = optReferences;
1267 } else { // ICF[=iterations]
1268 EnableCOMDATFolding = optFolding;
1269 // [=iterations] case is not documented
1270 }
1271 break;
1272 case 'R': // NOREF
1273 OptimizeReferences = optNoReferences;
1274 break;
1275 case 'I': // NOICF
1276 EnableCOMDATFolding = optNoFolding;
1277 break;
1278 case 'N': // WIN98
1279 OptimizeForWindows98 = optWin98Yes;
1280 break;
1281 case 'W': // NOWIN98
1282 OptimizeForWindows98 = optWin98No;
1283 break;
1284 default:
1285 found = FALSE;
1286 }
1287 }
1288 break;
1289 case 0x34468a2: // /ORDER:@filename
1290 FunctionOrder = option+8;
1291 break;
1292 case 0x00344a4: // /OUT:filename
1293 OutputFile = option+5;
1294 break;
1295 case 0x0034482: // /PDB:filename
1296 ProgramDatabaseFile = option+5;
1297 break;
1298 case 0xa2ad314: // /PDBSTRIPPED:pdb_file_name
1299 StripPrivateSymbols = option+13;
1300 break;
1301 case 0x6a09535: // /RELEASE
1302 SetChecksum = _True;
1303 break;
1304 case 0x348857b: // /STACK:reserve[,commit]
1305 {
1306 QStringList both = QStringList::split( ",", option+7 );
1307 StackReserveSize = both[0].toLong();
1308 if ( both.count() == 2 )
1309 StackCommitSize = both[1].toLong();
1310 }
1311 break;
1312 case 0x78dc00d: // /SUBSYSTEM:{CONSOLE|EFI_APPLICATION|EFI_BOOT_SERVICE_DRIVER|EFI_ROM|EFI_RUNTIME_DRIVER|NATIVE|POSIX|WINDOWS|WINDOWSCE}[,major[.minor]]
1313 {
1314 // Split up in subsystem, and version number
1315 QStringList both = QStringList::split( ",", option+11 );
1316 switch ( elfHash(both[0].latin1()) ) {
1317 case 0x8438445: // CONSOLE
1318 SubSystem = subSystemConsole;
1319 break;
1320 case 0xbe29493: // WINDOWS
1321 SubSystem = subSystemWindows;
1322 break;
1323 // The following are undocumented, so add them to AdditionalOptions
1324 case 0x240949e: // EFI_APPLICATION
1325 case 0xe617652: // EFI_BOOT_SERVICE_DRIVER
1326 case 0x9af477d: // EFI_ROM
1327 case 0xd34df42: // EFI_RUNTIME_DRIVER
1328 case 0x5268ea5: // NATIVE
1329 case 0x05547e8: // POSIX
1330 case 0x2949c95: // WINDOWSCE
1331 AdditionalOptions += option;
1332 break;
1333 default:
1334 found = FALSE;
1335 }
1336 }
1337 break;
1338 case 0x8b654de: // /SWAPRUN:{NET | CD}
1339 if ( *(option+9) == 'N' )
1340 SwapRunFromNet = _True;
1341 else if ( *(option+9) == 'C' )
1342 SwapRunFromCD = _True;
1343 else
1344 found = FALSE;
1345 break;
1346 case 0x34906d4: // /TLBID:id
1347 TypeLibraryResourceID = QString( option+7 ).toLong();
1348 break;
1349 case 0x4907494: // /TLBOUT:[path\]filename
1350 TypeLibraryFile = option+8;
1351 break;
1352 case 0x976b525: // /TSAWARE[:NO]
1353 if ( *(option+8) == ':' )
1354 TerminalServerAware = termSvrAwareNo;
1355 else
1356 TerminalServerAware = termSvrAwareYes;
1357 break;
1358 case 0xaa67735: // /VERBOSE[:lib]
1359 if ( *(option+9) == ':' ) {
1360 ShowProgress = linkProgressLibs;
1361 AdditionalOptions += option;
1362 } else {
1363 ShowProgress = linkProgressAll;
1364 }
1365 break;
1366 case 0xaa77f7e: // /VERSION:major[.minor]
1367 Version = option+9;
1368 break;
1369 default:
1370 found = FALSE;
1371 }
1372 if( !found )
1373 warn_msg( WarnLogic, "Could not parse Linker options: %s", option );
1374 return found;
1375}
1376
1377// VCMIDLTool -------------------------------------------------------
1378VCMIDLTool::VCMIDLTool()
1379 : DefaultCharType( midlCharUnsigned ),
1380 EnableErrorChecks( midlDisableAll ),
1381 ErrorCheckAllocations( unset ),
1382 ErrorCheckBounds( unset ),
1383 ErrorCheckEnumRange( unset ),
1384 ErrorCheckRefPointers( unset ),
1385 ErrorCheckStubData( unset ),
1386 GenerateStublessProxies( unset ),
1387 GenerateTypeLibrary( unset ),
1388 IgnoreStandardIncludePath( unset ),
1389 MkTypLibCompatible( unset ),
1390 StructMemberAlignment( midlAlignNotSet ),
1391 SuppressStartupBanner( unset ),
1392 TargetEnvironment( midlTargetNotSet ),
1393 ValidateParameters( unset ),
1394 WarnAsError( unset ),
1395 WarningLevel( midlWarningLevel_0 )
1396{
1397}
1398
1399QTextStream &operator<<( QTextStream &strm, const VCMIDLTool &tool )
1400{
1401 strm << _begTool3;
1402 strm << _VCMIDLToolName;
1403 strm << XPair( _AdditionalIncludeDirectories, tool.AdditionalIncludeDirectories );
1404 strm << XPair( _AdditionalOptions, tool.AdditionalOptions, " " );
1405 strm << XPair( _CPreprocessOptions, tool.CPreprocessOptions );
1406 strm << EPair( _DefaultCharType, tool.DefaultCharType );
1407 strm << SPair( _DLLDataFileName, tool.DLLDataFileName );
1408 strm << EPair( _EnableErrorChecks, tool.EnableErrorChecks );
1409 strm << TPair( _ErrorCheckAllocations, tool.ErrorCheckAllocations );
1410 strm << TPair( _ErrorCheckBounds, tool.ErrorCheckBounds );
1411 strm << TPair( _ErrorCheckEnumRange, tool.ErrorCheckEnumRange );
1412 strm << TPair( _ErrorCheckRefPointers, tool.ErrorCheckRefPointers );
1413 strm << TPair( _ErrorCheckStubData, tool.ErrorCheckStubData );
1414 strm << XPair( _FullIncludePath, tool.FullIncludePath );
1415 strm << TPair( _GenerateStublessProxies, tool.GenerateStublessProxies );
1416 strm << TPair( _GenerateTypeLibrary, tool.GenerateTypeLibrary );
1417 strm << SPair( _HeaderFileName, tool.HeaderFileName );
1418 strm << TPair( _IgnoreStandardIncludePath, tool.IgnoreStandardIncludePath );
1419 strm << SPair( _InterfaceIdentifierFileName, tool.InterfaceIdentifierFileName );
1420 strm << TPair( _MkTypLibCompatible, tool.MkTypLibCompatible );
1421 strm << SPair( _OutputDirectory4, tool.OutputDirectory );
1422 strm << XPair( _PreprocessorDefinitions, tool.PreprocessorDefinitions );
1423 strm << SPair( _ProxyFileName, tool.ProxyFileName );
1424 strm << SPair( _RedirectOutputAndErrors, tool.RedirectOutputAndErrors );
1425 if ( tool.StructMemberAlignment != midlAlignNotSet) strm << EPair( _StructMemberAlignment, tool.StructMemberAlignment );
1426 strm << TPair( _SuppressStartupBanner, tool.SuppressStartupBanner );
1427 if ( tool.TargetEnvironment != midlTargetNotSet ) strm << EPair( _TargetEnvironment, tool.TargetEnvironment );
1428 strm << SPair( _TypeLibraryName, tool.TypeLibraryName );
1429 strm << XPair( _UndefinePreprocessorDefinitions, tool.UndefinePreprocessorDefinitions );
1430 strm << TPair( _ValidateParameters, tool.ValidateParameters );
1431 strm << TPair( _WarnAsError, tool.WarnAsError );
1432 strm << EPair( _WarningLevel, tool.WarningLevel );
1433 strm << "/>";
1434 return strm;
1435}
1436
1437bool VCMIDLTool::parseOption( const char* option )
1438{
1439#ifdef USE_DISPLAY_HASH
1440 displayHash( "/D name[=def]" ); displayHash( "/I directory-list" ); displayHash( "/Oi" );
1441 displayHash( "/Oic" ); displayHash( "/Oicf" ); displayHash( "/Oif" ); displayHash( "/Os" );
1442 displayHash( "/U name" ); displayHash( "/WX" ); displayHash( "/W{0|1|2|3|4}" );
1443 displayHash( "/Zp {N}" ); displayHash( "/Zs" ); displayHash( "/acf filename" );
1444 displayHash( "/align {N}" ); displayHash( "/app_config" ); displayHash( "/c_ext" );
1445 displayHash( "/char ascii7" ); displayHash( "/char signed" ); displayHash( "/char unsigned" );
1446 displayHash( "/client none" ); displayHash( "/client stub" ); displayHash( "/confirm" );
1447 displayHash( "/cpp_cmd cmd_line" ); displayHash( "/cpp_opt options" );
1448 displayHash( "/cstub filename" ); displayHash( "/dlldata filename" ); displayHash( "/env win32" );
1449 displayHash( "/env win64" ); displayHash( "/error all" ); displayHash( "/error allocation" );
1450 displayHash( "/error bounds_check" ); displayHash( "/error enum" ); displayHash( "/error none" );
1451 displayHash( "/error ref" ); displayHash( "/error stub_data" ); displayHash( "/h filename" );
1452 displayHash( "/header filename" ); displayHash( "/iid filename" ); displayHash( "/lcid" );
1453 displayHash( "/mktyplib203" ); displayHash( "/ms_ext" ); displayHash( "/ms_union" );
1454 displayHash( "/msc_ver <nnnn>" ); displayHash( "/newtlb" ); displayHash( "/no_cpp" );
1455 displayHash( "/no_def_idir" ); displayHash( "/no_default_epv" ); displayHash( "/no_format_opt" );
1456 displayHash( "/no_warn" ); displayHash( "/nocpp" ); displayHash( "/nologo" ); displayHash( "/notlb" );
1457 displayHash( "/o filename" ); displayHash( "/oldnames" ); displayHash( "/oldtlb" );
1458 displayHash( "/osf" ); displayHash( "/out directory" ); displayHash( "/pack {N}" );
1459 displayHash( "/prefix all" ); displayHash( "/prefix client" ); displayHash( "/prefix server" );
1460 displayHash( "/prefix switch" ); displayHash( "/protocol all" ); displayHash( "/protocol dce" );
1461 displayHash( "/protocol ndr64" ); displayHash( "/proxy filename" ); displayHash( "/robust" );
1462 displayHash( "/rpcss" ); displayHash( "/savePP" ); displayHash( "/server none" );
1463 displayHash( "/server stub" ); displayHash( "/sstub filename" ); displayHash( "/syntax_check" );
1464 displayHash( "/target {system}" ); displayHash( "/tlb filename" ); displayHash( "/use_epv" );
1465 displayHash( "/win32" ); displayHash( "/win64" );
1466#endif
1467 bool found = TRUE;
1468 int offset = 0;
1469 switch( elfHash(option) ) {
1470 case 0x0000334: // /D name[=def]
1471 PreprocessorDefinitions += option+3;
1472 break;
1473 case 0x0000339: // /I directory-list
1474 AdditionalIncludeDirectories += option+3;
1475 break;
1476 case 0x0345f96: // /Oicf
1477 case 0x00345f6: // /Oif
1478 GenerateStublessProxies = _True;
1479 break;
1480 case 0x0000345: // /U name
1481 UndefinePreprocessorDefinitions += option+3;
1482 break;
1483 case 0x00034c8: // /WX
1484 WarnAsError = _True;
1485 break;
1486 case 0x3582fde: // /align {N}
1487 offset = 3; // Fallthrough
1488 case 0x0003510: // /Zp {N}
1489 switch ( *(option+offset+4) ) {
1490 case '1':
1491 StructMemberAlignment = ( *(option+offset+5) == '\0' ) ? midlAlignSingleByte : midlAlignSixteenBytes;
1492 break;
1493 case '2':
1494 StructMemberAlignment = midlAlignTwoBytes;
1495 break;
1496 case '4':
1497 StructMemberAlignment = midlAlignFourBytes;
1498 break;
1499 case '8':
1500 StructMemberAlignment = midlAlignEightBytes;
1501 break;
1502 default:
1503 found = FALSE;
1504 }
1505 break;
1506 case 0x0359e82: // /char {ascii7|signed|unsigned}
1507 switch( *(option+6) ) {
1508 case 'a':
1509 DefaultCharType = midlCharAscii7;
1510 break;
1511 case 's':
1512 DefaultCharType = midlCharSigned;
1513 break;
1514 case 'u':
1515 DefaultCharType = midlCharUnsigned;
1516 break;
1517 default:
1518 found = FALSE;
1519 }
1520 break;
1521 case 0xa766524: // /cpp_opt options
1522 CPreprocessOptions += option+9;
1523 break;
1524 case 0xb32abf1: // /dlldata filename
1525 DLLDataFileName = option + 9;
1526 break;
1527 case 0x0035c56: // /env {win32|win64}
1528 TargetEnvironment = ( *(option+8) == '6' ) ? midlTargetWin64 : midlTargetWin32;
1529 break;
1530 case 0x35c9962: // /error {all|allocation|bounds_check|enum|none|ref|stub_data}
1531 EnableErrorChecks = midlEnableCustom;
1532 switch ( *(option+7) ) {
1533 case 'a':
1534 if ( *(option+10) == '\0' )
1535 EnableErrorChecks = midlEnableAll;
1536 else
1537 ErrorCheckAllocations = _True;
1538 break;
1539 case 'b':
1540 ErrorCheckBounds = _True;
1541 break;
1542 case 'e':
1543 ErrorCheckEnumRange = _True;
1544 break;
1545 case 'n':
1546 EnableErrorChecks = midlDisableAll;
1547 break;
1548 case 'r':
1549 ErrorCheckRefPointers = _True;
1550 break;
1551 case 's':
1552 ErrorCheckStubData = _True;
1553 break;
1554 default:
1555 found = FALSE;
1556 }
1557 break;
1558 case 0x5eb7af2: // /header filename
1559 offset = 5;
1560 case 0x0000358: // /h filename
1561 HeaderFileName = option + offset + 3;
1562 break;
1563 case 0x0035ff4: // /iid filename
1564 InterfaceIdentifierFileName = option+5;
1565 break;
1566 case 0x64b7933: // /mktyplib203
1567 MkTypLibCompatible = _True;
1568 break;
1569 case 0x8e0b0a2: // /no_def_idir
1570 IgnoreStandardIncludePath = _True;
1571 break;
1572 case 0x65635ef: // /nologo
1573 SuppressStartupBanner = _True;
1574 break;
1575 case 0x3656b22: // /notlb
1576 GenerateTypeLibrary = _True;
1577 break;
1578 case 0x000035f: // /o filename
1579 RedirectOutputAndErrors = option+3;
1580 break;
1581 case 0x00366c4: // /out directory
1582 OutputDirectory = option+5;
1583 break;
1584 case 0x36796f9: // /proxy filename
1585 ProxyFileName = option+7;
1586 break;
1587 case 0x6959c94: // /robust
1588 ValidateParameters = _True;
1589 break;
1590 case 0x6a88df4: // /target {system}
1591 if ( *(option+11) == '6' )
1592 TargetEnvironment = midlTargetWin64;
1593 else
1594 TargetEnvironment = midlTargetWin32;
1595 break;
1596 case 0x0036b22: // /tlb filename
1597 TypeLibraryName = option+5;
1598 break;
1599 case 0x36e0162: // /win32
1600 TargetEnvironment = midlTargetWin32;
1601 break;
1602 case 0x36e0194: // /win64
1603 TargetEnvironment = midlTargetWin64;
1604 break;
1605 case 0x0003459: // /Oi
1606 case 0x00345f3: // /Oic
1607 case 0x0003463: // /Os
1608 case 0x0003513: // /Zs
1609 case 0x0035796: // /acf filename
1610 case 0x5b1cb97: // /app_config
1611 case 0x3595cf4: // /c_ext
1612 case 0x5a2fc64: // /client {none|stub}
1613 case 0xa64d3dd: // /confirm
1614 case 0xa765b64: // /cpp_cmd cmd_line
1615 case 0x35aabb2: // /cstub filename
1616 case 0x03629f4: // /lcid
1617 case 0x6495cc4: // /ms_ext
1618 case 0x96c7a1e: // /ms_union
1619 case 0x4996fa2: // /msc_ver <nnnn>
1620 case 0x64ceb12: // /newtlb
1621 case 0x6555a40: // /no_cpp
1622 case 0xf64d6a6: // /no_default_epv
1623 case 0x6dd9384: // /no_format_opt
1624 case 0x556dbee: // /no_warn
1625 case 0x3655a70: // /nocpp
1626 case 0x2b455a3: // /oldnames
1627 case 0x662bb12: // /oldtlb
1628 case 0x0036696: // /osf
1629 case 0x036679b: // /pack {N}
1630 case 0x678bd38: // /prefix {all|client|server|switch}
1631 case 0x96b702c: // /protocol {all|dce|ndr64}
1632 case 0x3696aa3: // /rpcss
1633 case 0x698ca60: // /savePP
1634 case 0x69c9cf2: // /server {none|stub}
1635 case 0x36aabb2: // /sstub filename
1636 case 0xce9b12b: // /syntax_check
1637 case 0xc9b5f16: // /use_epv
1638 AdditionalOptions += option;
1639 break;
1640 default:
1641 // /W{0|1|2|3|4} case
1642 if ( *(option+1) == 'W' ) {
1643 switch ( *(option+2) ) {
1644 case '0':
1645 WarningLevel = midlWarningLevel_0;
1646 break;
1647 case '1':
1648 WarningLevel = midlWarningLevel_1;
1649 break;
1650 case '2':
1651 WarningLevel = midlWarningLevel_2;
1652 break;
1653 case '3':
1654 WarningLevel = midlWarningLevel_3;
1655 break;
1656 case '4':
1657 WarningLevel = midlWarningLevel_4;
1658 break;
1659 default:
1660 found = FALSE;
1661 }
1662 }
1663 break;
1664 }
1665 if( !found )
1666 warn_msg( WarnLogic, "Could not parse MIDL option: %s", option );
1667 return TRUE;
1668}
1669
1670// VCLibrarianTool --------------------------------------------------
1671VCLibrarianTool::VCLibrarianTool()
1672 : IgnoreAllDefaultLibraries( unset ),
1673 SuppressStartupBanner( _True )
1674{
1675}
1676
1677QTextStream &operator<<( QTextStream &strm, const VCLibrarianTool &tool )
1678{
1679 strm << _begTool3;
1680 strm << SPair( _ToolName, QString( "VCLibrarianTool" ) );
1681 strm << XPair( _AdditionalDependencies4, tool.AdditionalDependencies );
1682 strm << XPair( _AdditionalLibraryDirectories, tool.AdditionalLibraryDirectories );
1683 strm << XPair( _AdditionalOptions, tool.AdditionalOptions, " " );
1684 strm << XPair( _ExportNamedFunctions, tool.ExportNamedFunctions );
1685 strm << XPair( _ForceSymbolReferences, tool.ForceSymbolReferences );
1686 strm << TPair( _IgnoreAllDefaultLibraries, tool.IgnoreAllDefaultLibraries );
1687 strm << XPair( _IgnoreDefaultLibraryNames, tool.IgnoreDefaultLibraryNames );
1688 strm << SPair( _ModuleDefinitionFile, tool.ModuleDefinitionFile );
1689 strm << SPair( _OutputFile, tool.OutputFile );
1690 strm << TPair( _SuppressStartupBanner, tool.SuppressStartupBanner );
1691 strm << "/>";
1692 return strm;
1693}
1694
1695// VCCustomBuildTool ------------------------------------------------
1696VCCustomBuildTool::VCCustomBuildTool()
1697{
1698 ToolName = "VCCustomBuildTool";
1699}
1700
1701QTextStream &operator<<( QTextStream &strm, const VCCustomBuildTool &tool )
1702{
1703 strm << _begTool3;
1704 strm << SPair( _ToolName, tool.ToolName );
1705 strm << XPair( _AdditionalDependencies4, tool.AdditionalDependencies, ";" );
1706 strm << XPair( _CommandLine4, tool.CommandLine, "\n" );
1707 strm << SPair( _Description4, tool.Description );
1708 strm << XPair( _Outputs4, tool.Outputs, ";" );
1709 strm << SPair( _ToolPath, tool.ToolPath );
1710 strm << "/>";
1711 return strm;
1712}
1713
1714// VCResourceCompilerTool -------------------------------------------
1715VCResourceCompilerTool::VCResourceCompilerTool()
1716 : Culture( rcUseDefault ),
1717 IgnoreStandardIncludePath( unset ),
1718 ShowProgress( linkProgressNotSet )
1719{
1720 PreprocessorDefinitions = "NDEBUG";
1721}
1722
1723QTextStream &operator<<( QTextStream &strm, const VCResourceCompilerTool &tool )
1724{
1725 strm << _begTool3;
1726 strm << _VCResourceCompilerToolName;
1727 strm << SPair( _ToolPath, tool.ToolPath );
1728 strm << XPair( _AdditionalIncludeDirectories, tool.AdditionalIncludeDirectories );
1729 strm << XPair( _AdditionalOptions, tool.AdditionalOptions, " " );
1730 if ( tool.Culture != rcUseDefault ) strm << EPair( _Culture, tool.Culture );
1731 strm << XPair( _FullIncludePath, tool.FullIncludePath );
1732 strm << TPair( _IgnoreStandardIncludePath, tool.IgnoreStandardIncludePath );
1733 strm << XPair( _PreprocessorDefinitions, tool.PreprocessorDefinitions );
1734 strm << SPair( _ResourceOutputFileName, tool.ResourceOutputFileName );
1735 if ( tool.ShowProgress != linkProgressNotSet ) strm << EPair( _ShowProgress, tool.ShowProgress );
1736 strm << "/>";
1737 return strm;
1738}
1739
1740// VCEventTool -------------------------------------------------
1741QTextStream &operator<<( QTextStream &strm, const VCEventTool &tool )
1742{
1743 strm << _begTool3;
1744 strm << SPair( _ToolName, tool.ToolName );
1745 strm << SPair( _ToolPath, tool.ToolPath );
1746 strm << SPair( _CommandLine4, tool.CommandLine );
1747 strm << SPair( _Description4, tool.Description );
1748 strm << TPair( _ExcludedFromBuild, tool.ExcludedFromBuild );
1749 strm << "/>";
1750 return strm;
1751}
1752
1753// VCPostBuildEventTool ---------------------------------------------
1754VCPostBuildEventTool::VCPostBuildEventTool()
1755{
1756 ToolName = "VCPostBuildEventTool";
1757}
1758
1759// VCPreBuildEventTool ----------------------------------------------
1760VCPreBuildEventTool::VCPreBuildEventTool()
1761{
1762 ToolName = "VCPreBuildEventTool";
1763}
1764
1765// VCPreLinkEventTool -----------------------------------------------
1766VCPreLinkEventTool::VCPreLinkEventTool()
1767{
1768 ToolName = "VCPreLinkEventTool";
1769}
1770
1771// VCConfiguration --------------------------------------------------
1772
1773VCConfiguration::VCConfiguration()
1774 : ATLMinimizesCRunTimeLibraryUsage( unset ),
1775 BuildBrowserInformation( unset ),
1776 CharacterSet( charSetNotSet ),
1777 ConfigurationType( typeApplication ),
1778 RegisterOutput( unset ),
1779 UseOfATL( useATLNotSet ),
1780 UseOfMfc( useMfcStdWin ),
1781 WholeProgramOptimization( unset )
1782{
1783 compiler.config = this;
1784 linker.config = this;
1785 idl.config = this;
1786}
1787
1788QTextStream &operator<<( QTextStream &strm, const VCConfiguration &tool )
1789{
1790 strm << _begConfiguration;
1791 strm << SPair( _Name3, tool.Name );
1792 strm << SPair( _OutputDirectory3, tool.OutputDirectory );
1793 strm << TPair( _ATLMinimizesCRunTimeLibraryUsage, tool.ATLMinimizesCRunTimeLibraryUsage );
1794 strm << TPair( _BuildBrowserInformation, tool.BuildBrowserInformation );
1795 if ( tool.CharacterSet != charSetNotSet) strm << EPair( _CharacterSet, tool.CharacterSet );
1796 strm << EPair( _ConfigurationType, tool.ConfigurationType );
1797 strm << SPair( _DeleteExtensionsOnClean, tool.DeleteExtensionsOnClean );
1798 strm << SPair( _ImportLibrary, tool.ImportLibrary );
1799 strm << SPair( _IntermediateDirectory, tool.IntermediateDirectory );
1800 strm << SPair( _PrimaryOutput, tool.PrimaryOutput );
1801 strm << SPair( _ProgramDatabase, tool.ProgramDatabase );
1802 strm << TPair( _RegisterOutput, tool.RegisterOutput );
1803 if ( tool.UseOfATL != useATLNotSet) strm << EPair( _UseOfATL, tool.UseOfATL );
1804 strm << EPair( _UseOfMfc, tool.UseOfMfc );
1805 strm << TPair( _WholeProgramOptimization, tool.WholeProgramOptimization );
1806 strm << ">";
1807 strm << tool.compiler;
1808 strm << tool.custom;
1809 if ( tool.ConfigurationType == typeStaticLibrary )
1810 strm << tool.librarian;
1811 else
1812 strm << tool.linker;
1813 strm << tool.idl;
1814 strm << tool.postBuild;
1815 strm << tool.preBuild;
1816 strm << tool.preLink;
1817 strm << tool.resource;
1818 strm << _endConfiguration;
1819 return strm;
1820}
1821// VCFilter ---------------------------------------------------------
1822VCFilter::VCFilter()
1823 : ParseFiles( unset )
1824{
1825 useCustomBuildTool = FALSE;
1826 useCompilerTool = FALSE;
1827}
1828
1829void VCFilter::addMOCstage( QTextStream &strm, QString filename )
1830{
1831 QString mocOutput = Project->findMocDestination( filename );
1832 QString mocApp = Project->var( "QMAKE_MOC" );
1833
1834 if( mocOutput.isEmpty() && filename.endsWith(".moc") ) {
1835 // In specialcases we DO moc .cpp files
1836 // when the result is an .moc file
1837 mocOutput = filename;
1838 filename = Project->findMocSource( mocOutput );
1839 }
1840
1841 if (mocOutput.isEmpty())
1842 return;
1843
1844 CustomBuildTool = VCCustomBuildTool();
1845 useCustomBuildTool = TRUE;
1846 CustomBuildTool.Description = "Moc&apos;ing " + filename + "...";
1847 CustomBuildTool.CommandLine += (mocApp + " "
1848 + filename + " -o " + mocOutput);
1849 CustomBuildTool.AdditionalDependencies = mocApp;
1850 CustomBuildTool.Outputs += mocOutput;
1851}
1852
1853void VCFilter::addUICstage( QTextStream &strm, QString str )
1854{
1855 CustomBuildTool = VCCustomBuildTool();
1856 useCustomBuildTool = TRUE;
1857
1858 QString uicApp = Project->var("QMAKE_UIC");
1859 QString mocApp = Project->var( "QMAKE_MOC" );
1860 QString fname = str.section( '\\', -1 );
1861 QString mocDir = Project->var( "MOC_DIR" );
1862 QString uiDir = Project->var( "UI_DIR" );
1863 QString uiHeaders;
1864 QString uiSources;
1865
1866 // Determining the paths for the output files.
1867 int slash = str.findRev( '\\' );
1868 QString pname = ( slash != -1 ) ? str.left( slash+1 ) : QString( ".\\" );
1869 if( !uiDir.isEmpty() ) {
1870 uiHeaders = uiDir;
1871 uiSources = uiDir;
1872 } else {
1873 uiHeaders = Project->var( "UI_HEADERS_DIR" );
1874 uiSources = Project->var( "UI_SOURCES_DIR" );
1875 if( uiHeaders.isEmpty() )
1876 uiHeaders = pname;
1877 if( uiSources.isEmpty() )
1878 uiSources = pname;
1879 }
1880 if( !uiHeaders.endsWith( "\\" ) )
1881 uiHeaders += "\\";
1882 if( !uiSources.endsWith( "\\" ) )
1883 uiSources += "\\";
1884
1885 // Determine the file name.
1886 int dot = fname.findRev( '.' );
1887 if( dot != -1 )
1888 fname.truncate( dot );
1889
1890 if ( mocDir.isEmpty() )
1891 mocDir = pname;
1892
1893 CustomBuildTool.Description = ("Uic'ing " + str + "...\"");
1894 CustomBuildTool.CommandLine += // Create .h from .ui file
1895 uicApp + " " + str + " -o " + uiHeaders + fname + ".h";
1896 CustomBuildTool.CommandLine += // Create .cpp from .ui file
1897 uicApp + " " + str + " -i " + fname + ".h -o " + uiSources + fname + ".cpp";
1898 CustomBuildTool.CommandLine += // Moc the headerfile
1899 mocApp + " " + uiHeaders + fname + ".h -o " + mocDir + Option::h_moc_mod + fname + Option::h_moc_ext;
1900
1901 CustomBuildTool.AdditionalDependencies += mocApp;
1902 CustomBuildTool.AdditionalDependencies += uicApp;
1903 CustomBuildTool.Outputs +=
1904 uiHeaders + fname + ".h;" + uiSources + fname + ".cpp;" + mocDir + Option::h_moc_mod + fname + Option::h_moc_ext;
1905}
1906
1907void 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
1934bool VCFilter::addIMGstage( QTextStream &strm, QString str )
1935{
1936 bool isCorH = FALSE;
1937 if (str.endsWith(".c"))
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
1986QTextStream &operator<<( QTextStream &strm, VCFilter &tool )
1987{
1988 if ( tool.Files.count() == 0 )
1989 return strm;
1990
1991 strm << _begFilter;
1992 strm << SPair( _Name3, tool.Name );
1993 strm << TPair( _ParseFiles, tool.ParseFiles );
1994 strm << SPair( _Filter, tool.Filter );
1995 strm << ">";
1996
1997 bool resourceBuild = FALSE;
1998 int currentLevels = 0;
1999 QStringList currentDirs;
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 = 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 = 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
2043 strm << _begFile;
2044 strm << SPair( _RelativePath, *it );
2045 strm << ">";
2046 // Output custom build and compiler options
2047 // for all configurations
2048 if (tool.useCustomBuildTool || tool.useCompilerTool) {
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 }
2061 strm << _endFile;
2062 }
2063 // close remaining open filters, in non-flat mode
2064 while ( !tool.flat_files && currentLevels-- ) {
2065 strm << _endFilter;
2066 }
2067 strm << _endFilter;
2068 return strm;
2069}
2070
2071// VCProject --------------------------------------------------------
2072VCProject::VCProject()
2073{
2074 VCConfiguration conf;
2075 Configuration += conf ; // Release
2076 //Configuration += conf ; // Debug added later, after Release init
2077}
2078
2079QTextStream &operator<<( QTextStream &strm, const VCProject &tool )
2080{
2081 strm << _xmlInit;
2082 strm << _begVisualStudioProject;
2083 strm << _ProjectType;
2084 strm << SPair( _Version1, tool.Version );
2085 strm << SPair( _Name1, tool.Name );
2086 strm << SPair( _ProjectGUID, tool.ProjectGUID );
2087 strm << SPair( _SccProjectName, tool.SccProjectName );
2088 strm << SPair( _SccLocalPath, tool.SccLocalPath );
2089 strm << ">";
2090 strm << _begPlatforms;
2091 strm << _begPlatform;
2092 strm << SPair( _Name3, tool.PlatformName );
2093 strm << "/>";
2094 strm << _endPlatforms;
2095 strm << _begConfigurations;
2096 for ( uint i = 0; i < tool.Configuration.count(); i++ )
2097 strm << tool.Configuration[i];
2098 strm << _endConfigurations;
2099 strm << _begFiles;
2100 strm << (VCFilter&)tool.SourceFiles;
2101 strm << (VCFilter&)tool.HeaderFiles;
2102 strm << (VCFilter&)tool.MOCFiles;
2103 strm << (VCFilter&)tool.UICFiles;
2104 strm << (VCFilter&)tool.FormFiles;
2105 strm << (VCFilter&)tool.TranslationFiles;
2106 strm << (VCFilter&)tool.LexYaccFiles;
2107 strm << (VCFilter&)tool.ResourceFiles;
2108 strm << _endFiles;
2109 strm << _begGlobals;
2110 strm << _endGlobals;
2111 strm << _endVisualStudioProject;
2112 return strm;
2113}
Note: See TracBrowser for help on using the repository browser.