|
1 /**************************************************************************** |
|
2 ** |
|
3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). |
|
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 "msbuild_objectmodel.h" |
|
44 #include "msvc_vcproj.h" |
|
45 #include "msvc_vcxproj.h" |
|
46 #include <qstringlist.h> |
|
47 #include <qfileinfo.h> |
|
48 |
|
49 QT_BEGIN_NAMESPACE |
|
50 |
|
51 // XML Tags --------------------------------------------------------- |
|
52 const char _CLCompile[] = "ClCompile"; |
|
53 const char _Configuration[] = "Configuration"; |
|
54 const char _Configurations[] = "Configurations"; |
|
55 const char q_File[] = "File"; |
|
56 const char _FileConfiguration[] = "FileConfiguration"; |
|
57 const char q_Files[] = "Files"; |
|
58 const char _Filter[] = "Filter"; |
|
59 const char _Globals[] = "Globals"; |
|
60 const char _ItemGroup[] = "ItemGroup"; |
|
61 const char _Link[] = "Link"; |
|
62 const char _Midl[] = "Midl"; |
|
63 const char _Platform[] = "Platform"; |
|
64 const char _Platforms[] = "Platforms"; |
|
65 const char _ResourceCompile[] = "ResourceCompile"; |
|
66 const char _Tool[] = "Tool"; |
|
67 const char _VisualStudioProject[] = "VisualStudioProject"; |
|
68 |
|
69 // XML Properties --------------------------------------------------- |
|
70 const char _AddModuleNamesToAssembly[] = "AddModuleNamesToAssembly"; |
|
71 const char _AdditionalDependencies[] = "AdditionalDependencies"; |
|
72 const char _AdditionalFiles[] = "AdditionalFiles"; |
|
73 const char _AdditionalIncludeDirectories[] = "AdditionalIncludeDirectories"; |
|
74 const char _AdditionalLibraryDirectories[] = "AdditionalLibraryDirectories"; |
|
75 const char _AdditionalManifestDependencies[] = "AdditionalManifestDependencies"; |
|
76 const char _AdditionalOptions[] = "AdditionalOptions"; |
|
77 const char _AdditionalUsingDirectories[] = "AdditionalUsingDirectories"; |
|
78 const char _AllowIsolation[] = "AllowIsolation"; |
|
79 const char _AlwaysAppend[] = "AlwaysAppend"; |
|
80 const char _ApplicationConfigurationMode[] = "ApplicationConfigurationMode"; |
|
81 const char _AssemblerListingLocation[] = "AssemblerListingLocation"; |
|
82 const char _AssemblerOutput[] = "AssemblerOutput"; |
|
83 const char _AssemblyDebug[] = "AssemblyDebug"; |
|
84 const char _AssemblyLinkResource[] = "AssemblyLinkResource"; |
|
85 const char _ATLMinimizesCRunTimeLibraryUsage[] = "ATLMinimizesCRunTimeLibraryUsage"; |
|
86 const char _BaseAddress[] = "BaseAddress"; |
|
87 const char _BasicRuntimeChecks[] = "BasicRuntimeChecks"; |
|
88 const char _BrowseInformation[] = "BrowseInformation"; |
|
89 const char _BrowseInformationFile[] = "BrowseInformationFile"; |
|
90 const char _BufferSecurityCheck[] = "BufferSecurityCheck"; |
|
91 const char _BuildBrowserInformation[] = "BuildBrowserInformation"; |
|
92 const char _CallingConvention[] = "CallingConvention"; |
|
93 const char _CharacterSet[] = "CharacterSet"; |
|
94 const char _ClientStubFile[] = "ClientStubFile"; |
|
95 const char _CLRImageType[] = "CLRImageType"; |
|
96 const char _CLRSupportLastError[] = "CLRSupportLastError"; |
|
97 const char _CLRThreadAttribute[] = "CLRThreadAttribute"; |
|
98 const char _CLRUnmanagedCodeCheck[] = "CLRUnmanagedCodeCheck"; |
|
99 const char _Command[] = "Command"; |
|
100 const char _CommandLine[] = "CommandLine"; |
|
101 const char _CompileAs[] = "CompileAs"; |
|
102 const char _CompileAsManaged[] = "CompileAsManaged"; |
|
103 const char _CompileForArchitecture[] = "CompileForArchitecture"; |
|
104 const char _CompileOnly[] = "CompileOnly"; |
|
105 const char _ConfigurationType[] = "ConfigurationType"; |
|
106 const char _CPreprocessOptions[] = "CPreprocessOptions"; |
|
107 const char _CreateHotpatchableImage[] = "CreateHotpatchableImage"; |
|
108 const char _CreateHotPatchableImage[] = "CreateHotPatchableImage"; |
|
109 const char _Culture[] = "Culture"; |
|
110 const char _DataExecutionPrevention[] = "DataExecutionPrevention"; |
|
111 const char _DebugInformationFormat[] = "DebugInformationFormat"; |
|
112 const char _DefaultCharIsUnsigned[] = "DefaultCharIsUnsigned"; |
|
113 const char _DefaultCharType[] = "DefaultCharType"; |
|
114 const char _DelayLoadDLLs[] = "DelayLoadDLLs"; |
|
115 const char _DelaySign[] = "DelaySign"; |
|
116 const char _DeleteExtensionsOnClean[] = "DeleteExtensionsOnClean"; |
|
117 const char _Description[] = "Description"; |
|
118 const char _Detect64BitPortabilityProblems[] = "Detect64BitPortabilityProblems"; |
|
119 const char _DisableLanguageExtensions[] = "DisableLanguageExtensions"; |
|
120 const char _DisableSpecificWarnings[] = "DisableSpecificWarnings"; |
|
121 const char _DisplayLibrary[] = "DisplayLibrary"; |
|
122 const char _DLLDataFileName[] = "DLLDataFileName"; |
|
123 const char _Driver[] = "Driver"; |
|
124 const char _EmbedManagedResourceFile[] = "EmbedManagedResourceFile"; |
|
125 const char _EnableCOMDATFolding[] = "EnableCOMDATFolding"; |
|
126 const char _EnableUAC[] = "EnableUAC"; |
|
127 const char _EnableErrorChecks[] = "EnableErrorChecks"; |
|
128 const char _EnableEnhancedInstructionSet[] = "EnableEnhancedInstructionSet"; |
|
129 const char _EnableFiberSafeOptimizations[] = "EnableFiberSafeOptimizations"; |
|
130 const char _EnableFunctionLevelLinking[] = "EnableFunctionLevelLinking"; |
|
131 const char _EnableIntrinsicFunctions[] = "EnableIntrinsicFunctions"; |
|
132 const char _EnablePREfast[] = "EnablePREfast"; |
|
133 const char _EntryPointSymbol[] = "EntryPointSymbol"; |
|
134 const char _ErrorCheckAllocations[] = "ErrorCheckAllocations"; |
|
135 const char _ErrorCheckBounds[] = "ErrorCheckBounds"; |
|
136 const char _ErrorCheckEnumRange[] = "ErrorCheckEnumRange"; |
|
137 const char _ErrorCheckRefPointers[] = "ErrorCheckRefPointers"; |
|
138 const char _ErrorCheckStubData[] = "ErrorCheckStubData"; |
|
139 const char _ErrorReporting[] = "ErrorReporting"; |
|
140 const char _ExceptionHandling[] = "ExceptionHandling"; |
|
141 const char _ExcludedFromBuild[] = "ExcludedFromBuild"; |
|
142 const char _ExpandAttributedSource[] = "ExpandAttributedSource"; |
|
143 const char _ExportNamedFunctions[] = "ExportNamedFunctions"; |
|
144 const char _FavorSizeOrSpeed[] = "FavorSizeOrSpeed"; |
|
145 const char _FixedBaseAddress[] = "FixedBaseAddress"; |
|
146 const char _FloatingPointModel[] = "FloatingPointModel"; |
|
147 const char _FloatingPointExceptions[] = "FloatingPointExceptions"; |
|
148 const char _ForceConformanceInForLoopScope[] = "ForceConformanceInForLoopScope"; |
|
149 const char _ForceFileOutput[] = "ForceFileOutput"; |
|
150 const char _ForceSymbolReferences[] = "ForceSymbolReferences"; |
|
151 const char _ForcedIncludeFiles[] = "ForcedIncludeFiles"; |
|
152 const char _ForcedUsingFiles[] = "ForcedUsingFiles"; |
|
153 const char _FullIncludePath[] = "FullIncludePath"; |
|
154 const char _FunctionLevelLinking[] = "FunctionLevelLinking"; |
|
155 const char _FunctionOrder[] = "FunctionOrder"; |
|
156 const char _GenerateClientFiles[] = "GenerateClientFiles"; |
|
157 const char _GenerateDebugInformation[] = "GenerateDebugInformation"; |
|
158 const char _GenerateManifest[] = "GenerateManifest"; |
|
159 const char _GenerateMapFile[] = "GenerateMapFile"; |
|
160 const char _GeneratePreprocessedFile[] = "GeneratePreprocessedFile"; |
|
161 const char _GenerateServerFiles[] = "GenerateServerFiles"; |
|
162 const char _GenerateStublessProxies[] = "GenerateStublessProxies"; |
|
163 const char _GenerateTypeLibrary[] = "GenerateTypeLibrary"; |
|
164 const char _GenerateXMLDocumentationFiles[] = "GenerateXMLDocumentationFiles"; |
|
165 const char _GlobalOptimizations[] = "GlobalOptimizations"; |
|
166 const char _HeaderFileName[] = "HeaderFileName"; |
|
167 const char _HeapCommitSize[] = "HeapCommitSize"; |
|
168 const char _HeapReserveSize[] = "HeapReserveSize"; |
|
169 const char _IgnoreAllDefaultLibraries[] = "IgnoreAllDefaultLibraries"; |
|
170 const char _IgnoreDefaultLibraryNames[] = "IgnoreDefaultLibraryNames"; |
|
171 const char _IgnoreEmbeddedIDL[] = "IgnoreEmbeddedIDL"; |
|
172 const char _IgnoreImportLibrary[] = "IgnoreImportLibrary"; |
|
173 const char _IgnoreSpecificDefaultLibraries[] = "IgnoreSpecificDefaultLibraries"; |
|
174 const char _IgnoreStandardIncludePath[] = "IgnoreStandardIncludePath"; |
|
175 const char _ImageHasSafeExceptionHandlers[] = "ImageHasSafeExceptionHandlers"; |
|
176 const char _ImportLibrary[] = "ImportLibrary"; |
|
177 const char _ImproveFloatingPointConsistency[] = "ImproveFloatingPointConsistency"; |
|
178 const char _InlineFunctionExpansion[] = "InlineFunctionExpansion"; |
|
179 const char _IntrinsicFunctions[] = "IntrinsicFunctions"; |
|
180 const char _InterfaceIdentifierFileName[] = "InterfaceIdentifierFileName"; |
|
181 const char _IntermediateDirectory[] = "IntermediateDirectory"; |
|
182 const char _InterworkCalls[] = "InterworkCalls"; |
|
183 const char _KeyContainer[] = "KeyContainer"; |
|
184 const char _KeyFile[] = "KeyFile"; |
|
185 const char _Keyword[] = "Keyword"; |
|
186 const char _KeepComments[] = "KeepComments"; |
|
187 const char _LargeAddressAware[] = "LargeAddressAware"; |
|
188 const char _LinkDLL[] = "LinkDLL"; |
|
189 const char _LinkErrorReporting[] = "LinkErrorReporting"; |
|
190 const char _LinkIncremental[] = "LinkIncremental"; |
|
191 const char _LinkStatus[] = "LinkStatus"; |
|
192 const char _LinkTimeCodeGeneration[] = "LinkTimeCodeGeneration"; |
|
193 const char _LinkToManagedResourceFile[] = "LinkToManagedResourceFile"; |
|
194 const char _LocaleID[] = "LocaleID"; |
|
195 const char _ManifestFile[] = "ManifestFile"; |
|
196 const char _MapExports[] = "MapExports"; |
|
197 const char _MapFileName[] = "MapFileName"; |
|
198 const char _MapLines[] = "MapLines "; |
|
199 const char _MergedIDLBaseFileName[] = "MergedIDLBaseFileName"; |
|
200 const char _MergeSections[] = "MergeSections"; |
|
201 const char _Message[] = "Message"; |
|
202 const char _MidlCommandFile[] = "MidlCommandFile"; |
|
203 const char _MinimalRebuild[] = "MinimalRebuild"; |
|
204 const char _MkTypLibCompatible[] = "MkTypLibCompatible"; |
|
205 const char _ModuleDefinitionFile[] = "ModuleDefinitionFile"; |
|
206 const char _MSDOSStubFileName[] = "MSDOSStubFileName"; |
|
207 const char _MultiProcessorCompilation[] = "MultiProcessorCompilation"; |
|
208 const char _Name[] = "Name"; |
|
209 const char _NoEntryPoint[] = "NoEntryPoint"; |
|
210 const char _NullTerminateStrings[] = "NullTerminateStrings"; |
|
211 const char _ObjectFile[] = "ObjectFile"; |
|
212 const char _ObjectFiles[] = "ObjectFiles"; |
|
213 const char _ObjectFileName[] = "ObjectFileName"; |
|
214 const char _OmitDefaultLibName[] = "OmitDefaultLibName"; |
|
215 const char _OmitFramePointers[] = "OmitFramePointers"; |
|
216 const char _OpenMP[] = "OpenMP"; |
|
217 const char _OpenMPSupport[] = "OpenMPSupport"; |
|
218 const char _Optimization[] = "Optimization"; |
|
219 const char _OptimizeForProcessor[] = "OptimizeForProcessor"; |
|
220 const char _OptimizeForWindows98[] = "OptimizeForWindows98"; |
|
221 const char _OptimizeForWindowsApplication[] = "OptimizeForWindowsApplication"; |
|
222 const char _OptimizeReferences[] = "OptimizeReferences"; |
|
223 const char _OutputDirectory[] = "OutputDirectory"; |
|
224 const char _OutputFile[] = "OutputFile"; |
|
225 const char _Outputs[] = "Outputs"; |
|
226 const char _ParseFiles[] = "ParseFiles"; |
|
227 const char _Path[] = "Path"; |
|
228 const char _PrecompiledHeader[] = "PrecompiledHeader"; |
|
229 const char _PrecompiledHeaderFile[] = "PrecompiledHeaderFile"; |
|
230 const char _PrecompiledHeaderOutputFile[] = "PrecompiledHeaderOutputFile"; |
|
231 const char _PrecompiledHeaderThrough[] = "PrecompiledHeaderThrough"; |
|
232 const char _PreprocessorDefinitions[] = "PreprocessorDefinitions"; |
|
233 const char _PreprocessKeepComments[] = "PreprocessKeepComments"; |
|
234 const char _PreprocessOutputPath[] = "PreprocessOutputPath"; |
|
235 const char _PreprocessSuppressLineNumbers[] = "PreprocessSuppressLineNumbers"; |
|
236 const char _PreprocessToFile[] = "PreprocessToFile"; |
|
237 const char _PreventDllBinding[] = "PreventDllBinding"; |
|
238 const char _PrimaryOutput[] = "PrimaryOutput"; |
|
239 const char _Profile[] = "Profile"; |
|
240 const char _ProfileGuidedDatabase[] = "ProfileGuidedDatabase"; |
|
241 const char _ProjectGUID[] = "ProjectGUID"; |
|
242 const char _ProcessorNumber[] = "ProcessorNumber"; |
|
243 const char _ProjectType[] = "ProjectType"; |
|
244 const char _ProgramDatabase[] = "ProgramDatabase"; |
|
245 const char _ProgramDataBaseFileName[] = "ProgramDataBaseFileName"; |
|
246 const char _ProgramDatabaseFile[] = "ProgramDatabaseFile"; |
|
247 const char _ProxyFileName[] = "ProxyFileName"; |
|
248 const char _RandomizedBaseAddress[] = "RandomizedBaseAddress"; |
|
249 const char _RedirectOutputAndErrors[] = "RedirectOutputAndErrors"; |
|
250 const char _RegisterOutput[] = "RegisterOutput"; |
|
251 const char _RelativePath[] = "RelativePath"; |
|
252 const char _RemoteDirectory[] = "RemoteDirectory"; |
|
253 const char _RemoveObjects[] = "RemoveObjects"; |
|
254 const char _ResourceOnlyDLL[] = "ResourceOnlyDLL"; |
|
255 const char _ResourceOutputFileName[] = "ResourceOutputFileName"; |
|
256 const char _RuntimeLibrary[] = "RuntimeLibrary"; |
|
257 const char _RuntimeTypeInfo[] = "RuntimeTypeInfo"; |
|
258 const char _SccProjectName[] = "SccProjectName"; |
|
259 const char _SccLocalPath[] = "SccLocalPath"; |
|
260 const char _SectionAlignment[] = "SectionAlignment"; |
|
261 const char _ServerStubFile[] = "ServerStubFile"; |
|
262 const char _SetChecksum[] = "SetChecksum"; |
|
263 const char _ShowIncludes[] = "ShowIncludes"; |
|
264 const char _ShowProgress[] = "ShowProgress"; |
|
265 const char _SmallerTypeCheck[] = "SmallerTypeCheck"; |
|
266 const char _SpecifySectionAttributes[] = "SpecifySectionAttributes"; |
|
267 const char _StackCommitSize[] = "StackCommitSize"; |
|
268 const char _StackReserveSize[] = "StackReserveSize"; |
|
269 const char _StringPooling[] = "StringPooling"; |
|
270 const char _StripPrivateSymbols[] = "StripPrivateSymbols"; |
|
271 const char _StructMemberAlignment[] = "StructMemberAlignment"; |
|
272 const char _SubSystem[] = "SubSystem"; |
|
273 const char _SupportNobindOfDelayLoadedDLL[] = "SupportNobindOfDelayLoadedDLL"; |
|
274 const char _SupportUnloadOfDelayLoadedDLL[] = "SupportUnloadOfDelayLoadedDLL"; |
|
275 const char _SuppressCompilerWarnings[] = "SuppressCompilerWarnings"; |
|
276 const char _SuppressStartupBanner[] = "SuppressStartupBanner"; |
|
277 const char _SwapRunFromCD[] = "SwapRunFromCD"; |
|
278 const char _SwapRunFromNet[] = "SwapRunFromNet"; |
|
279 const char _TargetEnvironment[] = "TargetEnvironment"; |
|
280 const char _TargetMachine[] = "TargetMachine"; |
|
281 const char _TerminalServerAware[] = "TerminalServerAware"; |
|
282 const char _TrackerLogDirectory[] = "TrackerLogDirectory"; |
|
283 const char _TreatLibWarningAsErrors[] = "TreatLibWarningAsErrors"; |
|
284 const char _TreatLinkerWarningAsErrors[] = "TreatLinkerWarningAsErrors"; |
|
285 const char _TreatSpecificWarningsAsErrors[] = "TreatSpecificWarningsAsErrors"; |
|
286 const char _TreatWarningAsError[] = "TreatWarningAsError"; |
|
287 const char _TreatWChar_tAsBuiltInType[] = "TreatWChar_tAsBuiltInType"; |
|
288 const char _TurnOffAssemblyGeneration[] = "TurnOffAssemblyGeneration"; |
|
289 const char _TypeLibFormat[] = "TypeLibFormat"; |
|
290 const char _TypeLibraryFile[] = "TypeLibraryFile"; |
|
291 const char _TypeLibraryName[] = "TypeLibraryName"; |
|
292 const char _TypeLibraryResourceID[] = "TypeLibraryResourceID"; |
|
293 const char _UACExecutionLevel[] = "UACExecutionLevel"; |
|
294 const char _UACUIAccess[] = "UACUIAccess"; |
|
295 const char _UndefineAllPreprocessorDefinitions[]= "UndefineAllPreprocessorDefinitions"; |
|
296 const char _UndefinePreprocessorDefinitions[] = "UndefinePreprocessorDefinitions"; |
|
297 const char _UniqueIdentifier[] = "UniqueIdentifier"; |
|
298 const char _UseFullPaths[] = "UseFullPaths"; |
|
299 const char _UseOfATL[] = "UseOfATL"; |
|
300 const char _UseOfMfc[] = "UseOfMfc"; |
|
301 const char _UsePrecompiledHeader[] = "UsePrecompiledHeader"; |
|
302 const char _UseUnicodeForAssemblerListing[] = "UseUnicodeForAssemblerListing"; |
|
303 const char _ValidateAllParameters[] = "ValidateAllParameters"; |
|
304 const char _VCCLCompilerTool[] = "VCCLCompilerTool"; |
|
305 const char _VCLibrarianTool[] = "VCLibrarianTool"; |
|
306 const char _VCLinkerTool[] = "VCLinkerTool"; |
|
307 const char _VCCustomBuildTool[] = "VCCustomBuildTool"; |
|
308 const char _VCResourceCompilerTool[] = "VCResourceCompilerTool"; |
|
309 const char _VCMIDLTool[] = "VCMIDLTool"; |
|
310 const char _Verbose[] = "Verbose"; |
|
311 const char _Version[] = "Version"; |
|
312 const char _WarnAsError[] = "WarnAsError"; |
|
313 const char _WarningLevel[] = "WarningLevel"; |
|
314 const char _WholeProgramOptimization[] = "WholeProgramOptimization"; |
|
315 const char _XMLDocumentationFileName[] = "XMLDocumentationFileName"; |
|
316 |
|
317 |
|
318 // XmlOutput stream functions ------------------------------ |
|
319 inline XmlOutput::xml_output attrTagT(const char *name, const triState v) |
|
320 { |
|
321 if(v == unset) |
|
322 return noxml(); |
|
323 return tagValue(name, (v == _True ? "true" : "false")); |
|
324 } |
|
325 |
|
326 inline XmlOutput::xml_output attrTagL(const char *name, qint64 v) |
|
327 { |
|
328 return tagValue(name, QString::number(v)); |
|
329 } |
|
330 |
|
331 /*ifNot version*/ |
|
332 inline XmlOutput::xml_output attrTagL(const char *name, qint64 v, qint64 ifn) |
|
333 { |
|
334 if (v == ifn) |
|
335 return noxml(); |
|
336 return tagValue(name, QString::number(v)); |
|
337 } |
|
338 |
|
339 inline XmlOutput::xml_output attrTagS(const char *name, const QString &v) |
|
340 { |
|
341 if(v.isEmpty()) |
|
342 return noxml(); |
|
343 return tagValue(name, v); |
|
344 } |
|
345 |
|
346 |
|
347 inline XmlOutput::xml_output attrTagX(const char *name, const QStringList &v, const char *s = ",") |
|
348 { |
|
349 if(v.isEmpty()) |
|
350 return noxml(); |
|
351 QStringList temp = v; |
|
352 temp.append(QString("%(%1)").arg(name)); |
|
353 return tagValue(name, temp.join(s)); |
|
354 } |
|
355 |
|
356 inline XmlOutput::xml_output valueTagX(const QStringList &v, const char *s = " ") |
|
357 { |
|
358 if(v.isEmpty()) |
|
359 return noxml(); |
|
360 return valueTag(v.join(s)); |
|
361 } |
|
362 |
|
363 inline XmlOutput::xml_output valueTagDefX(const QStringList &v, const QString &tagName, const char *s = " ") |
|
364 { |
|
365 if(v.isEmpty()) |
|
366 return noxml(); |
|
367 QStringList temp = v; |
|
368 temp.append(QString("%(%1)").arg(tagName)); |
|
369 return valueTag(temp.join(s)); |
|
370 } |
|
371 |
|
372 inline XmlOutput::xml_output valueTagT( const triState v) |
|
373 { |
|
374 if(v == unset) |
|
375 return noxml(); |
|
376 return valueTag(v == _True ? "true" : "false"); |
|
377 } |
|
378 |
|
379 |
|
380 // VCXCLCompilerTool ------------------------------------------------- |
|
381 VCXCLCompilerTool::VCXCLCompilerTool() |
|
382 : BrowseInformation(_False), |
|
383 BufferSecurityCheck(_False), |
|
384 CreateHotpatchableImage(unset), |
|
385 DisableLanguageExtensions(unset), |
|
386 EnableFiberSafeOptimizations(unset), |
|
387 EnablePREfast(unset), |
|
388 ExpandAttributedSource(unset), |
|
389 FloatingPointExceptions(unset), |
|
390 ForceConformanceInForLoopScope(unset), |
|
391 FunctionLevelLinking(unset), |
|
392 GenerateXMLDocumentationFiles(unset), |
|
393 IgnoreStandardIncludePath(unset), |
|
394 IntrinsicFunctions(unset), |
|
395 MinimalRebuild(unset), |
|
396 MultiProcessorCompilation(unset), |
|
397 OmitDefaultLibName(unset), |
|
398 OmitFramePointers(unset), |
|
399 Optimization("Disabled"), |
|
400 OpenMPSupport(unset), |
|
401 PreprocessKeepComments(unset), |
|
402 PreprocessSuppressLineNumbers(unset), |
|
403 RuntimeTypeInfo(unset), |
|
404 ShowIncludes(unset), |
|
405 SmallerTypeCheck(unset), |
|
406 StringPooling(unset), |
|
407 SuppressStartupBanner(unset), |
|
408 TreatWarningAsError(unset), |
|
409 TreatWChar_tAsBuiltInType(unset), |
|
410 UndefineAllPreprocessorDefinitions(unset), |
|
411 UseFullPaths(unset), |
|
412 UseUnicodeForAssemblerListing(unset), |
|
413 WholeProgramOptimization(unset) |
|
414 { |
|
415 } |
|
416 |
|
417 XmlOutput &operator<<(XmlOutput &xml, const VCXCLCompilerTool &tool) |
|
418 { |
|
419 return xml |
|
420 << tag(_CLCompile) |
|
421 << attrTagX(_AdditionalIncludeDirectories, tool.AdditionalIncludeDirectories, ";") |
|
422 << attrTagX(_AdditionalOptions, tool.AdditionalOptions, " ") |
|
423 << attrTagX(_AdditionalUsingDirectories, tool.AdditionalUsingDirectories, ";") |
|
424 << attrTagS(_AlwaysAppend, tool.AlwaysAppend) |
|
425 << attrTagS(_AssemblerListingLocation, tool.AssemblerListingLocation) |
|
426 << attrTagS(_AssemblerOutput, tool.AssemblerOutput) |
|
427 << attrTagS(_BasicRuntimeChecks, tool.BasicRuntimeChecks) |
|
428 << attrTagT(_BrowseInformation, tool.BrowseInformation) |
|
429 << attrTagS(_BrowseInformationFile, tool.BrowseInformationFile) |
|
430 << attrTagT(_BufferSecurityCheck, tool.BufferSecurityCheck) |
|
431 << attrTagS(_CallingConvention, tool.CallingConvention) |
|
432 << attrTagS(_CompileAs, tool.CompileAs) |
|
433 << attrTagS(_CompileAsManaged, tool.CompileAsManaged) |
|
434 << attrTagT(_CreateHotpatchableImage, tool.CreateHotpatchableImage) |
|
435 << attrTagS(_DebugInformationFormat, tool.DebugInformationFormat) |
|
436 << attrTagT(_DisableLanguageExtensions, tool.DisableLanguageExtensions) |
|
437 << attrTagX(_DisableSpecificWarnings, tool.DisableSpecificWarnings, ";") |
|
438 << attrTagS(_EnableEnhancedInstructionSet, tool.EnableEnhancedInstructionSet) |
|
439 << attrTagT(_EnableFiberSafeOptimizations, tool.EnableFiberSafeOptimizations) |
|
440 << attrTagT(_EnablePREfast, tool.EnablePREfast) |
|
441 << attrTagS(_ErrorReporting, tool.ErrorReporting) |
|
442 << attrTagS(_ExceptionHandling, tool.ExceptionHandling) |
|
443 << attrTagT(_ExpandAttributedSource, tool.ExpandAttributedSource) |
|
444 << attrTagS(_FavorSizeOrSpeed, tool.FavorSizeOrSpeed) |
|
445 << attrTagT(_FloatingPointExceptions, tool.FloatingPointExceptions) |
|
446 << attrTagS(_FloatingPointModel, tool.FloatingPointModel) |
|
447 << attrTagT(_ForceConformanceInForLoopScope, tool.ForceConformanceInForLoopScope) |
|
448 << attrTagX(_ForcedIncludeFiles, tool.ForcedIncludeFiles, ";") |
|
449 << attrTagX(_ForcedUsingFiles, tool.ForcedUsingFiles, ";") |
|
450 << attrTagT(_FunctionLevelLinking, tool.FunctionLevelLinking) |
|
451 << attrTagT(_GenerateXMLDocumentationFiles, tool.GenerateXMLDocumentationFiles) |
|
452 << attrTagT(_IgnoreStandardIncludePath, tool.IgnoreStandardIncludePath) |
|
453 << attrTagS(_InlineFunctionExpansion, tool.InlineFunctionExpansion) |
|
454 << attrTagT(_IntrinsicFunctions, tool.IntrinsicFunctions) |
|
455 << attrTagT(_MinimalRebuild, tool.MinimalRebuild) |
|
456 << attrTagT(_MultiProcessorCompilation, tool.MultiProcessorCompilation) |
|
457 << attrTagS(_ObjectFileName, tool.ObjectFileName) |
|
458 << attrTagX(_ObjectFiles, tool.ObjectFiles, ";") |
|
459 << attrTagT(_OmitDefaultLibName, tool.OmitDefaultLibName) |
|
460 << attrTagT(_OmitFramePointers, tool.OmitFramePointers) |
|
461 << attrTagT(_OpenMPSupport, tool.OpenMPSupport) |
|
462 << attrTagS(_Optimization, tool.Optimization) |
|
463 << attrTagS(_PrecompiledHeader, tool.PrecompiledHeader) |
|
464 << attrTagS(_PrecompiledHeaderFile, tool.PrecompiledHeaderFile) |
|
465 << attrTagS(_PrecompiledHeaderOutputFile, tool.PrecompiledHeaderOutputFile) |
|
466 << attrTagT(_PreprocessKeepComments, tool.PreprocessKeepComments) |
|
467 << attrTagX(_PreprocessorDefinitions, tool.PreprocessorDefinitions, ";") |
|
468 << attrTagS(_PreprocessOutputPath, tool.PreprocessOutputPath) |
|
469 << attrTagT(_PreprocessSuppressLineNumbers, tool.PreprocessSuppressLineNumbers) |
|
470 << attrTagT(_PreprocessToFile, tool.PreprocessToFile) |
|
471 << attrTagS(_ProgramDataBaseFileName, tool.ProgramDataBaseFileName) |
|
472 << attrTagS(_ProcessorNumber, tool.ProcessorNumber) |
|
473 << attrTagS(_RuntimeLibrary, tool.RuntimeLibrary) |
|
474 << attrTagT(_RuntimeTypeInfo, tool.RuntimeTypeInfo) |
|
475 << attrTagT(_ShowIncludes, tool.ShowIncludes) |
|
476 << attrTagT(_SmallerTypeCheck, tool.SmallerTypeCheck) |
|
477 << attrTagT(_StringPooling, tool.StringPooling) |
|
478 << attrTagS(_StructMemberAlignment, tool.StructMemberAlignment) |
|
479 << attrTagT(_SuppressStartupBanner, tool.SuppressStartupBanner) |
|
480 << attrTagS(_TreatSpecificWarningsAsErrors, tool.TreatSpecificWarningsAsErrors) |
|
481 << attrTagT(_TreatWarningAsError, tool.TreatWarningAsError) |
|
482 << attrTagT(_TreatWChar_tAsBuiltInType, tool.TreatWChar_tAsBuiltInType) |
|
483 << attrTagT(_UndefineAllPreprocessorDefinitions, tool.UndefineAllPreprocessorDefinitions) |
|
484 << attrTagX(_UndefinePreprocessorDefinitions, tool.UndefinePreprocessorDefinitions, ";") |
|
485 << attrTagT(_UseFullPaths, tool.UseFullPaths) |
|
486 << attrTagT(_UseUnicodeForAssemblerListing, tool.UseUnicodeForAssemblerListing) |
|
487 << attrTagS(_WarningLevel, tool.WarningLevel) |
|
488 << attrTagT(_WholeProgramOptimization, tool.WholeProgramOptimization) |
|
489 << attrTagS(_XMLDocumentationFileName, tool.XMLDocumentationFileName) |
|
490 << closetag(_CLCompile); |
|
491 } |
|
492 |
|
493 bool VCXCLCompilerTool::parseOption(const char* option) |
|
494 { |
|
495 // skip index 0 ('/' or '-') |
|
496 char first = option[1]; |
|
497 char second = option[2]; |
|
498 char third = option[3]; |
|
499 char fourth = option[4]; |
|
500 bool found = true; |
|
501 |
|
502 switch (first) { |
|
503 case '?': |
|
504 qWarning("Generator: Option '/?' : MSVC.NET projects do not support outputting help info"); |
|
505 found = false; |
|
506 break; |
|
507 case '@': |
|
508 qWarning("Generator: Option '/@': MSVC.NET projects do not support the use of a response file"); |
|
509 found = false; |
|
510 break; |
|
511 case 'l': |
|
512 qWarning("Generator: Option '/link': qmake generator does not support passing link options through the compiler tool"); |
|
513 found = false; |
|
514 break; |
|
515 case 'A': |
|
516 if(second != 'I') { |
|
517 found = false; |
|
518 break; |
|
519 } |
|
520 AdditionalUsingDirectories += option+3; |
|
521 break; |
|
522 case 'C': |
|
523 PreprocessKeepComments = _True; |
|
524 break; |
|
525 case 'D': |
|
526 PreprocessorDefinitions += option+2; |
|
527 break; |
|
528 case 'E': |
|
529 if(second == 'H') { |
|
530 QString opt(option); |
|
531 if (opt.endsWith("EHa")) |
|
532 ExceptionHandling = "Async"; |
|
533 else if (opt.endsWith("EHsc")) |
|
534 ExceptionHandling = "Sync"; |
|
535 else if (opt.endsWith("EHs")) |
|
536 ExceptionHandling = "SyncCThrow"; |
|
537 else { |
|
538 ExceptionHandling = "false"; |
|
539 } |
|
540 break; |
|
541 }else if(second == 'P') { |
|
542 PreprocessSuppressLineNumbers = _True; |
|
543 } |
|
544 found = false; |
|
545 break; |
|
546 case 'F': |
|
547 if(second <= '9' && second >= '0') { |
|
548 AdditionalOptions += option; |
|
549 break; |
|
550 } else { |
|
551 switch (second) { |
|
552 case 'A': |
|
553 if(third == 'c') { |
|
554 AssemblerOutput = "AssemblyAndMachineCode"; |
|
555 if(fourth == 's') |
|
556 AssemblerOutput = "All"; |
|
557 } else if(third == 's') { |
|
558 AssemblerOutput = "AssemblyAndSourceCode"; |
|
559 } else if(third == 'u') { |
|
560 UseUnicodeForAssemblerListing = _True; |
|
561 } else { |
|
562 AssemblerOutput = "AssemblyCode"; |
|
563 } |
|
564 break; |
|
565 case 'a': |
|
566 AssemblerListingLocation = option+3; |
|
567 break; |
|
568 case 'C': |
|
569 UseFullPaths = _True; |
|
570 break; |
|
571 case 'd': |
|
572 ProgramDataBaseFileName += option+3; |
|
573 case 'I': |
|
574 ForcedIncludeFiles += option+3; |
|
575 break; |
|
576 case 'i': |
|
577 PreprocessOutputPath += option+3; |
|
578 break; |
|
579 case 'm': |
|
580 AdditionalOptions += option; |
|
581 break; |
|
582 case 'R': |
|
583 BrowseInformation = _True; |
|
584 BrowseInformationFile = option+3; |
|
585 break; |
|
586 case 'r': |
|
587 BrowseInformation = _True; |
|
588 BrowseInformationFile = option+3; |
|
589 break; |
|
590 case 'U': |
|
591 ForcedUsingFiles += option+3; |
|
592 break; |
|
593 case 'o': |
|
594 ObjectFileName = option+3; |
|
595 break; |
|
596 case 'p': |
|
597 PrecompiledHeaderOutputFile = option+3; |
|
598 break; |
|
599 case 'x': |
|
600 ExpandAttributedSource = _True; |
|
601 break; |
|
602 default: |
|
603 found = false; |
|
604 break; |
|
605 } |
|
606 } |
|
607 break; |
|
608 case 'G': |
|
609 switch (second) { |
|
610 case 'F': |
|
611 StringPooling = _True; |
|
612 break; |
|
613 case 'L': |
|
614 WholeProgramOptimization = _True; |
|
615 if(third == '-') |
|
616 WholeProgramOptimization = _False; |
|
617 break; |
|
618 case 'R': |
|
619 RuntimeTypeInfo = _True; |
|
620 if(third == '-') |
|
621 RuntimeTypeInfo = _False; |
|
622 break; |
|
623 case 'S': |
|
624 BufferSecurityCheck = _True; |
|
625 if(third == '-') |
|
626 BufferSecurityCheck = _False; |
|
627 break; |
|
628 case 'T': |
|
629 EnableFiberSafeOptimizations = _True; |
|
630 break; |
|
631 case 'd': |
|
632 CallingConvention = "Cdecl"; |
|
633 break; |
|
634 case 'm': |
|
635 MinimalRebuild = _True; |
|
636 if(third == '-') |
|
637 MinimalRebuild = _False; |
|
638 break; |
|
639 case 'r': |
|
640 CallingConvention = "FastCall"; |
|
641 break; |
|
642 case 'y': |
|
643 FunctionLevelLinking = _True; |
|
644 break; |
|
645 case 'z': |
|
646 CallingConvention = "StdCall"; |
|
647 break; |
|
648 default: |
|
649 found = false; |
|
650 break; |
|
651 } |
|
652 break; |
|
653 case 'H': |
|
654 AdditionalOptions += option; |
|
655 break; |
|
656 case 'I': |
|
657 AdditionalIncludeDirectories += option+2; |
|
658 break; |
|
659 case 'L': |
|
660 if(second == 'D') { |
|
661 AdditionalOptions += option; |
|
662 break; |
|
663 } |
|
664 found = false; |
|
665 break; |
|
666 case 'M': |
|
667 if(second == 'D') { |
|
668 RuntimeLibrary = "MultiThreadedDLL"; |
|
669 if(third == 'd') |
|
670 RuntimeLibrary = "MultiThreadedDebugDLL"; |
|
671 break; |
|
672 } else if(second == 'P') { |
|
673 MultiProcessorCompilation = _True; |
|
674 ProcessorNumber = option+3; |
|
675 break; |
|
676 } else if(second == 'T') { |
|
677 RuntimeLibrary = "MultiThreaded"; |
|
678 if(third == 'd') |
|
679 RuntimeLibrary = "MultiThreadedDebug"; |
|
680 break; |
|
681 } |
|
682 found = false; |
|
683 break; |
|
684 case 'O': |
|
685 switch (second) { |
|
686 case '1': |
|
687 Optimization = "MinSpace"; |
|
688 break; |
|
689 case '2': |
|
690 Optimization = "MaxSpeed"; |
|
691 break; |
|
692 case 'b': |
|
693 if(third == '0') |
|
694 InlineFunctionExpansion = "Disabled"; |
|
695 else if(third == '1') |
|
696 InlineFunctionExpansion = "OnlyExplicitInline"; |
|
697 else if(third == '2') |
|
698 InlineFunctionExpansion = "AnySuitable"; |
|
699 else |
|
700 found = false; |
|
701 break; |
|
702 case 'd': |
|
703 Optimization = "Disabled"; |
|
704 break; |
|
705 case 'i': |
|
706 IntrinsicFunctions = _True; |
|
707 break; |
|
708 case 'p': |
|
709 if(third == 'e') |
|
710 OpenMPSupport = _True; |
|
711 else |
|
712 found = false; |
|
713 break; |
|
714 case 's': |
|
715 FavorSizeOrSpeed = "Size"; |
|
716 break; |
|
717 case 't': |
|
718 FavorSizeOrSpeed = "Speed"; |
|
719 break; |
|
720 case 'x': |
|
721 Optimization = "Full"; |
|
722 break; |
|
723 case 'y': |
|
724 OmitFramePointers = _True; |
|
725 if(third == '-') |
|
726 OmitFramePointers = _False; |
|
727 break; |
|
728 default: |
|
729 found = false; |
|
730 break; |
|
731 } |
|
732 break; |
|
733 case 'P': |
|
734 PreprocessToFile = _True; |
|
735 break; |
|
736 case 'Q': |
|
737 if(second == 'I') { |
|
738 AdditionalOptions += option; |
|
739 break; |
|
740 } |
|
741 found = false; |
|
742 break; |
|
743 case 'R': |
|
744 if(second == 'T' && third == 'C') { |
|
745 if(fourth == '1') |
|
746 BasicRuntimeChecks = "EnableFastChecks"; |
|
747 else if(fourth == 'c') |
|
748 SmallerTypeCheck = _True; |
|
749 else if(fourth == 's') |
|
750 BasicRuntimeChecks = "StackFrameRuntimeCheck"; |
|
751 else if(fourth == 'u') |
|
752 BasicRuntimeChecks = "UninitializedLocalUsageCheck"; |
|
753 else |
|
754 found = false; break; |
|
755 } |
|
756 break; |
|
757 case 'T': |
|
758 if(second == 'C') { |
|
759 CompileAs = "CompileAsC"; |
|
760 } else if(second == 'P') { |
|
761 CompileAs = "CompileAsCpp"; |
|
762 } else { |
|
763 qWarning("Generator: Options '/Tp<filename>' and '/Tc<filename>' are not supported by qmake"); |
|
764 found = false; break; |
|
765 } |
|
766 break; |
|
767 case 'U': |
|
768 UndefinePreprocessorDefinitions += option+2; |
|
769 break; |
|
770 case 'V': |
|
771 AdditionalOptions += option; |
|
772 break; |
|
773 case 'W': |
|
774 switch (second) { |
|
775 case 'a': |
|
776 WarningLevel = "EnableAllWarnings"; |
|
777 break; |
|
778 case '4': |
|
779 WarningLevel = "Level4"; |
|
780 break; |
|
781 case '3': |
|
782 WarningLevel = "Level3"; |
|
783 break; |
|
784 case '2': |
|
785 WarningLevel = "Level2"; |
|
786 break; |
|
787 case '1': |
|
788 WarningLevel = "Level1"; |
|
789 break; |
|
790 case '0': |
|
791 WarningLevel = "TurnOffAllWarnings"; |
|
792 break; |
|
793 case 'L': |
|
794 AdditionalOptions += option; |
|
795 break; |
|
796 case 'X': |
|
797 TreatWarningAsError = _True; |
|
798 break; |
|
799 case 'p': |
|
800 if(third == '6' && fourth == '4') { |
|
801 // Deprecated for VS2010 but can be used under Additional Options. |
|
802 AdditionalOptions += option; |
|
803 break; |
|
804 } |
|
805 // Fallthrough |
|
806 default: |
|
807 found = false; break; |
|
808 } |
|
809 break; |
|
810 case 'X': |
|
811 IgnoreStandardIncludePath = _True; |
|
812 break; |
|
813 case 'Y': |
|
814 switch (second) { |
|
815 case '\0': |
|
816 case '-': |
|
817 AdditionalOptions += option; |
|
818 break; |
|
819 case 'c': |
|
820 PrecompiledHeader = "Create"; |
|
821 PrecompiledHeaderFile = option+3; |
|
822 break; |
|
823 case 'd': |
|
824 case 'l': |
|
825 AdditionalOptions += option; |
|
826 break; |
|
827 case 'u': |
|
828 PrecompiledHeader = "Use"; |
|
829 PrecompiledHeaderFile = option+3; |
|
830 break; |
|
831 default: |
|
832 found = false; break; |
|
833 } |
|
834 break; |
|
835 case 'Z': |
|
836 switch (second) { |
|
837 case '7': |
|
838 DebugInformationFormat = "OldStyle"; |
|
839 break; |
|
840 case 'I': |
|
841 DebugInformationFormat = "EditAndContinue"; |
|
842 break; |
|
843 case 'i': |
|
844 DebugInformationFormat = "ProgramDatabase"; |
|
845 break; |
|
846 case 'l': |
|
847 OmitDefaultLibName = _True; |
|
848 break; |
|
849 case 'a': |
|
850 DisableLanguageExtensions = _True; |
|
851 break; |
|
852 case 'e': |
|
853 DisableLanguageExtensions = _False; |
|
854 break; |
|
855 case 'c': |
|
856 if(third == ':') { |
|
857 const char *c = option + 4; |
|
858 // Go to the end of the option |
|
859 while ( *c != '\0' && *c != ' ' && *c != '-') |
|
860 ++c; |
|
861 if(fourth == 'f') |
|
862 ForceConformanceInForLoopScope = ((*c) == '-' ? _False : _True); |
|
863 else if(fourth == 'w') |
|
864 TreatWChar_tAsBuiltInType = ((*c) == '-' ? _False : _True); |
|
865 else |
|
866 found = false; |
|
867 } else { |
|
868 found = false; break; |
|
869 } |
|
870 break; |
|
871 case 'g': |
|
872 case 'm': |
|
873 case 's': |
|
874 AdditionalOptions += option; |
|
875 break; |
|
876 case 'p': |
|
877 switch (third) |
|
878 { |
|
879 case '\0': |
|
880 case '1': |
|
881 StructMemberAlignment = "1Byte"; |
|
882 if(fourth == '6') |
|
883 StructMemberAlignment = "16Bytes"; |
|
884 break; |
|
885 case '2': |
|
886 StructMemberAlignment = "2Bytes"; |
|
887 break; |
|
888 case '4': |
|
889 StructMemberAlignment = "4Bytes"; |
|
890 break; |
|
891 case '8': |
|
892 StructMemberAlignment = "8Bytes"; |
|
893 break; |
|
894 default: |
|
895 found = false; break; |
|
896 } |
|
897 break; |
|
898 default: |
|
899 found = false; break; |
|
900 } |
|
901 break; |
|
902 case 'a': |
|
903 if (second == 'r' && third == 'c' && fourth == 'h') { |
|
904 if (option[5] == ':') { |
|
905 const char *o = option; |
|
906 if (o[6] == 'S' && o[7] == 'S' && o[8] == 'E') { |
|
907 EnableEnhancedInstructionSet = o[9] == '2' ? "StreamingSIMDExtensions2" : "StreamingSIMDExtensions"; |
|
908 break; |
|
909 } |
|
910 } |
|
911 } else if (second == 'n' && third == 'a' && fourth == 'l') { |
|
912 EnablePREfast = _True; |
|
913 break; |
|
914 } |
|
915 found = false; |
|
916 break; |
|
917 case 'b': // see http://msdn.microsoft.com/en-us/library/fwkeyyhe%28VS.100%29.aspx |
|
918 if (second == 'i' && third == 'g' && fourth == 'o') { |
|
919 const char *o = option; |
|
920 if (o[5] == 'b' && o[6] == 'j') { |
|
921 AdditionalOptions += option; |
|
922 break; |
|
923 } |
|
924 } |
|
925 found = false; |
|
926 break; |
|
927 case 'c': |
|
928 if(second == 'l') { |
|
929 if(*(option+5) == 'p') { |
|
930 CompileAsManaged = "Pure"; |
|
931 } else if(*(option+5) == 's') { |
|
932 CompileAsManaged = "Safe"; |
|
933 } else if(*(option+5) == 'o') { |
|
934 CompileAsManaged = "OldSyntax"; |
|
935 } else { |
|
936 CompileAsManaged = "true"; |
|
937 } |
|
938 } else { |
|
939 found = false; |
|
940 break; |
|
941 } |
|
942 break; |
|
943 case 'd': |
|
944 if(second != 'o' && third == 'c') { |
|
945 GenerateXMLDocumentationFiles = _True; |
|
946 XMLDocumentationFileName += option+4; |
|
947 break; |
|
948 } |
|
949 found = false; |
|
950 break; |
|
951 case 'e': |
|
952 if (second == 'r' && third == 'r' && fourth == 'o') { |
|
953 if (option[12] == ':') { |
|
954 if ( option[13] == 'n') { |
|
955 ErrorReporting = "None"; |
|
956 } else if (option[13] == 'p') { |
|
957 ErrorReporting = "Prompt"; |
|
958 } else if (option[13] == 'q') { |
|
959 ErrorReporting = "Queue"; |
|
960 } else if (option[13] == 's') { |
|
961 ErrorReporting = "Send"; |
|
962 } else { |
|
963 found = false; |
|
964 } |
|
965 break; |
|
966 } |
|
967 } |
|
968 found = false; |
|
969 break; |
|
970 case 'f': |
|
971 if(second == 'p' && third == ':') { |
|
972 // Go to the end of the option |
|
973 const char *c = option + 4; |
|
974 while (*c != '\0' && *c != ' ' && *c != '-') |
|
975 ++c; |
|
976 switch (fourth) { |
|
977 case 'e': |
|
978 FloatingPointExceptions = ((*c) == '-' ? _False : _True); |
|
979 break; |
|
980 case 'f': |
|
981 FloatingPointModel = "Fast"; |
|
982 break; |
|
983 case 'p': |
|
984 FloatingPointModel = "Precise"; |
|
985 break; |
|
986 case 's': |
|
987 FloatingPointModel = "Strict"; |
|
988 break; |
|
989 default: |
|
990 found = false; |
|
991 break; |
|
992 } |
|
993 } |
|
994 break; |
|
995 case 'h': |
|
996 if(second == 'o' && third == 't' && fourth == 'p') { |
|
997 CreateHotpatchableImage = _True; |
|
998 break; |
|
999 } |
|
1000 qWarning("Generator: Option '/help': MSVC.NET projects do not support outputting help info"); |
|
1001 found = false; |
|
1002 break; |
|
1003 case 'n': |
|
1004 if(second == 'o' && third == 'l' && fourth == 'o') { |
|
1005 SuppressStartupBanner = _True; |
|
1006 break; |
|
1007 } |
|
1008 found = false; |
|
1009 break; |
|
1010 case 'o': |
|
1011 if (second == 'p' && third == 'e' && fourth == 'n') { |
|
1012 OpenMPSupport = _True; |
|
1013 break; |
|
1014 } |
|
1015 found = false; |
|
1016 break; |
|
1017 case 's': |
|
1018 if(second == 'h' && third == 'o' && fourth == 'w') { |
|
1019 ShowIncludes = _True; |
|
1020 break; |
|
1021 } |
|
1022 found = false; |
|
1023 break; |
|
1024 case 'u': |
|
1025 UndefineAllPreprocessorDefinitions = _True; |
|
1026 break; |
|
1027 case 'v': |
|
1028 if(second == 'd' || second == 'm') { |
|
1029 AdditionalOptions += option; |
|
1030 break; |
|
1031 } |
|
1032 found = false; |
|
1033 break; |
|
1034 case 'w': |
|
1035 switch (second) { |
|
1036 case 'd': |
|
1037 DisableSpecificWarnings += option+3; |
|
1038 break; |
|
1039 case 'e': |
|
1040 TreatSpecificWarningsAsErrors = option+3; |
|
1041 break; |
|
1042 default: |
|
1043 AdditionalOptions += option; |
|
1044 } |
|
1045 break; |
|
1046 default: |
|
1047 AdditionalOptions += option; |
|
1048 break; |
|
1049 } |
|
1050 if(!found) { |
|
1051 warn_msg(WarnLogic, "Could not parse Compiler option: %s, added as AdditionalOption", option); |
|
1052 AdditionalOptions += option; |
|
1053 } |
|
1054 return true; |
|
1055 } |
|
1056 |
|
1057 // VCLinkerTool ----------------------------------------------------- |
|
1058 VCXLinkerTool::VCXLinkerTool() |
|
1059 : AllowIsolation(unset), |
|
1060 AssemblyDebug(unset), |
|
1061 DataExecutionPrevention(unset), |
|
1062 DelaySign(unset), |
|
1063 EnableCOMDATFolding(unset), |
|
1064 EnableUAC(unset), |
|
1065 FixedBaseAddress(unset), |
|
1066 GenerateDebugInformation(unset), |
|
1067 GenerateManifest(unset), |
|
1068 GenerateMapFile(unset), |
|
1069 HeapCommitSize(-1), |
|
1070 HeapReserveSize(-1), |
|
1071 IgnoreAllDefaultLibraries(unset), |
|
1072 IgnoreEmbeddedIDL(unset), |
|
1073 IgnoreImportLibrary(_True), |
|
1074 ImageHasSafeExceptionHandlers(unset), |
|
1075 LargeAddressAware(unset), |
|
1076 LinkDLL(unset), |
|
1077 LinkIncremental(unset), |
|
1078 LinkStatus(unset), |
|
1079 MapExports(unset), |
|
1080 NoEntryPoint(unset), |
|
1081 OptimizeReferences(unset), |
|
1082 PreventDllBinding(unset), |
|
1083 RandomizedBaseAddress(unset), |
|
1084 RegisterOutput(unset), |
|
1085 SectionAlignment(-1), |
|
1086 SetChecksum(unset), |
|
1087 //StackCommitSize(-1), |
|
1088 //StackReserveSize(-1), |
|
1089 SupportNobindOfDelayLoadedDLL(unset), |
|
1090 SupportUnloadOfDelayLoadedDLL(unset), |
|
1091 SuppressStartupBanner(unset), |
|
1092 SwapRunFromCD(unset), |
|
1093 SwapRunFromNet(unset), |
|
1094 TerminalServerAware(unset), |
|
1095 TreatLinkerWarningAsErrors(unset), |
|
1096 TurnOffAssemblyGeneration(unset), |
|
1097 TypeLibraryResourceID(0), |
|
1098 UACUIAccess(unset) |
|
1099 { |
|
1100 } |
|
1101 |
|
1102 XmlOutput &operator<<(XmlOutput &xml, const VCXLinkerTool &tool) |
|
1103 { |
|
1104 return xml |
|
1105 << tag(_Link) |
|
1106 << attrTagX(_AdditionalDependencies, tool.AdditionalDependencies, ";") |
|
1107 << attrTagX(_AdditionalLibraryDirectories, tool.AdditionalLibraryDirectories, ";") |
|
1108 << attrTagX(_AdditionalManifestDependencies, tool.AdditionalManifestDependencies, ";") |
|
1109 << attrTagX(_AdditionalOptions, tool.AdditionalOptions, " ") |
|
1110 << attrTagX(_AddModuleNamesToAssembly, tool.AddModuleNamesToAssembly, ";") |
|
1111 << attrTagT(_AllowIsolation, tool.AllowIsolation) |
|
1112 << attrTagT(_AssemblyDebug, tool.AssemblyDebug) |
|
1113 << attrTagX(_AssemblyLinkResource, tool.AssemblyLinkResource, ";") |
|
1114 << attrTagS(_BaseAddress, tool.BaseAddress) |
|
1115 << attrTagS(_CLRImageType, tool.CLRImageType) |
|
1116 << attrTagS(_CLRSupportLastError, tool.CLRSupportLastError) |
|
1117 << attrTagS(_CLRThreadAttribute, tool.CLRThreadAttribute) |
|
1118 << attrTagS(_CLRUnmanagedCodeCheck, tool.CLRUnmanagedCodeCheck) |
|
1119 << attrTagS(_CreateHotPatchableImage, tool.CreateHotPatchableImage) |
|
1120 << attrTagT(_DataExecutionPrevention, tool.DataExecutionPrevention) |
|
1121 << attrTagX(_DelayLoadDLLs, tool.DelayLoadDLLs, ";") |
|
1122 << attrTagT(_DelaySign, tool.DelaySign) |
|
1123 << attrTagS(_Driver, tool.Driver) |
|
1124 << attrTagX(_EmbedManagedResourceFile, tool.EmbedManagedResourceFile, ";") |
|
1125 << attrTagT(_EnableCOMDATFolding, tool.EnableCOMDATFolding) |
|
1126 << attrTagT(_EnableUAC, tool.EnableUAC) |
|
1127 << attrTagS(_EntryPointSymbol, tool.EntryPointSymbol) |
|
1128 << attrTagT(_FixedBaseAddress, tool.FixedBaseAddress) |
|
1129 << attrTagS(_ForceFileOutput, tool.ForceFileOutput) |
|
1130 << attrTagX(_ForceSymbolReferences, tool.ForceSymbolReferences, ";") |
|
1131 << attrTagS(_FunctionOrder, tool.FunctionOrder) |
|
1132 << attrTagT(_GenerateDebugInformation, tool.GenerateDebugInformation) |
|
1133 << attrTagT(_GenerateManifest, tool.GenerateManifest) |
|
1134 << attrTagT(_GenerateMapFile, tool.GenerateMapFile) |
|
1135 << attrTagL(_HeapCommitSize, tool.HeapCommitSize, /*ifNot*/ -1) |
|
1136 << attrTagL(_HeapReserveSize, tool.HeapReserveSize, /*ifNot*/ -1) |
|
1137 << attrTagT(_IgnoreAllDefaultLibraries, tool.IgnoreAllDefaultLibraries) |
|
1138 << attrTagT(_IgnoreEmbeddedIDL, tool.IgnoreEmbeddedIDL) |
|
1139 << attrTagT(_IgnoreImportLibrary, tool.IgnoreImportLibrary) |
|
1140 << attrTagX(_IgnoreSpecificDefaultLibraries, tool.IgnoreSpecificDefaultLibraries, ";") |
|
1141 << attrTagT(_ImageHasSafeExceptionHandlers, tool.ImageHasSafeExceptionHandlers) |
|
1142 << attrTagS(_ImportLibrary, tool.ImportLibrary) |
|
1143 << attrTagS(_KeyContainer, tool.KeyContainer) |
|
1144 << attrTagS(_KeyFile, tool.KeyFile) |
|
1145 << attrTagT(_LargeAddressAware, tool.LargeAddressAware) |
|
1146 << attrTagT(_LinkDLL, tool.LinkDLL) |
|
1147 << attrTagS(_LinkErrorReporting, tool.LinkErrorReporting) |
|
1148 << attrTagT(_LinkIncremental, tool.LinkIncremental) |
|
1149 << attrTagT(_LinkStatus, tool.LinkStatus) |
|
1150 << attrTagS(_LinkTimeCodeGeneration, tool.LinkTimeCodeGeneration) |
|
1151 << attrTagS(_ManifestFile, tool.ManifestFile) |
|
1152 << attrTagT(_MapExports, tool.MapExports) |
|
1153 << attrTagS(_MapFileName, tool.MapFileName) |
|
1154 << attrTagS(_MergedIDLBaseFileName, tool.MergedIDLBaseFileName) |
|
1155 << attrTagS(_MergeSections, tool.MergeSections) |
|
1156 << attrTagS(_MidlCommandFile, tool.MidlCommandFile) |
|
1157 << attrTagS(_ModuleDefinitionFile, tool.ModuleDefinitionFile) |
|
1158 << attrTagS(_MSDOSStubFileName, tool.MSDOSStubFileName) |
|
1159 << attrTagT(_NoEntryPoint, tool.NoEntryPoint) |
|
1160 << attrTagT(_OptimizeReferences, tool.OptimizeReferences) |
|
1161 << attrTagS(_OutputFile, tool.OutputFile) |
|
1162 << attrTagT(_PreventDllBinding, tool.PreventDllBinding) |
|
1163 << attrTagS(_Profile, tool.Profile) |
|
1164 << attrTagS(_ProfileGuidedDatabase, tool.ProfileGuidedDatabase) |
|
1165 << attrTagS(_ProgramDatabaseFile, tool.ProgramDatabaseFile) |
|
1166 << attrTagT(_RandomizedBaseAddress, tool.RandomizedBaseAddress) |
|
1167 << attrTagT(_RegisterOutput, tool.RegisterOutput) |
|
1168 << attrTagL(_SectionAlignment, tool.SectionAlignment, /*ifNot*/ -1) |
|
1169 << attrTagT(_SetChecksum, tool.SetChecksum) |
|
1170 << attrTagS(_ShowProgress, tool.ShowProgress) |
|
1171 << attrTagS(_SpecifySectionAttributes, tool.SpecifySectionAttributes) |
|
1172 << attrTagS(_StackCommitSize, tool.StackCommitSize) |
|
1173 << attrTagS(_StackReserveSize, tool.StackReserveSize) |
|
1174 << attrTagS(_StripPrivateSymbols, tool.StripPrivateSymbols) |
|
1175 << attrTagS(_SubSystem, tool.SubSystem) |
|
1176 << attrTagT(_SupportNobindOfDelayLoadedDLL, tool.SupportNobindOfDelayLoadedDLL) |
|
1177 << attrTagT(_SupportUnloadOfDelayLoadedDLL, tool.SupportUnloadOfDelayLoadedDLL) |
|
1178 << attrTagT(_SuppressStartupBanner, tool.SuppressStartupBanner) |
|
1179 << attrTagT(_SwapRunFromCD, tool.SwapRunFromCD) |
|
1180 << attrTagT(_SwapRunFromNet, tool.SwapRunFromNet) |
|
1181 << attrTagS(_TargetMachine, tool.TargetMachine) |
|
1182 << attrTagT(_TerminalServerAware, tool.TerminalServerAware) |
|
1183 << attrTagT(_TreatLinkerWarningAsErrors, tool.TreatLinkerWarningAsErrors) |
|
1184 << attrTagT(_TurnOffAssemblyGeneration, tool.TurnOffAssemblyGeneration) |
|
1185 << attrTagS(_TypeLibraryFile, tool.TypeLibraryFile) |
|
1186 << attrTagL(_TypeLibraryResourceID, tool.TypeLibraryResourceID, /*ifNot*/ 0) |
|
1187 << attrTagS(_UACExecutionLevel, tool.UACExecutionLevel) |
|
1188 << attrTagT(_UACUIAccess, tool.UACUIAccess) |
|
1189 << attrTagS(_Version, tool.Version) |
|
1190 << closetag(_Link); |
|
1191 } |
|
1192 |
|
1193 // Hashing routine to do fast option lookups ---- |
|
1194 // Slightly rewritten to stop on ':' ',' and '\0' |
|
1195 // Original routine in qtranslator.cpp ---------- |
|
1196 static uint elfHash(const char* name) |
|
1197 { |
|
1198 const uchar *k; |
|
1199 uint h = 0; |
|
1200 uint g; |
|
1201 |
|
1202 if(name) { |
|
1203 k = (const uchar *) name; |
|
1204 while((*k) && |
|
1205 (*k)!= ':' && |
|
1206 (*k)!=',' && |
|
1207 (*k)!=' ') { |
|
1208 h = (h << 4) + *k++; |
|
1209 if((g = (h & 0xf0000000)) != 0) |
|
1210 h ^= g >> 24; |
|
1211 h &= ~g; |
|
1212 } |
|
1213 } |
|
1214 if(!h) |
|
1215 h = 1; |
|
1216 return h; |
|
1217 } |
|
1218 |
|
1219 //#define USE_DISPLAY_HASH |
|
1220 #ifdef USE_DISPLAY_HASH |
|
1221 static void displayHash(const char* str) |
|
1222 { |
|
1223 printf("case 0x%07x: // %s\n break;\n", elfHash(str), str); |
|
1224 } |
|
1225 #endif |
|
1226 |
|
1227 bool VCXLinkerTool::parseOption(const char* option) |
|
1228 { |
|
1229 #ifdef USE_DISPLAY_HASH |
|
1230 // Main options |
|
1231 displayHash("/ALIGN"); displayHash("/ALLOWBIND"); displayHash("/ASSEMBLYMODULE"); |
|
1232 displayHash("/ASSEMBLYRESOURCE"); displayHash("/BASE"); displayHash("/DEBUG"); |
|
1233 displayHash("/DEF"); displayHash("/DEFAULTLIB"); displayHash("/DELAY"); |
|
1234 displayHash("/DELAYLOAD"); displayHash("/DLL"); displayHash("/DRIVER"); |
|
1235 displayHash("/ENTRY"); displayHash("/EXETYPE"); displayHash("/EXPORT"); |
|
1236 displayHash("/FIXED"); displayHash("/FORCE"); displayHash("/HEAP"); |
|
1237 displayHash("/IDLOUT"); displayHash("/IGNORE"); displayHash("/IGNOREIDL"); displayHash("/IMPLIB"); |
|
1238 displayHash("/INCLUDE"); displayHash("/INCREMENTAL"); displayHash("/LARGEADDRESSAWARE"); |
|
1239 displayHash("/LIBPATH"); displayHash("/LTCG"); displayHash("/MACHINE"); |
|
1240 displayHash("/MAP"); displayHash("/MAPINFO"); displayHash("/MERGE"); |
|
1241 displayHash("/MIDL"); displayHash("/NOASSEMBLY"); displayHash("/NODEFAULTLIB"); |
|
1242 displayHash("/NOENTRY"); displayHash("/NOLOGO"); displayHash("/OPT"); |
|
1243 displayHash("/ORDER"); displayHash("/OUT"); displayHash("/PDB"); |
|
1244 displayHash("/PDBSTRIPPED"); displayHash("/RELEASE"); displayHash("/SECTION"); |
|
1245 displayHash("/STACK"); displayHash("/STUB"); displayHash("/SUBSYSTEM"); |
|
1246 displayHash("/SWAPRUN"); displayHash("/TLBID"); displayHash("/TLBOUT"); |
|
1247 displayHash("/TSAWARE"); displayHash("/VERBOSE"); displayHash("/VERSION"); |
|
1248 displayHash("/VXD"); displayHash("/WS "); displayHash("/libpath"); |
|
1249 |
|
1250 #endif |
|
1251 #ifdef USE_DISPLAY_HASH |
|
1252 // Sub options |
|
1253 displayHash("UNLOAD"); displayHash("NOBIND"); displayHash("no"); displayHash("NOSTATUS"); displayHash("STATUS"); |
|
1254 displayHash("AM33"); displayHash("ARM"); displayHash("CEE"); displayHash("EBC"); displayHash("IA64"); displayHash("X86"); displayHash("X64"); displayHash("M32R"); |
|
1255 displayHash("MIPS"); displayHash("MIPS16"); displayHash("MIPSFPU"); displayHash("MIPSFPU16"); displayHash("MIPSR41XX"); displayHash("PPC"); |
|
1256 displayHash("SH3"); displayHash("SH3DSP"); displayHash("SH4"); displayHash("SH5"); displayHash("THUMB"); displayHash("TRICORE"); displayHash("EXPORTS"); |
|
1257 displayHash("LINES"); displayHash("REF"); displayHash("NOREF"); displayHash("ICF"); displayHash("WIN98"); displayHash("NOWIN98"); |
|
1258 displayHash("CONSOLE"); displayHash("EFI_APPLICATION"); displayHash("EFI_BOOT_SERVICE_DRIVER"); displayHash("EFI_ROM"); displayHash("EFI_RUNTIME_DRIVER"); displayHash("NATIVE"); |
|
1259 displayHash("POSIX"); displayHash("WINDOWS"); displayHash("WINDOWSCE"); displayHash("NET"); displayHash("CD"); displayHash("NO"); |
|
1260 #endif |
|
1261 bool found = true; |
|
1262 switch (elfHash(option)) { |
|
1263 case 0x6b21972: // /DEFAULTLIB:library |
|
1264 case 0xaca9d75: // /EXETYPE[:DYNAMIC | :DEV386] |
|
1265 case 0x3ad5444: // /EXPORT:entryname[,@ordinal[,NONAME]][,DATA] |
|
1266 case 0x3dc3455: // /IGNORE:number,number,number,number ### NOTE: This one is undocumented, but it is even used by Microsoft. |
|
1267 // In recent versions of the Microsoft linker they have disabled this undocumented feature. |
|
1268 case 0x0034bc4: // /VXD |
|
1269 AdditionalOptions += option; |
|
1270 break; |
|
1271 case 0x3360dbe: // /ALIGN[:number] |
|
1272 SectionAlignment = QString(option+7).toLongLong(); |
|
1273 break; |
|
1274 case 0x1485c34: // /ALLOWBIND[:NO] |
|
1275 if(*(option+10) == ':' && (*(option+11) == 'n' || *(option+11) == 'N')) |
|
1276 PreventDllBinding = _False; |
|
1277 else |
|
1278 PreventDllBinding = _True; |
|
1279 break; |
|
1280 case 0x312011e: // /ALLOWISOLATION[:NO] |
|
1281 if(*(option+15) == ':' && (*(option+16) == 'n' || *(option+16) == 'N')) |
|
1282 AllowIsolation = _False; |
|
1283 else |
|
1284 AllowIsolation = _True; |
|
1285 break; |
|
1286 case 0x679c075: // /ASSEMBLYMODULE:filename |
|
1287 AddModuleNamesToAssembly += option+15; |
|
1288 break; |
|
1289 case 0x75f35f7: // /ASSEMBLYDEBUG[:DISABLE] |
|
1290 if(*(option+14) == ':' && (*(option+15) == 'D')) |
|
1291 AssemblyDebug = _False; |
|
1292 else |
|
1293 AssemblyDebug = _True; |
|
1294 break; |
|
1295 case 0x43294a5: // /ASSEMBLYLINKRESOURCE:filename |
|
1296 AssemblyLinkResource += option+22; |
|
1297 break; |
|
1298 case 0x062d065: // /ASSEMBLYRESOURCE:filename |
|
1299 EmbedManagedResourceFile += option+18; |
|
1300 break; |
|
1301 case 0x0336675: // /BASE:{address | @filename,key} |
|
1302 // Do we need to do a manual lookup when '@filename,key'? |
|
1303 // Seems BaseAddress only can contain the location... |
|
1304 // We don't use it in Qt, so keep it simple for now |
|
1305 BaseAddress = option+6; |
|
1306 break; |
|
1307 case 0x63bf065: // /CLRIMAGETYPE:{IJW|PURE|SAFE} |
|
1308 if(*(option+14) == 'I') |
|
1309 CLRImageType = "ForceIJWImage"; |
|
1310 else if(*(option+14) == 'P') |
|
1311 CLRImageType = "ForcePureILImage"; |
|
1312 else if(*(option+14) == 'S') |
|
1313 CLRImageType = "ForceSafeILImage"; |
|
1314 break; |
|
1315 case 0x5f2a6a2: // /CLRSUPPORTLASTERROR{:NO | SYSTEMDLL} |
|
1316 if(*(option+20) == ':') { |
|
1317 if(*(option+21) == 'N') { |
|
1318 CLRSupportLastError = "Disabled"; |
|
1319 } else if(*(option+21) == 'S') { |
|
1320 CLRSupportLastError = "SystemDlls"; |
|
1321 } |
|
1322 } else { |
|
1323 CLRSupportLastError = "Enabled"; |
|
1324 } |
|
1325 break; |
|
1326 case 0xc7984f5: // /CLRTHREADATTRIBUTE:{STA|MTA|NONE} |
|
1327 if(*(option+20) == 'N') |
|
1328 CLRThreadAttribute = "DefaultThreadingAttribute"; |
|
1329 else if(*(option+20) == 'M') |
|
1330 CLRThreadAttribute = "MTAThreadingAttribute"; |
|
1331 else if(*(option+20) == 'S') |
|
1332 CLRThreadAttribute = "STAThreadingAttribute"; |
|
1333 break; |
|
1334 case 0xa8c637b: // /CLRUNMANAGEDCODECHECK[:NO] |
|
1335 if(*(option+23) == 'N') |
|
1336 CLRUnmanagedCodeCheck = _False; |
|
1337 else |
|
1338 CLRUnmanagedCodeCheck = _True; |
|
1339 break; |
|
1340 case 0x3389797: // /DEBUG |
|
1341 GenerateDebugInformation = _True; |
|
1342 break; |
|
1343 case 0x0033896: // /DEF:filename |
|
1344 ModuleDefinitionFile = option+5; |
|
1345 break; |
|
1346 case 0x338a069: // /DELAY:{UNLOAD | NOBIND} |
|
1347 if(*(option+7) == 'U') |
|
1348 SupportNobindOfDelayLoadedDLL = _True; |
|
1349 else if(*(option+7) == 'N') |
|
1350 SupportUnloadOfDelayLoadedDLL = _True; |
|
1351 break; |
|
1352 case 0x06f4bf4: // /DELAYLOAD:dllname |
|
1353 DelayLoadDLLs += option+11; |
|
1354 break; |
|
1355 case 0x06d451e: // /DELAYSIGN[:NO] |
|
1356 if(*(option+10) == ':' && (*(option+11) == 'n' || *(option+11) == 'N')) |
|
1357 DelaySign = _False; |
|
1358 else |
|
1359 DelaySign = _True; |
|
1360 break; |
|
1361 case 0x003390c: // /DLL |
|
1362 LinkDLL = _True; |
|
1363 break; |
|
1364 case 0x396ea92: // /DRIVER[:UPONLY | :WDM] |
|
1365 if((*(option+7) == ':') && (*(option+8) == 'U')) |
|
1366 Driver = "UpOnly"; |
|
1367 else if((*(option+7) == ':') && (*(option+8) == 'W')) |
|
1368 Driver = "WDM"; |
|
1369 else |
|
1370 Driver = "Driver"; |
|
1371 break; |
|
1372 case 0x2ee8415: // /DYNAMICBASE[:NO] |
|
1373 if(*(option+12) == ':' && (*(option+13) == 'n' || *(option+13) == 'N')) |
|
1374 RandomizedBaseAddress = _False; |
|
1375 else |
|
1376 RandomizedBaseAddress = _True; |
|
1377 break; |
|
1378 case 0x33a3979: // /ENTRY:function |
|
1379 EntryPointSymbol = option+7; |
|
1380 break; |
|
1381 case 0x4504334: // /ERRORREPORT:[ NONE | PROMPT | QUEUE | SEND ] |
|
1382 if(*(option+12) == ':' ) { |
|
1383 if(*(option+13) == 'N') |
|
1384 LinkErrorReporting = "NoErrorReport"; |
|
1385 else if(*(option+13) == 'P') |
|
1386 LinkErrorReporting = "PromptImmediately"; |
|
1387 else if(*(option+13) == 'Q') |
|
1388 LinkErrorReporting = "QueueForNextLogin"; |
|
1389 else if(*(option+13) == 'S') |
|
1390 LinkErrorReporting = "SendErrorReport"; |
|
1391 } |
|
1392 break; |
|
1393 case 0x33aec94: // /FIXED[:NO] |
|
1394 if(*(option+6) == ':' && (*(option+7) == 'n' || *(option+7) == 'N')) |
|
1395 FixedBaseAddress = _False; |
|
1396 else |
|
1397 FixedBaseAddress = _True; |
|
1398 break; |
|
1399 case 0x33b4675: // /FORCE:[MULTIPLE|UNRESOLVED] |
|
1400 if(*(option+6) == ':' && *(option+7) == 'M' ) |
|
1401 ForceFileOutput = "MultiplyDefinedSymbolOnly"; |
|
1402 else if(*(option+6) == ':' && *(option+7) == 'U' ) |
|
1403 ForceFileOutput = "UndefinedSymbolOnly"; |
|
1404 else |
|
1405 ForceFileOutput = "Enabled"; |
|
1406 break; |
|
1407 case 0x96d4e4e: // /FUNCTIONPADMIN[:space] |
|
1408 if(*(option+15) == ':') { |
|
1409 if(*(option+16) == '5') |
|
1410 CreateHotPatchableImage = "X86Image"; |
|
1411 else if(*(option+16) == '6') |
|
1412 CreateHotPatchableImage = "X64Image"; |
|
1413 else if((*(option+16) == '1') && (*(option+17) == '6')) |
|
1414 CreateHotPatchableImage = "ItaniumImage"; |
|
1415 } else { |
|
1416 CreateHotPatchableImage = "Enabled"; |
|
1417 } |
|
1418 break; |
|
1419 case 0x033c960: // /HEAP:reserve[,commit] |
|
1420 { |
|
1421 QStringList both = QString(option+6).split(","); |
|
1422 HeapReserveSize = both[0].toLongLong(); |
|
1423 if(both.count() == 2) |
|
1424 HeapCommitSize = both[1].toLongLong(); |
|
1425 } |
|
1426 break; |
|
1427 case 0x3d91494: // /IDLOUT:[path\]filename |
|
1428 MergedIDLBaseFileName = option+8; |
|
1429 break; |
|
1430 case 0x345a04c: // /IGNOREIDL |
|
1431 IgnoreEmbeddedIDL = _True; |
|
1432 break; |
|
1433 case 0x3e250e2: // /IMPLIB:filename |
|
1434 ImportLibrary = option+8; |
|
1435 break; |
|
1436 case 0xe281ab5: // /INCLUDE:symbol |
|
1437 ForceSymbolReferences += option+9; |
|
1438 break; |
|
1439 case 0xb28103c: // /INCREMENTAL[:no] |
|
1440 if(*(option+12) == ':' && |
|
1441 (*(option+13) == 'n' || *(option+13) == 'N')) |
|
1442 LinkIncremental = _False; |
|
1443 else |
|
1444 LinkIncremental = _True; |
|
1445 break; |
|
1446 case 0x07f1ab2: // /KEYCONTAINER:name |
|
1447 KeyContainer = option+14; |
|
1448 break; |
|
1449 case 0xfadaf35: // /KEYFILE:filename |
|
1450 KeyFile = option+9; |
|
1451 break; |
|
1452 case 0x26e4675: // /LARGEADDRESSAWARE[:no] |
|
1453 if(*(option+18) == ':' && |
|
1454 *(option+19) == 'n') |
|
1455 LargeAddressAware = _False; |
|
1456 else |
|
1457 LargeAddressAware = _True; |
|
1458 break; |
|
1459 case 0x2f96bc8: // /libpath:dir |
|
1460 case 0x0d745c8: // /LIBPATH:dir |
|
1461 AdditionalLibraryDirectories += option+9; |
|
1462 break; |
|
1463 case 0x0341877: // /LTCG[:NOSTATUS|:STATUS] |
|
1464 config->WholeProgramOptimization = _True; |
|
1465 LinkTimeCodeGeneration = "UseLinkTimeCodeGeneration"; |
|
1466 if(*(option+5) == ':') { |
|
1467 const char* str = option+6; |
|
1468 if (*str == 'S') |
|
1469 LinkStatus = _True; |
|
1470 else if (*str == 'N') |
|
1471 LinkStatus = _False; |
|
1472 #ifndef Q_OS_WIN |
|
1473 else if (strncasecmp(str, "pginstrument", 12)) |
|
1474 LinkTimeCodeGeneration = "PGInstrument"; |
|
1475 else if (strncasecmp(str, "pgoptimize", 10)) |
|
1476 LinkTimeCodeGeneration = "PGOptimization"; |
|
1477 else if (strncasecmp(str, "pgupdate", 8 )) |
|
1478 LinkTimeCodeGeneration = "PGUpdate"; |
|
1479 #else |
|
1480 |
|
1481 else if (_stricmp(str, "pginstrument")) |
|
1482 LinkTimeCodeGeneration = "PGInstrument"; |
|
1483 else if (_stricmp(str, "pgoptimize")) |
|
1484 LinkTimeCodeGeneration = "PGOptimization"; |
|
1485 else if (_stricmp(str, "pgupdate")) |
|
1486 LinkTimeCodeGeneration = "PGUpdate"; |
|
1487 #endif |
|
1488 } |
|
1489 break; |
|
1490 case 0x379ED25: |
|
1491 case 0x157cf65: // /MACHINE:{AM33|ARM|CEE|IA64|X86|M32R|MIPS|MIPS16|MIPSFPU|MIPSFPU16|MIPSR41XX|PPC|SH3|SH4|SH5|THUMB|TRICORE} |
|
1492 switch (elfHash(option+9)) { |
|
1493 case 0x0005bb6: // X86 |
|
1494 TargetMachine = "MachineX86"; |
|
1495 break; |
|
1496 case 0x0005b94: // X64 |
|
1497 TargetMachine = "MachineX64"; |
|
1498 break; |
|
1499 case 0x000466d: // ARM |
|
1500 TargetMachine = "MachineARM"; |
|
1501 break; |
|
1502 case 0x0004963: // EBC |
|
1503 TargetMachine = "MachineEBC"; |
|
1504 break; |
|
1505 case 0x004d494: // IA64 |
|
1506 TargetMachine = "MachineIA64"; |
|
1507 break; |
|
1508 case 0x0051e53: // MIPS |
|
1509 TargetMachine = "MachineMIPS"; |
|
1510 break; |
|
1511 case 0x51e5646: // MIPS16 |
|
1512 TargetMachine = "MachineMIPS16"; |
|
1513 break; |
|
1514 case 0x1e57b05: // MIPSFPU |
|
1515 TargetMachine = "MachineMIPSFPU"; |
|
1516 break; |
|
1517 case 0x57b09a6: // MIPSFPU16 |
|
1518 TargetMachine = "MachineMIPSFPU16"; |
|
1519 break; |
|
1520 case 0x00057b4: // SH4 |
|
1521 TargetMachine = "MachineSH4"; |
|
1522 break; |
|
1523 case 0x058da12: // THUMB |
|
1524 TargetMachine = "MachineTHUMB"; |
|
1525 break; |
|
1526 // put the others in AdditionalOptions... |
|
1527 case 0x0046063: // AM33 |
|
1528 case 0x0004795: // CEE |
|
1529 case 0x0050672: // M32R |
|
1530 case 0x5852738: // MIPSR41XX |
|
1531 case 0x0005543: // PPC |
|
1532 case 0x00057b3: // SH3 |
|
1533 case 0x57b7980: // SH3DSP |
|
1534 case 0x00057b5: // SH5 |
|
1535 case 0x96d8435: // TRICORE |
|
1536 default: |
|
1537 AdditionalOptions += option; |
|
1538 break; |
|
1539 } |
|
1540 break; |
|
1541 case 0x62d9e94: // /MANIFEST[:NO] |
|
1542 if ((*(option+9) == ':' && (*(option+10) == 'N' || *(option+10) == 'n'))) |
|
1543 GenerateManifest = _False; |
|
1544 else |
|
1545 GenerateManifest = _True; |
|
1546 break; |
|
1547 case 0x8b64559: // /MANIFESTDEPENDENCY:manifest_dependency |
|
1548 AdditionalManifestDependencies += option+20; |
|
1549 break; |
|
1550 case 0xe9e8195: // /MANIFESTFILE:filename |
|
1551 ManifestFile = option+14; |
|
1552 break; |
|
1553 case 0x9e9fb83: // /MANIFESTUAC http://msdn.microsoft.com/en-us/library/bb384691%28VS.100%29.aspx |
|
1554 if ((*(option+12) == ':' && (*(option+13) == 'N' || *(option+13) == 'n'))) |
|
1555 EnableUAC = _False; |
|
1556 else if((*(option+12) == ':' && (*(option+13) == 'l' || *(option+14) == 'e'))) { // level |
|
1557 if(*(option+20) == 'a') |
|
1558 UACExecutionLevel = "AsInvoker"; |
|
1559 else if(*(option+20) == 'h') |
|
1560 UACExecutionLevel = "HighestAvailable"; |
|
1561 else if(*(option+20) == 'r') |
|
1562 UACExecutionLevel = "RequireAdministrator"; |
|
1563 } else if((*(option+12) == ':' && (*(option+13) == 'u' || *(option+14) == 'i'))) { // uiAccess |
|
1564 if(*(option+22) == 't') |
|
1565 UACUIAccess = _True; |
|
1566 else |
|
1567 UACUIAccess = _False; |
|
1568 } else if((*(option+12) == ':' && (*(option+13) == 'f' || *(option+14) == 'r'))) { // fragment |
|
1569 AdditionalOptions += option; |
|
1570 }else |
|
1571 EnableUAC = _True; |
|
1572 break; |
|
1573 case 0x0034160: // /MAP[:filename] |
|
1574 GenerateMapFile = _True; |
|
1575 MapFileName = option+5; |
|
1576 break; |
|
1577 case 0x164e1ef: // /MAPINFO:{EXPORTS} |
|
1578 if(*(option+9) == 'E') |
|
1579 MapExports = _True; |
|
1580 break; |
|
1581 case 0x341a6b5: // /MERGE:from=to |
|
1582 MergeSections = option+7; |
|
1583 break; |
|
1584 case 0x0341d8c: // /MIDL:@file |
|
1585 MidlCommandFile = option+7; |
|
1586 break; |
|
1587 case 0x84e2679: // /NOASSEMBLY |
|
1588 TurnOffAssemblyGeneration = _True; |
|
1589 break; |
|
1590 case 0x2b21942: // /NODEFAULTLIB[:library] |
|
1591 if(*(option+13) == '\0') |
|
1592 IgnoreAllDefaultLibraries = _True; |
|
1593 else |
|
1594 IgnoreSpecificDefaultLibraries += option+14; |
|
1595 break; |
|
1596 case 0x33a3a39: // /NOENTRY |
|
1597 NoEntryPoint = _True; |
|
1598 break; |
|
1599 case 0x434138f: // /NOLOGO |
|
1600 SuppressStartupBanner = _True; |
|
1601 break; |
|
1602 case 0xc841054: // /NXCOMPAT[:NO] |
|
1603 if ((*(option+9) == ':' && (*(option+10) == 'N' || *(option+10) == 'n'))) |
|
1604 DataExecutionPrevention = _False; |
|
1605 else |
|
1606 DataExecutionPrevention = _True; |
|
1607 break; |
|
1608 case 0x0034454: // /OPT:{REF | NOREF | ICF[=iterations] | NOICF | WIN98 | NOWIN98} |
|
1609 { |
|
1610 char third = *(option+7); |
|
1611 switch (third) { |
|
1612 case 'F': // REF |
|
1613 if(*(option+5) == 'R') { |
|
1614 OptimizeReferences = _True; |
|
1615 } else { // ICF[=iterations] |
|
1616 EnableCOMDATFolding = _True; |
|
1617 // [=iterations] case is not documented |
|
1618 } |
|
1619 break; |
|
1620 case 'R': // NOREF |
|
1621 OptimizeReferences = _False; |
|
1622 break; |
|
1623 case 'I': // NOICF |
|
1624 EnableCOMDATFolding = _False; |
|
1625 break; |
|
1626 default: |
|
1627 found = false; |
|
1628 } |
|
1629 } |
|
1630 break; |
|
1631 case 0x34468a2: // /ORDER:@filename |
|
1632 FunctionOrder = option+8; |
|
1633 break; |
|
1634 case 0x00344a4: // /OUT:filename |
|
1635 OutputFile = option+5; |
|
1636 break; |
|
1637 case 0x0034482: // /PDB:filename |
|
1638 ProgramDatabaseFile = option+5; |
|
1639 break; |
|
1640 case 0xa2ad314: // /PDBSTRIPPED:pdb_file_name |
|
1641 StripPrivateSymbols = option+13; |
|
1642 break; |
|
1643 case 0x00344b4: // /PGD:filename |
|
1644 ProfileGuidedDatabase = option+5; |
|
1645 break; |
|
1646 case 0x573af45: // /PROFILE |
|
1647 Profile = _True; |
|
1648 break; |
|
1649 case 0x6a09535: // /RELEASE |
|
1650 SetChecksum = _True; |
|
1651 break; |
|
1652 case 0x75AA4D8: // /SAFESEH:{NO} |
|
1653 { |
|
1654 if(*(option+8) == ':' && *(option+9) == 'N') |
|
1655 ImageHasSafeExceptionHandlers = _False; |
|
1656 else |
|
1657 ImageHasSafeExceptionHandlers = _True; |
|
1658 } |
|
1659 break; |
|
1660 case 0x7988f7e: // /SECTION:name,[E][R][W][S][D][K][L][P][X][,ALIGN=#] |
|
1661 SpecifySectionAttributes = option+9; |
|
1662 break; |
|
1663 case 0x348857b: // /STACK:reserve[,commit] |
|
1664 { |
|
1665 QStringList both = QString(option+7).split(","); |
|
1666 StackReserveSize = both[0].toLongLong(); |
|
1667 if(both.count() == 2) |
|
1668 StackCommitSize = both[1].toLongLong(); |
|
1669 } |
|
1670 break; |
|
1671 case 0x0348992: // /STUB:filename |
|
1672 MSDOSStubFileName = option+6; |
|
1673 break; |
|
1674 case 0x9B3C00D: |
|
1675 case 0x78dc00d: // /SUBSYSTEM:{CONSOLE|EFI_APPLICATION|EFI_BOOT_SERVICE_DRIVER|EFI_ROM|EFI_RUNTIME_DRIVER|NATIVE|POSIX|WINDOWS|WINDOWSCE}[,major[.minor]] |
|
1676 { |
|
1677 // Split up in subsystem, and version number |
|
1678 QStringList both = QString(option+11).split(","); |
|
1679 switch (elfHash(both[0].toLatin1())) { |
|
1680 case 0x8438445: // CONSOLE |
|
1681 SubSystem = "Console"; |
|
1682 break; |
|
1683 case 0xbe29493: // WINDOWS |
|
1684 SubSystem = "Windows"; |
|
1685 break; |
|
1686 case 0x5268ea5: // NATIVE |
|
1687 SubSystem = "Native"; |
|
1688 break; |
|
1689 case 0x240949e: // EFI_APPLICATION |
|
1690 SubSystem = "EFI Application"; |
|
1691 break; |
|
1692 case 0xe617652: // EFI_BOOT_SERVICE_DRIVER |
|
1693 SubSystem = "EFI Boot Service Driver"; |
|
1694 break; |
|
1695 case 0x9af477d: // EFI_ROM |
|
1696 SubSystem = "EFI ROM"; |
|
1697 break; |
|
1698 case 0xd34df42: // EFI_RUNTIME_DRIVER |
|
1699 SubSystem = "EFI Runtime"; |
|
1700 break; |
|
1701 case 0x2949c95: // WINDOWSCE |
|
1702 SubSystem = "WindowsCE"; |
|
1703 break; |
|
1704 case 0x05547e8: // POSIX |
|
1705 SubSystem = "POSIX"; |
|
1706 break; |
|
1707 // The following are undocumented, so add them to AdditionalOptions |
|
1708 case 0x4B69795: // windowsce |
|
1709 AdditionalOptions += option; |
|
1710 break; |
|
1711 default: |
|
1712 found = false; |
|
1713 } |
|
1714 } |
|
1715 break; |
|
1716 case 0x8b654de: // /SWAPRUN:{NET | CD} |
|
1717 if(*(option+9) == 'N') |
|
1718 SwapRunFromNet = _True; |
|
1719 else if(*(option+9) == 'C') |
|
1720 SwapRunFromCD = _True; |
|
1721 else |
|
1722 found = false; |
|
1723 break; |
|
1724 case 0x34906d4: // /TLBID:id |
|
1725 TypeLibraryResourceID = QString(option+7).toLongLong(); |
|
1726 break; |
|
1727 case 0x4907494: // /TLBOUT:[path\]filename |
|
1728 TypeLibraryFile = option+8; |
|
1729 break; |
|
1730 case 0x976b525: // /TSAWARE[:NO] |
|
1731 if(*(option+8) == ':') |
|
1732 TerminalServerAware = _False; |
|
1733 else |
|
1734 TerminalServerAware = _True; |
|
1735 break; |
|
1736 case 0xaa67735: // /VERBOSE[:ICF |:LIB |:REF |:SAFESEH] |
|
1737 if(*(option+9) == ':') { |
|
1738 if (*(option+10) == 'I') { |
|
1739 ShowProgress = "LinkVerboseICF"; |
|
1740 } else if ( *(option+10) == 'L') { |
|
1741 ShowProgress = "LinkVerboseLib"; |
|
1742 } else if ( *(option+10) == 'R') { |
|
1743 ShowProgress = "LinkVerboseREF"; |
|
1744 } else if ( *(option+10) == 'S') { |
|
1745 ShowProgress = "LinkVerboseSAFESEH"; |
|
1746 } else if ( *(option+10) == 'C') { |
|
1747 ShowProgress = "LinkVerboseCLR"; |
|
1748 } |
|
1749 } else { |
|
1750 ShowProgress = "LinkVerbose"; |
|
1751 } |
|
1752 break; |
|
1753 case 0xaa77f7e: // /VERSION:major[.minor] |
|
1754 Version = option+9; |
|
1755 break; |
|
1756 case 0x0034c50: // /WS[:NO] |
|
1757 if(*(option+3) == ':') |
|
1758 TreatLinkerWarningAsErrors = _False; |
|
1759 else |
|
1760 TreatLinkerWarningAsErrors = _True; |
|
1761 break; |
|
1762 default: |
|
1763 AdditionalOptions += option; |
|
1764 break; |
|
1765 } |
|
1766 if(!found) { |
|
1767 warn_msg(WarnLogic, "Could not parse Linker options: %s, added as AdditionalOption", option); |
|
1768 AdditionalOptions += option; |
|
1769 } |
|
1770 return found; |
|
1771 } |
|
1772 |
|
1773 // VCMIDLTool ------------------------------------------------------- |
|
1774 VCXMIDLTool::VCXMIDLTool() |
|
1775 : ApplicationConfigurationMode(unset), |
|
1776 ErrorCheckAllocations(unset), |
|
1777 ErrorCheckBounds(unset), |
|
1778 ErrorCheckEnumRange(unset), |
|
1779 ErrorCheckRefPointers(unset), |
|
1780 ErrorCheckStubData(unset), |
|
1781 GenerateStublessProxies(unset), |
|
1782 GenerateTypeLibrary(unset), |
|
1783 IgnoreStandardIncludePath(unset), |
|
1784 LocaleID(-1), |
|
1785 MkTypLibCompatible(unset), |
|
1786 SuppressCompilerWarnings(unset), |
|
1787 SuppressStartupBanner(unset), |
|
1788 ValidateAllParameters(unset), |
|
1789 WarnAsError(unset) |
|
1790 { |
|
1791 } |
|
1792 |
|
1793 XmlOutput &operator<<(XmlOutput &xml, const VCXMIDLTool &tool) |
|
1794 { |
|
1795 return xml |
|
1796 << tag(_Midl) |
|
1797 << attrTagX(_AdditionalIncludeDirectories, tool.AdditionalIncludeDirectories, ";") |
|
1798 << attrTagX(_AdditionalOptions, tool.AdditionalOptions, " ") |
|
1799 << attrTagT(_ApplicationConfigurationMode, tool.ApplicationConfigurationMode) |
|
1800 << attrTagS(_ClientStubFile, tool.ClientStubFile) |
|
1801 << attrTagS(_CPreprocessOptions, tool.CPreprocessOptions) |
|
1802 << attrTagS(_DefaultCharType, tool.DefaultCharType) |
|
1803 << attrTagS(_DLLDataFileName, tool.DLLDataFileName) |
|
1804 << attrTagS(_EnableErrorChecks, tool.EnableErrorChecks) |
|
1805 << attrTagT(_ErrorCheckAllocations, tool.ErrorCheckAllocations) |
|
1806 << attrTagT(_ErrorCheckBounds, tool.ErrorCheckBounds) |
|
1807 << attrTagT(_ErrorCheckEnumRange, tool.ErrorCheckEnumRange) |
|
1808 << attrTagT(_ErrorCheckRefPointers, tool.ErrorCheckRefPointers) |
|
1809 << attrTagT(_ErrorCheckStubData, tool.ErrorCheckStubData) |
|
1810 << attrTagS(_GenerateClientFiles, tool.GenerateClientFiles) |
|
1811 << attrTagS(_GenerateServerFiles, tool.GenerateServerFiles) |
|
1812 << attrTagT(_GenerateStublessProxies, tool.GenerateStublessProxies) |
|
1813 << attrTagT(_GenerateTypeLibrary, tool.GenerateTypeLibrary) |
|
1814 << attrTagS(_HeaderFileName, tool.HeaderFileName) |
|
1815 << attrTagT(_IgnoreStandardIncludePath, tool.IgnoreStandardIncludePath) |
|
1816 << attrTagS(_InterfaceIdentifierFileName, tool.InterfaceIdentifierFileName) |
|
1817 << attrTagL(_LocaleID, tool.LocaleID, /*ifNot*/ -1) |
|
1818 << attrTagT(_MkTypLibCompatible, tool.MkTypLibCompatible) |
|
1819 << attrTagS(_OutputDirectory, tool.OutputDirectory) |
|
1820 << attrTagX(_PreprocessorDefinitions, tool.PreprocessorDefinitions, ";") |
|
1821 << attrTagS(_ProxyFileName, tool.ProxyFileName) |
|
1822 << attrTagS(_RedirectOutputAndErrors, tool.RedirectOutputAndErrors) |
|
1823 << attrTagS(_ServerStubFile, tool.ServerStubFile) |
|
1824 << attrTagS(_StructMemberAlignment, tool.StructMemberAlignment) |
|
1825 << attrTagT(_SuppressCompilerWarnings, tool.SuppressCompilerWarnings) |
|
1826 << attrTagT(_SuppressStartupBanner, tool.SuppressStartupBanner) |
|
1827 << attrTagS(_TargetEnvironment, tool.TargetEnvironment) |
|
1828 << attrTagS(_TypeLibFormat, tool.TypeLibFormat) |
|
1829 << attrTagS(_TypeLibraryName, tool.TypeLibraryName) |
|
1830 << attrTagX(_UndefinePreprocessorDefinitions, tool.UndefinePreprocessorDefinitions, ";") |
|
1831 << attrTagT(_ValidateAllParameters, tool.ValidateAllParameters) |
|
1832 << attrTagT(_WarnAsError, tool.WarnAsError) |
|
1833 << attrTagS(_WarningLevel, tool.WarningLevel) |
|
1834 << closetag(_Midl); |
|
1835 } |
|
1836 |
|
1837 bool VCXMIDLTool::parseOption(const char* option) |
|
1838 { |
|
1839 #ifdef USE_DISPLAY_HASH |
|
1840 displayHash("/D name[=def]"); displayHash("/I directory-list"); displayHash("/Oi"); |
|
1841 displayHash("/Oic"); displayHash("/Oicf"); displayHash("/Oif"); displayHash("/Os"); |
|
1842 displayHash("/U name"); displayHash("/WX"); displayHash("/W{0|1|2|3|4}"); |
|
1843 displayHash("/Zp {N}"); displayHash("/Zs"); displayHash("/acf filename"); |
|
1844 displayHash("/align {N}"); displayHash("/app_config"); displayHash("/c_ext"); |
|
1845 displayHash("/char ascii7"); displayHash("/char signed"); displayHash("/char unsigned"); |
|
1846 displayHash("/client none"); displayHash("/client stub"); displayHash("/confirm"); |
|
1847 displayHash("/cpp_cmd cmd_line"); displayHash("/cpp_opt options"); |
|
1848 displayHash("/cstub filename"); displayHash("/dlldata filename"); displayHash("/env win32"); |
|
1849 displayHash("/env win64"); displayHash("/error all"); displayHash("/error allocation"); |
|
1850 displayHash("/error bounds_check"); displayHash("/error enum"); displayHash("/error none"); |
|
1851 displayHash("/error ref"); displayHash("/error stub_data"); displayHash("/h filename"); |
|
1852 displayHash("/header filename"); displayHash("/iid filename"); displayHash("/lcid"); |
|
1853 displayHash("/mktyplib203"); displayHash("/ms_ext"); displayHash("/ms_union"); |
|
1854 displayHash("/msc_ver <nnnn>"); displayHash("/newtlb"); displayHash("/no_cpp"); |
|
1855 displayHash("/no_def_idir"); displayHash("/no_default_epv"); displayHash("/no_format_opt"); |
|
1856 displayHash("/no_warn"); displayHash("/nocpp"); displayHash("/nologo"); displayHash("/notlb"); |
|
1857 displayHash("/o filename"); displayHash("/oldnames"); displayHash("/oldtlb"); |
|
1858 displayHash("/osf"); displayHash("/out directory"); displayHash("/pack {N}"); |
|
1859 displayHash("/prefix all"); displayHash("/prefix client"); displayHash("/prefix server"); |
|
1860 displayHash("/prefix switch"); displayHash("/protocol all"); displayHash("/protocol dce"); |
|
1861 displayHash("/protocol ndr64"); displayHash("/proxy filename"); displayHash("/robust"); |
|
1862 displayHash("/rpcss"); displayHash("/savePP"); displayHash("/server none"); |
|
1863 displayHash("/server stub"); displayHash("/sstub filename"); displayHash("/syntax_check"); |
|
1864 displayHash("/target {system}"); displayHash("/tlb filename"); displayHash("/use_epv"); |
|
1865 displayHash("/win32"); displayHash("/win64"); |
|
1866 #endif |
|
1867 bool found = true; |
|
1868 int offset = 0; |
|
1869 switch(elfHash(option)) { |
|
1870 case 0x0000334: // /D name[=def] |
|
1871 PreprocessorDefinitions += option+3; |
|
1872 break; |
|
1873 case 0x0000339: // /I directory-list |
|
1874 AdditionalIncludeDirectories += option+3; |
|
1875 break; |
|
1876 case 0x0345f96: // /Oicf |
|
1877 case 0x00345f6: // /Oif |
|
1878 GenerateStublessProxies = _True; |
|
1879 break; |
|
1880 case 0x0000345: // /U name |
|
1881 UndefinePreprocessorDefinitions += option+3; |
|
1882 break; |
|
1883 case 0x00034c8: // /WX |
|
1884 WarnAsError = _True; |
|
1885 break; |
|
1886 case 0x3582fde: // /align {N} |
|
1887 offset = 3; // Fallthrough |
|
1888 case 0x0003510: // /Zp {N} |
|
1889 switch (*(option+offset+4)) { |
|
1890 case '1': |
|
1891 StructMemberAlignment = (*(option+offset+5) == '\0') ? "1" : "16"; |
|
1892 break; |
|
1893 case '2': |
|
1894 StructMemberAlignment = "2"; |
|
1895 break; |
|
1896 case '4': |
|
1897 StructMemberAlignment = "4"; |
|
1898 break; |
|
1899 case '8': |
|
1900 StructMemberAlignment = "8"; |
|
1901 break; |
|
1902 default: |
|
1903 found = false; |
|
1904 } |
|
1905 break; |
|
1906 case 0x5b1cb97: // /app_config |
|
1907 ApplicationConfigurationMode = _True; |
|
1908 break; |
|
1909 case 0x0359e82: // /char {ascii7|signed|unsigned} |
|
1910 switch(*(option+6)) { |
|
1911 case 'a': |
|
1912 DefaultCharType = "Ascii"; |
|
1913 break; |
|
1914 case 's': |
|
1915 DefaultCharType = "Signed"; |
|
1916 break; |
|
1917 case 'u': |
|
1918 DefaultCharType = "Unsigned"; |
|
1919 break; |
|
1920 default: |
|
1921 found = false; |
|
1922 } |
|
1923 break; |
|
1924 case 0x5a2fc64: // /client {none|stub} |
|
1925 if(*(option+8) == 's') |
|
1926 GenerateClientFiles = "Stub"; |
|
1927 else |
|
1928 GenerateClientFiles = "None"; |
|
1929 break; |
|
1930 case 0xa766524: // /cpp_opt options |
|
1931 CPreprocessOptions += option+9; |
|
1932 break; |
|
1933 case 0x35aabb2: // /cstub filename |
|
1934 ClientStubFile = option+7; |
|
1935 break; |
|
1936 case 0xb32abf1: // /dlldata filename |
|
1937 DLLDataFileName = option + 9; |
|
1938 break; |
|
1939 case 0x0035c56: // /env {win32|ia64|x64} |
|
1940 if(*(option+7) == 'w' && *(option+10) == '3') |
|
1941 TargetEnvironment = "Win32"; |
|
1942 else if(*(option+7) == 'i') |
|
1943 TargetEnvironment = "Itanium"; |
|
1944 else if(*(option+7) == 'x') |
|
1945 TargetEnvironment = "X64"; |
|
1946 else |
|
1947 AdditionalOptions += option; |
|
1948 break; |
|
1949 case 0x35c9962: // /error {all|allocation|bounds_check|enum|none|ref|stub_data} |
|
1950 EnableErrorChecks = midlEnableCustom; |
|
1951 switch (*(option+7)) { |
|
1952 case '\0': |
|
1953 EnableErrorChecks = "EnableCustom"; |
|
1954 break; |
|
1955 case 'a': |
|
1956 if(*(option+10) == '\0') |
|
1957 EnableErrorChecks = "All"; |
|
1958 else |
|
1959 ErrorCheckAllocations = _True; |
|
1960 break; |
|
1961 case 'b': |
|
1962 ErrorCheckBounds = _True; |
|
1963 break; |
|
1964 case 'e': |
|
1965 ErrorCheckEnumRange = _True; |
|
1966 break; |
|
1967 case 'n': |
|
1968 EnableErrorChecks = "None"; |
|
1969 break; |
|
1970 case 'r': |
|
1971 ErrorCheckRefPointers = _True; |
|
1972 break; |
|
1973 case 's': |
|
1974 ErrorCheckStubData = _True; |
|
1975 break; |
|
1976 default: |
|
1977 found = false; |
|
1978 } |
|
1979 break; |
|
1980 case 0x5eb7af2: // /header filename |
|
1981 offset = 5; |
|
1982 case 0x0000358: // /h filename |
|
1983 HeaderFileName = option + offset + 3; |
|
1984 break; |
|
1985 case 0x0035ff4: // /iid filename |
|
1986 InterfaceIdentifierFileName = option+5; |
|
1987 break; |
|
1988 case 0x64b7933: // /mktyplib203 |
|
1989 MkTypLibCompatible = _True; |
|
1990 break; |
|
1991 case 0x64ceb12: // /newtlb |
|
1992 TypeLibFormat = "NewFormat"; |
|
1993 break; |
|
1994 case 0x8e0b0a2: // /no_def_idir |
|
1995 IgnoreStandardIncludePath = _True; |
|
1996 break; |
|
1997 case 0x65635ef: // /nologo |
|
1998 SuppressStartupBanner = _True; |
|
1999 break; |
|
2000 case 0x695e9f4: // /no_robust |
|
2001 ValidateAllParameters = _False; |
|
2002 break; |
|
2003 case 0x3656b22: // /notlb |
|
2004 GenerateTypeLibrary = _True; |
|
2005 break; |
|
2006 case 0x556dbee: // /no_warn |
|
2007 SuppressCompilerWarnings = _True; |
|
2008 break; |
|
2009 case 0x000035f: // /o filename |
|
2010 RedirectOutputAndErrors = option+3; |
|
2011 break; |
|
2012 case 0x662bb12: // /oldtlb |
|
2013 TypeLibFormat = "OldFormat"; |
|
2014 break; |
|
2015 case 0x00366c4: // /out directory |
|
2016 OutputDirectory = option+5; |
|
2017 break; |
|
2018 case 0x36796f9: // /proxy filename |
|
2019 ProxyFileName = option+7; |
|
2020 break; |
|
2021 case 0x6959c94: // /robust |
|
2022 ValidateAllParameters = _True; |
|
2023 break; |
|
2024 case 0x69c9cf2: // /server {none|stub} |
|
2025 if(*(option+8) == 's') |
|
2026 GenerateServerFiles = "Stub"; |
|
2027 else |
|
2028 GenerateServerFiles = "None"; |
|
2029 break; |
|
2030 case 0x36aabb2: // /sstub filename |
|
2031 ServerStubFile = option+7; |
|
2032 break; |
|
2033 case 0x0036b22: // /tlb filename |
|
2034 TypeLibraryName = option+5; |
|
2035 break; |
|
2036 case 0x36e0162: // /win32 |
|
2037 TargetEnvironment = "Win32"; |
|
2038 break; |
|
2039 case 0x36e0194: // /win64 |
|
2040 TargetEnvironment = "Itanium"; |
|
2041 break; |
|
2042 case 0x0003459: // /Oi |
|
2043 case 0x00345f3: // /Oic |
|
2044 case 0x0003463: // /Os |
|
2045 case 0x0003513: // /Zs |
|
2046 case 0x0035796: // /acf filename |
|
2047 case 0x3595cf4: // /c_ext |
|
2048 case 0xa64d3dd: // /confirm |
|
2049 case 0xa765b64: // /cpp_cmd cmd_line |
|
2050 case 0x03629f4: // /lcid |
|
2051 case 0x6495cc4: // /ms_ext |
|
2052 case 0x96c7a1e: // /ms_union |
|
2053 case 0x4996fa2: // /msc_ver <nnnn> |
|
2054 case 0x6555a40: // /no_cpp |
|
2055 case 0xf64d6a6: // /no_default_epv |
|
2056 case 0x6dd9384: // /no_format_opt |
|
2057 case 0x3655a70: // /nocpp |
|
2058 case 0x2b455a3: // /oldnames |
|
2059 case 0x0036696: // /osf |
|
2060 case 0x036679b: // /pack {N} |
|
2061 case 0x678bd38: // /prefix {all|client|server|switch} |
|
2062 case 0x96b702c: // /protocol {all|dce|ndr64} |
|
2063 case 0x3696aa3: // /rpcss |
|
2064 case 0x698ca60: // /savePP |
|
2065 case 0xce9b12b: // /syntax_check |
|
2066 case 0xc9b5f16: // /use_epv |
|
2067 AdditionalOptions += option; |
|
2068 break; |
|
2069 default: |
|
2070 // /W{0|1|2|3|4} case |
|
2071 if(*(option+1) == 'W') { |
|
2072 switch (*(option+2)) { |
|
2073 case '0': |
|
2074 WarningLevel = "0"; |
|
2075 break; |
|
2076 case '1': |
|
2077 WarningLevel = "1"; |
|
2078 break; |
|
2079 case '2': |
|
2080 WarningLevel = "2"; |
|
2081 break; |
|
2082 case '3': |
|
2083 WarningLevel = "3"; |
|
2084 break; |
|
2085 case '4': |
|
2086 WarningLevel = "4"; |
|
2087 break; |
|
2088 default: |
|
2089 found = false; |
|
2090 } |
|
2091 } |
|
2092 break; |
|
2093 } |
|
2094 if(!found) |
|
2095 warn_msg(WarnLogic, "Could not parse MIDL option: %s", option); |
|
2096 return true; |
|
2097 } |
|
2098 |
|
2099 // VCLibrarianTool -------------------------------------------------- |
|
2100 VCXLibrarianTool::VCXLibrarianTool() |
|
2101 : IgnoreAllDefaultLibraries(unset), |
|
2102 LinkTimeCodeGeneration(unset), |
|
2103 SuppressStartupBanner(_True), |
|
2104 TreatLibWarningAsErrors(unset), |
|
2105 Verbose(unset) |
|
2106 { |
|
2107 } |
|
2108 |
|
2109 XmlOutput &operator<<(XmlOutput &xml, const VCXLibrarianTool &tool) |
|
2110 { |
|
2111 return xml |
|
2112 << tag(_Link) |
|
2113 << attrTagX(_AdditionalDependencies, tool.AdditionalDependencies, ";") |
|
2114 << attrTagX(_AdditionalLibraryDirectories, tool.AdditionalLibraryDirectories, ";") |
|
2115 << attrTagX(_AdditionalOptions, tool.AdditionalOptions, " ") |
|
2116 << attrTagS(_DisplayLibrary, tool.DisplayLibrary) |
|
2117 << attrTagS(_ErrorReporting, tool.ErrorReporting) |
|
2118 << attrTagX(_ExportNamedFunctions, tool.ExportNamedFunctions, ";") |
|
2119 << attrTagX(_ForceSymbolReferences, tool.ForceSymbolReferences, ";") |
|
2120 << attrTagT(_IgnoreAllDefaultLibraries, tool.IgnoreAllDefaultLibraries) |
|
2121 << attrTagX(_IgnoreSpecificDefaultLibraries, tool.IgnoreSpecificDefaultLibraries, ";") |
|
2122 << attrTagT(_LinkTimeCodeGeneration, tool.LinkTimeCodeGeneration) |
|
2123 << attrTagS(_ModuleDefinitionFile, tool.ModuleDefinitionFile) |
|
2124 << attrTagS(_Name, tool.Name) |
|
2125 << attrTagS(_OutputFile, tool.OutputFile) |
|
2126 << attrTagX(_RemoveObjects, tool.RemoveObjects, ";") |
|
2127 << attrTagS(_SubSystem, tool.SubSystem) |
|
2128 << attrTagT(_SuppressStartupBanner, tool.SuppressStartupBanner) |
|
2129 << attrTagS(_TargetMachine, tool.TargetMachine) |
|
2130 << attrTagT(_TreatLibWarningAsErrors, tool.TreatLibWarningAsErrors) |
|
2131 << attrTagT(_Verbose, tool.Verbose) |
|
2132 << closetag(_Link); |
|
2133 } |
|
2134 |
|
2135 // VCCustomBuildTool ------------------------------------------------ |
|
2136 VCXCustomBuildTool::VCXCustomBuildTool() |
|
2137 { |
|
2138 ToolName = "VCXCustomBuildTool"; |
|
2139 } |
|
2140 |
|
2141 XmlOutput &operator<<(XmlOutput &xml, const VCXCustomBuildTool &tool) |
|
2142 { |
|
2143 // The code below offers two ways to split custom build step commands. |
|
2144 // Normally the $$escape_expand(\n\t) is used in a project file, which is correctly translated |
|
2145 // in all generators. However, if you use $$escape_expand(\n\r) (or \n\h) instead, the VCPROJ |
|
2146 // generator will instead of binding the commands with " && " will insert a proper newline into |
|
2147 // the VCPROJ file. We sometimes use this method of splitting commands if the custom buildstep |
|
2148 // contains a command-line which is too big to run on certain OS. |
|
2149 QString cmds; |
|
2150 int end = tool.CommandLine.count(); |
|
2151 for(int i = 0; i < end; ++i) { |
|
2152 QString cmdl = tool.CommandLine.at(i); |
|
2153 if (cmdl.contains("\r\t")) { |
|
2154 if (i == end - 1) |
|
2155 cmdl = cmdl.trimmed(); |
|
2156 cmdl.replace("\r\t", " && "); |
|
2157 } else if (cmdl.contains("\r\n")) { |
|
2158 ; |
|
2159 } else if (cmdl.contains("\r\\h")) { |
|
2160 // The above \r\n should work, but doesn't, so we have this hack |
|
2161 cmdl.replace("\r\\h", "\r\n"); |
|
2162 } else { |
|
2163 if (i < end - 1) |
|
2164 cmdl += " && "; |
|
2165 } |
|
2166 cmds += cmdl; |
|
2167 } |
|
2168 |
|
2169 if ( !tool.AdditionalDependencies.isEmpty() ) |
|
2170 { |
|
2171 xml << tag("AdditionalInputs") |
|
2172 << attrTag("Condition", QString("'$(Configuration)|$(Platform)'=='%1'").arg(tool.ConfigName)) |
|
2173 << valueTagDefX(tool.AdditionalDependencies, "AdditionalInputs", ";"); |
|
2174 } |
|
2175 |
|
2176 if( !cmds.isEmpty() ) |
|
2177 { |
|
2178 xml << tag("Command") |
|
2179 << attrTag("Condition", QString("'$(Configuration)|$(Platform)'=='%1'").arg(tool.ConfigName)) |
|
2180 << valueTag(cmds); |
|
2181 } |
|
2182 |
|
2183 if ( !tool.Description.isEmpty() ) |
|
2184 { |
|
2185 xml << tag("Message") |
|
2186 << attrTag("Condition", QString("'$(Configuration)|$(Platform)'=='%1'").arg(tool.ConfigName)) |
|
2187 << valueTag(tool.Description); |
|
2188 } |
|
2189 |
|
2190 if ( !tool.Outputs.isEmpty() ) |
|
2191 { |
|
2192 xml << tag("Outputs") |
|
2193 << attrTag("Condition", QString("'$(Configuration)|$(Platform)'=='%1'").arg(tool.ConfigName)) |
|
2194 << valueTagDefX(tool.Outputs, "Outputs", ";"); |
|
2195 } |
|
2196 |
|
2197 return xml; |
|
2198 } |
|
2199 |
|
2200 // VCResourceCompilerTool ------------------------------------------- |
|
2201 VCXResourceCompilerTool::VCXResourceCompilerTool() |
|
2202 : IgnoreStandardIncludePath(unset), |
|
2203 NullTerminateStrings(unset), |
|
2204 ShowProgress(unset), |
|
2205 SuppressStartupBanner(unset) |
|
2206 { |
|
2207 PreprocessorDefinitions = QStringList("NDEBUG"); |
|
2208 } |
|
2209 |
|
2210 XmlOutput &operator<<(XmlOutput &xml, const VCXResourceCompilerTool &tool) |
|
2211 { |
|
2212 return xml |
|
2213 << tag(_ResourceCompile) |
|
2214 << attrTagX(_AdditionalIncludeDirectories, tool.AdditionalIncludeDirectories, ";") |
|
2215 << attrTagS(_AdditionalOptions, tool.AdditionalOptions) |
|
2216 << attrTagS(_Culture, tool.Culture) |
|
2217 << attrTagT(_IgnoreStandardIncludePath, tool.IgnoreStandardIncludePath) |
|
2218 << attrTagT(_NullTerminateStrings, tool.NullTerminateStrings) |
|
2219 << attrTagX(_PreprocessorDefinitions, tool.PreprocessorDefinitions, ";") |
|
2220 << attrTagS(_ResourceOutputFileName, tool.ResourceOutputFileName) |
|
2221 << attrTagT(_ShowProgress, tool.ShowProgress) |
|
2222 << attrTagT(_SuppressStartupBanner, tool.SuppressStartupBanner) |
|
2223 << attrTagS(_TrackerLogDirectory, tool.TrackerLogDirectory) |
|
2224 << attrTagS(_UndefinePreprocessorDefinitions, tool.UndefinePreprocessorDefinitions) |
|
2225 << closetag(_ResourceCompile); |
|
2226 } |
|
2227 |
|
2228 // VCXDeploymentTool -------------------------------------------- |
|
2229 VCXDeploymentTool::VCXDeploymentTool() |
|
2230 { |
|
2231 DeploymentTag = "DeploymentTool"; |
|
2232 RemoteDirectory = ""; |
|
2233 } |
|
2234 |
|
2235 // http://msdn.microsoft.com/en-us/library/sa69he4t.aspx |
|
2236 XmlOutput &operator<<(XmlOutput &xml, const VCXDeploymentTool &tool) |
|
2237 { |
|
2238 if (tool.AdditionalFiles.isEmpty()) |
|
2239 return xml; |
|
2240 return xml |
|
2241 << tag(tool.DeploymentTag) |
|
2242 << closetag(tool.DeploymentTag); |
|
2243 } |
|
2244 |
|
2245 // VCEventTool ------------------------------------------------- |
|
2246 XmlOutput &operator<<(XmlOutput &xml, const VCXEventTool &tool) |
|
2247 { |
|
2248 return xml |
|
2249 << tag(tool.EventName) |
|
2250 << attrTagS(_Command, tool.CommandLine) |
|
2251 << attrTagS(_Message, tool.Description) |
|
2252 << closetag(tool.EventName); |
|
2253 } |
|
2254 |
|
2255 // VCXPostBuildEventTool --------------------------------------------- |
|
2256 VCXPostBuildEventTool::VCXPostBuildEventTool() |
|
2257 { |
|
2258 EventName = "PostBuildEvent"; |
|
2259 } |
|
2260 |
|
2261 // VCXPreBuildEventTool ---------------------------------------------- |
|
2262 VCXPreBuildEventTool::VCXPreBuildEventTool() |
|
2263 { |
|
2264 EventName = "PreBuildEvent"; |
|
2265 } |
|
2266 |
|
2267 // VCXPreLinkEventTool ----------------------------------------------- |
|
2268 VCXPreLinkEventTool::VCXPreLinkEventTool() |
|
2269 { |
|
2270 EventName = "PreLinkEvent"; |
|
2271 } |
|
2272 |
|
2273 // VCConfiguration -------------------------------------------------- |
|
2274 |
|
2275 VCXConfiguration::VCXConfiguration() |
|
2276 : ATLMinimizesCRunTimeLibraryUsage(unset), |
|
2277 BuildBrowserInformation(unset), |
|
2278 RegisterOutput(unset), |
|
2279 WholeProgramOptimization(unset) |
|
2280 { |
|
2281 compiler.config = this; |
|
2282 linker.config = this; |
|
2283 idl.config = this; |
|
2284 } |
|
2285 |
|
2286 XmlOutput &operator<<(XmlOutput &xml, const VCXConfiguration &tool) |
|
2287 { |
|
2288 xml << tag("PropertyGroup") |
|
2289 << attrTag("Condition", QString("'$(Configuration)|$(Platform)'=='%1'").arg(tool.Name)) |
|
2290 << attrTag("Label", "Configuration") |
|
2291 << attrTagS(_OutputDirectory, tool.OutputDirectory) |
|
2292 << attrTagT(_ATLMinimizesCRunTimeLibraryUsage, tool.ATLMinimizesCRunTimeLibraryUsage) |
|
2293 << attrTagT(_BuildBrowserInformation, tool.BuildBrowserInformation) |
|
2294 << attrTagS(_CharacterSet, tool.CharacterSet) |
|
2295 << attrTagS(_ConfigurationType, tool.ConfigurationType) |
|
2296 << attrTagS(_DeleteExtensionsOnClean, tool.DeleteExtensionsOnClean) |
|
2297 << attrTagS(_ImportLibrary, tool.ImportLibrary) |
|
2298 << attrTagS(_IntermediateDirectory, tool.IntermediateDirectory) |
|
2299 << attrTagS(_PrimaryOutput, tool.PrimaryOutput) |
|
2300 << attrTagS(_ProgramDatabase, tool.ProgramDatabase) |
|
2301 << attrTagT(_RegisterOutput, tool.RegisterOutput) |
|
2302 << attrTagS(_UseOfATL, tool.UseOfATL) |
|
2303 << attrTagS(_UseOfMfc, tool.UseOfMfc) |
|
2304 << attrTagT(_WholeProgramOptimization, tool.WholeProgramOptimization) |
|
2305 << closetag(); |
|
2306 return xml; |
|
2307 } |
|
2308 // VCXFilter --------------------------------------------------------- |
|
2309 VCXFilter::VCXFilter() |
|
2310 : ParseFiles(unset), |
|
2311 Config(0) |
|
2312 { |
|
2313 useCustomBuildTool = false; |
|
2314 useCompilerTool = false; |
|
2315 } |
|
2316 |
|
2317 void VCXFilter::addFile(const QString& filename) |
|
2318 { |
|
2319 Files += VCXFilterFile(filename); |
|
2320 } |
|
2321 |
|
2322 void VCXFilter::addFile(const VCXFilterFile& fileInfo) |
|
2323 { |
|
2324 Files += VCXFilterFile(fileInfo); |
|
2325 } |
|
2326 |
|
2327 void VCXFilter::addFiles(const QStringList& fileList) |
|
2328 { |
|
2329 for (int i = 0; i < fileList.count(); ++i) |
|
2330 addFile(fileList.at(i)); |
|
2331 } |
|
2332 |
|
2333 void VCXFilter::modifyPCHstage(QString str) |
|
2334 { |
|
2335 bool autogenSourceFile = Project->autogenPrecompCPP; |
|
2336 bool pchThroughSourceFile = !Project->precompCPP.isEmpty(); |
|
2337 bool isCFile = false; |
|
2338 for (QStringList::Iterator it = Option::c_ext.begin(); it != Option::c_ext.end(); ++it) { |
|
2339 if (str.endsWith(*it)) { |
|
2340 isCFile = true; |
|
2341 break; |
|
2342 } |
|
2343 } |
|
2344 bool isHFile = str.endsWith(".h") && (str == Project->precompH); |
|
2345 bool isCPPFile = pchThroughSourceFile && (str == Project->precompCPP); |
|
2346 |
|
2347 if(!isCFile && !isHFile && !isCPPFile) |
|
2348 return; |
|
2349 |
|
2350 if(isHFile && pchThroughSourceFile) { |
|
2351 if (autogenSourceFile) { |
|
2352 useCustomBuildTool = true; |
|
2353 QString toFile(Project->precompCPP); |
|
2354 CustomBuildTool.Description = "Generating precompiled header source file '" + toFile + "' ..."; |
|
2355 CustomBuildTool.Outputs += toFile; |
|
2356 |
|
2357 QStringList lines; |
|
2358 CustomBuildTool.CommandLine += |
|
2359 "echo /*-------------------------------------------------------------------- >" + toFile; |
|
2360 lines << "* Precompiled header source file used by Visual Studio.NET to generate"; |
|
2361 lines << "* the .pch file."; |
|
2362 lines << "*"; |
|
2363 lines << "* Due to issues with the dependencies checker within the IDE, it"; |
|
2364 lines << "* sometimes fails to recompile the PCH file, if we force the IDE to"; |
|
2365 lines << "* create the PCH file directly from the header file."; |
|
2366 lines << "*"; |
|
2367 lines << "* This file is auto-generated by qmake since no PRECOMPILED_SOURCE was"; |
|
2368 lines << "* specified, and is used as the common stdafx.cpp. The file is only"; |
|
2369 lines << "* generated when creating .vcxproj project files, and is not used for"; |
|
2370 lines << "* command line compilations by nmake."; |
|
2371 lines << "*"; |
|
2372 lines << "* WARNING: All changes made in this file will be lost."; |
|
2373 lines << "--------------------------------------------------------------------*/"; |
|
2374 lines << "#include \"" + Project->precompHFilename + "\""; |
|
2375 foreach(QString line, lines) |
|
2376 CustomBuildTool.CommandLine += "echo " + line + ">>" + toFile; |
|
2377 } |
|
2378 return; |
|
2379 } |
|
2380 |
|
2381 useCompilerTool = true; |
|
2382 // Setup PCH options |
|
2383 CompilerTool.PrecompiledHeader = (isCFile ? "NotUsing" : "Create" ); |
|
2384 CompilerTool.PrecompiledHeaderFile = (isCPPFile ? QString("$(INHERIT)") : QString("$(NOINHERIT)")); |
|
2385 CompilerTool.ForcedIncludeFiles = QStringList("$(NOINHERIT)"); |
|
2386 } |
|
2387 |
|
2388 bool VCXFilter::addExtraCompiler(const VCXFilterFile &info) |
|
2389 { |
|
2390 const QStringList &extraCompilers = Project->extraCompilerSources.value(info.file); |
|
2391 if (extraCompilers.isEmpty()) |
|
2392 return false; |
|
2393 |
|
2394 QString inFile = info.file; |
|
2395 |
|
2396 // is the extracompiler rule on a file with a built in compiler? |
|
2397 const QStringList &objectMappedFile = Project->extraCompilerOutputs[inFile]; |
|
2398 bool hasBuiltIn = false; |
|
2399 if (!objectMappedFile.isEmpty()) { |
|
2400 hasBuiltIn = Project->hasBuiltinCompiler(objectMappedFile.at(0)); |
|
2401 // qDebug("*** Extra compiler file has object mapped file '%s' => '%s'", qPrintable(inFile), qPrintable(objectMappedFile.join(" "))); |
|
2402 } |
|
2403 |
|
2404 CustomBuildTool.AdditionalDependencies.clear(); |
|
2405 CustomBuildTool.CommandLine.clear(); |
|
2406 CustomBuildTool.Description.clear(); |
|
2407 CustomBuildTool.Outputs.clear(); |
|
2408 CustomBuildTool.ToolPath.clear(); |
|
2409 CustomBuildTool.ToolName = QLatin1String(_VCCustomBuildTool); |
|
2410 |
|
2411 for (int x = 0; x < extraCompilers.count(); ++x) { |
|
2412 const QString &extraCompilerName = extraCompilers.at(x); |
|
2413 |
|
2414 if (!Project->verifyExtraCompiler(extraCompilerName, inFile) && !hasBuiltIn) |
|
2415 continue; |
|
2416 |
|
2417 // All information about the extra compiler |
|
2418 QString tmp_out = Project->project->first(extraCompilerName + ".output"); |
|
2419 QString tmp_cmd = Project->project->variables()[extraCompilerName + ".commands"].join(" "); |
|
2420 QString tmp_cmd_name = Project->project->variables()[extraCompilerName + ".name"].join(" "); |
|
2421 QStringList tmp_dep = Project->project->variables()[extraCompilerName + ".depends"]; |
|
2422 QString tmp_dep_cmd = Project->project->variables()[extraCompilerName + ".depend_command"].join(" "); |
|
2423 QStringList vars = Project->project->variables()[extraCompilerName + ".variables"]; |
|
2424 QStringList configs = Project->project->variables()[extraCompilerName + ".CONFIG"]; |
|
2425 bool combined = configs.indexOf("combine") != -1; |
|
2426 |
|
2427 QString cmd, cmd_name, out; |
|
2428 QStringList deps, inputs; |
|
2429 // Variabel replacement of output name |
|
2430 out = Option::fixPathToTargetOS( |
|
2431 Project->replaceExtraCompilerVariables(tmp_out, inFile, QString()), |
|
2432 false); |
|
2433 |
|
2434 // If file has built-in compiler, we've swapped the input and output of |
|
2435 // the command, as we in Visual Studio cannot have a Custom Buildstep on |
|
2436 // a file which uses a built-in compiler. We would in this case only get |
|
2437 // the result from the extra compiler. If 'hasBuiltIn' is true, we know |
|
2438 // that we're actually on the _output_file_ of the result, and we |
|
2439 // therefore swap inFile and out below, since the extra-compiler still |
|
2440 // must see it as the original way. If the result also has a built-in |
|
2441 // compiler, too bad.. |
|
2442 if (hasBuiltIn) { |
|
2443 out = inFile; |
|
2444 inFile = objectMappedFile.at(0); |
|
2445 } |
|
2446 |
|
2447 // Dependency for the output |
|
2448 if(!tmp_dep.isEmpty()) |
|
2449 deps = tmp_dep; |
|
2450 if(!tmp_dep_cmd.isEmpty()) { |
|
2451 // Execute dependency command, and add every line as a dep |
|
2452 char buff[256]; |
|
2453 QString dep_cmd = Project->replaceExtraCompilerVariables(tmp_dep_cmd, Option::fixPathToLocalOS(inFile, true, false), out); |
|
2454 if(Project->canExecute(dep_cmd)) { |
|
2455 if(FILE *proc = QT_POPEN(dep_cmd.toLatin1().constData(), "r")) { |
|
2456 QString indeps; |
|
2457 while(!feof(proc)) { |
|
2458 int read_in = (int)fread(buff, 1, 255, proc); |
|
2459 if(!read_in) |
|
2460 break; |
|
2461 indeps += QByteArray(buff, read_in); |
|
2462 } |
|
2463 QT_PCLOSE(proc); |
|
2464 if(!indeps.isEmpty()) { |
|
2465 QStringList extradeps = indeps.split(QLatin1Char('\n')); |
|
2466 for (int i = 0; i < extradeps.count(); ++i) { |
|
2467 QString dd = extradeps.at(i).simplified(); |
|
2468 if (!dd.isEmpty()) |
|
2469 deps += Project->fileFixify(dd); |
|
2470 } |
|
2471 } |
|
2472 } |
|
2473 } |
|
2474 } |
|
2475 for (int i = 0; i < deps.count(); ++i) |
|
2476 deps[i] = Option::fixPathToTargetOS( |
|
2477 Project->replaceExtraCompilerVariables(deps.at(i), inFile, out), |
|
2478 false).trimmed(); |
|
2479 // Command for file |
|
2480 if (combined) { |
|
2481 // Add dependencies for each file |
|
2482 QStringList tmp_in = Project->project->variables()[extraCompilerName + ".input"]; |
|
2483 for (int a = 0; a < tmp_in.count(); ++a) { |
|
2484 const QStringList &files = Project->project->variables()[tmp_in.at(a)]; |
|
2485 for (int b = 0; b < files.count(); ++b) { |
|
2486 deps += Project->findDependencies(files.at(b)); |
|
2487 inputs += Option::fixPathToTargetOS(files.at(b), false); |
|
2488 } |
|
2489 } |
|
2490 deps += inputs; // input files themselves too.. |
|
2491 |
|
2492 // Replace variables for command w/all input files |
|
2493 // ### join gives path issues with directories containing spaces! |
|
2494 cmd = Project->replaceExtraCompilerVariables(tmp_cmd, |
|
2495 inputs.join(" "), |
|
2496 out); |
|
2497 } else { |
|
2498 deps += inFile; // input file itself too.. |
|
2499 cmd = Project->replaceExtraCompilerVariables(tmp_cmd, |
|
2500 inFile, |
|
2501 out); |
|
2502 } |
|
2503 // Name for command |
|
2504 if(!tmp_cmd_name.isEmpty()) { |
|
2505 cmd_name = Project->replaceExtraCompilerVariables(tmp_cmd_name, inFile, out); |
|
2506 } else { |
|
2507 int space = cmd.indexOf(' '); |
|
2508 if(space != -1) |
|
2509 cmd_name = cmd.left(space); |
|
2510 else |
|
2511 cmd_name = cmd; |
|
2512 if((cmd_name[0] == '\'' || cmd_name[0] == '"') && |
|
2513 cmd_name[0] == cmd_name[cmd_name.length()-1]) |
|
2514 cmd_name = cmd_name.mid(1,cmd_name.length()-2); |
|
2515 } |
|
2516 |
|
2517 // Fixify paths |
|
2518 for (int i = 0; i < deps.count(); ++i) |
|
2519 deps[i] = Option::fixPathToTargetOS(deps[i], false); |
|
2520 |
|
2521 |
|
2522 // Output in info.additionalFile ----------- |
|
2523 if (!CustomBuildTool.Description.isEmpty()) |
|
2524 CustomBuildTool.Description += " & "; |
|
2525 CustomBuildTool.Description += cmd_name; |
|
2526 CustomBuildTool.CommandLine += cmd.trimmed().split("\n", QString::SkipEmptyParts); |
|
2527 int space = cmd.indexOf(' '); |
|
2528 QFileInfo finf(cmd.left(space)); |
|
2529 if (CustomBuildTool.ToolPath.isEmpty()) |
|
2530 CustomBuildTool.ToolPath += Option::fixPathToTargetOS(finf.path()); |
|
2531 CustomBuildTool.Outputs += out; |
|
2532 |
|
2533 deps += CustomBuildTool.AdditionalDependencies; |
|
2534 deps += cmd.left(cmd.indexOf(' ')); |
|
2535 // Make sure that all deps are only once |
|
2536 QMap<QString, bool> uniqDeps; |
|
2537 for (int c = 0; c < deps.count(); ++c) { |
|
2538 QString aDep = deps.at(c).trimmed(); |
|
2539 if (!aDep.isEmpty()) |
|
2540 uniqDeps[aDep] = false; |
|
2541 } |
|
2542 CustomBuildTool.AdditionalDependencies = uniqDeps.keys(); |
|
2543 } |
|
2544 |
|
2545 // Ensure that none of the output files are also dependencies. Or else, the custom buildstep |
|
2546 // will be rebuild every time, even if nothing has changed. |
|
2547 foreach(QString output, CustomBuildTool.Outputs) { |
|
2548 CustomBuildTool.AdditionalDependencies.removeAll(output); |
|
2549 } |
|
2550 |
|
2551 useCustomBuildTool = !CustomBuildTool.CommandLine.isEmpty(); |
|
2552 return useCustomBuildTool; |
|
2553 } |
|
2554 |
|
2555 bool VCXFilter::outputFileConfig(XmlOutput &xml, XmlOutput &xmlFilter, const QString &filename, const QString &filtername, bool fileAllreadyAdded) |
|
2556 { |
|
2557 bool fileAdded = false; |
|
2558 |
|
2559 // Clearing each filter tool |
|
2560 useCustomBuildTool = false; |
|
2561 useCompilerTool = false; |
|
2562 CustomBuildTool = VCXCustomBuildTool(); |
|
2563 CompilerTool = VCXCLCompilerTool(); |
|
2564 |
|
2565 // Unset some default options |
|
2566 CompilerTool.BufferSecurityCheck = unset; |
|
2567 CompilerTool.DebugInformationFormat = ""; |
|
2568 CompilerTool.ExceptionHandling = ""; |
|
2569 //CompilerTool.Optimization = optimizeDefault; |
|
2570 CompilerTool.ProgramDataBaseFileName.clear(); |
|
2571 CompilerTool.RuntimeLibrary = ""; |
|
2572 //CompilerTool.WarningLevel = warningLevelUnknown; |
|
2573 CompilerTool.config = Config; |
|
2574 |
|
2575 bool inBuild = false; |
|
2576 VCXFilterFile info; |
|
2577 for (int i = 0; i < Files.count(); ++i) { |
|
2578 if (Files.at(i).file == filename) { |
|
2579 info = Files.at(i); |
|
2580 inBuild = true; |
|
2581 } |
|
2582 } |
|
2583 inBuild &= !info.excludeFromBuild; |
|
2584 |
|
2585 if (inBuild) { |
|
2586 addExtraCompiler(info); |
|
2587 if(Project->usePCH) |
|
2588 modifyPCHstage(info.file); |
|
2589 } else { |
|
2590 // Excluded files uses an empty compiler stage |
|
2591 if(info.excludeFromBuild) |
|
2592 useCompilerTool = true; |
|
2593 } |
|
2594 |
|
2595 // Actual XML output ---------------------------------- |
|
2596 if(useCustomBuildTool || useCompilerTool || !inBuild) { |
|
2597 |
|
2598 if (useCustomBuildTool) |
|
2599 { |
|
2600 CustomBuildTool.ConfigName = (*Config).Name; |
|
2601 |
|
2602 if ( !fileAllreadyAdded ) { |
|
2603 |
|
2604 fileAdded = true; |
|
2605 |
|
2606 xmlFilter << tag("CustomBuild") |
|
2607 << attrTag("Include",Option::fixPathToLocalOS(filename)) |
|
2608 << attrTagS("Filter", filtername); |
|
2609 |
|
2610 xml << tag("CustomBuild") |
|
2611 << attrTag("Include",Option::fixPathToLocalOS(filename)); |
|
2612 |
|
2613 if ( filtername == "Form Files" || filtername == "Generated Files" || filtername == "Resource Files" ) |
|
2614 xml << attrTagS("FileType", "Document"); |
|
2615 } |
|
2616 |
|
2617 xml << CustomBuildTool; |
|
2618 } |
|
2619 |
|
2620 if ( !fileAdded && !fileAllreadyAdded ) |
|
2621 { |
|
2622 fileAdded = true; |
|
2623 |
|
2624 if (filtername == "Source Files") { |
|
2625 |
|
2626 xmlFilter << tag("ClCompile") |
|
2627 << attrTag("Include",Option::fixPathToLocalOS(filename)) |
|
2628 << attrTagS("Filter", filtername); |
|
2629 |
|
2630 xml << tag("ClCompile") |
|
2631 << attrTag("Include",Option::fixPathToLocalOS(filename)); |
|
2632 |
|
2633 } else if(filtername == "Header Files") { |
|
2634 |
|
2635 xmlFilter << tag("ClInclude") |
|
2636 << attrTag("Include",Option::fixPathToLocalOS(filename)) |
|
2637 << attrTagS("Filter", filtername); |
|
2638 |
|
2639 xml << tag("ClInclude") |
|
2640 << attrTag("Include",Option::fixPathToLocalOS(filename)); |
|
2641 } else if(filtername == "Generated Files" || filtername == "Form Files") { |
|
2642 |
|
2643 if (filename.endsWith(".h")) { |
|
2644 |
|
2645 xmlFilter << tag("ClInclude") |
|
2646 << attrTag("Include",Option::fixPathToLocalOS(filename)) |
|
2647 << attrTagS("Filter", filtername); |
|
2648 |
|
2649 xml << tag("ClInclude") |
|
2650 << attrTag("Include",Option::fixPathToLocalOS(filename)); |
|
2651 } else if(filename.endsWith(".cpp")) { |
|
2652 |
|
2653 xmlFilter << tag("ClCompile") |
|
2654 << attrTag("Include",Option::fixPathToLocalOS(filename)) |
|
2655 << attrTagS("Filter", filtername); |
|
2656 |
|
2657 xml << tag("ClCompile") |
|
2658 << attrTag("Include",Option::fixPathToLocalOS(filename)); |
|
2659 } else { |
|
2660 |
|
2661 xmlFilter << tag("CustomBuild") |
|
2662 << attrTag("Include",Option::fixPathToLocalOS(filename)) |
|
2663 << attrTagS("Filter", filtername); |
|
2664 |
|
2665 xml << tag("CustomBuild") |
|
2666 << attrTag("Include",Option::fixPathToLocalOS(filename)); |
|
2667 } |
|
2668 } |
|
2669 } |
|
2670 |
|
2671 if(!inBuild) { |
|
2672 |
|
2673 xml << tag("ExcludedFromBuild") |
|
2674 << attrTag("Condition", QString("'$(Configuration)|$(Platform)'=='%1'").arg((*Config).Name)) |
|
2675 << valueTag("true"); |
|
2676 } |
|
2677 |
|
2678 if (useCompilerTool) { |
|
2679 |
|
2680 if ( !CompilerTool.ForcedIncludeFiles.isEmpty() ) { |
|
2681 xml << tag("ForcedIncludeFiles") |
|
2682 << attrTag("Condition", QString("'$(Configuration)|$(Platform)'=='%1'").arg((*Config).Name)) |
|
2683 << valueTagX(CompilerTool.ForcedIncludeFiles); |
|
2684 } |
|
2685 |
|
2686 if ( !CompilerTool.PrecompiledHeaderFile.isEmpty() ) { |
|
2687 |
|
2688 xml << tag("PrecompiledHeaderFile") |
|
2689 << attrTag("Condition", QString("'$(Configuration)|$(Platform)'=='%1'").arg((*Config).Name)) |
|
2690 << valueTag(CompilerTool.PrecompiledHeaderFile); |
|
2691 } |
|
2692 |
|
2693 if ( !CompilerTool.PrecompiledHeader.isEmpty() ) { |
|
2694 |
|
2695 xml << tag("PrecompiledHeader") |
|
2696 << attrTag("Condition", QString("'$(Configuration)|$(Platform)'=='%1'").arg((*Config).Name)) |
|
2697 << valueTag(CompilerTool.PrecompiledHeader); |
|
2698 } |
|
2699 |
|
2700 //xml << CompilerTool; |
|
2701 } |
|
2702 } |
|
2703 |
|
2704 return fileAdded; |
|
2705 } |
|
2706 |
|
2707 |
|
2708 // VCXProjectSingleConfig -------------------------------------------- |
|
2709 VCXFilter nullVCXFilter; |
|
2710 VCXFilter& VCXProjectSingleConfig::filterForExtraCompiler(const QString &compilerName) |
|
2711 { |
|
2712 for (int i = 0; i < ExtraCompilersFiles.count(); ++i) |
|
2713 if (ExtraCompilersFiles.at(i).Name == compilerName) |
|
2714 return ExtraCompilersFiles[i]; |
|
2715 return nullVCXFilter; |
|
2716 } |
|
2717 |
|
2718 |
|
2719 XmlOutput &operator<<(XmlOutput &xml, const VCXProjectSingleConfig &tool) |
|
2720 { |
|
2721 xml.setIndentString(" "); |
|
2722 |
|
2723 xml << decl("1.0", "utf-8") |
|
2724 << tag("Project") |
|
2725 << attrTag("DefaultTargets","Build") |
|
2726 << attrTag("ToolsVersion", "4.0") |
|
2727 << attrTag("xmlns", "http://schemas.microsoft.com/developer/msbuild/2003") |
|
2728 << tag("ItemGroup") |
|
2729 << attrTag("Label", "ProjectConfigurations"); |
|
2730 |
|
2731 xml << tag("ProjectConfiguration") |
|
2732 << attrTag("Include" , tool.Configuration.Name) |
|
2733 << tagValue("Configuration", tool.Configuration.ConfigurationName) |
|
2734 << tagValue("Platform", tool.PlatformName) |
|
2735 << closetag(); |
|
2736 |
|
2737 xml << closetag() |
|
2738 << tag("PropertyGroup") |
|
2739 << attrTag("Label", "Globals") |
|
2740 << tagValue("ProjectGuid", tool.ProjectGUID) |
|
2741 << tagValue("RootNamespace", tool.Name) |
|
2742 << tagValue("Keyword", tool.Keyword) |
|
2743 << closetag(); |
|
2744 |
|
2745 // config part. |
|
2746 xml << import("Project", "$(VCTargetsPath)\\Microsoft.Cpp.Default.props"); |
|
2747 |
|
2748 xml << tool.Configuration; |
|
2749 |
|
2750 xml << import("Project", "$(VCTargetsPath)\\Microsoft.Cpp.props"); |
|
2751 |
|
2752 // Extension settings |
|
2753 xml << tag("ImportGroup") |
|
2754 << attrTag("Label", "ExtensionSettings") |
|
2755 << closetag(); |
|
2756 |
|
2757 // PropertySheets |
|
2758 xml << tag("ImportGroup") |
|
2759 << attrTag("Condition", QString("'$(Configuration)|$(Platform)'=='%1'").arg(tool.Configuration.Name)) |
|
2760 << attrTag("Label", "PropertySheets"); |
|
2761 |
|
2762 xml << tag("Import") |
|
2763 << attrTag("Project", "$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props") |
|
2764 << attrTag("Condition", "exists('$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props')") |
|
2765 << closetag() |
|
2766 << closetag(); |
|
2767 |
|
2768 |
|
2769 // UserMacros |
|
2770 xml << tag("PropertyGroup") |
|
2771 << attrTag("Label", "UserMacros") |
|
2772 << closetag(); |
|
2773 |
|
2774 xml << tag("PropertyGroup"); |
|
2775 |
|
2776 if ( !tool.Configuration.OutputDirectory.isEmpty() ) { |
|
2777 xml<< tag("OutDir") |
|
2778 << attrTag("Condition", QString("'$(Configuration)|$(Platform)'=='%1'").arg(tool.Configuration.Name)) |
|
2779 << valueTag(tool.Configuration.OutputDirectory); |
|
2780 } |
|
2781 if ( !tool.Configuration.IntermediateDirectory.isEmpty() ) { |
|
2782 xml<< tag("IntDir") |
|
2783 << attrTag("Condition", QString("'$(Configuration)|$(Platform)'=='%1'").arg(tool.Configuration.Name)) |
|
2784 << valueTag(tool.Configuration.IntermediateDirectory); |
|
2785 } |
|
2786 if ( !tool.Configuration.TargetName.isEmpty() ) { |
|
2787 xml<< tag("TargetName") |
|
2788 << attrTag("Condition", QString("'$(Configuration)|$(Platform)'=='%1'").arg(tool.Configuration.Name)) |
|
2789 << valueTag(tool.Configuration.TargetName); |
|
2790 } |
|
2791 |
|
2792 if ( tool.Configuration.linker.IgnoreImportLibrary != unset) { |
|
2793 xml<< tag("IgnoreImportLibrary") |
|
2794 << attrTag("Condition", QString("'$(Configuration)|$(Platform)'=='%1'").arg(tool.Configuration.Name)) |
|
2795 << valueTagT(tool.Configuration.linker.IgnoreImportLibrary); |
|
2796 } |
|
2797 |
|
2798 if ( tool.Configuration.linker.LinkIncremental != unset) { |
|
2799 xml<< tag("LinkIncremental") |
|
2800 << attrTag("Condition", QString("'$(Configuration)|$(Platform)'=='%1'").arg(tool.Configuration.Name)) |
|
2801 << valueTagT(tool.Configuration.linker.LinkIncremental); |
|
2802 } |
|
2803 |
|
2804 if ( tool.Configuration.preBuild.UseInBuild != unset ) |
|
2805 { |
|
2806 xml<< tag("PreBuildEventUseInBuild") |
|
2807 << attrTag("Condition", QString("'$(Configuration)|$(Platform)'=='%1'").arg(tool.Configuration.Name)) |
|
2808 << valueTagT(tool.Configuration.preBuild.UseInBuild); |
|
2809 } |
|
2810 |
|
2811 if ( tool.Configuration.preLink.UseInBuild != unset ) |
|
2812 { |
|
2813 xml<< tag("PreLinkEventUseInBuild") |
|
2814 << attrTag("Condition", QString("'$(Configuration)|$(Platform)'=='%1'").arg(tool.Configuration.Name)) |
|
2815 << valueTagT(tool.Configuration.preLink.UseInBuild); |
|
2816 } |
|
2817 |
|
2818 if ( tool.Configuration.postBuild.UseInBuild != unset ) |
|
2819 { |
|
2820 xml<< tag("PostBuildEventUseInBuild") |
|
2821 << attrTag("Condition", QString("'$(Configuration)|$(Platform)'=='%1'").arg(tool.Configuration.Name)) |
|
2822 << valueTagT(tool.Configuration.postBuild.UseInBuild); |
|
2823 } |
|
2824 xml << closetag(); |
|
2825 |
|
2826 xml << tag("ItemDefinitionGroup") |
|
2827 << attrTag("Condition", QString("'$(Configuration)|$(Platform)'=='%1'").arg(tool.Configuration.Name)); |
|
2828 |
|
2829 // ClCompile |
|
2830 xml << tool.Configuration.compiler; |
|
2831 |
|
2832 // Link |
|
2833 xml << tool.Configuration.linker; |
|
2834 |
|
2835 // Midl |
|
2836 xml << tool.Configuration.idl; |
|
2837 |
|
2838 // ResourceCompiler |
|
2839 xml << tool.Configuration.resource; |
|
2840 |
|
2841 // Post build event |
|
2842 if ( tool.Configuration.postBuild.UseInBuild != unset ) |
|
2843 xml << tool.Configuration.postBuild; |
|
2844 |
|
2845 // Pre build event |
|
2846 if ( tool.Configuration.preBuild.UseInBuild != unset ) |
|
2847 xml << tool.Configuration.preBuild; |
|
2848 |
|
2849 // Pre link event |
|
2850 if ( tool.Configuration.preLink.UseInBuild != unset ) |
|
2851 xml << tool.Configuration.preLink; |
|
2852 |
|
2853 xml << closetag(); |
|
2854 |
|
2855 QFile filterFile; |
|
2856 filterFile.setFileName(Option::output.fileName().append(".filters")); |
|
2857 filterFile.open(QIODevice::WriteOnly | QIODevice::Text | QIODevice::Truncate); |
|
2858 QTextStream ts(&filterFile); |
|
2859 XmlOutput xmlFilter(ts, XmlOutput::NoConversion); |
|
2860 |
|
2861 xmlFilter.setIndentString(" "); |
|
2862 |
|
2863 xmlFilter << decl("1.0", "utf-8") |
|
2864 << tag("Project") |
|
2865 << attrTag("ToolsVersion", "4.0") |
|
2866 << attrTag("xmlns", "http://schemas.microsoft.com/developer/msbuild/2003"); |
|
2867 |
|
2868 xmlFilter << tag("ItemGroup"); |
|
2869 |
|
2870 VCXProject tempProj; |
|
2871 tempProj.SingleProjects += tool; |
|
2872 |
|
2873 tempProj.addFilters(xmlFilter, "Form Files"); |
|
2874 tempProj.addFilters(xmlFilter, "Generated Files"); |
|
2875 tempProj.addFilters(xmlFilter, "Header Files"); |
|
2876 tempProj.addFilters(xmlFilter, "LexYacc Files"); |
|
2877 tempProj.addFilters(xmlFilter, "Resource Files"); |
|
2878 tempProj.addFilters(xmlFilter, "Source Files"); |
|
2879 tempProj.addFilters(xmlFilter, "Translation Files"); |
|
2880 xmlFilter << closetag(); |
|
2881 |
|
2882 tempProj.outputFilter(xml, xmlFilter, "Source Files"); |
|
2883 tempProj.outputFilter(xml, xmlFilter, "Header Files"); |
|
2884 tempProj.outputFilter(xml, xmlFilter, "Generated Files"); |
|
2885 tempProj.outputFilter(xml, xmlFilter, "LexYacc Files"); |
|
2886 tempProj.outputFilter(xml, xmlFilter, "Translation Files"); |
|
2887 tempProj.outputFilter(xml, xmlFilter, "Form Files"); |
|
2888 tempProj.outputFilter(xml, xmlFilter, "Resource Files"); |
|
2889 |
|
2890 for (int x = 0; x < tempProj.ExtraCompilers.count(); ++x) { |
|
2891 tempProj.outputFilter(xml, xmlFilter, tempProj.ExtraCompilers.at(x)); |
|
2892 } |
|
2893 |
|
2894 xml << import("Project", "$(VCTargetsPath)\\Microsoft.Cpp.targets"); |
|
2895 |
|
2896 xml << tag("ImportGroup") |
|
2897 << attrTag("Label", "ExtensionTargets") |
|
2898 << closetag(); |
|
2899 |
|
2900 return xml; |
|
2901 } |
|
2902 |
|
2903 |
|
2904 // Tree file generation --------------------------------------------- |
|
2905 void XTreeNode::generateXML(XmlOutput &xml, XmlOutput &xmlFilter, const QString &tagName, VCXProject &tool, const QString &filter) { |
|
2906 |
|
2907 if (children.size()) { |
|
2908 // Filter |
|
2909 ChildrenMap::ConstIterator it, end = children.constEnd(); |
|
2910 if (!tagName.isEmpty()) { |
|
2911 xmlFilter << tag("Filter") |
|
2912 << attrTag("Include", tagName) |
|
2913 << attrTagS("Extensions", ""); |
|
2914 } |
|
2915 // First round, do nested filters |
|
2916 for (it = children.constBegin(); it != end; ++it) |
|
2917 if ((*it)->children.size()) |
|
2918 (*it)->generateXML(xml, xmlFilter, it.key(), tool, filter); |
|
2919 // Second round, do leafs |
|
2920 for (it = children.constBegin(); it != end; ++it) |
|
2921 if (!(*it)->children.size()) |
|
2922 (*it)->generateXML(xml, xmlFilter, it.key(), tool, filter); |
|
2923 |
|
2924 if (!tagName.isEmpty()) |
|
2925 xml << closetag("Filter"); |
|
2926 } else { |
|
2927 // Leaf |
|
2928 tool.outputFileConfigs(xml, xmlFilter, info, filter); |
|
2929 } |
|
2930 } |
|
2931 |
|
2932 |
|
2933 // Flat file generation --------------------------------------------- |
|
2934 void XFlatNode::generateXML(XmlOutput &xml, XmlOutput &xmlFilter, const QString &/*tagName*/, VCXProject &tool, const QString &filter) { |
|
2935 if (children.size()) { |
|
2936 ChildrenMapFlat::ConstIterator it = children.constBegin(); |
|
2937 ChildrenMapFlat::ConstIterator end = children.constEnd(); |
|
2938 xml << tag(_ItemGroup); |
|
2939 xmlFilter << tag(_ItemGroup); |
|
2940 for (; it != end; ++it) { |
|
2941 tool.outputFileConfigs(xml, xmlFilter, (*it), filter); |
|
2942 } |
|
2943 xml << closetag(); |
|
2944 xmlFilter << closetag(); |
|
2945 } |
|
2946 } |
|
2947 |
|
2948 |
|
2949 // VCXProject -------------------------------------------------------- |
|
2950 // Output all configurations (by filtername) for a file (by info) |
|
2951 // A filters config output is in VCXFilter.outputFileConfig() |
|
2952 void VCXProject::outputFileConfigs(XmlOutput &xml, |
|
2953 XmlOutput &xmlFilter, |
|
2954 const VCXFilterFile &info, |
|
2955 const QString &filtername) |
|
2956 { |
|
2957 // We need to check if the file has any custom build step. |
|
2958 // If there is one then it has to be included with "CustomBuild Include" |
|
2959 bool fileAdded = false; |
|
2960 |
|
2961 for (int i = 0; i < SingleProjects.count(); ++i) { |
|
2962 VCXFilter filter; |
|
2963 if (filtername == "Root Files") { |
|
2964 filter = SingleProjects.at(i).RootFiles; |
|
2965 } else if (filtername == "Source Files") { |
|
2966 filter = SingleProjects.at(i).SourceFiles; |
|
2967 } else if (filtername == "Header Files") { |
|
2968 filter = SingleProjects.at(i).HeaderFiles; |
|
2969 } else if (filtername == "Generated Files") { |
|
2970 filter = SingleProjects.at(i).GeneratedFiles; |
|
2971 } else if (filtername == "LexYacc Files") { |
|
2972 filter = SingleProjects.at(i).LexYaccFiles; |
|
2973 } else if (filtername == "Translation Files") { |
|
2974 filter = SingleProjects.at(i).TranslationFiles; |
|
2975 } else if (filtername == "Form Files") { |
|
2976 filter = SingleProjects.at(i).FormFiles; |
|
2977 } else if (filtername == "Resource Files") { |
|
2978 filter = SingleProjects.at(i).ResourceFiles; |
|
2979 } else { |
|
2980 // ExtraCompilers |
|
2981 filter = SingleProjects[i].filterForExtraCompiler(filtername); |
|
2982 } |
|
2983 |
|
2984 if (filter.Config) // only if the filter is not empty |
|
2985 if (filter.outputFileConfig(xml, xmlFilter, info.file, filtername, fileAdded)) // only add it once. |
|
2986 fileAdded = true; |
|
2987 } |
|
2988 |
|
2989 if ( !fileAdded ) |
|
2990 { |
|
2991 if (filtername == "Source Files") { |
|
2992 |
|
2993 xmlFilter << tag("ClCompile") |
|
2994 << attrTag("Include",Option::fixPathToLocalOS(info.file)) |
|
2995 << attrTagS("Filter", filtername); |
|
2996 |
|
2997 xml << tag("ClCompile") |
|
2998 << attrTag("Include",Option::fixPathToLocalOS(info.file)); |
|
2999 |
|
3000 } else if(filtername == "Header Files") { |
|
3001 |
|
3002 xmlFilter << tag("ClInclude") |
|
3003 << attrTag("Include",Option::fixPathToLocalOS(info.file)) |
|
3004 << attrTagS("Filter", filtername); |
|
3005 |
|
3006 xml << tag("ClInclude") |
|
3007 << attrTag("Include",Option::fixPathToLocalOS(info.file)); |
|
3008 } else if(filtername == "Generated Files" || filtername == "Form Files") { |
|
3009 |
|
3010 if (info.file.endsWith(".h")) { |
|
3011 |
|
3012 xmlFilter << tag("ClInclude") |
|
3013 << attrTag("Include",Option::fixPathToLocalOS(info.file)) |
|
3014 << attrTagS("Filter", filtername); |
|
3015 |
|
3016 xml << tag("ClInclude") |
|
3017 << attrTag("Include",Option::fixPathToLocalOS(info.file)); |
|
3018 } else if(info.file.endsWith(".cpp")) { |
|
3019 |
|
3020 xmlFilter << tag("ClCompile") |
|
3021 << attrTag("Include",Option::fixPathToLocalOS(info.file)) |
|
3022 << attrTagS("Filter", filtername); |
|
3023 |
|
3024 xml << tag("ClCompile") |
|
3025 << attrTag("Include",Option::fixPathToLocalOS(info.file)); |
|
3026 } else { |
|
3027 |
|
3028 xmlFilter << tag("CustomBuild") |
|
3029 << attrTag("Include",Option::fixPathToLocalOS(info.file)) |
|
3030 << attrTagS("Filter", filtername); |
|
3031 |
|
3032 xml << tag("CustomBuild") |
|
3033 << attrTag("Include",Option::fixPathToLocalOS(info.file)); |
|
3034 } |
|
3035 |
|
3036 } else { |
|
3037 |
|
3038 xmlFilter << tag("None") |
|
3039 << attrTag("Include",Option::fixPathToLocalOS(info.file)) |
|
3040 << attrTagS("Filter", filtername); |
|
3041 |
|
3042 xml << tag("None") |
|
3043 << attrTag("Include",Option::fixPathToLocalOS(info.file)); |
|
3044 } |
|
3045 } |
|
3046 |
|
3047 xml << closetag(); |
|
3048 xmlFilter << closetag(); |
|
3049 } |
|
3050 |
|
3051 // outputs a given filter for all existing configurations of a project |
|
3052 void VCXProject::outputFilter(XmlOutput &xml, |
|
3053 XmlOutput &xmlFilter, |
|
3054 const QString &filtername) |
|
3055 { |
|
3056 XNode *root; |
|
3057 if (SingleProjects.at(0).flat_files) |
|
3058 root = new XFlatNode; |
|
3059 else |
|
3060 root = new XTreeNode; |
|
3061 |
|
3062 QString name, extfilter; |
|
3063 triState parse; |
|
3064 |
|
3065 for (int i = 0; i < SingleProjects.count(); ++i) { |
|
3066 VCXFilter filter; |
|
3067 if (filtername == "Root Files") { |
|
3068 filter = SingleProjects.at(i).RootFiles; |
|
3069 } else if (filtername == "Source Files") { |
|
3070 filter = SingleProjects.at(i).SourceFiles; |
|
3071 } else if (filtername == "Header Files") { |
|
3072 filter = SingleProjects.at(i).HeaderFiles; |
|
3073 } else if (filtername == "Generated Files") { |
|
3074 filter = SingleProjects.at(i).GeneratedFiles; |
|
3075 } else if (filtername == "LexYacc Files") { |
|
3076 filter = SingleProjects.at(i).LexYaccFiles; |
|
3077 } else if (filtername == "Translation Files") { |
|
3078 filter = SingleProjects.at(i).TranslationFiles; |
|
3079 } else if (filtername == "Form Files") { |
|
3080 filter = SingleProjects.at(i).FormFiles; |
|
3081 } else if (filtername == "Resource Files") { |
|
3082 filter = SingleProjects.at(i).ResourceFiles; |
|
3083 } else { |
|
3084 // ExtraCompilers |
|
3085 filter = SingleProjects[i].filterForExtraCompiler(filtername); |
|
3086 } |
|
3087 |
|
3088 // Merge all files in this filter to root tree |
|
3089 for (int x = 0; x < filter.Files.count(); ++x) |
|
3090 root->addElement(filter.Files.at(x)); |
|
3091 |
|
3092 // Save filter setting from first filter. Next filters |
|
3093 // may differ but we cannot handle that. (ex. extfilter) |
|
3094 if (name.isEmpty()) { |
|
3095 name = filter.Name; |
|
3096 extfilter = filter.Filter; |
|
3097 parse = filter.ParseFiles; |
|
3098 } |
|
3099 } |
|
3100 |
|
3101 if (!root->hasElements()) |
|
3102 return; |
|
3103 |
|
3104 root->generateXML(xml, xmlFilter, "", *this, filtername); // output root tree |
|
3105 } |
|
3106 |
|
3107 |
|
3108 void VCXProject::addFilters(XmlOutput &xmlFilter, |
|
3109 const QString &filtername) |
|
3110 { |
|
3111 bool added = false; |
|
3112 |
|
3113 for (int i = 0; i < SingleProjects.count(); ++i) { |
|
3114 VCXFilter filter; |
|
3115 if (filtername == "Root Files") { |
|
3116 filter = SingleProjects.at(i).RootFiles; |
|
3117 } else if (filtername == "Source Files") { |
|
3118 filter = SingleProjects.at(i).SourceFiles; |
|
3119 } else if (filtername == "Header Files") { |
|
3120 filter = SingleProjects.at(i).HeaderFiles; |
|
3121 } else if (filtername == "Generated Files") { |
|
3122 filter = SingleProjects.at(i).GeneratedFiles; |
|
3123 } else if (filtername == "LexYacc Files") { |
|
3124 filter = SingleProjects.at(i).LexYaccFiles; |
|
3125 } else if (filtername == "Translation Files") { |
|
3126 filter = SingleProjects.at(i).TranslationFiles; |
|
3127 } else if (filtername == "Form Files") { |
|
3128 filter = SingleProjects.at(i).FormFiles; |
|
3129 } else if (filtername == "Resource Files") { |
|
3130 filter = SingleProjects.at(i).ResourceFiles; |
|
3131 } else { |
|
3132 // ExtraCompilers |
|
3133 filter = SingleProjects[i].filterForExtraCompiler(filtername); |
|
3134 } |
|
3135 |
|
3136 if(!filter.Files.isEmpty() && !added) { |
|
3137 added = true; |
|
3138 xmlFilter << tag("Filter") |
|
3139 << attrTag("Include", filtername) |
|
3140 << attrTagS("UniqueIdentifier", filter.Guid) |
|
3141 << attrTagS("Extensions", filter.Filter) |
|
3142 << attrTagT("ParseFiles", filter.ParseFiles) |
|
3143 << closetag(); |
|
3144 } |
|
3145 } |
|
3146 } |
|
3147 |
|
3148 |
|
3149 XmlOutput &operator<<(XmlOutput &xml, VCXProject &tool) |
|
3150 { |
|
3151 |
|
3152 if (tool.SingleProjects.count() == 0) { |
|
3153 warn_msg(WarnLogic, "Generator: .NET: no single project in merge project, no output"); |
|
3154 return xml; |
|
3155 } |
|
3156 |
|
3157 xml.setIndentString(" "); |
|
3158 |
|
3159 xml << decl("1.0", "utf-8") |
|
3160 << tag("Project") |
|
3161 << attrTag("DefaultTargets","Build") |
|
3162 << attrTag("ToolsVersion", "4.0") |
|
3163 << attrTag("xmlns", "http://schemas.microsoft.com/developer/msbuild/2003") |
|
3164 << tag("ItemGroup") |
|
3165 << attrTag("Label", "ProjectConfigurations"); |
|
3166 |
|
3167 for (int i = 0; i < tool.SingleProjects.count(); ++i) { |
|
3168 xml << tag("ProjectConfiguration") |
|
3169 << attrTag("Include" , tool.SingleProjects.at(i).Configuration.Name) |
|
3170 << tagValue("Configuration", tool.SingleProjects.at(i).Configuration.ConfigurationName) |
|
3171 << tagValue("Platform", tool.SingleProjects.at(i).PlatformName) |
|
3172 << closetag(); |
|
3173 } |
|
3174 |
|
3175 xml << closetag() |
|
3176 << tag("PropertyGroup") |
|
3177 << attrTag("Label", "Globals") |
|
3178 << tagValue("ProjectGuid", tool.ProjectGUID) |
|
3179 << tagValue("RootNamespace", tool.Name) |
|
3180 << tagValue("Keyword", tool.Keyword) |
|
3181 << closetag(); |
|
3182 |
|
3183 // config part. |
|
3184 xml << import("Project", "$(VCTargetsPath)\\Microsoft.Cpp.Default.props"); |
|
3185 for (int i = 0; i < tool.SingleProjects.count(); ++i) |
|
3186 xml << tool.SingleProjects.at(i).Configuration; |
|
3187 xml << import("Project", "$(VCTargetsPath)\\Microsoft.Cpp.props"); |
|
3188 |
|
3189 // Extension settings |
|
3190 xml << tag("ImportGroup") |
|
3191 << attrTag("Label", "ExtensionSettings") |
|
3192 << closetag(); |
|
3193 |
|
3194 // PropertySheets |
|
3195 for (int i = 0; i < tool.SingleProjects.count(); ++i) { |
|
3196 xml << tag("ImportGroup") |
|
3197 << attrTag("Condition", QString("'$(Configuration)|$(Platform)'=='%1'").arg(tool.SingleProjects.at(i).Configuration.Name)) |
|
3198 << attrTag("Label", "PropertySheets"); |
|
3199 |
|
3200 xml << tag("Import") |
|
3201 << attrTag("Project", "$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props") |
|
3202 << attrTag("Condition", "exists('$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props')") |
|
3203 << closetag() |
|
3204 << closetag(); |
|
3205 } |
|
3206 |
|
3207 // UserMacros |
|
3208 xml << tag("PropertyGroup") |
|
3209 << attrTag("Label", "UserMacros") |
|
3210 << closetag(); |
|
3211 |
|
3212 xml << tag("PropertyGroup"); |
|
3213 for (int i = 0; i < tool.SingleProjects.count(); ++i) { |
|
3214 |
|
3215 if ( !tool.SingleProjects.at(i).Configuration.OutputDirectory.isEmpty() ) { |
|
3216 xml << tag("OutDir") |
|
3217 << attrTag("Condition", QString("'$(Configuration)|$(Platform)'=='%1'").arg(tool.SingleProjects.at(i).Configuration.Name)) |
|
3218 << valueTag(tool.SingleProjects.at(i).Configuration.OutputDirectory); |
|
3219 } |
|
3220 if ( !tool.SingleProjects.at(i).Configuration.IntermediateDirectory.isEmpty() ) { |
|
3221 xml << tag("IntDir") |
|
3222 << attrTag("Condition", QString("'$(Configuration)|$(Platform)'=='%1'").arg(tool.SingleProjects.at(i).Configuration.Name)) |
|
3223 << valueTag(tool.SingleProjects.at(i).Configuration.IntermediateDirectory); |
|
3224 } |
|
3225 if ( !tool.SingleProjects.at(i).Configuration.TargetName.isEmpty() ) { |
|
3226 xml << tag("TargetName") |
|
3227 << attrTag("Condition", QString("'$(Configuration)|$(Platform)'=='%1'").arg(tool.SingleProjects.at(i).Configuration.Name)) |
|
3228 << valueTag(tool.SingleProjects.at(i).Configuration.TargetName); |
|
3229 } |
|
3230 |
|
3231 if ( tool.SingleProjects.at(i).Configuration.linker.IgnoreImportLibrary != unset) { |
|
3232 xml << tag("IgnoreImportLibrary") |
|
3233 << attrTag("Condition", QString("'$(Configuration)|$(Platform)'=='%1'").arg(tool.SingleProjects.at(i).Configuration.Name)) |
|
3234 << valueTagT(tool.SingleProjects.at(i).Configuration.linker.IgnoreImportLibrary); |
|
3235 } |
|
3236 |
|
3237 if ( tool.SingleProjects.at(i).Configuration.linker.LinkIncremental != unset) { |
|
3238 xml << tag("LinkIncremental") |
|
3239 << attrTag("Condition", QString("'$(Configuration)|$(Platform)'=='%1'").arg(tool.SingleProjects.at(i).Configuration.Name)) |
|
3240 << valueTagT(tool.SingleProjects.at(i).Configuration.linker.LinkIncremental); |
|
3241 } |
|
3242 |
|
3243 if ( tool.SingleProjects.at(i).Configuration.preBuild.UseInBuild != unset ) |
|
3244 { |
|
3245 xml << tag("PreBuildEventUseInBuild") |
|
3246 << attrTag("Condition", QString("'$(Configuration)|$(Platform)'=='%1'").arg(tool.SingleProjects.at(i).Configuration.Name)) |
|
3247 << valueTagT(tool.SingleProjects.at(i).Configuration.preBuild.UseInBuild); |
|
3248 } |
|
3249 |
|
3250 if ( tool.SingleProjects.at(i).Configuration.preLink.UseInBuild != unset ) |
|
3251 { |
|
3252 xml << tag("PreLinkEventUseInBuild") |
|
3253 << attrTag("Condition", QString("'$(Configuration)|$(Platform)'=='%1'").arg(tool.SingleProjects.at(i).Configuration.Name)) |
|
3254 << valueTagT(tool.SingleProjects.at(i).Configuration.preLink.UseInBuild); |
|
3255 } |
|
3256 |
|
3257 if ( tool.SingleProjects.at(i).Configuration.postBuild.UseInBuild != unset ) |
|
3258 { |
|
3259 xml << tag("PostBuildEventUseInBuild") |
|
3260 << attrTag("Condition", QString("'$(Configuration)|$(Platform)'=='%1'").arg(tool.SingleProjects.at(i).Configuration.Name)) |
|
3261 << valueTagT(tool.SingleProjects.at(i).Configuration.postBuild.UseInBuild); |
|
3262 } |
|
3263 } |
|
3264 xml << closetag(); |
|
3265 |
|
3266 for (int i = 0; i < tool.SingleProjects.count(); ++i) { |
|
3267 xml << tag("ItemDefinitionGroup") |
|
3268 << attrTag("Condition", QString("'$(Configuration)|$(Platform)'=='%1'").arg(tool.SingleProjects.at(i).Configuration.Name)); |
|
3269 |
|
3270 // ClCompile |
|
3271 xml << tool.SingleProjects.at(i).Configuration.compiler; |
|
3272 |
|
3273 // Link |
|
3274 xml << tool.SingleProjects.at(i).Configuration.linker; |
|
3275 |
|
3276 // Midl |
|
3277 xml << tool.SingleProjects.at(i).Configuration.idl; |
|
3278 |
|
3279 // ResourceCompiler |
|
3280 xml << tool.SingleProjects.at(i).Configuration.resource; |
|
3281 |
|
3282 // Post build event |
|
3283 if ( tool.SingleProjects.at(i).Configuration.postBuild.UseInBuild != unset ) |
|
3284 xml << tool.SingleProjects.at(i).Configuration.postBuild; |
|
3285 |
|
3286 // Pre build event |
|
3287 if ( tool.SingleProjects.at(i).Configuration.preBuild.UseInBuild != unset ) |
|
3288 xml << tool.SingleProjects.at(i).Configuration.preBuild; |
|
3289 |
|
3290 // Pre link event |
|
3291 if ( tool.SingleProjects.at(i).Configuration.preLink.UseInBuild != unset ) |
|
3292 xml << tool.SingleProjects.at(i).Configuration.preLink; |
|
3293 |
|
3294 xml << closetag(); |
|
3295 } |
|
3296 |
|
3297 // The file filters are added in a separate file for MSBUILD. |
|
3298 QFile filterFile; |
|
3299 filterFile.setFileName(Option::output.fileName().append(".filters")); |
|
3300 filterFile.open(QIODevice::WriteOnly | QIODevice::Text | QIODevice::Truncate); |
|
3301 QTextStream ts(&filterFile); |
|
3302 XmlOutput xmlFilter(ts, XmlOutput::NoConversion); |
|
3303 |
|
3304 xmlFilter.setIndentString(" "); |
|
3305 |
|
3306 xmlFilter << decl("1.0", "utf-8") |
|
3307 << tag("Project") |
|
3308 << attrTag("ToolsVersion", "4.0") |
|
3309 << attrTag("xmlns", "http://schemas.microsoft.com/developer/msbuild/2003"); |
|
3310 |
|
3311 xmlFilter << tag("ItemGroup"); |
|
3312 |
|
3313 tool.addFilters(xmlFilter, "Form Files"); |
|
3314 tool.addFilters(xmlFilter, "Generated Files"); |
|
3315 tool.addFilters(xmlFilter, "Header Files"); |
|
3316 tool.addFilters(xmlFilter, "LexYacc Files"); |
|
3317 tool.addFilters(xmlFilter, "Resource Files"); |
|
3318 tool.addFilters(xmlFilter, "Source Files"); |
|
3319 tool.addFilters(xmlFilter, "Translation Files"); |
|
3320 xmlFilter << closetag(); |
|
3321 |
|
3322 tool.outputFilter(xml, xmlFilter, "Source Files"); |
|
3323 tool.outputFilter(xml, xmlFilter, "Header Files"); |
|
3324 tool.outputFilter(xml, xmlFilter, "Generated Files"); |
|
3325 tool.outputFilter(xml, xmlFilter, "LexYacc Files"); |
|
3326 tool.outputFilter(xml, xmlFilter, "Translation Files"); |
|
3327 tool.outputFilter(xml, xmlFilter, "Form Files"); |
|
3328 tool.outputFilter(xml, xmlFilter, "Resource Files"); |
|
3329 for (int x = 0; x < tool.ExtraCompilers.count(); ++x) { |
|
3330 tool.outputFilter(xml, xmlFilter, tool.ExtraCompilers.at(x)); |
|
3331 } |
|
3332 |
|
3333 xml << import("Project", "$(VCTargetsPath)\\Microsoft.Cpp.targets"); |
|
3334 |
|
3335 xml << tag("ImportGroup") |
|
3336 << attrTag("Label", "ExtensionTargets") |
|
3337 << closetag(); |
|
3338 |
|
3339 return xml; |
|
3340 } |
|
3341 |
|
3342 QT_END_NAMESPACE |