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