author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Wed, 18 Aug 2010 10:37:55 +0300 | |
changeset 33 | 3e2da88830cd |
parent 30 | 5dc02b23752f |
child 37 | 758a864f9613 |
permissions | -rw-r--r-- |
0 | 1 |
/**************************************************************************** |
2 |
** |
|
18
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
3 |
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). |
0 | 4 |
** All rights reserved. |
5 |
** Contact: Nokia Corporation (qt-info@nokia.com) |
|
6 |
** |
|
7 |
** This file is part of the qmake application of the Qt Toolkit. |
|
8 |
** |
|
9 |
** $QT_BEGIN_LICENSE:LGPL$ |
|
10 |
** No Commercial Usage |
|
11 |
** This file contains pre-release code and may not be distributed. |
|
12 |
** You may use this file in accordance with the terms and conditions |
|
13 |
** contained in the Technology Preview License Agreement accompanying |
|
14 |
** this package. |
|
15 |
** |
|
16 |
** GNU Lesser General Public License Usage |
|
17 |
** Alternatively, this file may be used under the terms of the GNU Lesser |
|
18 |
** General Public License version 2.1 as published by the Free Software |
|
19 |
** Foundation and appearing in the file LICENSE.LGPL included in the |
|
20 |
** packaging of this file. Please review the following information to |
|
21 |
** ensure the GNU Lesser General Public License version 2.1 requirements |
|
22 |
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. |
|
23 |
** |
|
24 |
** In addition, as a special exception, Nokia gives you certain additional |
|
25 |
** rights. These rights are described in the Nokia Qt LGPL Exception |
|
26 |
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. |
|
27 |
** |
|
28 |
** If you have questions regarding the use of this file, please contact |
|
29 |
** Nokia at qt-info@nokia.com. |
|
30 |
** |
|
31 |
** |
|
32 |
** |
|
33 |
** |
|
34 |
** |
|
35 |
** |
|
36 |
** |
|
37 |
** |
|
38 |
** $QT_END_LICENSE$ |
|
39 |
** |
|
40 |
****************************************************************************/ |
|
41 |
||
42 |
#include "msvc_objectmodel.h" |
|
43 |
#include "msvc_vcproj.h" |
|
30
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
44 |
#include "msvc_vcxproj.h" |
0 | 45 |
#include <qstringlist.h> |
46 |
#include <qfileinfo.h> |
|
47 |
||
48 |
QT_BEGIN_NAMESPACE |
|
49 |
||
50 |
// XML Tags --------------------------------------------------------- |
|
51 |
const char _Configuration[] = "Configuration"; |
|
52 |
const char _Configurations[] = "Configurations"; |
|
53 |
const char q_File[] = "File"; |
|
54 |
const char _FileConfiguration[] = "FileConfiguration"; |
|
55 |
const char q_Files[] = "Files"; |
|
56 |
const char _Filter[] = "Filter"; |
|
57 |
const char _Globals[] = "Globals"; |
|
58 |
const char _Platform[] = "Platform"; |
|
59 |
const char _Platforms[] = "Platforms"; |
|
60 |
const char _Tool[] = "Tool"; |
|
61 |
const char _VisualStudioProject[] = "VisualStudioProject"; |
|
62 |
||
63 |
// XML Properties --------------------------------------------------- |
|
64 |
const char _AddModuleNamesToAssembly[] = "AddModuleNamesToAssembly"; |
|
65 |
const char _AdditionalDependencies[] = "AdditionalDependencies"; |
|
66 |
const char _AdditionalFiles[] = "AdditionalFiles"; |
|
67 |
const char _AdditionalIncludeDirectories[] = "AdditionalIncludeDirectories"; |
|
68 |
const char _AdditionalLibraryDirectories[] = "AdditionalLibraryDirectories"; |
|
69 |
const char _AdditionalOptions[] = "AdditionalOptions"; |
|
70 |
const char _AdditionalUsingDirectories[] = "AdditionalUsingDirectories"; |
|
71 |
const char _AssemblerListingLocation[] = "AssemblerListingLocation"; |
|
72 |
const char _AssemblerOutput[] = "AssemblerOutput"; |
|
73 |
const char _ATLMinimizesCRunTimeLibraryUsage[] = "ATLMinimizesCRunTimeLibraryUsage"; |
|
74 |
const char _BaseAddress[] = "BaseAddress"; |
|
75 |
const char _BasicRuntimeChecks[] = "BasicRuntimeChecks"; |
|
76 |
const char _BrowseInformation[] = "BrowseInformation"; |
|
77 |
const char _BrowseInformationFile[] = "BrowseInformationFile"; |
|
78 |
const char _BufferSecurityCheck[] = "BufferSecurityCheck"; |
|
79 |
const char _BuildBrowserInformation[] = "BuildBrowserInformation"; |
|
80 |
const char _CPreprocessOptions[] = "CPreprocessOptions"; |
|
81 |
const char _CallingConvention[] = "CallingConvention"; |
|
82 |
const char _CharacterSet[] = "CharacterSet"; |
|
83 |
const char _CommandLine[] = "CommandLine"; |
|
84 |
const char _CompileAs[] = "CompileAs"; |
|
85 |
const char _CompileAsManaged[] = "CompileAsManaged"; |
|
86 |
const char _CompileOnly[] = "CompileOnly"; |
|
87 |
const char _ConfigurationType[] = "ConfigurationType"; |
|
88 |
const char _Culture[] = "Culture"; |
|
89 |
const char _DLLDataFileName[] = "DLLDataFileName"; |
|
90 |
const char _DebugInformationFormat[] = "DebugInformationFormat"; |
|
91 |
const char _DefaultCharIsUnsigned[] = "DefaultCharIsUnsigned"; |
|
92 |
const char _DefaultCharType[] = "DefaultCharType"; |
|
93 |
const char _DelayLoadDLLs[] = "DelayLoadDLLs"; |
|
94 |
const char _DeleteExtensionsOnClean[] = "DeleteExtensionsOnClean"; |
|
95 |
const char _Description[] = "Description"; |
|
96 |
const char _Detect64BitPortabilityProblems[] = "Detect64BitPortabilityProblems"; |
|
97 |
const char _DisableLanguageExtensions[] = "DisableLanguageExtensions"; |
|
98 |
const char _DisableSpecificWarnings[] = "DisableSpecificWarnings"; |
|
99 |
const char _EnableCOMDATFolding[] = "EnableCOMDATFolding"; |
|
100 |
const char _EnableErrorChecks[] = "EnableErrorChecks"; |
|
101 |
const char _EnableEnhancedInstructionSet[] = "EnableEnhancedInstructionSet"; |
|
102 |
const char _EnableFiberSafeOptimizations[] = "EnableFiberSafeOptimizations"; |
|
103 |
const char _EnableFunctionLevelLinking[] = "EnableFunctionLevelLinking"; |
|
104 |
const char _EnableIntrinsicFunctions[] = "EnableIntrinsicFunctions"; |
|
105 |
const char _EntryPointSymbol[] = "EntryPointSymbol"; |
|
106 |
const char _ErrorCheckAllocations[] = "ErrorCheckAllocations"; |
|
107 |
const char _ErrorCheckBounds[] = "ErrorCheckBounds"; |
|
108 |
const char _ErrorCheckEnumRange[] = "ErrorCheckEnumRange"; |
|
109 |
const char _ErrorCheckRefPointers[] = "ErrorCheckRefPointers"; |
|
110 |
const char _ErrorCheckStubData[] = "ErrorCheckStubData"; |
|
111 |
const char _ExceptionHandling[] = "ExceptionHandling"; |
|
112 |
const char _ExcludedFromBuild[] = "ExcludedFromBuild"; |
|
113 |
const char _ExpandAttributedSource[] = "ExpandAttributedSource"; |
|
114 |
const char _ExportNamedFunctions[] = "ExportNamedFunctions"; |
|
115 |
const char _FavorSizeOrSpeed[] = "FavorSizeOrSpeed"; |
|
116 |
const char _FloatingPointModel[] = "FloatingPointModel"; |
|
117 |
const char _FloatingPointExceptions[] = "FloatingPointExceptions"; |
|
118 |
const char _ForceConformanceInForLoopScope[] = "ForceConformanceInForLoopScope"; |
|
119 |
const char _ForceSymbolReferences[] = "ForceSymbolReferences"; |
|
120 |
const char _ForcedIncludeFiles[] = "ForcedIncludeFiles"; |
|
121 |
const char _ForcedUsingFiles[] = "ForcedUsingFiles"; |
|
122 |
const char _FullIncludePath[] = "FullIncludePath"; |
|
123 |
const char _FunctionOrder[] = "FunctionOrder"; |
|
124 |
const char _GenerateDebugInformation[] = "GenerateDebugInformation"; |
|
125 |
const char _GenerateMapFile[] = "GenerateMapFile"; |
|
126 |
const char _GeneratePreprocessedFile[] = "GeneratePreprocessedFile"; |
|
127 |
const char _GenerateStublessProxies[] = "GenerateStublessProxies"; |
|
128 |
const char _GenerateTypeLibrary[] = "GenerateTypeLibrary"; |
|
129 |
const char _GlobalOptimizations[] = "GlobalOptimizations"; |
|
130 |
const char _HeaderFileName[] = "HeaderFileName"; |
|
131 |
const char _HeapCommitSize[] = "HeapCommitSize"; |
|
132 |
const char _HeapReserveSize[] = "HeapReserveSize"; |
|
133 |
const char _IgnoreAllDefaultLibraries[] = "IgnoreAllDefaultLibraries"; |
|
134 |
const char _IgnoreDefaultLibraryNames[] = "IgnoreDefaultLibraryNames"; |
|
135 |
const char _IgnoreEmbeddedIDL[] = "IgnoreEmbeddedIDL"; |
|
136 |
const char _IgnoreImportLibrary[] = "IgnoreImportLibrary"; |
|
137 |
const char _IgnoreStandardIncludePath[] = "IgnoreStandardIncludePath"; |
|
138 |
const char _ImportLibrary[] = "ImportLibrary"; |
|
139 |
const char _ImproveFloatingPointConsistency[] = "ImproveFloatingPointConsistency"; |
|
140 |
const char _InlineFunctionExpansion[] = "InlineFunctionExpansion"; |
|
141 |
const char _InterfaceIdentifierFileName[] = "InterfaceIdentifierFileName"; |
|
142 |
const char _IntermediateDirectory[] = "IntermediateDirectory"; |
|
143 |
const char _KeepComments[] = "KeepComments"; |
|
144 |
const char _LargeAddressAware[] = "LargeAddressAware"; |
|
145 |
const char _LinkDLL[] = "LinkDLL"; |
|
146 |
const char _LinkIncremental[] = "LinkIncremental"; |
|
147 |
const char _LinkTimeCodeGeneration[] = "LinkTimeCodeGeneration"; |
|
148 |
const char _LinkToManagedResourceFile[] = "LinkToManagedResourceFile"; |
|
149 |
const char _MapExports[] = "MapExports"; |
|
150 |
const char _MapFileName[] = "MapFileName"; |
|
151 |
const char _MapLines[] = "MapLines "; |
|
152 |
const char _MergeSections[] = "MergeSections"; |
|
153 |
const char _MergedIDLBaseFileName[] = "MergedIDLBaseFileName"; |
|
154 |
const char _MidlCommandFile[] = "MidlCommandFile"; |
|
155 |
const char _MinimalRebuild[] = "MinimalRebuild"; |
|
156 |
const char _MkTypLibCompatible[] = "MkTypLibCompatible"; |
|
157 |
const char _ModuleDefinitionFile[] = "ModuleDefinitionFile"; |
|
158 |
const char _Name[] = "Name"; |
|
159 |
const char _ObjectFile[] = "ObjectFile"; |
|
160 |
const char _OmitFramePointers[] = "OmitFramePointers"; |
|
161 |
const char _OpenMP[] = "OpenMP"; |
|
162 |
const char _Optimization[] = "Optimization "; |
|
163 |
const char _OptimizeForProcessor[] = "OptimizeForProcessor"; |
|
164 |
const char _OptimizeForWindows98[] = "OptimizeForWindows98"; |
|
165 |
const char _OptimizeForWindowsApplication[] = "OptimizeForWindowsApplication"; |
|
166 |
const char _OptimizeReferences[] = "OptimizeReferences"; |
|
167 |
const char _OutputDirectory[] = "OutputDirectory"; |
|
168 |
const char _OutputFile[] = "OutputFile"; |
|
169 |
const char _Outputs[] = "Outputs"; |
|
170 |
const char _ParseFiles[] = "ParseFiles"; |
|
171 |
const char _PrecompiledHeaderFile[] = "PrecompiledHeaderFile"; |
|
172 |
const char _PrecompiledHeaderThrough[] = "PrecompiledHeaderThrough"; |
|
173 |
const char _PreprocessorDefinitions[] = "PreprocessorDefinitions"; |
|
174 |
const char _PrimaryOutput[] = "PrimaryOutput"; |
|
175 |
const char _ProjectGUID[] = "ProjectGUID"; |
|
176 |
const char _Keyword[] = "Keyword"; |
|
177 |
const char _ProjectType[] = "ProjectType"; |
|
178 |
const char _ProgramDatabase[] = "ProgramDatabase"; |
|
179 |
const char _ProgramDataBaseFileName[] = "ProgramDataBaseFileName"; |
|
180 |
const char _ProgramDatabaseFile[] = "ProgramDatabaseFile"; |
|
181 |
const char _ProxyFileName[] = "ProxyFileName"; |
|
182 |
const char _RedirectOutputAndErrors[] = "RedirectOutputAndErrors"; |
|
183 |
const char _RegisterOutput[] = "RegisterOutput"; |
|
184 |
const char _RelativePath[] = "RelativePath"; |
|
185 |
const char _RemoteDirectory[] = "RemoteDirectory"; |
|
186 |
const char _ResourceOnlyDLL[] = "ResourceOnlyDLL"; |
|
187 |
const char _ResourceOutputFileName[] = "ResourceOutputFileName"; |
|
188 |
const char _RuntimeLibrary[] = "RuntimeLibrary"; |
|
189 |
const char _RuntimeTypeInfo[] = "RuntimeTypeInfo"; |
|
190 |
const char _SccProjectName[] = "SccProjectName"; |
|
191 |
const char _SccLocalPath[] = "SccLocalPath"; |
|
192 |
const char _SetChecksum[] = "SetChecksum"; |
|
193 |
const char _ShowIncludes[] = "ShowIncludes"; |
|
194 |
const char _ShowProgress[] = "ShowProgress"; |
|
195 |
const char _SmallerTypeCheck[] = "SmallerTypeCheck"; |
|
196 |
const char _StackCommitSize[] = "StackCommitSize"; |
|
197 |
const char _StackReserveSize[] = "StackReserveSize"; |
|
198 |
const char _StringPooling[] = "StringPooling"; |
|
199 |
const char _StripPrivateSymbols[] = "StripPrivateSymbols"; |
|
200 |
const char _StructMemberAlignment[] = "StructMemberAlignment"; |
|
201 |
const char _SubSystem[] = "SubSystem"; |
|
202 |
const char _SupportUnloadOfDelayLoadedDLL[] = "SupportUnloadOfDelayLoadedDLL"; |
|
203 |
const char _SuppressStartupBanner[] = "SuppressStartupBanner"; |
|
204 |
const char _SwapRunFromCD[] = "SwapRunFromCD"; |
|
205 |
const char _SwapRunFromNet[] = "SwapRunFromNet"; |
|
206 |
const char _TargetEnvironment[] = "TargetEnvironment"; |
|
207 |
const char _TargetMachine[] = "TargetMachine"; |
|
208 |
const char _TerminalServerAware[] = "TerminalServerAware"; |
|
209 |
const char _Path[] = "Path"; |
|
210 |
const char _TreatWChar_tAsBuiltInType[] = "TreatWChar_tAsBuiltInType"; |
|
211 |
const char _TurnOffAssemblyGeneration[] = "TurnOffAssemblyGeneration"; |
|
212 |
const char _TypeLibraryFile[] = "TypeLibraryFile"; |
|
213 |
const char _TypeLibraryName[] = "TypeLibraryName"; |
|
214 |
const char _TypeLibraryResourceID[] = "TypeLibraryResourceID"; |
|
215 |
const char _UndefineAllPreprocessorDefinitions[]= "UndefineAllPreprocessorDefinitions"; |
|
216 |
const char _UndefinePreprocessorDefinitions[] = "UndefinePreprocessorDefinitions"; |
|
217 |
const char _UniqueIdentifier[] = "UniqueIdentifier"; |
|
218 |
const char _UseOfATL[] = "UseOfATL"; |
|
219 |
const char _UseOfMfc[] = "UseOfMfc"; |
|
220 |
const char _UsePrecompiledHeader[] = "UsePrecompiledHeader"; |
|
221 |
const char _ValidateParameters[] = "ValidateParameters"; |
|
222 |
const char _VCCLCompilerTool[] = "VCCLCompilerTool"; |
|
223 |
const char _VCLibrarianTool[] = "VCLibrarianTool"; |
|
224 |
const char _VCLinkerTool[] = "VCLinkerTool"; |
|
225 |
const char _VCCustomBuildTool[] = "VCCustomBuildTool"; |
|
226 |
const char _VCResourceCompilerTool[] = "VCResourceCompilerTool"; |
|
227 |
const char _VCMIDLTool[] = "VCMIDLTool"; |
|
228 |
const char _Version[] = "Version"; |
|
229 |
const char _WarnAsError[] = "WarnAsError"; |
|
230 |
const char _WarningLevel[] = "WarningLevel"; |
|
231 |
const char _WholeProgramOptimization[] = "WholeProgramOptimization"; |
|
232 |
const char _CompileForArchitecture[] = "CompileForArchitecture"; |
|
233 |
const char _InterworkCalls[] = "InterworkCalls"; |
|
234 |
||
235 |
// XmlOutput stream functions ------------------------------ |
|
236 |
inline XmlOutput::xml_output attrT(const char *name, const triState v) |
|
237 |
{ |
|
238 |
if(v == unset) |
|
239 |
return noxml(); |
|
240 |
return attr(name, (v == _True ? "true" : "false")); |
|
241 |
} |
|
242 |
||
243 |
inline XmlOutput::xml_output attrE(const char *name, int v) |
|
244 |
{ |
|
245 |
return attr(name, QString::number(v)); |
|
246 |
} |
|
247 |
||
248 |
/*ifNot version*/ |
|
249 |
inline XmlOutput::xml_output attrE(const char *name, int v, int ifn) |
|
250 |
{ |
|
251 |
if (v == ifn) |
|
252 |
return noxml(); |
|
253 |
return attr(name, QString::number(v)); |
|
254 |
} |
|
255 |
||
256 |
inline XmlOutput::xml_output attrL(const char *name, qint64 v) |
|
257 |
{ |
|
258 |
return attr(name, QString::number(v)); |
|
259 |
} |
|
260 |
||
261 |
/*ifNot version*/ |
|
262 |
inline XmlOutput::xml_output attrL(const char *name, qint64 v, qint64 ifn) |
|
263 |
{ |
|
264 |
if (v == ifn) |
|
265 |
return noxml(); |
|
266 |
return attr(name, QString::number(v)); |
|
267 |
} |
|
268 |
||
269 |
inline XmlOutput::xml_output attrS(const char *name, const QString &v) |
|
270 |
{ |
|
271 |
if(v.isEmpty()) |
|
272 |
return noxml(); |
|
273 |
return attr(name, v); |
|
274 |
} |
|
275 |
||
276 |
inline XmlOutput::xml_output attrX(const char *name, const QStringList &v, const char *s = ",") |
|
277 |
{ |
|
278 |
if(v.isEmpty()) |
|
279 |
return noxml(); |
|
280 |
return attr(name, v.join(s)); |
|
281 |
} |
|
282 |
||
283 |
// VCCLCompilerTool ------------------------------------------------- |
|
284 |
VCCLCompilerTool::VCCLCompilerTool() |
|
285 |
: AssemblerOutput(asmListingNone), |
|
286 |
BasicRuntimeChecks(runtimeBasicCheckNone), |
|
287 |
BrowseInformation(brInfoNone), |
|
288 |
BufferSecurityCheck(_False), |
|
289 |
CallingConvention(callConventionDefault), |
|
290 |
CompileAs(compileAsDefault), |
|
291 |
CompileAsManaged(managedDefault), |
|
292 |
CompileOnly(unset), |
|
293 |
DebugInformationFormat(debugDisabled), |
|
294 |
DefaultCharIsUnsigned(unset), |
|
295 |
Detect64BitPortabilityProblems(unset), |
|
296 |
DisableLanguageExtensions(unset), |
|
297 |
EnableEnhancedInstructionSet(archNotSet), |
|
298 |
EnableFiberSafeOptimizations(unset), |
|
299 |
EnableFunctionLevelLinking(unset), |
|
300 |
EnableIntrinsicFunctions(unset), |
|
301 |
ExceptionHandling(ehDefault), |
|
302 |
ExpandAttributedSource(unset), |
|
303 |
FavorSizeOrSpeed(favorNone), |
|
304 |
FloatingPointModel(floatingPointNotSet), |
|
305 |
FloatingPointExceptions(unset), |
|
306 |
ForceConformanceInForLoopScope(unset), |
|
307 |
GeneratePreprocessedFile(preprocessNo), |
|
308 |
GlobalOptimizations(unset), |
|
309 |
IgnoreStandardIncludePath(unset), |
|
310 |
ImproveFloatingPointConsistency(unset), |
|
311 |
InlineFunctionExpansion(expandDefault), |
|
312 |
KeepComments(unset), |
|
313 |
MinimalRebuild(unset), |
|
314 |
OmitFramePointers(unset), |
|
315 |
OpenMP(unset), |
|
316 |
Optimization(optimizeCustom), |
|
317 |
OptimizeForProcessor(procOptimizeBlended), |
|
318 |
OptimizeForWindowsApplication(unset), |
|
319 |
ProgramDataBaseFileName(""), |
|
320 |
RuntimeLibrary(rtMultiThreaded), |
|
321 |
RuntimeTypeInfo(unset), |
|
322 |
ShowIncludes(unset), |
|
323 |
SmallerTypeCheck(unset), |
|
324 |
StringPooling(unset), |
|
325 |
StructMemberAlignment(alignNotSet), |
|
326 |
SuppressStartupBanner(unset), |
|
327 |
TreatWChar_tAsBuiltInType(unset), |
|
328 |
TurnOffAssemblyGeneration(unset), |
|
329 |
UndefineAllPreprocessorDefinitions(unset), |
|
330 |
UsePrecompiledHeader(pchNone), |
|
331 |
WarnAsError(unset), |
|
332 |
WarningLevel(warningLevel_0), |
|
333 |
WholeProgramOptimization(unset), |
|
334 |
CompileForArchitecture(archUnknown), |
|
335 |
InterworkCalls(unset) |
|
336 |
{ |
|
337 |
} |
|
338 |
||
339 |
/* |
|
340 |
* Some values for the attribute UsePrecompiledHeader have changed from VS 2003 to VS 2005, |
|
341 |
* see the following chart, so we need a function that transforms those values if we are |
|
342 |
* using NET2005: |
|
343 |
* |
|
344 |
* Meaning 2003 2005 |
|
345 |
* ----------------------------------------- |
|
346 |
* Don't use PCH 0 0 |
|
347 |
* Create PCH (/Yc) 1 1 |
|
348 |
* Automatically generate (/YX) 2 (seems that it was removed) |
|
349 |
* Use specific PCH (/Yu) 3 2 |
|
350 |
* |
|
351 |
*/ |
|
352 |
inline XmlOutput::xml_output xformUsePrecompiledHeaderForNET2005(pchOption whatPch, DotNET compilerVersion) |
|
353 |
{ |
|
354 |
if (compilerVersion >= NET2005) { |
|
355 |
if (whatPch == pchGenerateAuto) whatPch = (pchOption)0; |
|
356 |
if (whatPch == pchUseUsingSpecific) whatPch = (pchOption)2; |
|
357 |
} |
|
358 |
return attrE(_UsePrecompiledHeader, whatPch); |
|
359 |
} |
|
360 |
||
361 |
inline XmlOutput::xml_output xformExceptionHandlingNET2005(exceptionHandling eh, DotNET compilerVersion) |
|
362 |
{ |
|
363 |
if (eh == ehDefault) |
|
364 |
return noxml(); |
|
365 |
||
366 |
if (compilerVersion >= NET2005) |
|
367 |
return attrE(_ExceptionHandling, eh); |
|
368 |
||
369 |
return attrS(_ExceptionHandling, (eh == ehNoSEH ? "true" : "false")); |
|
370 |
} |
|
371 |
||
372 |
XmlOutput &operator<<(XmlOutput &xml, const VCCLCompilerTool &tool) |
|
373 |
{ |
|
374 |
return xml |
|
375 |
<< tag(_Tool) |
|
376 |
<< attrS(_Name, _VCCLCompilerTool) |
|
377 |
<< attrX(_AdditionalIncludeDirectories, tool.AdditionalIncludeDirectories) |
|
378 |
<< attrX(_AdditionalOptions, tool.AdditionalOptions, " ") |
|
379 |
<< attrX(_AdditionalUsingDirectories, tool.AdditionalUsingDirectories) |
|
380 |
<< attrS(_AssemblerListingLocation, tool.AssemblerListingLocation) |
|
381 |
<< attrE(_AssemblerOutput, tool.AssemblerOutput, /*ifNot*/ asmListingNone) |
|
382 |
<< attrE(_BasicRuntimeChecks, tool.BasicRuntimeChecks, /*ifNot*/ runtimeBasicCheckNone) |
|
383 |
<< attrE(_BrowseInformation, tool.BrowseInformation, /*ifNot*/ brInfoNone) |
|
384 |
<< attrS(_BrowseInformationFile, tool.BrowseInformationFile) |
|
385 |
<< attrT(_BufferSecurityCheck, tool.BufferSecurityCheck) |
|
386 |
<< attrE(_CallingConvention, tool.CallingConvention, /*ifNot*/ callConventionDefault) |
|
387 |
<< attrE(_CompileAs, tool.CompileAs, compileAsDefault) |
|
388 |
<< attrE(_CompileAsManaged, tool.CompileAsManaged, /*ifNot*/ managedDefault) |
|
389 |
<< attrT(_CompileOnly, tool.CompileOnly) |
|
390 |
<< attrE(_DebugInformationFormat, tool.DebugInformationFormat, /*ifNot*/ debugUnknown) |
|
391 |
<< attrT(_DefaultCharIsUnsigned, tool.DefaultCharIsUnsigned) |
|
392 |
<< attrT(_Detect64BitPortabilityProblems, tool.Detect64BitPortabilityProblems) |
|
393 |
<< attrT(_DisableLanguageExtensions, tool.DisableLanguageExtensions) |
|
394 |
<< attrX(_DisableSpecificWarnings, tool.DisableSpecificWarnings) |
|
395 |
<< attrE(_EnableEnhancedInstructionSet, tool.EnableEnhancedInstructionSet, /*ifnot*/ archNotSet) |
|
396 |
<< attrT(_EnableFiberSafeOptimizations, tool.EnableFiberSafeOptimizations) |
|
397 |
<< attrT(_EnableFunctionLevelLinking, tool.EnableFunctionLevelLinking) |
|
398 |
<< attrT(_EnableIntrinsicFunctions, tool.EnableIntrinsicFunctions) |
|
399 |
<< xformExceptionHandlingNET2005(tool.ExceptionHandling, tool.config->CompilerVersion) |
|
400 |
<< attrT(_ExpandAttributedSource, tool.ExpandAttributedSource) |
|
401 |
<< attrE(_FavorSizeOrSpeed, tool.FavorSizeOrSpeed, /*ifNot*/ favorNone) |
|
402 |
||
403 |
<< attrE(_FloatingPointModel, tool.FloatingPointModel, /*ifNot*/ floatingPointNotSet) |
|
404 |
<< attrT(_FloatingPointExceptions, tool.FloatingPointExceptions) |
|
405 |
||
406 |
<< attrT(_ForceConformanceInForLoopScope, tool.ForceConformanceInForLoopScope) |
|
407 |
<< attrX(_ForcedIncludeFiles, tool.ForcedIncludeFiles) |
|
408 |
<< attrX(_ForcedUsingFiles, tool.ForcedUsingFiles) |
|
409 |
<< attrE(_GeneratePreprocessedFile, tool.GeneratePreprocessedFile, /*ifNot*/ preprocessUnknown) |
|
410 |
<< attrT(_GlobalOptimizations, tool.GlobalOptimizations) |
|
411 |
<< attrT(_IgnoreStandardIncludePath, tool.IgnoreStandardIncludePath) |
|
412 |
<< attrT(_ImproveFloatingPointConsistency, tool.ImproveFloatingPointConsistency) |
|
413 |
<< attrE(_InlineFunctionExpansion, tool.InlineFunctionExpansion, /*ifNot*/ expandDefault) |
|
414 |
<< attrT(_KeepComments, tool.KeepComments) |
|
415 |
<< attrT(_MinimalRebuild, tool.MinimalRebuild) |
|
416 |
<< attrS(_ObjectFile, tool.ObjectFile) |
|
417 |
<< attrT(_OmitFramePointers, tool.OmitFramePointers) |
|
418 |
<< attrT(_OpenMP, tool.OpenMP) |
|
419 |
<< attrE(_Optimization, tool.Optimization, /*ifNot*/ optimizeDefault) |
|
420 |
<< attrE(_OptimizeForProcessor, tool.OptimizeForProcessor, /*ifNot*/ procOptimizeBlended) |
|
421 |
<< attrT(_OptimizeForWindowsApplication, tool.OptimizeForWindowsApplication) |
|
422 |
<< attrS(_OutputFile, tool.OutputFile) |
|
423 |
<< attrS(_PrecompiledHeaderFile, tool.PrecompiledHeaderFile) |
|
424 |
<< attrS(_PrecompiledHeaderThrough, tool.PrecompiledHeaderThrough) |
|
425 |
<< attrX(_PreprocessorDefinitions, tool.PreprocessorDefinitions) |
|
426 |
<< (tool.ProgramDataBaseFileName.isNull() ? noxml() : attr(_ProgramDataBaseFileName, tool.ProgramDataBaseFileName)) |
|
427 |
<< attrE(_RuntimeLibrary, tool.RuntimeLibrary, /*ifNot*/ rtUnknown) |
|
428 |
<< attrT(_RuntimeTypeInfo, tool.RuntimeTypeInfo) |
|
429 |
<< attrT(_ShowIncludes, tool.ShowIncludes) |
|
430 |
<< attrT(_SmallerTypeCheck, tool.SmallerTypeCheck) |
|
431 |
<< attrT(_StringPooling, tool.StringPooling) |
|
432 |
<< attrE(_StructMemberAlignment, tool.StructMemberAlignment, /*ifNot*/ alignNotSet) |
|
433 |
<< attrT(_SuppressStartupBanner, tool.SuppressStartupBanner) |
|
434 |
<< attrT(_TreatWChar_tAsBuiltInType, tool.TreatWChar_tAsBuiltInType) |
|
435 |
<< attrT(_TurnOffAssemblyGeneration, tool.TurnOffAssemblyGeneration) |
|
436 |
<< attrT(_UndefineAllPreprocessorDefinitions, tool.UndefineAllPreprocessorDefinitions) |
|
437 |
<< attrX(_UndefinePreprocessorDefinitions, tool.UndefinePreprocessorDefinitions) |
|
438 |
<< (!tool.PrecompiledHeaderFile.isEmpty() || !tool.PrecompiledHeaderThrough.isEmpty() ? xformUsePrecompiledHeaderForNET2005(tool.UsePrecompiledHeader, tool.config->CompilerVersion) : noxml()) |
|
439 |
<< attrT(_WarnAsError, tool.WarnAsError) |
|
440 |
<< attrE(_WarningLevel, tool.WarningLevel, /*ifNot*/ warningLevelUnknown) |
|
441 |
<< attrT(_WholeProgramOptimization, tool.WholeProgramOptimization) |
|
442 |
<< attrE(_CompileForArchitecture, tool.CompileForArchitecture, /*ifNot*/ archUnknown) |
|
443 |
<< attrT(_InterworkCalls, tool.InterworkCalls) |
|
444 |
||
445 |
<< closetag(_Tool); |
|
446 |
} |
|
447 |
||
448 |
bool VCCLCompilerTool::parseOption(const char* option) |
|
449 |
{ |
|
450 |
// skip index 0 ('/' or '-') |
|
451 |
char first = option[1]; |
|
452 |
char second = option[2]; |
|
453 |
char third = option[3]; |
|
454 |
char fourth = option[4]; |
|
455 |
bool found = true; |
|
456 |
||
457 |
switch (first) { |
|
458 |
case '?': |
|
459 |
case 'h': |
|
460 |
qWarning("Generator: Option '/?', '/help': MSVC.NET projects do not support outputting help info"); |
|
461 |
found = false; |
|
462 |
break; |
|
463 |
case '@': |
|
464 |
qWarning("Generator: Option '/@': MSVC.NET projects do not support the use of a response file"); |
|
465 |
found = false; |
|
466 |
break; |
|
467 |
case 'l': |
|
468 |
qWarning("Generator: Option '/link': qmake generator does not support passing link options through the compiler tool"); |
|
469 |
found = false; |
|
470 |
break; |
|
471 |
case 'A': |
|
472 |
if(second != 'I') { |
|
473 |
found = false; break; |
|
474 |
} |
|
475 |
AdditionalUsingDirectories += option+3; |
|
476 |
break; |
|
477 |
case 'C': |
|
478 |
KeepComments = _True; |
|
479 |
break; |
|
480 |
case 'D': |
|
481 |
PreprocessorDefinitions += option+2; |
|
482 |
break; |
|
483 |
case 'E': |
|
484 |
if(second == 'H') { |
|
485 |
QString opt(option); |
|
486 |
if (opt.contains('a') && !opt.contains('s') && !opt.contains('c')) |
|
487 |
ExceptionHandling = ehSEH; |
|
488 |
else if (!opt.contains('a') && opt.contains("s-") && opt.contains("c-")) |
|
489 |
ExceptionHandling = ehNone; |
|
490 |
else if (!opt.contains('a') && opt.contains('s') && opt.contains('c')) |
|
491 |
ExceptionHandling = ehNoSEH; |
|
492 |
else { |
|
493 |
// ExceptionHandling must be false, or it will override |
|
494 |
// with an /EHsc option |
|
495 |
ExceptionHandling = ehNone; |
|
496 |
AdditionalOptions += option; |
|
497 |
} |
|
498 |
if (config->CompilerVersion < NET2005 |
|
499 |
&& ExceptionHandling == ehSEH) { |
|
500 |
ExceptionHandling = ehNone; |
|
501 |
AdditionalOptions += option; |
|
502 |
} |
|
503 |
break; |
|
504 |
} |
|
505 |
GeneratePreprocessedFile = preprocessYes; |
|
506 |
break; |
|
507 |
case 'F': |
|
508 |
if(second <= '9' && second >= '0') { |
|
509 |
AdditionalOptions += option; |
|
510 |
break; |
|
511 |
} else { |
|
512 |
switch (second) { |
|
513 |
case 'A': |
|
514 |
if(third == 'c') { |
|
515 |
AssemblerOutput = asmListingAsmMachine; |
|
516 |
if(fourth == 's') |
|
517 |
AssemblerOutput = asmListingAsmMachineSrc; |
|
518 |
} else if(third == 's') { |
|
519 |
AssemblerOutput = asmListingAsmSrc; |
|
520 |
} else { |
|
521 |
AssemblerOutput = asmListingAssemblyOnly; |
|
522 |
} |
|
523 |
break; |
|
524 |
case 'a': |
|
525 |
AssemblerListingLocation = option+3; |
|
526 |
break; |
|
527 |
case 'I': |
|
528 |
ForcedIncludeFiles += option+3; |
|
529 |
break; |
|
530 |
case 'R': |
|
531 |
BrowseInformation = brAllInfo; |
|
532 |
BrowseInformationFile = option+3; |
|
533 |
break; |
|
534 |
case 'r': |
|
535 |
BrowseInformation = brNoLocalSymbols; |
|
536 |
BrowseInformationFile = option+3; |
|
537 |
break; |
|
538 |
case 'U': |
|
539 |
ForcedUsingFiles += option+3; |
|
540 |
break; |
|
541 |
case 'd': |
|
542 |
ProgramDataBaseFileName = option+3; |
|
543 |
break; |
|
544 |
case 'e': |
|
545 |
OutputFile = option+3; |
|
546 |
break; |
|
547 |
case 'm': |
|
548 |
AdditionalOptions += option; |
|
549 |
break; |
|
550 |
case 'o': |
|
551 |
ObjectFile = option+3; |
|
552 |
break; |
|
553 |
case 'p': |
|
554 |
PrecompiledHeaderFile = option+3; |
|
555 |
break; |
|
556 |
case 'x': |
|
557 |
ExpandAttributedSource = _True; |
|
558 |
break; |
|
559 |
default: |
|
560 |
found = false; break; |
|
561 |
} |
|
562 |
} |
|
563 |
break; |
|
564 |
case 'G': |
|
565 |
switch (second) { |
|
566 |
case '3': |
|
567 |
case '4': |
|
568 |
qWarning("Option '/G3' and '/G4' were phased out in Visual C++ 5.0"); |
|
569 |
found = false; break; |
|
570 |
case '5': |
|
571 |
OptimizeForProcessor = procOptimizePentium; |
|
572 |
break; |
|
573 |
case '6': |
|
574 |
case 'B': |
|
575 |
OptimizeForProcessor = procOptimizePentiumProAndAbove; |
|
576 |
break; |
|
577 |
case '7': |
|
578 |
OptimizeForProcessor = procOptimizePentium4AndAbove; |
|
579 |
break; |
|
580 |
case 'A': |
|
581 |
OptimizeForWindowsApplication = _True; |
|
582 |
break; |
|
583 |
case 'F': |
|
584 |
StringPooling = _True; |
|
585 |
break; |
|
586 |
case 'H': |
|
587 |
AdditionalOptions += option; |
|
588 |
break; |
|
589 |
case 'L': |
|
590 |
WholeProgramOptimization = _True; |
|
591 |
if(third == '-') |
|
592 |
WholeProgramOptimization = _False; |
|
593 |
break; |
|
594 |
case 'R': |
|
595 |
RuntimeTypeInfo = _True; |
|
596 |
if(third == '-') |
|
597 |
RuntimeTypeInfo = _False; |
|
598 |
break; |
|
599 |
case 'S': |
|
600 |
BufferSecurityCheck = _True; |
|
601 |
break; |
|
602 |
case 'T': |
|
603 |
EnableFiberSafeOptimizations = _True; |
|
604 |
break; |
|
605 |
case 'X': |
|
606 |
// Same as the /EHsc option, which is Exception Handling without SEH |
|
607 |
ExceptionHandling = ehNoSEH; |
|
608 |
if (third == '-') |
|
609 |
ExceptionHandling = ehNone; |
|
610 |
break; |
|
611 |
case 'Z': |
|
612 |
case 'e': |
|
613 |
case 'h': |
|
614 |
AdditionalOptions += option; |
|
615 |
break; |
|
616 |
case 'd': |
|
617 |
CallingConvention = callConventionCDecl; |
|
618 |
break; |
|
619 |
case 'f': |
|
620 |
StringPooling = _True; |
|
621 |
AdditionalOptions += option; |
|
622 |
break; |
|
623 |
case 'm': |
|
624 |
MinimalRebuild = _True; |
|
625 |
if(third == '-') |
|
626 |
MinimalRebuild = _False; |
|
627 |
break; |
|
628 |
case 'r': |
|
629 |
CallingConvention = callConventionFastCall; |
|
630 |
break; |
|
631 |
case 's': |
|
632 |
// Warning: following [num] is not used, |
|
633 |
// were should we put it? |
|
634 |
BufferSecurityCheck = _True; |
|
635 |
break; |
|
636 |
case 'y': |
|
637 |
EnableFunctionLevelLinking = _True; |
|
638 |
break; |
|
639 |
case 'z': |
|
640 |
CallingConvention = callConventionStdCall; |
|
641 |
break; |
|
642 |
default: |
|
643 |
found = false; break; |
|
644 |
} |
|
645 |
break; |
|
646 |
case 'H': |
|
647 |
AdditionalOptions += option; |
|
648 |
break; |
|
649 |
case 'I': |
|
650 |
AdditionalIncludeDirectories += option+2; |
|
651 |
break; |
|
652 |
case 'J': |
|
653 |
DefaultCharIsUnsigned = _True; |
|
654 |
break; |
|
655 |
case 'L': |
|
656 |
if(second == 'D') { |
|
657 |
AdditionalOptions += option; |
|
658 |
break; |
|
659 |
} |
|
660 |
found = false; break; |
|
661 |
case 'M': |
|
662 |
if(second == 'D') { |
|
663 |
RuntimeLibrary = rtMultiThreadedDLL; |
|
664 |
if(third == 'd') |
|
665 |
RuntimeLibrary = rtMultiThreadedDebugDLL; |
|
666 |
break; |
|
667 |
} else if(second == 'L') { |
|
668 |
RuntimeLibrary = rtSingleThreaded; |
|
669 |
if(third == 'd') |
|
670 |
RuntimeLibrary = rtSingleThreadedDebug; |
|
671 |
break; |
|
672 |
} else if(second == 'T') { |
|
673 |
RuntimeLibrary = rtMultiThreaded; |
|
674 |
if(third == 'd') |
|
675 |
RuntimeLibrary = rtMultiThreadedDebug; |
|
676 |
break; |
|
33
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
677 |
} else if (second == 'P') { |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
678 |
if (config->CompilerVersion >= NET2005) |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
679 |
AdditionalOptions += option; |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
680 |
else |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
681 |
warn_msg(WarnLogic, "/MP option is not supported in Visual C++ < 2005, ignoring."); |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
682 |
break; |
0 | 683 |
} |
684 |
found = false; break; |
|
685 |
case 'O': |
|
686 |
switch (second) { |
|
687 |
case '1': |
|
688 |
Optimization = optimizeMinSpace; |
|
689 |
break; |
|
690 |
case '2': |
|
691 |
Optimization = optimizeMaxSpeed; |
|
692 |
break; |
|
693 |
case 'a': |
|
694 |
AdditionalOptions += option; |
|
695 |
break; |
|
696 |
case 'b': |
|
697 |
if(third == '0') |
|
698 |
InlineFunctionExpansion = expandDisable; |
|
699 |
else if(third == '1') |
|
700 |
InlineFunctionExpansion = expandOnlyInline; |
|
701 |
else if(third == '2') |
|
702 |
InlineFunctionExpansion = expandAnySuitable; |
|
703 |
else |
|
704 |
found = false; |
|
705 |
break; |
|
706 |
case 'd': |
|
707 |
Optimization = optimizeDisabled; |
|
708 |
break; |
|
709 |
case 'g': |
|
710 |
GlobalOptimizations = _True; |
|
711 |
break; |
|
712 |
case 'i': |
|
713 |
EnableIntrinsicFunctions = _True; |
|
714 |
break; |
|
715 |
case 'p': |
|
716 |
ImproveFloatingPointConsistency = _True; |
|
717 |
if(third == '-') |
|
718 |
ImproveFloatingPointConsistency = _False; |
|
719 |
break; |
|
720 |
case 's': |
|
721 |
FavorSizeOrSpeed = favorSize; |
|
722 |
break; |
|
723 |
case 't': |
|
724 |
FavorSizeOrSpeed = favorSpeed; |
|
725 |
break; |
|
726 |
case 'w': |
|
727 |
AdditionalOptions += option; |
|
728 |
break; |
|
729 |
case 'x': |
|
730 |
Optimization = optimizeFull; |
|
731 |
break; |
|
732 |
case 'y': |
|
733 |
OmitFramePointers = _True; |
|
734 |
if(third == '-') |
|
735 |
OmitFramePointers = _False; |
|
736 |
break; |
|
737 |
default: |
|
738 |
found = false; break; |
|
739 |
} |
|
740 |
break; |
|
741 |
case 'P': |
|
742 |
GeneratePreprocessedFile = preprocessYes; |
|
743 |
break; |
|
744 |
case 'Q': |
|
745 |
if(second == 'I') { |
|
746 |
AdditionalOptions += option; |
|
747 |
break; |
|
748 |
} else if (second == 'R') { |
|
749 |
QString opt = option + 3; |
|
750 |
if (opt == "interwork-return") { |
|
751 |
InterworkCalls = _True; |
|
752 |
break; |
|
753 |
} else if (opt == "arch4") { |
|
754 |
CompileForArchitecture = archArmv4; |
|
755 |
break; |
|
756 |
} else if (opt == "arch5") { |
|
757 |
CompileForArchitecture = archArmv5; |
|
758 |
break; |
|
759 |
} else if (opt == "arch4T") { |
|
760 |
CompileForArchitecture = archArmv4T; |
|
761 |
break; |
|
762 |
} else if (opt == "arch5T") { |
|
763 |
CompileForArchitecture = archArmv5T; |
|
764 |
break; |
|
765 |
} |
|
766 |
} else if (second == 'M') { |
|
767 |
QString opt = option + 3; |
|
768 |
if (opt == "mips1") { |
|
769 |
CompileForArchitecture = archMips1; |
|
770 |
break; |
|
771 |
} |
|
772 |
else if (opt == "mips2") { |
|
773 |
CompileForArchitecture = archMips2; |
|
774 |
break; |
|
775 |
} |
|
776 |
else if (opt == "mips3") { |
|
777 |
CompileForArchitecture = archMips3; |
|
778 |
break; |
|
779 |
} |
|
780 |
else if (opt == "mips4") { |
|
781 |
CompileForArchitecture = archMips4; |
|
782 |
break; |
|
783 |
} |
|
784 |
else if (opt == "mips5") { |
|
785 |
CompileForArchitecture = archMips5; |
|
786 |
break; |
|
787 |
} |
|
788 |
else if (opt == "mips16") { |
|
789 |
CompileForArchitecture = archMips16; |
|
790 |
break; |
|
791 |
} |
|
792 |
else if (opt == "mips32") { |
|
793 |
CompileForArchitecture = archMips32; |
|
794 |
break; |
|
795 |
} |
|
796 |
else if (opt == "mips64") { |
|
797 |
CompileForArchitecture = archMips64; |
|
798 |
break; |
|
799 |
} |
|
800 |
} |
|
801 |
found = false; break; |
|
802 |
case 'R': |
|
803 |
if(second == 'T' && third == 'C') { |
|
804 |
if(fourth == '1') |
|
805 |
BasicRuntimeChecks = runtimeBasicCheckAll; |
|
806 |
else if(fourth == 'c') |
|
807 |
SmallerTypeCheck = _True; |
|
808 |
else if(fourth == 's') |
|
809 |
BasicRuntimeChecks = runtimeCheckStackFrame; |
|
810 |
else if(fourth == 'u') |
|
811 |
BasicRuntimeChecks = runtimeCheckUninitVariables; |
|
812 |
else |
|
813 |
found = false; break; |
|
814 |
} |
|
815 |
break; |
|
816 |
case 'T': |
|
817 |
if(second == 'C') { |
|
818 |
CompileAs = compileAsC; |
|
819 |
} else if(second == 'P') { |
|
820 |
CompileAs = compileAsCPlusPlus; |
|
821 |
} else { |
|
822 |
qWarning("Generator: Options '/Tp<filename>' and '/Tc<filename>' are not supported by qmake"); |
|
823 |
found = false; break; |
|
824 |
} |
|
825 |
break; |
|
826 |
case 'U': |
|
827 |
UndefinePreprocessorDefinitions += option+2; |
|
828 |
break; |
|
829 |
case 'V': |
|
830 |
AdditionalOptions += option; |
|
831 |
break; |
|
832 |
case 'W': |
|
833 |
switch (second) { |
|
834 |
case 'a': |
|
835 |
case '4': |
|
836 |
WarningLevel = warningLevel_4; |
|
837 |
break; |
|
838 |
case '3': |
|
839 |
WarningLevel = warningLevel_3; |
|
840 |
break; |
|
841 |
case '2': |
|
842 |
WarningLevel = warningLevel_2; |
|
843 |
break; |
|
844 |
case '1': |
|
845 |
WarningLevel = warningLevel_1; |
|
846 |
break; |
|
847 |
case '0': |
|
848 |
WarningLevel = warningLevel_0; |
|
849 |
break; |
|
850 |
case 'L': |
|
851 |
AdditionalOptions += option; |
|
852 |
break; |
|
853 |
case 'X': |
|
854 |
WarnAsError = _True; |
|
855 |
break; |
|
856 |
case 'p': |
|
857 |
if(third == '6' && fourth == '4') { |
|
858 |
Detect64BitPortabilityProblems = _True; |
|
859 |
break; |
|
860 |
} |
|
861 |
// Fallthrough |
|
862 |
default: |
|
863 |
found = false; break; |
|
864 |
} |
|
865 |
break; |
|
866 |
case 'X': |
|
867 |
IgnoreStandardIncludePath = _True; |
|
868 |
break; |
|
869 |
case 'Y': |
|
870 |
switch (second) { |
|
871 |
case '\0': |
|
872 |
case '-': |
|
873 |
AdditionalOptions += option; |
|
874 |
break; |
|
875 |
case 'X': |
|
876 |
UsePrecompiledHeader = pchGenerateAuto; |
|
877 |
PrecompiledHeaderFile = option+3; |
|
878 |
break; |
|
879 |
case 'c': |
|
880 |
UsePrecompiledHeader = pchCreateUsingSpecific; |
|
881 |
PrecompiledHeaderFile = option+3; |
|
882 |
break; |
|
883 |
case 'd': |
|
884 |
case 'l': |
|
885 |
AdditionalOptions += option; |
|
886 |
break; |
|
887 |
case 'u': |
|
888 |
UsePrecompiledHeader = pchUseUsingSpecific; |
|
889 |
PrecompiledHeaderFile = option+3; |
|
890 |
break; |
|
891 |
default: |
|
892 |
found = false; break; |
|
893 |
} |
|
894 |
break; |
|
895 |
case 'Z': |
|
896 |
switch (second) { |
|
897 |
case '7': |
|
898 |
DebugInformationFormat = debugOldStyleInfo; |
|
899 |
break; |
|
900 |
case 'I': |
|
901 |
DebugInformationFormat = debugEditAndContinue; |
|
902 |
break; |
|
903 |
case 'd': |
|
904 |
DebugInformationFormat = debugLineInfoOnly; |
|
905 |
break; |
|
906 |
case 'i': |
|
907 |
DebugInformationFormat = debugEnabled; |
|
908 |
break; |
|
909 |
case 'l': |
|
910 |
DebugInformationFormat = debugEditAndContinue; |
|
911 |
break; |
|
912 |
case 'a': |
|
913 |
DisableLanguageExtensions = _True; |
|
914 |
break; |
|
915 |
case 'e': |
|
916 |
DisableLanguageExtensions = _False; |
|
917 |
break; |
|
918 |
case 'c': |
|
919 |
if(third == ':') { |
|
920 |
const char *c = option + 4; |
|
921 |
// Go to the end of the option |
|
922 |
while ( *c != '\0' && *c != ' ' && *c != '-') |
|
923 |
++c; |
|
924 |
if(fourth == 'f') |
|
925 |
ForceConformanceInForLoopScope = ((*c) == '-' ? _False : _True); |
|
926 |
else if(fourth == 'w') |
|
927 |
TreatWChar_tAsBuiltInType = ((*c) == '-' ? _False : _True); |
|
928 |
else |
|
929 |
found = false; |
|
930 |
} else { |
|
931 |
found = false; break; |
|
932 |
} |
|
933 |
break; |
|
934 |
case 'g': |
|
935 |
case 'm': |
|
936 |
case 's': |
|
937 |
AdditionalOptions += option; |
|
938 |
break; |
|
939 |
case 'p': |
|
940 |
switch (third) |
|
941 |
{ |
|
942 |
case '\0': |
|
943 |
case '1': |
|
944 |
StructMemberAlignment = alignSingleByte; |
|
945 |
if(fourth == '6') |
|
946 |
StructMemberAlignment = alignSixteenBytes; |
|
947 |
break; |
|
948 |
case '2': |
|
949 |
StructMemberAlignment = alignTwoBytes; |
|
950 |
break; |
|
951 |
case '4': |
|
952 |
StructMemberAlignment = alignFourBytes; |
|
953 |
break; |
|
954 |
case '8': |
|
955 |
StructMemberAlignment = alignEightBytes; |
|
956 |
break; |
|
957 |
default: |
|
958 |
found = false; break; |
|
959 |
} |
|
960 |
break; |
|
961 |
default: |
|
962 |
found = false; break; |
|
963 |
} |
|
964 |
break; |
|
965 |
case 'a': |
|
966 |
if (second == 'r' && third == 'c' && fourth == 'h') { |
|
967 |
if (option[5] == ':') { |
|
968 |
const char *o = option; |
|
969 |
if (o[6] == 'S' && o[7] == 'S' && o[8] == 'E') { |
|
970 |
EnableEnhancedInstructionSet = o[9] == '2' ? archSSE2 : archSSE; |
|
971 |
break; |
|
972 |
} |
|
973 |
} |
|
974 |
} |
|
975 |
found = false; |
|
976 |
break; |
|
977 |
case 'b': // see http://msdn2.microsoft.com/en-us/library/ms173499.aspx |
|
978 |
if (second == 'i' && third == 'g' && fourth == 'o') { |
|
979 |
const char *o = option; |
|
980 |
if (o[5] == 'b' && o[6] == 'j') { |
|
981 |
AdditionalOptions += option; |
|
982 |
break; |
|
983 |
} |
|
984 |
} |
|
985 |
found = false; |
|
986 |
break; |
|
987 |
case 'c': |
|
988 |
if(second == '\0') { |
|
989 |
CompileOnly = _True; |
|
990 |
} else if(second == 'l') { |
|
991 |
if (config->CompilerVersion < NET2005) { |
|
992 |
if(*(option+5) == 'n') { |
|
993 |
CompileAsManaged = managedAssemblyPure; |
|
994 |
TurnOffAssemblyGeneration = _True; |
|
995 |
} else if(*(option+5) == 'p') { |
|
996 |
CompileAsManaged = managedAssemblyPure; |
|
997 |
warn_msg(WarnLogic, "/clr:pure option only for .NET >= 2005, using /clr"); |
|
998 |
} else if(*(option+5) == 's') { |
|
999 |
CompileAsManaged = managedAssemblyPure; |
|
1000 |
warn_msg(WarnLogic, "/clr:safe option only for .NET >= 2005, using /clr"); |
|
1001 |
} else if(*(option+5) == 'o') { |
|
1002 |
CompileAsManaged = managedAssemblyPure; |
|
1003 |
warn_msg(WarnLogic, "/clr:oldSyntax option only for .NET >= 2005, using /clr"); |
|
1004 |
} else if(*(option+5) == 'i') { |
|
1005 |
CompileAsManaged = managedAssemblyPure; |
|
1006 |
warn_msg(WarnLogic, "initialAppDomain enum value unknown, using /crl"); |
|
1007 |
} else { |
|
1008 |
CompileAsManaged = managedAssemblyPure; |
|
1009 |
} |
|
1010 |
} else { |
|
1011 |
if(*(option+5) == 'n') { |
|
1012 |
CompileAsManaged = managedAssembly; |
|
1013 |
TurnOffAssemblyGeneration = _True; |
|
1014 |
} else if(*(option+5) == 'p') { |
|
1015 |
CompileAsManaged = managedAssemblyPure; |
|
1016 |
} else if(*(option+5) == 's') { |
|
1017 |
CompileAsManaged = managedAssemblySafe; |
|
1018 |
} else if(*(option+5) == 'o') { |
|
1019 |
CompileAsManaged = managedAssemblyOldSyntax; |
|
1020 |
} else if(*(option+5) == 'i') { |
|
1021 |
CompileAsManaged = managedAssembly; |
|
1022 |
warn_msg(WarnLogic, "initialAppDomain enum value unknown, using /crl default"); |
|
1023 |
} else { |
|
1024 |
CompileAsManaged = managedAssembly; |
|
1025 |
} |
|
1026 |
} |
|
1027 |
} else { |
|
1028 |
found = false; break; |
|
1029 |
} |
|
1030 |
break; |
|
1031 |
case 'd': |
|
1032 |
if(second != 'r') { |
|
1033 |
found = false; break; |
|
1034 |
} |
|
1035 |
CompileAsManaged = managedAssembly; |
|
1036 |
break; |
|
1037 |
case 'f': |
|
1038 |
if(second == 'p' && third == ':') { |
|
1039 |
// Go to the end of the option |
|
1040 |
const char *c = option + 4; |
|
1041 |
while (*c != '\0' && *c != ' ' && *c != '-') |
|
1042 |
++c; |
|
1043 |
switch (fourth) { |
|
1044 |
case 'e': |
|
1045 |
FloatingPointExceptions = ((*c) == '-' ? _False : _True); |
|
1046 |
break; |
|
1047 |
case 'f': |
|
1048 |
FloatingPointModel = floatingPointFast; |
|
1049 |
break; |
|
1050 |
case 'p': |
|
1051 |
FloatingPointModel = floatingPointPrecise; |
|
1052 |
break; |
|
1053 |
case 's': |
|
1054 |
FloatingPointModel = floatingPointStrict; |
|
1055 |
break; |
|
1056 |
default: |
|
1057 |
found = false; |
|
1058 |
break; |
|
1059 |
} |
|
1060 |
} |
|
1061 |
break; |
|
1062 |
case 'n': |
|
1063 |
if(second == 'o' && third == 'B' && fourth == 'o') { |
|
1064 |
AdditionalOptions += "/noBool"; |
|
1065 |
break; |
|
1066 |
} |
|
1067 |
if(second == 'o' && third == 'l' && fourth == 'o') { |
|
1068 |
SuppressStartupBanner = _True; |
|
1069 |
break; |
|
1070 |
} |
|
1071 |
found = false; break; |
|
1072 |
case 'o': |
|
1073 |
if (second == 'p' && third == 'e' && fourth == 'n') { |
|
1074 |
OpenMP = _True; |
|
1075 |
break; |
|
1076 |
} |
|
1077 |
found = false; break; |
|
1078 |
case 's': |
|
1079 |
if(second == 'h' && third == 'o' && fourth == 'w') { |
|
1080 |
ShowIncludes = _True; |
|
1081 |
break; |
|
1082 |
} |
|
1083 |
found = false; break; |
|
1084 |
case 'u': |
|
1085 |
UndefineAllPreprocessorDefinitions = _True; |
|
1086 |
break; |
|
1087 |
case 'v': |
|
1088 |
if(second == 'd' || second == 'm') { |
|
1089 |
AdditionalOptions += option; |
|
1090 |
break; |
|
1091 |
} |
|
1092 |
found = false; break; |
|
1093 |
case 'w': |
|
1094 |
switch (second) { |
|
1095 |
case '\0': |
|
1096 |
WarningLevel = warningLevel_0; |
|
1097 |
break; |
|
1098 |
case 'd': |
|
1099 |
DisableSpecificWarnings += option+3; |
|
1100 |
break; |
|
1101 |
default: |
|
1102 |
AdditionalOptions += option; |
|
1103 |
} |
|
1104 |
break; |
|
1105 |
default: |
|
1106 |
AdditionalOptions += option; |
|
1107 |
break; |
|
1108 |
} |
|
1109 |
if(!found) { |
|
1110 |
warn_msg(WarnLogic, "Could not parse Compiler option: %s, added as AdditionalOption", option); |
|
1111 |
AdditionalOptions += option; |
|
1112 |
} |
|
1113 |
return true; |
|
1114 |
} |
|
1115 |
||
1116 |
// VCLinkerTool ----------------------------------------------------- |
|
1117 |
VCLinkerTool::VCLinkerTool() |
|
1118 |
: EnableCOMDATFolding(optFoldingDefault), |
|
1119 |
GenerateDebugInformation(unset), |
|
1120 |
GenerateMapFile(unset), |
|
1121 |
HeapCommitSize(-1), |
|
1122 |
HeapReserveSize(-1), |
|
1123 |
IgnoreAllDefaultLibraries(unset), |
|
1124 |
IgnoreEmbeddedIDL(unset), |
|
1125 |
IgnoreImportLibrary(_True), |
|
1126 |
LargeAddressAware(addrAwareDefault), |
|
1127 |
LinkDLL(unset), |
|
1128 |
LinkIncremental(linkIncrementalDefault), |
|
1129 |
LinkTimeCodeGeneration(optLTCGDefault), |
|
1130 |
MapExports(unset), |
|
1131 |
MapLines(unset), |
|
1132 |
OptimizeForWindows98(optWin98Default), |
|
1133 |
OptimizeReferences(optReferencesDefault), |
|
1134 |
RegisterOutput(unset), |
|
1135 |
ResourceOnlyDLL(unset), |
|
1136 |
SetChecksum(unset), |
|
1137 |
ShowProgress(linkProgressNotSet), |
|
1138 |
StackCommitSize(-1), |
|
1139 |
StackReserveSize(-1), |
|
1140 |
SubSystem(subSystemNotSet), |
|
1141 |
SupportUnloadOfDelayLoadedDLL(unset), |
|
1142 |
SuppressStartupBanner(unset), |
|
1143 |
SwapRunFromCD(unset), |
|
1144 |
SwapRunFromNet(unset), |
|
1145 |
TargetMachine(machineNotSet), |
|
1146 |
TerminalServerAware(termSvrAwareDefault), |
|
1147 |
TurnOffAssemblyGeneration(unset), |
|
1148 |
TypeLibraryResourceID(0) |
|
1149 |
{ |
|
1150 |
} |
|
1151 |
||
1152 |
XmlOutput &operator<<(XmlOutput &xml, const VCLinkerTool &tool) |
|
1153 |
{ |
|
1154 |
return xml |
|
1155 |
<< tag(_Tool) |
|
1156 |
<< attrS(_Name, _VCLinkerTool) |
|
1157 |
<< attrX(_AdditionalDependencies, tool.AdditionalDependencies, " ") |
|
1158 |
<< attrX(_AdditionalLibraryDirectories, tool.AdditionalLibraryDirectories) |
|
1159 |
<< attrX(_AdditionalOptions, tool.AdditionalOptions, " ") |
|
1160 |
<< attrX(_AddModuleNamesToAssembly, tool.AddModuleNamesToAssembly) |
|
1161 |
<< attrS(_BaseAddress, tool.BaseAddress) |
|
1162 |
<< attrX(_DelayLoadDLLs, tool.DelayLoadDLLs) |
|
1163 |
<< attrE(_EnableCOMDATFolding, tool.EnableCOMDATFolding, /*ifNot*/ optFoldingDefault) |
|
1164 |
<< attrS(_EntryPointSymbol, tool.EntryPointSymbol) |
|
1165 |
<< attrX(_ForceSymbolReferences, tool.ForceSymbolReferences) |
|
1166 |
<< attrS(_FunctionOrder, tool.FunctionOrder) |
|
1167 |
<< attrT(_GenerateDebugInformation, tool.GenerateDebugInformation) |
|
1168 |
<< attrT(_GenerateMapFile, tool.GenerateMapFile) |
|
1169 |
<< attrL(_HeapCommitSize, tool.HeapCommitSize, /*ifNot*/ -1) |
|
1170 |
<< attrL(_HeapReserveSize, tool.HeapReserveSize, /*ifNot*/ -1) |
|
1171 |
<< attrT(_IgnoreAllDefaultLibraries, tool.IgnoreAllDefaultLibraries) |
|
1172 |
<< attrX(_IgnoreDefaultLibraryNames, tool.IgnoreDefaultLibraryNames) |
|
1173 |
<< attrT(_IgnoreEmbeddedIDL, tool.IgnoreEmbeddedIDL) |
|
1174 |
<< attrT(_IgnoreImportLibrary, tool.IgnoreImportLibrary) |
|
1175 |
<< attrS(_ImportLibrary, tool.ImportLibrary) |
|
1176 |
<< attrE(_LargeAddressAware, tool.LargeAddressAware, /*ifNot*/ addrAwareDefault) |
|
1177 |
<< attrT(_LinkDLL, tool.LinkDLL) |
|
1178 |
<< attrE(_LinkIncremental, tool.LinkIncremental, /*ifNot*/ linkIncrementalDefault) |
|
1179 |
<< attrE(_LinkTimeCodeGeneration, tool.LinkTimeCodeGeneration) |
|
1180 |
<< attrS(_LinkToManagedResourceFile, tool.LinkToManagedResourceFile) |
|
1181 |
<< attrT(_MapExports, tool.MapExports) |
|
1182 |
<< attrS(_MapFileName, tool.MapFileName) |
|
1183 |
<< attrT(_MapLines, tool.MapLines) |
|
1184 |
<< attrS(_MergedIDLBaseFileName, tool.MergedIDLBaseFileName) |
|
1185 |
<< attrS(_MergeSections, tool.MergeSections) |
|
1186 |
<< attrS(_MidlCommandFile, tool.MidlCommandFile) |
|
1187 |
<< attrS(_ModuleDefinitionFile, tool.ModuleDefinitionFile) |
|
1188 |
<< attrE(_OptimizeForWindows98, tool.OptimizeForWindows98, /*ifNot*/ optWin98Default) |
|
1189 |
<< attrE(_OptimizeReferences, tool.OptimizeReferences, /*ifNot*/ optReferencesDefault) |
|
1190 |
<< attrS(_OutputFile, tool.OutputFile) |
|
1191 |
<< attr(_ProgramDatabaseFile, tool.ProgramDatabaseFile) |
|
1192 |
<< attrT(_RegisterOutput, tool.RegisterOutput) |
|
1193 |
<< attrT(_ResourceOnlyDLL, tool.ResourceOnlyDLL) |
|
1194 |
<< attrT(_SetChecksum, tool.SetChecksum) |
|
1195 |
<< attrE(_ShowProgress, tool.ShowProgress, /*ifNot*/ linkProgressNotSet) |
|
1196 |
<< attrL(_StackCommitSize, tool.StackCommitSize, /*ifNot*/ -1) |
|
1197 |
<< attrL(_StackReserveSize, tool.StackReserveSize, /*ifNot*/ -1) |
|
1198 |
<< attrS(_StripPrivateSymbols, tool.StripPrivateSymbols) |
|
1199 |
<< attrE(_SubSystem, tool.SubSystem) |
|
1200 |
<< attrT(_SupportUnloadOfDelayLoadedDLL, tool.SupportUnloadOfDelayLoadedDLL) |
|
1201 |
<< attrT(_SuppressStartupBanner, tool.SuppressStartupBanner) |
|
1202 |
<< attrT(_SwapRunFromCD, tool.SwapRunFromCD) |
|
1203 |
<< attrT(_SwapRunFromNet, tool.SwapRunFromNet) |
|
1204 |
<< attrE(_TargetMachine, tool.TargetMachine, /*ifNot*/ machineNotSet) |
|
1205 |
<< attrE(_TerminalServerAware, tool.TerminalServerAware, /*ifNot*/ termSvrAwareDefault) |
|
1206 |
<< attrT(_TurnOffAssemblyGeneration, tool.TurnOffAssemblyGeneration) |
|
1207 |
<< attrS(_TypeLibraryFile, tool.TypeLibraryFile) |
|
1208 |
<< attrL(_TypeLibraryResourceID, tool.TypeLibraryResourceID, /*ifNot*/ rcUseDefault) |
|
1209 |
<< attrS(_Version, tool.Version) |
|
1210 |
<< closetag(_Tool); |
|
1211 |
} |
|
1212 |
||
1213 |
// Hashing routine to do fast option lookups ---- |
|
1214 |
// Slightly rewritten to stop on ':' ',' and '\0' |
|
1215 |
// Original routine in qtranslator.cpp ---------- |
|
1216 |
static uint elfHash(const char* name) |
|
1217 |
{ |
|
1218 |
const uchar *k; |
|
1219 |
uint h = 0; |
|
1220 |
uint g; |
|
1221 |
||
1222 |
if(name) { |
|
1223 |
k = (const uchar *) name; |
|
1224 |
while((*k) && |
|
1225 |
(*k)!= ':' && |
|
1226 |
(*k)!=',' && |
|
1227 |
(*k)!=' ') { |
|
1228 |
h = (h << 4) + *k++; |
|
1229 |
if((g = (h & 0xf0000000)) != 0) |
|
1230 |
h ^= g >> 24; |
|
1231 |
h &= ~g; |
|
1232 |
} |
|
1233 |
} |
|
1234 |
if(!h) |
|
1235 |
h = 1; |
|
1236 |
return h; |
|
1237 |
} |
|
1238 |
||
1239 |
//#define USE_DISPLAY_HASH |
|
1240 |
#ifdef USE_DISPLAY_HASH |
|
1241 |
static void displayHash(const char* str) |
|
1242 |
{ |
|
1243 |
printf("case 0x%07x: // %s\n break;\n", elfHash(str), str); |
|
1244 |
} |
|
1245 |
#endif |
|
1246 |
||
1247 |
bool VCLinkerTool::parseOption(const char* option) |
|
1248 |
{ |
|
1249 |
#ifdef USE_DISPLAY_HASH |
|
1250 |
// Main options |
|
1251 |
displayHash("/ALIGN"); displayHash("/ALLOWBIND"); displayHash("/ASSEMBLYMODULE"); |
|
1252 |
displayHash("/ASSEMBLYRESOURCE"); displayHash("/BASE"); displayHash("/DEBUG"); |
|
1253 |
displayHash("/DEF"); displayHash("/DEFAULTLIB"); displayHash("/DELAY"); |
|
1254 |
displayHash("/DELAYLOAD"); displayHash("/DLL"); displayHash("/DRIVER"); |
|
1255 |
displayHash("/ENTRY"); displayHash("/EXETYPE"); displayHash("/EXPORT"); |
|
1256 |
displayHash("/FIXED"); displayHash("/FORCE"); displayHash("/HEAP"); |
|
1257 |
displayHash("/IDLOUT"); displayHash("/IGNORE"); displayHash("/IGNOREIDL"); displayHash("/IMPLIB"); |
|
1258 |
displayHash("/INCLUDE"); displayHash("/INCREMENTAL"); displayHash("/LARGEADDRESSAWARE"); |
|
1259 |
displayHash("/LIBPATH"); displayHash("/LTCG"); displayHash("/MACHINE"); |
|
1260 |
displayHash("/MAP"); displayHash("/MAPINFO"); displayHash("/MERGE"); |
|
1261 |
displayHash("/MIDL"); displayHash("/NOASSEMBLY"); displayHash("/NODEFAULTLIB"); |
|
1262 |
displayHash("/NOENTRY"); displayHash("/NOLOGO"); displayHash("/OPT"); |
|
1263 |
displayHash("/ORDER"); displayHash("/OUT"); displayHash("/PDB"); |
|
1264 |
displayHash("/PDBSTRIPPED"); displayHash("/RELEASE"); displayHash("/SECTION"); |
|
1265 |
displayHash("/STACK"); displayHash("/STUB"); displayHash("/SUBSYSTEM"); |
|
1266 |
displayHash("/SWAPRUN"); displayHash("/TLBID"); displayHash("/TLBOUT"); |
|
1267 |
displayHash("/TSAWARE"); displayHash("/VERBOSE"); displayHash("/VERSION"); |
|
1268 |
displayHash("/VXD"); displayHash("/WS "); displayHash("/libpath"); |
|
1269 |
||
1270 |
#endif |
|
1271 |
#ifdef USE_DISPLAY_HASH |
|
1272 |
// Sub options |
|
1273 |
displayHash("UNLOAD"); displayHash("NOBIND"); displayHash("no"); displayHash("NOSTATUS"); displayHash("STATUS"); |
|
1274 |
displayHash("AM33"); displayHash("ARM"); displayHash("CEE"); displayHash("EBC"); displayHash("IA64"); displayHash("X86"); displayHash("X64"); displayHash("M32R"); |
|
1275 |
displayHash("MIPS"); displayHash("MIPS16"); displayHash("MIPSFPU"); displayHash("MIPSFPU16"); displayHash("MIPSR41XX"); displayHash("PPC"); |
|
1276 |
displayHash("SH3"); displayHash("SH3DSP"); displayHash("SH4"); displayHash("SH5"); displayHash("THUMB"); displayHash("TRICORE"); displayHash("EXPORTS"); |
|
1277 |
displayHash("LINES"); displayHash("REF"); displayHash("NOREF"); displayHash("ICF"); displayHash("WIN98"); displayHash("NOWIN98"); |
|
1278 |
displayHash("CONSOLE"); displayHash("EFI_APPLICATION"); displayHash("EFI_BOOT_SERVICE_DRIVER"); displayHash("EFI_ROM"); displayHash("EFI_RUNTIME_DRIVER"); displayHash("NATIVE"); |
|
1279 |
displayHash("POSIX"); displayHash("WINDOWS"); displayHash("WINDOWSCE"); displayHash("NET"); displayHash("CD"); displayHash("NO"); |
|
1280 |
#endif |
|
1281 |
bool found = true; |
|
1282 |
switch (elfHash(option)) { |
|
1283 |
case 0x3360dbe: // /ALIGN[:number] |
|
1284 |
case 0x1485c34: // /ALLOWBIND[:NO] |
|
1285 |
case 0x6b21972: // /DEFAULTLIB:library |
|
1286 |
case 0x396ea92: // /DRIVER[:UPONLY | :WDM] |
|
1287 |
case 0xaca9d75: // /EXETYPE[:DYNAMIC | :DEV386] |
|
1288 |
case 0x3ad5444: // /EXPORT:entryname[,@ordinal[,NONAME]][,DATA] |
|
1289 |
case 0x33aec94: // /FIXED[:NO] |
|
1290 |
case 0x33b4675: // /FORCE:[MULTIPLE|UNRESOLVED] |
|
1291 |
case 0x3dc3455: // /IGNORE:number,number,number,number ### NOTE: This one is undocumented, but it is even used by Microsoft. |
|
1292 |
// In recent versions of the Microsoft linker they have disabled this undocumented feature. |
|
1293 |
case 0x7988f7e: // /SECTION:name,[E][R][W][S][D][K][L][P][X][,ALIGN=#] |
|
1294 |
case 0x0348992: // /STUB:filename |
|
1295 |
case 0x0034bc4: // /VXD |
|
1296 |
case 0x0034c50: // /WS |
|
1297 |
AdditionalOptions += option; |
|
1298 |
break; |
|
1299 |
case 0x679c075: // /ASSEMBLYMODULE:filename |
|
1300 |
AddModuleNamesToAssembly += option+15; |
|
1301 |
break; |
|
1302 |
case 0x062d065: // /ASSEMBLYRESOURCE:filename |
|
1303 |
LinkToManagedResourceFile = option+18; |
|
1304 |
break; |
|
1305 |
case 0x0336675: // /BASE:{address | @filename,key} |
|
1306 |
// Do we need to do a manual lookup when '@filename,key'? |
|
1307 |
// Seems BaseAddress only can contain the location... |
|
1308 |
// We don't use it in Qt, so keep it simple for now |
|
1309 |
BaseAddress = option+6; |
|
1310 |
break; |
|
1311 |
case 0x3389797: // /DEBUG |
|
1312 |
GenerateDebugInformation = _True; |
|
1313 |
break; |
|
1314 |
case 0x0033896: // /DEF:filename |
|
1315 |
ModuleDefinitionFile = option+5; |
|
1316 |
break; |
|
1317 |
case 0x338a069: // /DELAY:{UNLOAD | NOBIND} |
|
1318 |
// MS documentation does not specify what to do with |
|
1319 |
// this option, so we'll put it in AdditionalOptions |
|
1320 |
AdditionalOptions += option; |
|
1321 |
break; |
|
1322 |
case 0x06f4bf4: // /DELAYLOAD:dllname |
|
1323 |
DelayLoadDLLs += option+11; |
|
1324 |
break; |
|
1325 |
case 0x003390c: // /DLL |
|
1326 |
// This option is not used for vcproj files |
|
1327 |
break; |
|
1328 |
case 0x33a3979: // /ENTRY:function |
|
1329 |
EntryPointSymbol = option+7; |
|
1330 |
break; |
|
1331 |
case 0x033c960: // /HEAP:reserve[,commit] |
|
1332 |
{ |
|
1333 |
QStringList both = QString(option+6).split(","); |
|
1334 |
HeapReserveSize = both[0].toLongLong(); |
|
1335 |
if(both.count() == 2) |
|
1336 |
HeapCommitSize = both[1].toLongLong(); |
|
1337 |
} |
|
1338 |
break; |
|
1339 |
case 0x3d91494: // /IDLOUT:[path\]filename |
|
1340 |
MergedIDLBaseFileName = option+8; |
|
1341 |
break; |
|
1342 |
case 0x345a04c: // /IGNOREIDL |
|
1343 |
IgnoreEmbeddedIDL = _True; |
|
1344 |
break; |
|
1345 |
case 0x3e250e2: // /IMPLIB:filename |
|
1346 |
ImportLibrary = option+8; |
|
1347 |
break; |
|
1348 |
case 0xe281ab5: // /INCLUDE:symbol |
|
1349 |
ForceSymbolReferences += option+9; |
|
1350 |
break; |
|
1351 |
case 0xb28103c: // /INCREMENTAL[:no] |
|
1352 |
if(*(option+12) == ':' && |
|
1353 |
(*(option+13) == 'n' || *(option+13) == 'N')) |
|
1354 |
LinkIncremental = linkIncrementalNo; |
|
1355 |
else |
|
1356 |
LinkIncremental = linkIncrementalYes; |
|
1357 |
break; |
|
1358 |
case 0x26e4675: // /LARGEADDRESSAWARE[:no] |
|
1359 |
if(*(option+18) == ':' && |
|
1360 |
*(option+19) == 'n') |
|
1361 |
LargeAddressAware = addrAwareNoLarge; |
|
1362 |
else |
|
1363 |
LargeAddressAware = addrAwareLarge; |
|
1364 |
break; |
|
1365 |
case 0x2f96bc8: // /libpath:dir |
|
1366 |
case 0x0d745c8: // /LIBPATH:dir |
|
1367 |
AdditionalLibraryDirectories += option+9; |
|
1368 |
break; |
|
1369 |
case 0x0341877: // /LTCG[:NOSTATUS|:STATUS] |
|
1370 |
config->WholeProgramOptimization = _True; |
|
1371 |
if (config->CompilerVersion >= NET2005) { |
|
1372 |
LinkTimeCodeGeneration = optLTCGEnabled; |
|
1373 |
if(*(option+5) == ':') { |
|
1374 |
const char* str = option+6; |
|
1375 |
if (*str == 'S') |
|
1376 |
ShowProgress = linkProgressAll; |
|
1377 |
#ifndef Q_OS_WIN |
|
1378 |
else if (strncasecmp(str, "pginstrument", 12)) |
|
1379 |
LinkTimeCodeGeneration = optLTCGInstrument; |
|
1380 |
else if (strncasecmp(str, "pgoptimize", 10)) |
|
1381 |
LinkTimeCodeGeneration = optLTCGOptimize; |
|
1382 |
else if (strncasecmp(str, "pgupdate", 8 )) |
|
1383 |
LinkTimeCodeGeneration = optLTCGUpdate; |
|
1384 |
#else |
|
1385 |
else if (_stricmp(str, "pginstrument")) |
|
1386 |
LinkTimeCodeGeneration = optLTCGInstrument; |
|
1387 |
else if (_stricmp(str, "pgoptimize")) |
|
1388 |
LinkTimeCodeGeneration = optLTCGOptimize; |
|
1389 |
else if (_stricmp(str, "pgupdate")) |
|
1390 |
LinkTimeCodeGeneration = optLTCGUpdate; |
|
1391 |
#endif |
|
1392 |
} |
|
1393 |
} else { |
|
1394 |
AdditionalOptions.append(option); |
|
1395 |
} |
|
1396 |
break; |
|
1397 |
case 0x379ED25: |
|
1398 |
case 0x157cf65: // /MACHINE:{AM33|ARM|CEE|IA64|X86|M32R|MIPS|MIPS16|MIPSFPU|MIPSFPU16|MIPSR41XX|PPC|SH3|SH4|SH5|THUMB|TRICORE} |
|
1399 |
switch (elfHash(option+9)) { |
|
1400 |
// Very limited documentation on all options but X86, |
|
1401 |
case 0x0005bb6: // X86 |
|
1402 |
TargetMachine = machineX86; |
|
1403 |
break; |
|
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1404 |
case 0x0005b94: // X64 |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1405 |
TargetMachine = machineX64; |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1406 |
break; |
0 | 1407 |
// so we put the others in AdditionalOptions... |
1408 |
case 0x0046063: // AM33 |
|
1409 |
case 0x000466d: // ARM |
|
1410 |
case 0x0004795: // CEE |
|
1411 |
case 0x0004963: // EBC |
|
1412 |
case 0x004d494: // IA64 |
|
1413 |
case 0x0050672: // M32R |
|
1414 |
case 0x0051e53: // MIPS |
|
1415 |
case 0x51e5646: // MIPS16 |
|
1416 |
case 0x1e57b05: // MIPSFPU |
|
1417 |
case 0x57b09a6: // MIPSFPU16 |
|
1418 |
case 0x5852738: // MIPSR41XX |
|
1419 |
case 0x0005543: // PPC |
|
1420 |
case 0x00057b3: // SH3 |
|
1421 |
case 0x57b7980: // SH3DSP |
|
1422 |
case 0x00057b4: // SH4 |
|
1423 |
case 0x00057b5: // SH5 |
|
1424 |
case 0x058da12: // THUMB |
|
1425 |
case 0x96d8435: // TRICORE |
|
1426 |
default: |
|
1427 |
AdditionalOptions += option; |
|
1428 |
break; |
|
1429 |
} |
|
1430 |
break; |
|
1431 |
case 0x0034160: // /MAP[:filename] |
|
1432 |
GenerateMapFile = _True; |
|
1433 |
MapFileName = option+5; |
|
1434 |
break; |
|
1435 |
case 0x164e1ef: // /MAPINFO:{EXPORTS|LINES} |
|
1436 |
if(*(option+9) == 'E') |
|
1437 |
MapExports = _True; |
|
1438 |
else if(*(option+9) == 'L') |
|
1439 |
MapLines = _True; |
|
1440 |
break; |
|
1441 |
case 0x341a6b5: // /MERGE:from=to |
|
1442 |
MergeSections = option+7; |
|
1443 |
break; |
|
1444 |
case 0x0341d8c: // /MIDL:@file |
|
1445 |
MidlCommandFile = option+7; |
|
1446 |
break; |
|
1447 |
case 0x84e2679: // /NOASSEMBLY |
|
1448 |
TurnOffAssemblyGeneration = _True; |
|
1449 |
break; |
|
1450 |
case 0x2b21942: // /NODEFAULTLIB[:library] |
|
1451 |
if(*(option+13) == '\0') |
|
1452 |
IgnoreAllDefaultLibraries = _True; |
|
1453 |
else |
|
1454 |
IgnoreDefaultLibraryNames += option+14; |
|
1455 |
break; |
|
1456 |
case 0x33a3a39: // /NOENTRY |
|
1457 |
ResourceOnlyDLL = _True; |
|
1458 |
break; |
|
1459 |
case 0x434138f: // /NOLOGO |
|
1460 |
SuppressStartupBanner = _True; |
|
1461 |
break; |
|
1462 |
case 0x0034454: // /OPT:{REF | NOREF | ICF[=iterations] | NOICF | WIN98 | NOWIN98} |
|
1463 |
{ |
|
1464 |
char third = *(option+7); |
|
1465 |
switch (third) { |
|
1466 |
case 'F': // REF |
|
1467 |
if(*(option+5) == 'R') { |
|
1468 |
OptimizeReferences = optReferences; |
|
1469 |
} else { // ICF[=iterations] |
|
1470 |
EnableCOMDATFolding = optFolding; |
|
1471 |
// [=iterations] case is not documented |
|
1472 |
} |
|
1473 |
break; |
|
1474 |
case 'R': // NOREF |
|
1475 |
OptimizeReferences = optNoReferences; |
|
1476 |
break; |
|
1477 |
case 'I': // NOICF |
|
1478 |
EnableCOMDATFolding = optNoFolding; |
|
1479 |
break; |
|
1480 |
case 'N': // WIN98 |
|
1481 |
OptimizeForWindows98 = optWin98Yes; |
|
1482 |
break; |
|
1483 |
case 'W': // NOWIN98 |
|
1484 |
OptimizeForWindows98 = optWin98No; |
|
1485 |
break; |
|
1486 |
default: |
|
1487 |
found = false; |
|
1488 |
} |
|
1489 |
} |
|
1490 |
break; |
|
1491 |
case 0x34468a2: // /ORDER:@filename |
|
1492 |
FunctionOrder = option+8; |
|
1493 |
break; |
|
1494 |
case 0x00344a4: // /OUT:filename |
|
1495 |
OutputFile = option+5; |
|
1496 |
break; |
|
1497 |
case 0x0034482: // /PDB:filename |
|
1498 |
ProgramDatabaseFile = option+5; |
|
1499 |
break; |
|
1500 |
case 0xa2ad314: // /PDBSTRIPPED:pdb_file_name |
|
1501 |
StripPrivateSymbols = option+13; |
|
1502 |
break; |
|
1503 |
case 0x6a09535: // /RELEASE |
|
1504 |
SetChecksum = _True; |
|
1505 |
break; |
|
1506 |
case 0x348857b: // /STACK:reserve[,commit] |
|
1507 |
{ |
|
1508 |
QStringList both = QString(option+7).split(","); |
|
1509 |
StackReserveSize = both[0].toLongLong(); |
|
1510 |
if(both.count() == 2) |
|
1511 |
StackCommitSize = both[1].toLongLong(); |
|
1512 |
} |
|
1513 |
break; |
|
1514 |
case 0x75AA4D8: // /SAFESH:{NO} |
|
1515 |
{ |
|
1516 |
AdditionalOptions += option; |
|
1517 |
break; |
|
1518 |
} |
|
1519 |
case 0x9B3C00D: |
|
1520 |
case 0x78dc00d: // /SUBSYSTEM:{CONSOLE|EFI_APPLICATION|EFI_BOOT_SERVICE_DRIVER|EFI_ROM|EFI_RUNTIME_DRIVER|NATIVE|POSIX|WINDOWS|WINDOWSCE}[,major[.minor]] |
|
1521 |
{ |
|
1522 |
// Split up in subsystem, and version number |
|
1523 |
QStringList both = QString(option+11).split(","); |
|
1524 |
switch (elfHash(both[0].toLatin1())) { |
|
1525 |
case 0x8438445: // CONSOLE |
|
1526 |
SubSystem = subSystemConsole; |
|
1527 |
break; |
|
1528 |
case 0xbe29493: // WINDOWS |
|
1529 |
SubSystem = subSystemWindows; |
|
1530 |
break; |
|
1531 |
// The following are undocumented, so add them to AdditionalOptions |
|
1532 |
case 0x240949e: // EFI_APPLICATION |
|
1533 |
case 0xe617652: // EFI_BOOT_SERVICE_DRIVER |
|
1534 |
case 0x9af477d: // EFI_ROM |
|
1535 |
case 0xd34df42: // EFI_RUNTIME_DRIVER |
|
1536 |
case 0x5268ea5: // NATIVE |
|
1537 |
case 0x05547e8: // POSIX |
|
1538 |
case 0x2949c95: // WINDOWSCE |
|
1539 |
case 0x4B69795: // windowsce |
|
1540 |
AdditionalOptions += option; |
|
1541 |
break; |
|
1542 |
default: |
|
1543 |
found = false; |
|
1544 |
} |
|
1545 |
} |
|
1546 |
break; |
|
1547 |
case 0x8b654de: // /SWAPRUN:{NET | CD} |
|
1548 |
if(*(option+9) == 'N') |
|
1549 |
SwapRunFromNet = _True; |
|
1550 |
else if(*(option+9) == 'C') |
|
1551 |
SwapRunFromCD = _True; |
|
1552 |
else |
|
1553 |
found = false; |
|
1554 |
break; |
|
1555 |
case 0x34906d4: // /TLBID:id |
|
1556 |
TypeLibraryResourceID = QString(option+7).toLongLong(); |
|
1557 |
break; |
|
1558 |
case 0x4907494: // /TLBOUT:[path\]filename |
|
1559 |
TypeLibraryFile = option+8; |
|
1560 |
break; |
|
1561 |
case 0x976b525: // /TSAWARE[:NO] |
|
1562 |
if(*(option+8) == ':') |
|
1563 |
TerminalServerAware = termSvrAwareNo; |
|
1564 |
else |
|
1565 |
TerminalServerAware = termSvrAwareYes; |
|
1566 |
break; |
|
1567 |
case 0xaa67735: // /VERBOSE[:lib] |
|
1568 |
if(*(option+9) == ':') { |
|
1569 |
ShowProgress = linkProgressLibs; |
|
1570 |
AdditionalOptions += option; |
|
1571 |
} else { |
|
1572 |
ShowProgress = linkProgressAll; |
|
1573 |
} |
|
1574 |
break; |
|
1575 |
case 0xaa77f7e: // /VERSION:major[.minor] |
|
1576 |
Version = option+9; |
|
1577 |
break; |
|
1578 |
default: |
|
1579 |
AdditionalOptions += option; |
|
1580 |
break; |
|
1581 |
} |
|
1582 |
if(!found) { |
|
1583 |
warn_msg(WarnLogic, "Could not parse Linker options: %s, added as AdditionalOption", option); |
|
1584 |
AdditionalOptions += option; |
|
1585 |
} |
|
1586 |
return found; |
|
1587 |
} |
|
1588 |
||
1589 |
// VCMIDLTool ------------------------------------------------------- |
|
1590 |
VCMIDLTool::VCMIDLTool() |
|
1591 |
: DefaultCharType(midlCharUnsigned), |
|
1592 |
EnableErrorChecks(midlDisableAll), |
|
1593 |
ErrorCheckAllocations(unset), |
|
1594 |
ErrorCheckBounds(unset), |
|
1595 |
ErrorCheckEnumRange(unset), |
|
1596 |
ErrorCheckRefPointers(unset), |
|
1597 |
ErrorCheckStubData(unset), |
|
1598 |
GenerateStublessProxies(unset), |
|
1599 |
GenerateTypeLibrary(unset), |
|
1600 |
IgnoreStandardIncludePath(unset), |
|
1601 |
MkTypLibCompatible(unset), |
|
1602 |
StructMemberAlignment(midlAlignNotSet), |
|
1603 |
SuppressStartupBanner(unset), |
|
1604 |
TargetEnvironment(midlTargetNotSet), |
|
1605 |
ValidateParameters(unset), |
|
1606 |
WarnAsError(unset), |
|
1607 |
WarningLevel(midlWarningLevel_0) |
|
1608 |
{ |
|
1609 |
} |
|
1610 |
||
1611 |
XmlOutput &operator<<(XmlOutput &xml, const VCMIDLTool &tool) |
|
1612 |
{ |
|
1613 |
return xml |
|
1614 |
<< tag(_Tool) |
|
1615 |
<< attrS(_Name, _VCMIDLTool) |
|
1616 |
<< attrX(_AdditionalIncludeDirectories, tool.AdditionalIncludeDirectories) |
|
1617 |
<< attrX(_AdditionalOptions, tool.AdditionalOptions, " ") |
|
1618 |
<< attrX(_CPreprocessOptions, tool.CPreprocessOptions) |
|
1619 |
<< attrE(_DefaultCharType, tool.DefaultCharType) |
|
1620 |
<< attrS(_DLLDataFileName, tool.DLLDataFileName) |
|
1621 |
<< attrE(_EnableErrorChecks, tool.EnableErrorChecks) |
|
1622 |
<< attrT(_ErrorCheckAllocations, tool.ErrorCheckAllocations) |
|
1623 |
<< attrT(_ErrorCheckBounds, tool.ErrorCheckBounds) |
|
1624 |
<< attrT(_ErrorCheckEnumRange, tool.ErrorCheckEnumRange) |
|
1625 |
<< attrT(_ErrorCheckRefPointers, tool.ErrorCheckRefPointers) |
|
1626 |
<< attrT(_ErrorCheckStubData, tool.ErrorCheckStubData) |
|
1627 |
<< attrX(_FullIncludePath, tool.FullIncludePath) |
|
1628 |
<< attrT(_GenerateStublessProxies, tool.GenerateStublessProxies) |
|
1629 |
<< attrT(_GenerateTypeLibrary, tool.GenerateTypeLibrary) |
|
1630 |
<< attrS(_HeaderFileName, tool.HeaderFileName) |
|
1631 |
<< attrT(_IgnoreStandardIncludePath, tool.IgnoreStandardIncludePath) |
|
1632 |
<< attrS(_InterfaceIdentifierFileName, tool.InterfaceIdentifierFileName) |
|
1633 |
<< attrT(_MkTypLibCompatible, tool.MkTypLibCompatible) |
|
1634 |
<< attrS(_OutputDirectory, tool.OutputDirectory) |
|
1635 |
<< attrX(_PreprocessorDefinitions, tool.PreprocessorDefinitions) |
|
1636 |
<< attrS(_ProxyFileName, tool.ProxyFileName) |
|
1637 |
<< attrS(_RedirectOutputAndErrors, tool.RedirectOutputAndErrors) |
|
1638 |
<< attrE(_StructMemberAlignment, tool.StructMemberAlignment, /*ifNot*/ midlAlignNotSet) |
|
1639 |
<< attrT(_SuppressStartupBanner, tool.SuppressStartupBanner) |
|
1640 |
<< attrE(_TargetEnvironment, tool.TargetEnvironment, /*ifNot*/ midlTargetNotSet) |
|
1641 |
<< attrS(_TypeLibraryName, tool.TypeLibraryName) |
|
1642 |
<< attrX(_UndefinePreprocessorDefinitions, tool.UndefinePreprocessorDefinitions) |
|
1643 |
<< attrT(_ValidateParameters, tool.ValidateParameters) |
|
1644 |
<< attrT(_WarnAsError, tool.WarnAsError) |
|
1645 |
<< attrE(_WarningLevel, tool.WarningLevel) |
|
1646 |
<< closetag(_Tool); |
|
1647 |
} |
|
1648 |
||
1649 |
bool VCMIDLTool::parseOption(const char* option) |
|
1650 |
{ |
|
1651 |
#ifdef USE_DISPLAY_HASH |
|
1652 |
displayHash("/D name[=def]"); displayHash("/I directory-list"); displayHash("/Oi"); |
|
1653 |
displayHash("/Oic"); displayHash("/Oicf"); displayHash("/Oif"); displayHash("/Os"); |
|
1654 |
displayHash("/U name"); displayHash("/WX"); displayHash("/W{0|1|2|3|4}"); |
|
1655 |
displayHash("/Zp {N}"); displayHash("/Zs"); displayHash("/acf filename"); |
|
1656 |
displayHash("/align {N}"); displayHash("/app_config"); displayHash("/c_ext"); |
|
1657 |
displayHash("/char ascii7"); displayHash("/char signed"); displayHash("/char unsigned"); |
|
1658 |
displayHash("/client none"); displayHash("/client stub"); displayHash("/confirm"); |
|
1659 |
displayHash("/cpp_cmd cmd_line"); displayHash("/cpp_opt options"); |
|
1660 |
displayHash("/cstub filename"); displayHash("/dlldata filename"); displayHash("/env win32"); |
|
1661 |
displayHash("/env win64"); displayHash("/error all"); displayHash("/error allocation"); |
|
1662 |
displayHash("/error bounds_check"); displayHash("/error enum"); displayHash("/error none"); |
|
1663 |
displayHash("/error ref"); displayHash("/error stub_data"); displayHash("/h filename"); |
|
1664 |
displayHash("/header filename"); displayHash("/iid filename"); displayHash("/lcid"); |
|
1665 |
displayHash("/mktyplib203"); displayHash("/ms_ext"); displayHash("/ms_union"); |
|
1666 |
displayHash("/msc_ver <nnnn>"); displayHash("/newtlb"); displayHash("/no_cpp"); |
|
1667 |
displayHash("/no_def_idir"); displayHash("/no_default_epv"); displayHash("/no_format_opt"); |
|
1668 |
displayHash("/no_warn"); displayHash("/nocpp"); displayHash("/nologo"); displayHash("/notlb"); |
|
1669 |
displayHash("/o filename"); displayHash("/oldnames"); displayHash("/oldtlb"); |
|
1670 |
displayHash("/osf"); displayHash("/out directory"); displayHash("/pack {N}"); |
|
1671 |
displayHash("/prefix all"); displayHash("/prefix client"); displayHash("/prefix server"); |
|
1672 |
displayHash("/prefix switch"); displayHash("/protocol all"); displayHash("/protocol dce"); |
|
1673 |
displayHash("/protocol ndr64"); displayHash("/proxy filename"); displayHash("/robust"); |
|
1674 |
displayHash("/rpcss"); displayHash("/savePP"); displayHash("/server none"); |
|
1675 |
displayHash("/server stub"); displayHash("/sstub filename"); displayHash("/syntax_check"); |
|
1676 |
displayHash("/target {system}"); displayHash("/tlb filename"); displayHash("/use_epv"); |
|
1677 |
displayHash("/win32"); displayHash("/win64"); |
|
1678 |
#endif |
|
1679 |
bool found = true; |
|
1680 |
int offset = 0; |
|
1681 |
switch(elfHash(option)) { |
|
1682 |
case 0x0000334: // /D name[=def] |
|
1683 |
PreprocessorDefinitions += option+3; |
|
1684 |
break; |
|
1685 |
case 0x0000339: // /I directory-list |
|
1686 |
AdditionalIncludeDirectories += option+3; |
|
1687 |
break; |
|
1688 |
case 0x0345f96: // /Oicf |
|
1689 |
case 0x00345f6: // /Oif |
|
1690 |
GenerateStublessProxies = _True; |
|
1691 |
break; |
|
1692 |
case 0x0000345: // /U name |
|
1693 |
UndefinePreprocessorDefinitions += option+3; |
|
1694 |
break; |
|
1695 |
case 0x00034c8: // /WX |
|
1696 |
WarnAsError = _True; |
|
1697 |
break; |
|
1698 |
case 0x3582fde: // /align {N} |
|
1699 |
offset = 3; // Fallthrough |
|
1700 |
case 0x0003510: // /Zp {N} |
|
1701 |
switch (*(option+offset+4)) { |
|
1702 |
case '1': |
|
1703 |
StructMemberAlignment = (*(option+offset+5) == '\0') ? midlAlignSingleByte : midlAlignSixteenBytes; |
|
1704 |
break; |
|
1705 |
case '2': |
|
1706 |
StructMemberAlignment = midlAlignTwoBytes; |
|
1707 |
break; |
|
1708 |
case '4': |
|
1709 |
StructMemberAlignment = midlAlignFourBytes; |
|
1710 |
break; |
|
1711 |
case '8': |
|
1712 |
StructMemberAlignment = midlAlignEightBytes; |
|
1713 |
break; |
|
1714 |
default: |
|
1715 |
found = false; |
|
1716 |
} |
|
1717 |
break; |
|
1718 |
case 0x0359e82: // /char {ascii7|signed|unsigned} |
|
1719 |
switch(*(option+6)) { |
|
1720 |
case 'a': |
|
1721 |
DefaultCharType = midlCharAscii7; |
|
1722 |
break; |
|
1723 |
case 's': |
|
1724 |
DefaultCharType = midlCharSigned; |
|
1725 |
break; |
|
1726 |
case 'u': |
|
1727 |
DefaultCharType = midlCharUnsigned; |
|
1728 |
break; |
|
1729 |
default: |
|
1730 |
found = false; |
|
1731 |
} |
|
1732 |
break; |
|
1733 |
case 0xa766524: // /cpp_opt options |
|
1734 |
CPreprocessOptions += option+9; |
|
1735 |
break; |
|
1736 |
case 0xb32abf1: // /dlldata filename |
|
1737 |
DLLDataFileName = option + 9; |
|
1738 |
break; |
|
1739 |
case 0x0035c56: // /env {win32|win64} |
|
1740 |
TargetEnvironment = (*(option+8) == '6') ? midlTargetWin64 : midlTargetWin32; |
|
1741 |
break; |
|
1742 |
case 0x35c9962: // /error {all|allocation|bounds_check|enum|none|ref|stub_data} |
|
1743 |
EnableErrorChecks = midlEnableCustom; |
|
1744 |
switch (*(option+7)) { |
|
1745 |
case 'a': |
|
1746 |
if(*(option+10) == '\0') |
|
1747 |
EnableErrorChecks = midlEnableAll; |
|
1748 |
else |
|
1749 |
ErrorCheckAllocations = _True; |
|
1750 |
break; |
|
1751 |
case 'b': |
|
1752 |
ErrorCheckBounds = _True; |
|
1753 |
break; |
|
1754 |
case 'e': |
|
1755 |
ErrorCheckEnumRange = _True; |
|
1756 |
break; |
|
1757 |
case 'n': |
|
1758 |
EnableErrorChecks = midlDisableAll; |
|
1759 |
break; |
|
1760 |
case 'r': |
|
1761 |
ErrorCheckRefPointers = _True; |
|
1762 |
break; |
|
1763 |
case 's': |
|
1764 |
ErrorCheckStubData = _True; |
|
1765 |
break; |
|
1766 |
default: |
|
1767 |
found = false; |
|
1768 |
} |
|
1769 |
break; |
|
1770 |
case 0x5eb7af2: // /header filename |
|
1771 |
offset = 5; |
|
1772 |
case 0x0000358: // /h filename |
|
1773 |
HeaderFileName = option + offset + 3; |
|
1774 |
break; |
|
1775 |
case 0x0035ff4: // /iid filename |
|
1776 |
InterfaceIdentifierFileName = option+5; |
|
1777 |
break; |
|
1778 |
case 0x64b7933: // /mktyplib203 |
|
1779 |
MkTypLibCompatible = _True; |
|
1780 |
break; |
|
1781 |
case 0x8e0b0a2: // /no_def_idir |
|
1782 |
IgnoreStandardIncludePath = _True; |
|
1783 |
break; |
|
1784 |
case 0x65635ef: // /nologo |
|
1785 |
SuppressStartupBanner = _True; |
|
1786 |
break; |
|
1787 |
case 0x3656b22: // /notlb |
|
1788 |
GenerateTypeLibrary = _True; |
|
1789 |
break; |
|
1790 |
case 0x000035f: // /o filename |
|
1791 |
RedirectOutputAndErrors = option+3; |
|
1792 |
break; |
|
1793 |
case 0x00366c4: // /out directory |
|
1794 |
OutputDirectory = option+5; |
|
1795 |
break; |
|
1796 |
case 0x36796f9: // /proxy filename |
|
1797 |
ProxyFileName = option+7; |
|
1798 |
break; |
|
1799 |
case 0x6959c94: // /robust |
|
1800 |
ValidateParameters = _True; |
|
1801 |
break; |
|
1802 |
case 0x6a88df4: // /target {system} |
|
1803 |
if(*(option+11) == '6') |
|
1804 |
TargetEnvironment = midlTargetWin64; |
|
1805 |
else |
|
1806 |
TargetEnvironment = midlTargetWin32; |
|
1807 |
break; |
|
1808 |
case 0x0036b22: // /tlb filename |
|
1809 |
TypeLibraryName = option+5; |
|
1810 |
break; |
|
1811 |
case 0x36e0162: // /win32 |
|
1812 |
TargetEnvironment = midlTargetWin32; |
|
1813 |
break; |
|
1814 |
case 0x36e0194: // /win64 |
|
1815 |
TargetEnvironment = midlTargetWin64; |
|
1816 |
break; |
|
1817 |
case 0x0003459: // /Oi |
|
1818 |
case 0x00345f3: // /Oic |
|
1819 |
case 0x0003463: // /Os |
|
1820 |
case 0x0003513: // /Zs |
|
1821 |
case 0x0035796: // /acf filename |
|
1822 |
case 0x5b1cb97: // /app_config |
|
1823 |
case 0x3595cf4: // /c_ext |
|
1824 |
case 0x5a2fc64: // /client {none|stub} |
|
1825 |
case 0xa64d3dd: // /confirm |
|
1826 |
case 0xa765b64: // /cpp_cmd cmd_line |
|
1827 |
case 0x35aabb2: // /cstub filename |
|
1828 |
case 0x03629f4: // /lcid |
|
1829 |
case 0x6495cc4: // /ms_ext |
|
1830 |
case 0x96c7a1e: // /ms_union |
|
1831 |
case 0x4996fa2: // /msc_ver <nnnn> |
|
1832 |
case 0x64ceb12: // /newtlb |
|
1833 |
case 0x6555a40: // /no_cpp |
|
1834 |
case 0xf64d6a6: // /no_default_epv |
|
1835 |
case 0x6dd9384: // /no_format_opt |
|
1836 |
case 0x556dbee: // /no_warn |
|
1837 |
case 0x3655a70: // /nocpp |
|
1838 |
case 0x2b455a3: // /oldnames |
|
1839 |
case 0x662bb12: // /oldtlb |
|
1840 |
case 0x0036696: // /osf |
|
1841 |
case 0x036679b: // /pack {N} |
|
1842 |
case 0x678bd38: // /prefix {all|client|server|switch} |
|
1843 |
case 0x96b702c: // /protocol {all|dce|ndr64} |
|
1844 |
case 0x3696aa3: // /rpcss |
|
1845 |
case 0x698ca60: // /savePP |
|
1846 |
case 0x69c9cf2: // /server {none|stub} |
|
1847 |
case 0x36aabb2: // /sstub filename |
|
1848 |
case 0xce9b12b: // /syntax_check |
|
1849 |
case 0xc9b5f16: // /use_epv |
|
1850 |
AdditionalOptions += option; |
|
1851 |
break; |
|
1852 |
default: |
|
1853 |
// /W{0|1|2|3|4} case |
|
1854 |
if(*(option+1) == 'W') { |
|
1855 |
switch (*(option+2)) { |
|
1856 |
case '0': |
|
1857 |
WarningLevel = midlWarningLevel_0; |
|
1858 |
break; |
|
1859 |
case '1': |
|
1860 |
WarningLevel = midlWarningLevel_1; |
|
1861 |
break; |
|
1862 |
case '2': |
|
1863 |
WarningLevel = midlWarningLevel_2; |
|
1864 |
break; |
|
1865 |
case '3': |
|
1866 |
WarningLevel = midlWarningLevel_3; |
|
1867 |
break; |
|
1868 |
case '4': |
|
1869 |
WarningLevel = midlWarningLevel_4; |
|
1870 |
break; |
|
1871 |
default: |
|
1872 |
found = false; |
|
1873 |
} |
|
1874 |
} |
|
1875 |
break; |
|
1876 |
} |
|
1877 |
if(!found) |
|
1878 |
warn_msg(WarnLogic, "Could not parse MIDL option: %s", option); |
|
1879 |
return true; |
|
1880 |
} |
|
1881 |
||
1882 |
// VCLibrarianTool -------------------------------------------------- |
|
1883 |
VCLibrarianTool::VCLibrarianTool() |
|
1884 |
: IgnoreAllDefaultLibraries(unset), |
|
1885 |
SuppressStartupBanner(_True) |
|
1886 |
{ |
|
1887 |
} |
|
1888 |
||
1889 |
XmlOutput &operator<<(XmlOutput &xml, const VCLibrarianTool &tool) |
|
1890 |
{ |
|
1891 |
return xml |
|
1892 |
<< tag(_Tool) |
|
1893 |
<< attrS(_Name, _VCLibrarianTool) |
|
1894 |
<< attrX(_AdditionalDependencies, tool.AdditionalDependencies) |
|
1895 |
<< attrX(_AdditionalLibraryDirectories, tool.AdditionalLibraryDirectories) |
|
1896 |
<< attrX(_AdditionalOptions, tool.AdditionalOptions, " ") |
|
1897 |
<< attrX(_ExportNamedFunctions, tool.ExportNamedFunctions) |
|
1898 |
<< attrX(_ForceSymbolReferences, tool.ForceSymbolReferences) |
|
1899 |
<< attrT(_IgnoreAllDefaultLibraries, tool.IgnoreAllDefaultLibraries) |
|
1900 |
<< attrX(_IgnoreDefaultLibraryNames, tool.IgnoreDefaultLibraryNames) |
|
1901 |
<< attrS(_ModuleDefinitionFile, tool.ModuleDefinitionFile) |
|
1902 |
<< attrS(_OutputFile, tool.OutputFile) |
|
1903 |
<< attrT(_SuppressStartupBanner, tool.SuppressStartupBanner) |
|
1904 |
<< closetag(_Tool); |
|
1905 |
} |
|
1906 |
||
1907 |
// VCCustomBuildTool ------------------------------------------------ |
|
1908 |
VCCustomBuildTool::VCCustomBuildTool() |
|
1909 |
{ |
|
1910 |
ToolName = "VCCustomBuildTool"; |
|
1911 |
} |
|
1912 |
||
1913 |
XmlOutput &operator<<(XmlOutput &xml, const VCCustomBuildTool &tool) |
|
1914 |
{ |
|
1915 |
// The code below offers two ways to split custom build step commands. |
|
1916 |
// Normally the $$escape_expand(\n\t) is used in a project file, which is correctly translated |
|
1917 |
// in all generators. However, if you use $$escape_expand(\n\r) (or \n\h) instead, the VCPROJ |
|
1918 |
// generator will instead of binding the commands with " && " will insert a proper newline into |
|
1919 |
// the VCPROJ file. We sometimes use this method of splitting commands if the custom buildstep |
|
1920 |
// contains a command-line which is too big to run on certain OS. |
|
1921 |
QString cmds; |
|
1922 |
int end = tool.CommandLine.count(); |
|
1923 |
for(int i = 0; i < end; ++i) { |
|
1924 |
QString cmdl = tool.CommandLine.at(i); |
|
1925 |
if (cmdl.contains("\r\t")) { |
|
1926 |
if (i == end - 1) |
|
1927 |
cmdl = cmdl.trimmed(); |
|
1928 |
cmdl.replace("\r\t", " && "); |
|
1929 |
} else if (cmdl.contains("\r\n")) { |
|
1930 |
; |
|
1931 |
} else if (cmdl.contains("\r\\h")) { |
|
1932 |
// The above \r\n should work, but doesn't, so we have this hack |
|
1933 |
cmdl.replace("\r\\h", "\r\n"); |
|
1934 |
} else { |
|
1935 |
if (i < end - 1) |
|
1936 |
cmdl += " && "; |
|
1937 |
} |
|
1938 |
cmds += cmdl; |
|
1939 |
} |
|
1940 |
return xml |
|
1941 |
<< tag(_Tool) |
|
1942 |
<< attrS(_Name, tool.ToolName) |
|
1943 |
<< attrX(_AdditionalDependencies, tool.AdditionalDependencies, ";") |
|
1944 |
<< attrS(_CommandLine, cmds) |
|
1945 |
<< attrS(_Description, tool.Description) |
|
1946 |
<< attrX(_Outputs, tool.Outputs, ";") |
|
1947 |
<< attrS(_Path, tool.ToolPath) |
|
1948 |
<< closetag(_Tool); |
|
1949 |
} |
|
1950 |
||
1951 |
// VCResourceCompilerTool ------------------------------------------- |
|
1952 |
VCResourceCompilerTool::VCResourceCompilerTool() |
|
1953 |
: Culture(rcUseDefault), |
|
1954 |
IgnoreStandardIncludePath(unset), |
|
1955 |
ShowProgress(linkProgressNotSet) |
|
1956 |
{ |
|
1957 |
PreprocessorDefinitions = QStringList("NDEBUG"); |
|
1958 |
} |
|
1959 |
||
1960 |
XmlOutput &operator<<(XmlOutput &xml, const VCResourceCompilerTool &tool) |
|
1961 |
{ |
|
1962 |
return xml |
|
1963 |
<< tag(_Tool) |
|
1964 |
<< attrS(_Name, _VCResourceCompilerTool) |
|
1965 |
<< attrS(_Path, tool.ToolPath) |
|
1966 |
<< attrX(_AdditionalIncludeDirectories, tool.AdditionalIncludeDirectories) |
|
1967 |
<< attrX(_AdditionalOptions, tool.AdditionalOptions, " ") |
|
1968 |
<< attrE(_Culture, tool.Culture, /*ifNot*/ rcUseDefault) |
|
1969 |
<< attrX(_FullIncludePath, tool.FullIncludePath) |
|
1970 |
<< attrT(_IgnoreStandardIncludePath, tool.IgnoreStandardIncludePath) |
|
1971 |
<< attrX(_PreprocessorDefinitions, tool.PreprocessorDefinitions) |
|
1972 |
<< attrS(_ResourceOutputFileName, tool.ResourceOutputFileName) |
|
1973 |
<< attrE(_ShowProgress, tool.ShowProgress, /*ifNot*/ linkProgressNotSet) |
|
1974 |
<< closetag(_Tool); |
|
1975 |
} |
|
1976 |
||
1977 |
// VCDeploymentTool -------------------------------------------- |
|
1978 |
VCDeploymentTool::VCDeploymentTool() |
|
1979 |
: RegisterOutput(registerNo) |
|
1980 |
{ |
|
1981 |
DeploymentTag = "DeploymentTool"; |
|
1982 |
RemoteDirectory = ""; |
|
1983 |
} |
|
1984 |
||
1985 |
XmlOutput &operator<<(XmlOutput &xml, const VCDeploymentTool &tool) |
|
1986 |
{ |
|
1987 |
if (tool.AdditionalFiles.isEmpty()) |
|
1988 |
return xml; |
|
1989 |
return xml |
|
1990 |
<< tag(tool.DeploymentTag) |
|
1991 |
<< attrS(_RemoteDirectory, tool.RemoteDirectory) |
|
1992 |
<< attrE(_RegisterOutput, tool.RegisterOutput) |
|
1993 |
<< attrS(_AdditionalFiles, tool.AdditionalFiles) |
|
1994 |
<< closetag(tool.DeploymentTag); |
|
1995 |
} |
|
1996 |
||
1997 |
// VCEventTool ------------------------------------------------- |
|
1998 |
XmlOutput &operator<<(XmlOutput &xml, const VCEventTool &tool) |
|
1999 |
{ |
|
2000 |
return xml |
|
2001 |
<< tag(_Tool) |
|
2002 |
<< attrS(_Name, tool.ToolName) |
|
2003 |
<< attrS(_Path, tool.ToolPath) |
|
2004 |
<< attrS(_CommandLine, tool.CommandLine) |
|
2005 |
<< attrS(_Description, tool.Description) |
|
2006 |
<< attrT(_ExcludedFromBuild, tool.ExcludedFromBuild) |
|
2007 |
<< closetag(_Tool); |
|
2008 |
} |
|
2009 |
||
2010 |
// VCPostBuildEventTool --------------------------------------------- |
|
2011 |
VCPostBuildEventTool::VCPostBuildEventTool() |
|
2012 |
{ |
|
2013 |
ToolName = "VCPostBuildEventTool"; |
|
2014 |
} |
|
2015 |
||
2016 |
// VCPreBuildEventTool ---------------------------------------------- |
|
2017 |
VCPreBuildEventTool::VCPreBuildEventTool() |
|
2018 |
{ |
|
2019 |
ToolName = "VCPreBuildEventTool"; |
|
2020 |
} |
|
2021 |
||
2022 |
// VCPreLinkEventTool ----------------------------------------------- |
|
2023 |
VCPreLinkEventTool::VCPreLinkEventTool() |
|
2024 |
{ |
|
2025 |
ToolName = "VCPreLinkEventTool"; |
|
2026 |
} |
|
2027 |
||
2028 |
// VCConfiguration -------------------------------------------------- |
|
2029 |
||
2030 |
VCConfiguration::VCConfiguration() |
|
2031 |
: ATLMinimizesCRunTimeLibraryUsage(unset), |
|
2032 |
BuildBrowserInformation(unset), |
|
2033 |
CharacterSet(charSetNotSet), |
|
2034 |
ConfigurationType(typeApplication), |
|
2035 |
RegisterOutput(unset), |
|
2036 |
UseOfATL(useATLNotSet), |
|
2037 |
UseOfMfc(useMfcStdWin), |
|
2038 |
WholeProgramOptimization(unset) |
|
2039 |
{ |
|
2040 |
compiler.config = this; |
|
2041 |
linker.config = this; |
|
2042 |
idl.config = this; |
|
2043 |
} |
|
2044 |
||
2045 |
XmlOutput &operator<<(XmlOutput &xml, const VCConfiguration &tool) |
|
2046 |
{ |
|
2047 |
xml << tag(_Configuration) |
|
2048 |
<< attrS(_Name, tool.Name) |
|
2049 |
<< attrS(_OutputDirectory, tool.OutputDirectory) |
|
2050 |
<< attrT(_ATLMinimizesCRunTimeLibraryUsage, tool.ATLMinimizesCRunTimeLibraryUsage) |
|
2051 |
<< attrT(_BuildBrowserInformation, tool.BuildBrowserInformation) |
|
2052 |
<< attrE(_CharacterSet, tool.CharacterSet, /*ifNot*/ charSetNotSet) |
|
2053 |
<< attrE(_ConfigurationType, tool.ConfigurationType) |
|
2054 |
<< attrS(_DeleteExtensionsOnClean, tool.DeleteExtensionsOnClean) |
|
2055 |
<< attrS(_ImportLibrary, tool.ImportLibrary) |
|
2056 |
<< attrS(_IntermediateDirectory, tool.IntermediateDirectory) |
|
2057 |
<< attrS(_PrimaryOutput, tool.PrimaryOutput) |
|
2058 |
<< attrS(_ProgramDatabase, tool.ProgramDatabase) |
|
2059 |
<< attrT(_RegisterOutput, tool.RegisterOutput) |
|
2060 |
<< attrE(_UseOfATL, tool.UseOfATL, /*ifNot*/ useATLNotSet) |
|
2061 |
<< attrE(_UseOfMfc, tool.UseOfMfc) |
|
2062 |
<< attrT(_WholeProgramOptimization, tool.WholeProgramOptimization) |
|
2063 |
<< tool.compiler |
|
2064 |
<< tool.custom; |
|
2065 |
if (tool.ConfigurationType == typeStaticLibrary) |
|
2066 |
xml << tool.librarian; |
|
2067 |
else |
|
2068 |
xml << tool.linker; |
|
2069 |
xml << tool.idl |
|
2070 |
<< tool.postBuild |
|
2071 |
<< tool.preBuild |
|
2072 |
<< tool.preLink |
|
2073 |
<< tool.resource |
|
2074 |
<< tool.deployment |
|
2075 |
<< closetag(_Configuration); |
|
2076 |
return xml; |
|
2077 |
} |
|
2078 |
// VCFilter --------------------------------------------------------- |
|
2079 |
VCFilter::VCFilter() |
|
2080 |
: ParseFiles(unset), |
|
2081 |
Config(0) |
|
2082 |
{ |
|
2083 |
useCustomBuildTool = false; |
|
2084 |
useCompilerTool = false; |
|
2085 |
} |
|
2086 |
||
2087 |
void VCFilter::addFile(const QString& filename) |
|
2088 |
{ |
|
2089 |
Files += VCFilterFile(filename); |
|
2090 |
} |
|
2091 |
||
2092 |
void VCFilter::addFile(const VCFilterFile& fileInfo) |
|
2093 |
{ |
|
2094 |
Files += VCFilterFile(fileInfo); |
|
2095 |
} |
|
2096 |
||
2097 |
void VCFilter::addFiles(const QStringList& fileList) |
|
2098 |
{ |
|
2099 |
for (int i = 0; i < fileList.count(); ++i) |
|
2100 |
addFile(fileList.at(i)); |
|
2101 |
} |
|
2102 |
||
2103 |
void VCFilter::modifyPCHstage(QString str) |
|
2104 |
{ |
|
2105 |
bool autogenSourceFile = Project->autogenPrecompCPP; |
|
2106 |
bool pchThroughSourceFile = !Project->precompCPP.isEmpty(); |
|
2107 |
bool isCFile = false; |
|
2108 |
for (QStringList::Iterator it = Option::c_ext.begin(); it != Option::c_ext.end(); ++it) { |
|
2109 |
if (str.endsWith(*it)) { |
|
2110 |
isCFile = true; |
|
2111 |
break; |
|
2112 |
} |
|
2113 |
} |
|
2114 |
bool isHFile = str.endsWith(".h") && (str == Project->precompH); |
|
2115 |
bool isCPPFile = pchThroughSourceFile && (str == Project->precompCPP); |
|
2116 |
||
2117 |
if(!isCFile && !isHFile && !isCPPFile) |
|
2118 |
return; |
|
2119 |
||
2120 |
if(isHFile && pchThroughSourceFile) { |
|
2121 |
if (autogenSourceFile) { |
|
2122 |
useCustomBuildTool = true; |
|
2123 |
QString toFile(Project->precompCPP); |
|
2124 |
CustomBuildTool.Description = "Generating precompiled header source file '" + toFile + "' ..."; |
|
2125 |
CustomBuildTool.Outputs += toFile; |
|
2126 |
||
2127 |
QStringList lines; |
|
2128 |
CustomBuildTool.CommandLine += |
|
2129 |
"echo /*-------------------------------------------------------------------- >" + toFile; |
|
2130 |
lines << "* Precompiled header source file used by Visual Studio.NET to generate"; |
|
2131 |
lines << "* the .pch file."; |
|
2132 |
lines << "*"; |
|
2133 |
lines << "* Due to issues with the dependencies checker within the IDE, it"; |
|
2134 |
lines << "* sometimes fails to recompile the PCH file, if we force the IDE to"; |
|
2135 |
lines << "* create the PCH file directly from the header file."; |
|
2136 |
lines << "*"; |
|
2137 |
lines << "* This file is auto-generated by qmake since no PRECOMPILED_SOURCE was"; |
|
2138 |
lines << "* specified, and is used as the common stdafx.cpp. The file is only"; |
|
2139 |
lines << "* generated when creating .vcproj project files, and is not used for"; |
|
2140 |
lines << "* command line compilations by nmake."; |
|
2141 |
lines << "*"; |
|
2142 |
lines << "* WARNING: All changes made in this file will be lost."; |
|
2143 |
lines << "--------------------------------------------------------------------*/"; |
|
2144 |
lines << "#include \"" + Project->precompHFilename + "\""; |
|
2145 |
foreach(QString line, lines) |
|
2146 |
CustomBuildTool.CommandLine += "echo " + line + ">>" + toFile; |
|
2147 |
} |
|
2148 |
return; |
|
2149 |
} |
|
2150 |
||
2151 |
useCompilerTool = true; |
|
2152 |
// Setup PCH options |
|
2153 |
CompilerTool.UsePrecompiledHeader = (isCFile ? pchNone : pchCreateUsingSpecific); |
|
2154 |
CompilerTool.PrecompiledHeaderThrough = (isCPPFile ? QString("$(INHERIT)") : QString("$(NOINHERIT)")); |
|
2155 |
CompilerTool.ForcedIncludeFiles = QStringList("$(NOINHERIT)"); |
|
2156 |
} |
|
2157 |
||
2158 |
bool VCFilter::addExtraCompiler(const VCFilterFile &info) |
|
2159 |
{ |
|
2160 |
const QStringList &extraCompilers = Project->extraCompilerSources.value(info.file); |
|
2161 |
if (extraCompilers.isEmpty()) |
|
2162 |
return false; |
|
2163 |
||
2164 |
QString inFile = info.file; |
|
2165 |
||
2166 |
// is the extracompiler rule on a file with a built in compiler? |
|
2167 |
const QStringList &objectMappedFile = Project->extraCompilerOutputs[inFile]; |
|
2168 |
bool hasBuiltIn = false; |
|
2169 |
if (!objectMappedFile.isEmpty()) { |
|
2170 |
hasBuiltIn = Project->hasBuiltinCompiler(objectMappedFile.at(0)); |
|
2171 |
// qDebug("*** Extra compiler file has object mapped file '%s' => '%s'", qPrintable(inFile), qPrintable(objectMappedFile.join(" "))); |
|
2172 |
} |
|
2173 |
||
2174 |
CustomBuildTool.AdditionalDependencies.clear(); |
|
2175 |
CustomBuildTool.CommandLine.clear(); |
|
2176 |
CustomBuildTool.Description.clear(); |
|
2177 |
CustomBuildTool.Outputs.clear(); |
|
2178 |
CustomBuildTool.ToolPath.clear(); |
|
2179 |
CustomBuildTool.ToolName = QLatin1String(_VCCustomBuildTool); |
|
2180 |
||
2181 |
for (int x = 0; x < extraCompilers.count(); ++x) { |
|
2182 |
const QString &extraCompilerName = extraCompilers.at(x); |
|
2183 |
||
2184 |
if (!Project->verifyExtraCompiler(extraCompilerName, inFile) && !hasBuiltIn) |
|
2185 |
continue; |
|
2186 |
||
2187 |
// All information about the extra compiler |
|
2188 |
QString tmp_out = Project->project->first(extraCompilerName + ".output"); |
|
2189 |
QString tmp_cmd = Project->project->variables()[extraCompilerName + ".commands"].join(" "); |
|
2190 |
QString tmp_cmd_name = Project->project->variables()[extraCompilerName + ".name"].join(" "); |
|
2191 |
QStringList tmp_dep = Project->project->variables()[extraCompilerName + ".depends"]; |
|
2192 |
QString tmp_dep_cmd = Project->project->variables()[extraCompilerName + ".depend_command"].join(" "); |
|
2193 |
QStringList vars = Project->project->variables()[extraCompilerName + ".variables"]; |
|
2194 |
QStringList configs = Project->project->variables()[extraCompilerName + ".CONFIG"]; |
|
2195 |
bool combined = configs.indexOf("combine") != -1; |
|
2196 |
||
2197 |
QString cmd, cmd_name, out; |
|
2198 |
QStringList deps, inputs; |
|
2199 |
// Variabel replacement of output name |
|
2200 |
out = Option::fixPathToTargetOS( |
|
2201 |
Project->replaceExtraCompilerVariables(tmp_out, inFile, QString()), |
|
2202 |
false); |
|
2203 |
||
2204 |
// If file has built-in compiler, we've swapped the input and output of |
|
2205 |
// the command, as we in Visual Studio cannot have a Custom Buildstep on |
|
2206 |
// a file which uses a built-in compiler. We would in this case only get |
|
2207 |
// the result from the extra compiler. If 'hasBuiltIn' is true, we know |
|
2208 |
// that we're actually on the _output_file_ of the result, and we |
|
2209 |
// therefore swap inFile and out below, since the extra-compiler still |
|
2210 |
// must see it as the original way. If the result also has a built-in |
|
2211 |
// compiler, too bad.. |
|
2212 |
if (hasBuiltIn) { |
|
2213 |
out = inFile; |
|
2214 |
inFile = objectMappedFile.at(0); |
|
2215 |
} |
|
2216 |
||
2217 |
// Dependency for the output |
|
2218 |
if(!tmp_dep.isEmpty()) |
|
2219 |
deps = tmp_dep; |
|
2220 |
if(!tmp_dep_cmd.isEmpty()) { |
|
2221 |
// Execute dependency command, and add every line as a dep |
|
2222 |
char buff[256]; |
|
2223 |
QString dep_cmd = Project->replaceExtraCompilerVariables(tmp_dep_cmd, |
|
2224 |
Option::fixPathToLocalOS(inFile, true, false), |
|
2225 |
out); |
|
2226 |
if(Project->canExecute(dep_cmd)) { |
|
2227 |
if(FILE *proc = QT_POPEN(dep_cmd.toLatin1().constData(), "r")) { |
|
2228 |
QString indeps; |
|
2229 |
while(!feof(proc)) { |
|
2230 |
int read_in = (int)fread(buff, 1, 255, proc); |
|
2231 |
if(!read_in) |
|
2232 |
break; |
|
2233 |
indeps += QByteArray(buff, read_in); |
|
2234 |
} |
|
2235 |
QT_PCLOSE(proc); |
|
2236 |
if(!indeps.isEmpty()) { |
|
2237 |
QStringList extradeps = indeps.split(QLatin1Char('\n')); |
|
2238 |
for (int i = 0; i < extradeps.count(); ++i) { |
|
2239 |
QString dd = extradeps.at(i).simplified(); |
|
2240 |
if (!dd.isEmpty()) |
|
2241 |
deps += Project->fileFixify(dd); |
|
2242 |
} |
|
2243 |
} |
|
2244 |
} |
|
2245 |
} |
|
2246 |
} |
|
2247 |
for (int i = 0; i < deps.count(); ++i) |
|
2248 |
deps[i] = Option::fixPathToTargetOS( |
|
2249 |
Project->replaceExtraCompilerVariables(deps.at(i), inFile, out), |
|
2250 |
false).trimmed(); |
|
2251 |
// Command for file |
|
2252 |
if (combined) { |
|
2253 |
// Add dependencies for each file |
|
2254 |
QStringList tmp_in = Project->project->variables()[extraCompilerName + ".input"]; |
|
2255 |
for (int a = 0; a < tmp_in.count(); ++a) { |
|
2256 |
const QStringList &files = Project->project->variables()[tmp_in.at(a)]; |
|
2257 |
for (int b = 0; b < files.count(); ++b) { |
|
2258 |
deps += Project->findDependencies(files.at(b)); |
|
2259 |
inputs += Option::fixPathToTargetOS(files.at(b), false); |
|
2260 |
} |
|
2261 |
} |
|
2262 |
deps += inputs; // input files themselves too.. |
|
2263 |
||
2264 |
// Replace variables for command w/all input files |
|
2265 |
// ### join gives path issues with directories containing spaces! |
|
2266 |
cmd = Project->replaceExtraCompilerVariables(tmp_cmd, |
|
2267 |
inputs.join(" "), |
|
2268 |
out); |
|
2269 |
} else { |
|
2270 |
deps += inFile; // input file itself too.. |
|
2271 |
cmd = Project->replaceExtraCompilerVariables(tmp_cmd, |
|
2272 |
inFile, |
|
2273 |
out); |
|
2274 |
} |
|
2275 |
// Name for command |
|
2276 |
if(!tmp_cmd_name.isEmpty()) { |
|
2277 |
cmd_name = Project->replaceExtraCompilerVariables(tmp_cmd_name, inFile, out); |
|
2278 |
} else { |
|
2279 |
int space = cmd.indexOf(' '); |
|
2280 |
if(space != -1) |
|
2281 |
cmd_name = cmd.left(space); |
|
2282 |
else |
|
2283 |
cmd_name = cmd; |
|
2284 |
if((cmd_name[0] == '\'' || cmd_name[0] == '"') && |
|
2285 |
cmd_name[0] == cmd_name[cmd_name.length()-1]) |
|
2286 |
cmd_name = cmd_name.mid(1,cmd_name.length()-2); |
|
2287 |
} |
|
2288 |
||
2289 |
// Fixify paths |
|
2290 |
for (int i = 0; i < deps.count(); ++i) |
|
2291 |
deps[i] = Option::fixPathToTargetOS(deps[i], false); |
|
2292 |
||
2293 |
||
2294 |
// Output in info.additionalFile ----------- |
|
2295 |
if (!CustomBuildTool.Description.isEmpty()) |
|
2296 |
CustomBuildTool.Description += " & "; |
|
2297 |
CustomBuildTool.Description += cmd_name; |
|
2298 |
CustomBuildTool.CommandLine += cmd.trimmed().split("\n", QString::SkipEmptyParts); |
|
2299 |
int space = cmd.indexOf(' '); |
|
2300 |
QFileInfo finf(cmd.left(space)); |
|
2301 |
if (CustomBuildTool.ToolPath.isEmpty()) |
|
2302 |
CustomBuildTool.ToolPath += Option::fixPathToTargetOS(finf.path()); |
|
2303 |
CustomBuildTool.Outputs += out; |
|
2304 |
||
2305 |
deps += CustomBuildTool.AdditionalDependencies; |
|
2306 |
deps += cmd.left(cmd.indexOf(' ')); |
|
2307 |
// Make sure that all deps are only once |
|
2308 |
QMap<QString, bool> uniqDeps; |
|
2309 |
for (int c = 0; c < deps.count(); ++c) { |
|
2310 |
QString aDep = deps.at(c).trimmed(); |
|
2311 |
if (!aDep.isEmpty()) |
|
2312 |
uniqDeps[aDep] = false; |
|
2313 |
} |
|
2314 |
CustomBuildTool.AdditionalDependencies = uniqDeps.keys(); |
|
2315 |
} |
|
2316 |
||
2317 |
// Ensure that none of the output files are also dependencies. Or else, the custom buildstep |
|
2318 |
// will be rebuild every time, even if nothing has changed. |
|
2319 |
foreach(QString output, CustomBuildTool.Outputs) { |
|
2320 |
CustomBuildTool.AdditionalDependencies.removeAll(output); |
|
2321 |
} |
|
2322 |
||
2323 |
useCustomBuildTool = !CustomBuildTool.CommandLine.isEmpty(); |
|
2324 |
return useCustomBuildTool; |
|
2325 |
} |
|
2326 |
||
2327 |
void VCFilter::outputFileConfig(XmlOutput &xml, const QString &filename) |
|
2328 |
{ |
|
2329 |
// Clearing each filter tool |
|
2330 |
useCustomBuildTool = false; |
|
2331 |
useCompilerTool = false; |
|
2332 |
CustomBuildTool = VCCustomBuildTool(); |
|
2333 |
CompilerTool = VCCLCompilerTool(); |
|
2334 |
||
2335 |
// Unset some default options |
|
2336 |
CompilerTool.BufferSecurityCheck = unset; |
|
2337 |
CompilerTool.DebugInformationFormat = debugUnknown; |
|
2338 |
CompilerTool.ExceptionHandling = ehDefault; |
|
2339 |
CompilerTool.GeneratePreprocessedFile = preprocessUnknown; |
|
2340 |
CompilerTool.Optimization = optimizeDefault; |
|
2341 |
CompilerTool.ProgramDataBaseFileName.clear(); |
|
2342 |
CompilerTool.RuntimeLibrary = rtUnknown; |
|
2343 |
CompilerTool.WarningLevel = warningLevelUnknown; |
|
2344 |
CompilerTool.config = Config; |
|
2345 |
||
2346 |
bool inBuild = false; |
|
2347 |
VCFilterFile info; |
|
2348 |
for (int i = 0; i < Files.count(); ++i) { |
|
2349 |
if (Files.at(i).file == filename) { |
|
2350 |
info = Files.at(i); |
|
2351 |
inBuild = true; |
|
2352 |
} |
|
2353 |
} |
|
2354 |
inBuild &= !info.excludeFromBuild; |
|
2355 |
||
2356 |
if (inBuild) { |
|
2357 |
addExtraCompiler(info); |
|
2358 |
if(Project->usePCH) |
|
2359 |
modifyPCHstage(info.file); |
|
2360 |
} else { |
|
2361 |
// Excluded files uses an empty compiler stage |
|
2362 |
if(info.excludeFromBuild) |
|
2363 |
useCompilerTool = true; |
|
2364 |
} |
|
2365 |
||
2366 |
// Actual XML output ---------------------------------- |
|
2367 |
if(useCustomBuildTool || useCompilerTool || !inBuild) { |
|
2368 |
xml << tag(_FileConfiguration) |
|
2369 |
<< attr(_Name, (*Config).Name) |
|
2370 |
<< (!inBuild ? attrS(_ExcludedFromBuild, "true") : noxml()); |
|
2371 |
if (useCustomBuildTool) |
|
2372 |
xml << CustomBuildTool; |
|
2373 |
if (useCompilerTool) |
|
2374 |
xml << CompilerTool; |
|
2375 |
xml << closetag(_FileConfiguration); |
|
2376 |
} |
|
2377 |
} |
|
2378 |
||
2379 |
XmlOutput &operator<<(XmlOutput &xml, VCFilter &tool) |
|
2380 |
{ |
|
2381 |
if(!tool.Files.count()) |
|
2382 |
return xml; |
|
2383 |
||
2384 |
if (!tool.Name.isEmpty()) { |
|
2385 |
xml << tag(_Filter) |
|
2386 |
<< attrS(_Name, tool.Name) |
|
2387 |
<< attrS(_Filter, tool.Filter) |
|
2388 |
<< attrS(_UniqueIdentifier, tool.Guid) |
|
2389 |
<< attrT(_ParseFiles, tool.ParseFiles); |
|
2390 |
} |
|
2391 |
for (int i = 0; i < tool.Files.count(); ++i) { |
|
2392 |
const VCFilterFile &info = tool.Files.at(i); |
|
2393 |
xml << tag(q_File) |
|
2394 |
<< attrS(_RelativePath, Option::fixPathToLocalOS(info.file)) |
|
2395 |
<< data(); // In case no custom builds, to avoid "/>" endings |
|
2396 |
tool.outputFileConfig(xml, tool.Files.at(i).file); |
|
2397 |
xml << closetag(q_File); |
|
2398 |
} |
|
2399 |
if (!tool.Name.isEmpty()) |
|
2400 |
xml << closetag(_Filter); |
|
2401 |
return xml; |
|
2402 |
} |
|
2403 |
||
2404 |
// VCProjectSingleConfig -------------------------------------------- |
|
2405 |
VCFilter nullFilter; |
|
2406 |
VCFilter& VCProjectSingleConfig::filterForExtraCompiler(const QString &compilerName) |
|
2407 |
{ |
|
2408 |
for (int i = 0; i < ExtraCompilersFiles.count(); ++i) |
|
2409 |
if (ExtraCompilersFiles.at(i).Name == compilerName) |
|
2410 |
return ExtraCompilersFiles[i]; |
|
2411 |
return nullFilter; |
|
2412 |
} |
|
2413 |
||
2414 |
||
2415 |
XmlOutput &operator<<(XmlOutput &xml, const VCProjectSingleConfig &tool) |
|
2416 |
{ |
|
2417 |
xml << decl("1.0", "Windows-1252") |
|
2418 |
<< tag(_VisualStudioProject) |
|
2419 |
<< attrS(_ProjectType, "Visual C++") |
|
2420 |
<< attrS(_Version, tool.Version) |
|
2421 |
<< attrS(_Name, tool.Name) |
|
2422 |
<< attrS(_ProjectGUID, tool.ProjectGUID) |
|
2423 |
<< attrS(_Keyword, tool.Keyword) |
|
2424 |
<< attrS(_SccProjectName, tool.SccProjectName) |
|
2425 |
<< attrS(_SccLocalPath, tool.SccLocalPath) |
|
2426 |
<< tag(_Platforms) |
|
2427 |
<< tag(_Platform) |
|
2428 |
<< attrS(_Name, tool.PlatformName) |
|
2429 |
<< closetag(_Platforms) |
|
2430 |
<< tag(_Configurations) |
|
2431 |
<< tool.Configuration; |
|
2432 |
xml << closetag(_Configurations) |
|
2433 |
<< tag(q_Files); |
|
2434 |
// Add this configuration into a multi-config project, since that's where we have the flat/tree |
|
2435 |
// XML output functionality |
|
2436 |
VCProject tempProj; |
|
2437 |
tempProj.SingleProjects += tool; |
|
2438 |
tempProj.outputFilter(xml, "Sources"); |
|
2439 |
tempProj.outputFilter(xml, "Headers"); |
|
2440 |
tempProj.outputFilter(xml, "GeneratedFiles"); |
|
2441 |
tempProj.outputFilter(xml, "LexYaccFiles"); |
|
2442 |
tempProj.outputFilter(xml, "TranslationFiles"); |
|
2443 |
tempProj.outputFilter(xml, "FormFiles"); |
|
2444 |
tempProj.outputFilter(xml, "ResourceFiles"); |
|
2445 |
for (int x = 0; x < tempProj.ExtraCompilers.count(); ++x) { |
|
2446 |
tempProj.outputFilter(xml, tempProj.ExtraCompilers.at(x)); |
|
2447 |
} |
|
2448 |
tempProj.outputFilter(xml, "RootFiles"); |
|
2449 |
xml << closetag(q_Files) |
|
2450 |
<< tag(_Globals) |
|
2451 |
<< data(); // No "/>" end tag |
|
2452 |
return xml; |
|
2453 |
} |
|
2454 |
||
2455 |
||
2456 |
// Tree file generation --------------------------------------------- |
|
2457 |
void TreeNode::generateXML(XmlOutput &xml, const QString &tagName, VCProject &tool, const QString &filter) { |
|
2458 |
if (children.size()) { |
|
2459 |
// Filter |
|
2460 |
ChildrenMap::ConstIterator it, end = children.constEnd(); |
|
2461 |
if (!tagName.isEmpty()) { |
|
2462 |
xml << tag("Filter") |
|
2463 |
<< attr("Name", tagName) |
|
2464 |
<< attr("Filter", ""); |
|
2465 |
} |
|
2466 |
// First round, do nested filters |
|
2467 |
for (it = children.constBegin(); it != end; ++it) |
|
2468 |
if ((*it)->children.size()) |
|
2469 |
(*it)->generateXML(xml, it.key(), tool, filter); |
|
2470 |
// Second round, do leafs |
|
2471 |
for (it = children.constBegin(); it != end; ++it) |
|
2472 |
if (!(*it)->children.size()) |
|
2473 |
(*it)->generateXML(xml, it.key(), tool, filter); |
|
2474 |
||
2475 |
if (!tagName.isEmpty()) |
|
2476 |
xml << closetag("Filter"); |
|
2477 |
} else { |
|
2478 |
// Leaf |
|
2479 |
tool.outputFileConfigs(xml, info, filter); |
|
2480 |
} |
|
2481 |
} |
|
2482 |
||
2483 |
||
2484 |
// Flat file generation --------------------------------------------- |
|
2485 |
void FlatNode::generateXML(XmlOutput &xml, const QString &/*tagName*/, VCProject &tool, const QString &filter) { |
|
2486 |
if (children.size()) { |
|
2487 |
ChildrenMapFlat::ConstIterator it = children.constBegin(); |
|
2488 |
ChildrenMapFlat::ConstIterator end = children.constEnd(); |
|
2489 |
for (; it != end; ++it) { |
|
2490 |
tool.outputFileConfigs(xml, (*it), filter); |
|
2491 |
} |
|
2492 |
} |
|
2493 |
} |
|
2494 |
||
2495 |
||
2496 |
// VCProject -------------------------------------------------------- |
|
2497 |
// Output all configurations (by filtername) for a file (by info) |
|
2498 |
// A filters config output is in VCFilter.outputFileConfig() |
|
2499 |
void VCProject::outputFileConfigs(XmlOutput &xml, |
|
2500 |
// VCProjectSingleConfig::FilterTypes type |
|
2501 |
const VCFilterFile &info, |
|
2502 |
const QString &filtername) |
|
2503 |
{ |
|
2504 |
xml << tag(q_File) |
|
2505 |
<< attrS(_RelativePath, Option::fixPathToLocalOS(info.file)); |
|
2506 |
for (int i = 0; i < SingleProjects.count(); ++i) { |
|
2507 |
VCFilter filter; |
|
2508 |
if (filtername == "RootFiles") { |
|
2509 |
filter = SingleProjects.at(i).RootFiles; |
|
2510 |
} else if (filtername == "Sources") { |
|
2511 |
filter = SingleProjects.at(i).SourceFiles; |
|
2512 |
} else if (filtername == "Headers") { |
|
2513 |
filter = SingleProjects.at(i).HeaderFiles; |
|
2514 |
} else if (filtername == "GeneratedFiles") { |
|
2515 |
filter = SingleProjects.at(i).GeneratedFiles; |
|
2516 |
} else if (filtername == "LexYaccFiles") { |
|
2517 |
filter = SingleProjects.at(i).LexYaccFiles; |
|
2518 |
} else if (filtername == "TranslationFiles") { |
|
2519 |
filter = SingleProjects.at(i).TranslationFiles; |
|
2520 |
} else if (filtername == "FormFiles") { |
|
2521 |
filter = SingleProjects.at(i).FormFiles; |
|
2522 |
} else if (filtername == "ResourceFiles") { |
|
2523 |
filter = SingleProjects.at(i).ResourceFiles; |
|
2524 |
} else { |
|
2525 |
// ExtraCompilers |
|
2526 |
filter = SingleProjects[i].filterForExtraCompiler(filtername); |
|
2527 |
} |
|
2528 |
||
2529 |
if (filter.Config) // only if the filter is not empty |
|
2530 |
filter.outputFileConfig(xml, info.file); |
|
2531 |
} |
|
2532 |
xml << closetag(q_File); |
|
2533 |
} |
|
2534 |
||
2535 |
// outputs a given filter for all existing configurations of a project |
|
2536 |
void VCProject::outputFilter(XmlOutput &xml, |
|
2537 |
// VCProjectSingleConfig::FilterTypes type |
|
2538 |
const QString &filtername) |
|
2539 |
{ |
|
2540 |
Node *root; |
|
2541 |
if (SingleProjects.at(0).flat_files) |
|
2542 |
root = new FlatNode; |
|
2543 |
else |
|
2544 |
root = new TreeNode; |
|
2545 |
||
2546 |
QString name, extfilter, guid; |
|
2547 |
triState parse; |
|
2548 |
||
2549 |
for (int i = 0; i < SingleProjects.count(); ++i) { |
|
2550 |
VCFilter filter; |
|
2551 |
if (filtername == "RootFiles") { |
|
2552 |
filter = SingleProjects.at(i).RootFiles; |
|
2553 |
} else if (filtername == "Sources") { |
|
2554 |
filter = SingleProjects.at(i).SourceFiles; |
|
2555 |
} else if (filtername == "Headers") { |
|
2556 |
filter = SingleProjects.at(i).HeaderFiles; |
|
2557 |
} else if (filtername == "GeneratedFiles") { |
|
2558 |
filter = SingleProjects.at(i).GeneratedFiles; |
|
2559 |
} else if (filtername == "LexYaccFiles") { |
|
2560 |
filter = SingleProjects.at(i).LexYaccFiles; |
|
2561 |
} else if (filtername == "TranslationFiles") { |
|
2562 |
filter = SingleProjects.at(i).TranslationFiles; |
|
2563 |
} else if (filtername == "FormFiles") { |
|
2564 |
filter = SingleProjects.at(i).FormFiles; |
|
2565 |
} else if (filtername == "ResourceFiles") { |
|
2566 |
filter = SingleProjects.at(i).ResourceFiles; |
|
2567 |
} else { |
|
2568 |
// ExtraCompilers |
|
2569 |
filter = SingleProjects[i].filterForExtraCompiler(filtername); |
|
2570 |
} |
|
2571 |
||
2572 |
// Merge all files in this filter to root tree |
|
2573 |
for (int x = 0; x < filter.Files.count(); ++x) |
|
2574 |
root->addElement(filter.Files.at(x)); |
|
2575 |
||
2576 |
// Save filter setting from first filter. Next filters |
|
2577 |
// may differ but we cannot handle that. (ex. extfilter) |
|
2578 |
if (name.isEmpty()) { |
|
2579 |
name = filter.Name; |
|
2580 |
extfilter = filter.Filter; |
|
2581 |
parse = filter.ParseFiles; |
|
2582 |
guid = filter.Guid; |
|
2583 |
} |
|
2584 |
} |
|
2585 |
||
2586 |
if (!root->hasElements()) |
|
2587 |
return; |
|
2588 |
||
2589 |
// Actual XML output ---------------------------------- |
|
2590 |
if (!name.isEmpty()) { |
|
2591 |
xml << tag(_Filter) |
|
2592 |
<< attrS(_Name, name) |
|
2593 |
<< attrS(_Filter, extfilter) |
|
2594 |
<< attrS(_UniqueIdentifier, guid) |
|
2595 |
<< attrT(_ParseFiles, parse); |
|
2596 |
} |
|
2597 |
root->generateXML(xml, "", *this, filtername); // output root tree |
|
2598 |
if (!name.isEmpty()) |
|
2599 |
xml << closetag(_Filter); |
|
2600 |
} |
|
2601 |
||
2602 |
XmlOutput &operator<<(XmlOutput &xml, VCProject &tool) |
|
2603 |
{ |
|
2604 |
if (tool.SingleProjects.count() == 0) { |
|
2605 |
warn_msg(WarnLogic, "Generator: .NET: no single project in merge project, no output"); |
|
2606 |
return xml; |
|
2607 |
} |
|
2608 |
||
2609 |
xml << decl("1.0", "Windows-1252") |
|
2610 |
<< tag(_VisualStudioProject) |
|
2611 |
<< attrS(_ProjectType, "Visual C++") |
|
2612 |
<< attrS(_Version, tool.Version) |
|
2613 |
<< attrS(_Name, tool.Name) |
|
2614 |
<< attrS(_ProjectGUID, tool.ProjectGUID) |
|
2615 |
<< attrS(_Keyword, tool.Keyword) |
|
2616 |
<< attrS(_SccProjectName, tool.SccProjectName) |
|
2617 |
<< attrS(_SccLocalPath, tool.SccLocalPath) |
|
2618 |
<< tag(_Platforms) |
|
2619 |
<< tag(_Platform) |
|
2620 |
<< attrS(_Name, tool.PlatformName) |
|
2621 |
<< closetag(_Platforms) |
|
2622 |
<< tag(_Configurations); |
|
2623 |
// Output each configuration |
|
2624 |
for (int i = 0; i < tool.SingleProjects.count(); ++i) |
|
2625 |
xml << tool.SingleProjects.at(i).Configuration; |
|
2626 |
xml << closetag(_Configurations) |
|
2627 |
<< tag(q_Files); |
|
2628 |
tool.outputFilter(xml, "Sources"); |
|
2629 |
tool.outputFilter(xml, "Headers"); |
|
2630 |
tool.outputFilter(xml, "GeneratedFiles"); |
|
2631 |
tool.outputFilter(xml, "LexYaccFiles"); |
|
2632 |
tool.outputFilter(xml, "TranslationFiles"); |
|
2633 |
tool.outputFilter(xml, "FormFiles"); |
|
2634 |
tool.outputFilter(xml, "ResourceFiles"); |
|
2635 |
for (int x = 0; x < tool.ExtraCompilers.count(); ++x) { |
|
2636 |
tool.outputFilter(xml, tool.ExtraCompilers.at(x)); |
|
2637 |
} |
|
2638 |
tool.outputFilter(xml, "RootFiles"); |
|
2639 |
xml << closetag(q_Files) |
|
2640 |
<< tag(_Globals) |
|
2641 |
<< data(); // No "/>" end tag |
|
2642 |
return xml; |
|
2643 |
} |
|
2644 |
||
2645 |
QT_END_NAMESPACE |