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