1 | // Copyright (C) 2016 The Qt Company Ltd. |
2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 |
3 | |
4 | #ifndef MSVC_OBJECTMODEL_H |
5 | #define MSVC_OBJECTMODEL_H |
6 | |
7 | #include "project.h" |
8 | #include "xmloutput.h" |
9 | |
10 | #include <proitems.h> |
11 | |
12 | #include <qlist.h> |
13 | #include <qstring.h> |
14 | #include <qstringlist.h> |
15 | #include <qmap.h> |
16 | #include <qdebug.h> |
17 | |
18 | QT_BEGIN_NAMESPACE |
19 | |
20 | enum DotNET { |
21 | NETUnknown = 0, |
22 | NET2002 = 0x70, |
23 | NET2003 = 0x71, |
24 | NET2005 = 0x80, |
25 | NET2008 = 0x90, |
26 | NET2010 = 0xa0, |
27 | NET2012 = 0xb0, |
28 | NET2013 = 0xc0, |
29 | NET2015 = 0xd0, |
30 | NET2017 = 0xe0, |
31 | NET2019, |
32 | NET2022 |
33 | }; |
34 | |
35 | DotNET vsVersionFromString(const ProString &versionString); |
36 | |
37 | /* |
38 | This Object model is of course VERY simplyfied, |
39 | and does not actually follow the original MSVC |
40 | object model. However, it fulfilles the basic |
41 | needs for qmake |
42 | */ |
43 | |
44 | /* |
45 | If a triState value is 'unset' then the |
46 | corresponding property is not in the output, |
47 | forcing the tool to utilize default values. |
48 | False/True values will be in the output... |
49 | */ |
50 | enum triState { |
51 | unset = -1, |
52 | _False = 0, |
53 | _True = 1 |
54 | }; |
55 | |
56 | triState operator!(const triState &rhs); |
57 | |
58 | enum addressAwarenessType { |
59 | addrAwareDefault, |
60 | addrAwareNoLarge, |
61 | addrAwareLarge |
62 | }; |
63 | enum asmListingOption { |
64 | asmListingNone, |
65 | asmListingAssemblyOnly, |
66 | asmListingAsmMachineSrc, |
67 | asmListingAsmMachine, |
68 | asmListingAsmSrc |
69 | }; |
70 | enum basicRuntimeCheckOption { |
71 | runtimeBasicCheckNone = 0, |
72 | runtimeCheckStackFrame = 1, |
73 | runtimeCheckUninitVariables = 2, |
74 | runtimeBasicCheckAll = runtimeCheckStackFrame | runtimeCheckUninitVariables |
75 | }; |
76 | enum browseInfoOption { |
77 | brInfoNone, |
78 | brAllInfo, |
79 | brNoLocalSymbols |
80 | }; |
81 | enum callingConventionOption { |
82 | callConventionDefault = -1, |
83 | callConventionCDecl, |
84 | callConventionFastCall, |
85 | callConventionStdCall |
86 | }; |
87 | enum charSet { |
88 | charSetNotSet, |
89 | charSetUnicode, |
90 | charSetMBCS |
91 | }; |
92 | enum compileAsManagedOptions { |
93 | managedDefault = -1, // Was: noAssembly |
94 | managedAssembly = 1, |
95 | managedAssemblyPure = 2, // Old was: Assembly |
96 | managedAssemblySafe = 3, |
97 | managedAssemblyOldSyntax = 4 |
98 | }; |
99 | enum CompileAsOptions{ |
100 | compileAsDefault, |
101 | compileAsC, |
102 | compileAsCPlusPlus |
103 | }; |
104 | enum ConfigurationTypes { |
105 | typeUnknown = 0, |
106 | typeApplication = 1, |
107 | typeDynamicLibrary = 2, |
108 | typeStaticLibrary = 4, |
109 | typeGeneric = 10 |
110 | }; |
111 | enum debugOption { |
112 | debugUnknown = -1, |
113 | debugDisabled, |
114 | debugOldStyleInfo, |
115 | debugLineInfoOnly, |
116 | debugEnabled, |
117 | debugEditAndContinue |
118 | }; |
119 | enum eAppProtectionOption { |
120 | eAppProtectUnchanged, |
121 | eAppProtectLow, |
122 | eAppProtectMedium, |
123 | eAppProtectHigh |
124 | }; |
125 | enum enhancedInstructionSetOption { |
126 | archNotSet = 0, |
127 | archSSE = 1, |
128 | archSSE2 = 2 |
129 | }; |
130 | enum exceptionHandling { |
131 | ehDefault = -1, |
132 | ehNone = 0, |
133 | ehNoSEH = 1, |
134 | ehSEH = 2 |
135 | }; |
136 | enum enumResourceLangID { |
137 | rcUseDefault = 0, |
138 | rcAfrikaans = 1078, |
139 | rcAlbanian = 1052, |
140 | rcArabicAlgeria = 5121, |
141 | rcArabicBahrain = 15361, |
142 | rcArabicEgypt = 3073, |
143 | rcArabicIraq = 2049, |
144 | rcArabicJordan = 11265, |
145 | rcArabicKuwait = 13313, |
146 | rcArabicLebanon = 12289, |
147 | rcArabicLibya = 4097, |
148 | rcArabicMorocco = 6145, |
149 | rcArabicOman = 8193, |
150 | rcArabicQatar = 16385, |
151 | rcArabicSaudi = 1025, |
152 | rcArabicSyria = 10241, |
153 | rcArabicTunisia = 7169, |
154 | rcArabicUnitedArabEmirates = 14337, |
155 | rcArabicYemen = 9217, |
156 | rcBasque = 1069, |
157 | rcBulgarian = 1026, |
158 | rcByelorussian = 1059, |
159 | rcCatalan = 1027, |
160 | rcChineseHongKong = 3076, |
161 | rcChinesePRC = 2052, |
162 | rcChineseSingapore = 4100, |
163 | rcChineseTaiwan = 1028, |
164 | rcCroatian = 1050, |
165 | rcCzech = 1029, |
166 | rcDanish = 1030, |
167 | rcDutchBelgium = 2067, |
168 | rcDutchStandard = 1043, |
169 | rcEnglishAustralia = 3081, |
170 | rcEnglishBritain = 2057, |
171 | rcEnglishCanada = 4105, |
172 | RcEnglishCaribbean = 9225, |
173 | rcEnglishIreland = 6153, |
174 | rcEnglishJamaica = 8201, |
175 | rcEnglishNewZealand = 5129, |
176 | rcEnglishSouthAfrica = 7177, |
177 | rcEnglishUS = 1033, |
178 | rcEstonian = 1061, |
179 | rcFarsi = 1065, |
180 | rcFinnish = 1035, |
181 | rcFrenchBelgium = 2060, |
182 | rcFrenchCanada = 3084, |
183 | rcFrenchLuxembourg = 5132, |
184 | rcFrenchStandard = 1036, |
185 | rcFrenchSwitzerland = 4108, |
186 | rcGermanAustria = 3079, |
187 | rcGermanLichtenstein = 5127, |
188 | rcGermanLuxembourg = 4103, |
189 | rcGermanStandard = 1031, |
190 | rcGermanSwitzerland = 2055, |
191 | rcGreek = 1032, |
192 | rcHebrew = 1037, |
193 | rcHungarian = 1038, |
194 | rcIcelandic = 1039, |
195 | rcIndonesian = 1057, |
196 | rcItalianStandard = 1040, |
197 | rcItalianSwitzerland = 2064, |
198 | rcJapanese = 1041, |
199 | rcKorean = 1042, |
200 | rcKoreanJohab = 2066, |
201 | rcLatvian = 1062, |
202 | rcLithuanian = 1063, |
203 | rcNorwegianBokmal = 1044, |
204 | rcNorwegianNynorsk = 2068, |
205 | rcPolish = 1045, |
206 | rcPortugueseBrazilian = 1046, |
207 | rcPortugueseStandard = 2070, |
208 | rcRomanian = 1048, |
209 | rcRussian = 1049, |
210 | rcSerbian = 2074, |
211 | rcSlovak = 1051, |
212 | rcSpanishArgentina = 11274, |
213 | rcSpanishBolivia = 16394, |
214 | rcSpanishChile = 13322, |
215 | rcSpanishColombia = 9226, |
216 | rcSpanishCostaRica = 5130, |
217 | rcSpanishDominicanRepublic = 7178, |
218 | rcSpanishEcuador = 12298, |
219 | rcSpanishGuatemala = 4106, |
220 | rcSpanishMexico = 2058, |
221 | rcSpanishModern = 3082, |
222 | rcSpanishPanama = 6154, |
223 | rcSpanishParaguay = 15370, |
224 | rcSpanishPeru = 10250, |
225 | rcSpanishTraditional = 1034, |
226 | rcSpanishUruguay = 14346, |
227 | rcSpanishVenezuela = 8202, |
228 | rcSwedish = 1053, |
229 | rcThai = 1054, |
230 | rcTurkish = 1055, |
231 | rcUkrainian = 1058, |
232 | rcUrdu = 1056 |
233 | }; |
234 | enum enumSccEvent { |
235 | eProjectInScc, |
236 | ePreDirtyNotification |
237 | }; |
238 | enum favorSizeOrSpeedOption { |
239 | favorNone, |
240 | favorSpeed, |
241 | favorSize |
242 | }; |
243 | enum floatingPointModel { |
244 | floatingPointNotSet = -1, |
245 | floatingPointPrecise, |
246 | floatingPointStrict, |
247 | floatingPointFast |
248 | }; |
249 | enum genProxyLanguage { |
250 | genProxyNative, |
251 | genProxyManaged |
252 | }; |
253 | enum inlineExpansionOption { |
254 | expandDisable, |
255 | expandOnlyInline, |
256 | expandAnySuitable, |
257 | expandDefault // Not useful number, but stops the output |
258 | }; |
259 | enum linkerDebugOption { |
260 | linkerDebugOptionNone, |
261 | linkerDebugOptionEnabled, // represents /DEBUG without further options |
262 | linkerDebugOptionFastLink, |
263 | linkerDebugOptionFull |
264 | }; |
265 | enum linkIncrementalType { |
266 | linkIncrementalDefault, |
267 | linkIncrementalNo, |
268 | linkIncrementalYes |
269 | }; |
270 | enum linkProgressOption { |
271 | linkProgressNotSet, |
272 | linkProgressAll, |
273 | linkProgressLibs |
274 | }; |
275 | enum machineTypeOption { |
276 | machineNotSet, |
277 | machineX86, |
278 | machineX64 = 17 |
279 | }; |
280 | enum midlCharOption { |
281 | midlCharUnsigned, |
282 | midlCharSigned, |
283 | midlCharAscii7 |
284 | }; |
285 | enum midlErrorCheckOption { |
286 | midlEnableCustom, |
287 | midlDisableAll, |
288 | midlEnableAll |
289 | }; |
290 | enum midlStructMemberAlignOption { |
291 | midlAlignNotSet, |
292 | midlAlignSingleByte, |
293 | midlAlignTwoBytes, |
294 | midlAlignFourBytes, |
295 | midlAlignEightBytes, |
296 | midlAlignSixteenBytes |
297 | }; |
298 | enum midlTargetEnvironment { |
299 | midlTargetNotSet, |
300 | midlTargetWin32, |
301 | midlTargetWin64 |
302 | }; |
303 | enum midlWarningLevelOption { |
304 | midlWarningLevel_0, |
305 | midlWarningLevel_1, |
306 | midlWarningLevel_2, |
307 | midlWarningLevel_3, |
308 | midlWarningLevel_4 |
309 | }; |
310 | enum optFoldingType { |
311 | optFoldingDefault, |
312 | optNoFolding, |
313 | optFolding |
314 | }; |
315 | enum optimizeOption { |
316 | optimizeDisabled, |
317 | optimizeMinSpace, |
318 | optimizeMaxSpeed, |
319 | optimizeFull, |
320 | optimizeCustom, |
321 | optimizeDefault // Not useful number, but stops the output |
322 | }; |
323 | enum optRefType { |
324 | optReferencesDefault, |
325 | optNoReferences, |
326 | optReferences |
327 | }; |
328 | enum optWin98Type { |
329 | optWin98Default, |
330 | optWin98No, |
331 | optWin98Yes |
332 | }; |
333 | enum optLinkTimeCodeGenType { |
334 | optLTCGDefault, |
335 | optLTCGEnabled, |
336 | optLTCGIncremental, |
337 | optLTCGInstrument, |
338 | optLTCGOptimize, |
339 | optLTCGUpdate |
340 | }; |
341 | enum pchOption { |
342 | pchUnset = -1, |
343 | pchNone, |
344 | pchCreateUsingSpecific, |
345 | pchGenerateAuto, |
346 | pchUseUsingSpecific |
347 | }; |
348 | enum preprocessOption { |
349 | preprocessUnknown = -1, |
350 | preprocessNo, |
351 | preprocessYes, |
352 | preprocessNoLineNumbers |
353 | }; |
354 | enum ProcessorOptimizeOption { |
355 | procOptimizeBlended, //GB |
356 | procOptimizePentium, //G5 |
357 | procOptimizePentiumProAndAbove, //G6 |
358 | procOptimizePentium4AndAbove //G7 |
359 | }; |
360 | enum RegisterDeployOption { |
361 | registerNo = 0, |
362 | registerYes |
363 | }; |
364 | enum RemoteDebuggerType { |
365 | DbgLocal, |
366 | DbgRemote, |
367 | DbgRemoteTCPIP |
368 | }; |
369 | enum runtimeLibraryOption { |
370 | rtUnknown = -1, |
371 | rtMultiThreaded, |
372 | rtMultiThreadedDebug, |
373 | rtMultiThreadedDLL, |
374 | rtMultiThreadedDebugDLL, |
375 | rtSingleThreaded, |
376 | rtSingleThreadedDebug |
377 | }; |
378 | enum structMemberAlignOption { |
379 | alignNotSet, |
380 | alignSingleByte, |
381 | alignTwoBytes, |
382 | alignFourBytes, |
383 | alignEightBytes, |
384 | alignSixteenBytes |
385 | }; |
386 | enum subSystemOption { |
387 | subSystemNotSet, |
388 | subSystemConsole, |
389 | subSystemWindows |
390 | }; |
391 | enum termSvrAwarenessType { |
392 | termSvrAwareDefault, |
393 | termSvrAwareNo, |
394 | termSvrAwareYes |
395 | }; |
396 | enum toolSetType { |
397 | toolSetUtility, |
398 | toolSetMakefile, |
399 | toolSetLinker, |
400 | toolSetLibrarian, |
401 | toolSetAll |
402 | }; |
403 | enum TypeOfDebugger { |
404 | DbgNativeOnly, |
405 | DbgManagedOnly, |
406 | DbgMixed, |
407 | DbgAuto |
408 | }; |
409 | enum useOfATL { |
410 | useATLNotSet, |
411 | useATLStatic, |
412 | useATLDynamic |
413 | }; |
414 | enum useOfMfc { |
415 | useMfcStdWin, |
416 | useMfcStatic, |
417 | useMfcDynamic |
418 | }; |
419 | enum useOfArchitecture { |
420 | archUnknown = -1, |
421 | archArmv4, |
422 | archArmv5, |
423 | archArmv4T, |
424 | archArmv5T, |
425 | archMips1 = 0, |
426 | archMips2 = 1, |
427 | archMips3 = 2, |
428 | archMips4 = 3, |
429 | archMips5 = 4, |
430 | archMips16 = 5, |
431 | archMips32 = 6, |
432 | archMips64 = 7 |
433 | }; |
434 | enum warningLevelOption { |
435 | warningLevelUnknown = -1, |
436 | warningLevel_0, |
437 | warningLevel_1, |
438 | warningLevel_2, |
439 | warningLevel_3, |
440 | warningLevel_4 |
441 | }; |
442 | |
443 | |
444 | class VCToolBase { |
445 | protected: |
446 | // Functions |
447 | VCToolBase(){} |
448 | virtual ~VCToolBase(){} |
449 | virtual bool parseOption(const char* option) = 0; |
450 | public: |
451 | void parseOptions(const ProStringList& options) { |
452 | for (ProStringList::ConstIterator it=options.begin(); (it!=options.end()); it++) |
453 | parseOption(option: (*it).toLatin1().constData()); |
454 | } |
455 | static QStringList fixCommandLine(const QString &input); |
456 | }; |
457 | |
458 | class VCConfiguration; |
459 | class VCProject; |
460 | |
461 | class VCCLCompilerTool : public VCToolBase |
462 | { |
463 | public: |
464 | // Functions |
465 | VCCLCompilerTool(); |
466 | |
467 | bool parseOption(const char* option) override; |
468 | |
469 | // Variables |
470 | QStringList AdditionalIncludeDirectories; |
471 | QStringList AdditionalOptions; |
472 | QStringList AdditionalUsingDirectories; |
473 | QString AssemblerListingLocation; |
474 | asmListingOption AssemblerOutput; |
475 | basicRuntimeCheckOption BasicRuntimeChecks; |
476 | browseInfoOption BrowseInformation; |
477 | QString BrowseInformationFile; |
478 | triState BufferSecurityCheck; |
479 | callingConventionOption CallingConvention; |
480 | CompileAsOptions CompileAs; |
481 | compileAsManagedOptions CompileAsManaged; |
482 | triState CompileAsWinRT; |
483 | triState CompileOnly; |
484 | debugOption DebugInformationFormat; |
485 | triState DefaultCharIsUnsigned; |
486 | triState Detect64BitPortabilityProblems; |
487 | triState DisableLanguageExtensions; |
488 | QStringList DisableSpecificWarnings; |
489 | enhancedInstructionSetOption EnableEnhancedInstructionSet; |
490 | triState EnableFiberSafeOptimizations; |
491 | triState EnableFunctionLevelLinking; |
492 | triState EnableIntrinsicFunctions; |
493 | exceptionHandling ExceptionHandling; |
494 | triState ExpandAttributedSource; |
495 | favorSizeOrSpeedOption FavorSizeOrSpeed; |
496 | floatingPointModel FloatingPointModel; |
497 | triState FloatingPointExceptions; |
498 | triState ForceConformanceInForLoopScope; |
499 | QStringList ForcedIncludeFiles; |
500 | QStringList ForcedUsingFiles; |
501 | preprocessOption GeneratePreprocessedFile; |
502 | triState PreprocessSuppressLineNumbers; |
503 | triState GlobalOptimizations; |
504 | triState IgnoreStandardIncludePath; |
505 | triState ImproveFloatingPointConsistency; |
506 | inlineExpansionOption InlineFunctionExpansion; |
507 | triState ; |
508 | QString LanguageStandard; |
509 | QString LanguageStandard_C; |
510 | triState MinimalRebuild; |
511 | QString ObjectFile; |
512 | triState OmitDefaultLibName; |
513 | triState OmitFramePointers; |
514 | triState OpenMP; |
515 | optimizeOption Optimization; |
516 | ProcessorOptimizeOption OptimizeForProcessor; |
517 | triState OptimizeForWindowsApplication; |
518 | QString OutputFile; |
519 | QString ; |
520 | QString ; |
521 | QStringList PreprocessorDefinitions; |
522 | QString ProgramDataBaseFileName; |
523 | runtimeLibraryOption RuntimeLibrary; |
524 | triState RuntimeTypeInfo; |
525 | triState ShowIncludes; |
526 | triState SmallerTypeCheck; |
527 | triState StringPooling; |
528 | structMemberAlignOption StructMemberAlignment; |
529 | triState SuppressStartupBanner; |
530 | triState TreatWChar_tAsBuiltInType; |
531 | triState TurnOffAssemblyGeneration; |
532 | triState UndefineAllPreprocessorDefinitions; |
533 | QStringList UndefinePreprocessorDefinitions; |
534 | pchOption ; |
535 | triState UseUnicodeForAssemblerListing; |
536 | QStringList TreatSpecificWarningsAsErrors; |
537 | triState WarnAsError; |
538 | warningLevelOption WarningLevel; |
539 | triState WholeProgramOptimization; |
540 | useOfArchitecture CompileForArchitecture; |
541 | triState InterworkCalls; |
542 | |
543 | // VS2010 |
544 | triState EnablePREfast; |
545 | triState DisplayFullPaths; |
546 | triState MultiProcessorCompilation; |
547 | QString MultiProcessorCompilationProcessorCount; |
548 | triState GenerateXMLDocumentationFiles; |
549 | QString XMLDocumentationFileName; |
550 | QString ErrorReporting; |
551 | triState CreateHotpatchableImage; |
552 | QString PreprocessOutputPath; |
553 | |
554 | VCConfiguration* config; |
555 | |
556 | private: |
557 | bool parseRuntimeCheckOption(char c, int *rtc); |
558 | }; |
559 | |
560 | class VCLinkerTool : public VCToolBase |
561 | { |
562 | public: |
563 | // Functions |
564 | VCLinkerTool(); |
565 | |
566 | bool parseOption(const char* option) override; |
567 | |
568 | // Variables |
569 | QStringList AdditionalDependencies; |
570 | QStringList AdditionalLibraryDirectories; |
571 | QStringList AdditionalOptions; |
572 | QStringList AddModuleNamesToAssembly; |
573 | QString BaseAddress; |
574 | triState DataExecutionPrevention; |
575 | QStringList DelayLoadDLLs; |
576 | optFoldingType EnableCOMDATFolding; |
577 | QString EntryPointSymbol; |
578 | QStringList ForceSymbolReferences; |
579 | QString FunctionOrder; |
580 | triState GenerateDebugInformation; |
581 | linkerDebugOption DebugInfoOption; |
582 | triState GenerateMapFile; |
583 | qlonglong HeapCommitSize; |
584 | qlonglong HeapReserveSize; |
585 | triState IgnoreAllDefaultLibraries; |
586 | QStringList IgnoreDefaultLibraryNames; |
587 | triState IgnoreEmbeddedIDL; |
588 | triState IgnoreImportLibrary; |
589 | triState ImageHasSafeExceptionHandlers; |
590 | QString ImportLibrary; |
591 | addressAwarenessType LargeAddressAware; |
592 | triState LinkDLL; |
593 | linkIncrementalType LinkIncremental; |
594 | optLinkTimeCodeGenType LinkTimeCodeGeneration; |
595 | QString LinkToManagedResourceFile; |
596 | triState MapExports; |
597 | QString MapFileName; |
598 | triState MapLines; |
599 | QString MergedIDLBaseFileName; |
600 | QString MergeSections; // Should be list? |
601 | QString MidlCommandFile; |
602 | QString ModuleDefinitionFile; // Should be list? |
603 | optWin98Type OptimizeForWindows98; |
604 | optRefType OptimizeReferences; |
605 | QString OutputFile; |
606 | QString ProgramDatabaseFile; |
607 | triState RandomizedBaseAddress; |
608 | triState RegisterOutput; |
609 | triState ResourceOnlyDLL; |
610 | triState SetChecksum; |
611 | linkProgressOption ShowProgress; |
612 | qlonglong StackCommitSize; |
613 | qlonglong StackReserveSize; |
614 | QString StripPrivateSymbols; // Should be list? |
615 | subSystemOption SubSystem; |
616 | triState SupportUnloadOfDelayLoadedDLL; |
617 | triState SuppressStartupBanner; |
618 | triState SwapRunFromCD; |
619 | triState SwapRunFromNet; |
620 | machineTypeOption TargetMachine; |
621 | termSvrAwarenessType TerminalServerAware; |
622 | triState TreatWarningsAsErrors; |
623 | triState TurnOffAssemblyGeneration; |
624 | QString TypeLibraryFile; |
625 | qlonglong TypeLibraryResourceID; |
626 | QString Version; |
627 | |
628 | // VS2010 |
629 | triState GenerateManifest; |
630 | QStringList AdditionalManifestDependencies; |
631 | QString ManifestFile; |
632 | triState EnableUAC; |
633 | QString UACExecutionLevel; |
634 | triState UACUIAccess; |
635 | qlonglong SectionAlignment; |
636 | triState PreventDllBinding; |
637 | triState AllowIsolation; |
638 | triState AssemblyDebug; |
639 | QStringList AssemblyLinkResource; |
640 | QString CLRImageType; |
641 | QString CLRSupportLastError; |
642 | QString CLRThreadAttribute; |
643 | triState CLRUnmanagedCodeCheck; |
644 | triState DelaySign; |
645 | QString KeyContainer; |
646 | QString KeyFile; |
647 | QString LinkErrorReporting; |
648 | |
649 | // VS2012 |
650 | triState GenerateWindowsMetadata; |
651 | QString WindowsMetadataFile; |
652 | |
653 | VCConfiguration* config; |
654 | }; |
655 | |
656 | class VCManifestTool : public VCToolBase |
657 | { |
658 | public: |
659 | VCManifestTool(); |
660 | |
661 | bool parseOption(const char* option) override; |
662 | |
663 | triState EmbedManifest; |
664 | }; |
665 | |
666 | class VCMIDLTool : public VCToolBase |
667 | { |
668 | public: |
669 | // Functions |
670 | VCMIDLTool(); |
671 | |
672 | bool parseOption(const char* option) override; |
673 | |
674 | // Variables |
675 | QStringList AdditionalIncludeDirectories; |
676 | QStringList AdditionalOptions; |
677 | QStringList CPreprocessOptions; |
678 | midlCharOption DefaultCharType; |
679 | QString DLLDataFileName; // Should be list? |
680 | midlErrorCheckOption EnableErrorChecks; |
681 | triState ErrorCheckAllocations; |
682 | triState ErrorCheckBounds; |
683 | triState ErrorCheckEnumRange; |
684 | triState ErrorCheckRefPointers; |
685 | triState ErrorCheckStubData; |
686 | QStringList FullIncludePath; |
687 | triState GenerateStublessProxies; |
688 | triState GenerateTypeLibrary; |
689 | QString ; |
690 | triState IgnoreStandardIncludePath; |
691 | QString InterfaceIdentifierFileName; |
692 | triState MkTypLibCompatible; |
693 | QString OutputDirectory; |
694 | QStringList PreprocessorDefinitions; |
695 | QString ProxyFileName; |
696 | QString RedirectOutputAndErrors; |
697 | midlStructMemberAlignOption StructMemberAlignment; |
698 | triState SuppressStartupBanner; |
699 | midlTargetEnvironment TargetEnvironment; |
700 | QString TypeLibraryName; |
701 | QStringList UndefinePreprocessorDefinitions; |
702 | triState ValidateParameters; |
703 | triState WarnAsError; |
704 | midlWarningLevelOption WarningLevel; |
705 | |
706 | // VS 2010 |
707 | triState ApplicationConfigurationMode; |
708 | QString GenerateClientFiles; |
709 | QString ClientStubFile; |
710 | QString TypeLibFormat; |
711 | triState ValidateAllParameters; |
712 | triState SuppressCompilerWarnings; |
713 | QString GenerateServerFiles; |
714 | QString ServerStubFile; |
715 | qlonglong LocaleID; |
716 | |
717 | VCConfiguration* config; |
718 | }; |
719 | |
720 | class VCLibrarianTool : public VCToolBase |
721 | { |
722 | public: |
723 | // Functions |
724 | VCLibrarianTool(); |
725 | |
726 | bool parseOption(const char*) override { return false; } |
727 | |
728 | // Variables |
729 | QStringList AdditionalDependencies; |
730 | QStringList AdditionalLibraryDirectories; |
731 | QStringList AdditionalOptions; |
732 | QStringList ExportNamedFunctions; |
733 | QStringList ForceSymbolReferences; |
734 | triState IgnoreAllDefaultLibraries; |
735 | QStringList IgnoreDefaultLibraryNames; |
736 | QString ModuleDefinitionFile; |
737 | QString OutputFile; |
738 | triState SuppressStartupBanner; |
739 | }; |
740 | |
741 | class VCCustomBuildTool : public VCToolBase |
742 | { |
743 | public: |
744 | // Functions |
745 | VCCustomBuildTool(); |
746 | |
747 | bool parseOption(const char*) override { return false; } |
748 | |
749 | // Variables |
750 | QStringList AdditionalDependencies; |
751 | QStringList CommandLine; |
752 | QString Description; |
753 | QStringList Outputs; |
754 | QString ToolName; |
755 | QString ToolPath; |
756 | |
757 | VCConfiguration* config; |
758 | }; |
759 | |
760 | class VCResourceCompilerTool : public VCToolBase |
761 | { |
762 | public: |
763 | // Functions |
764 | VCResourceCompilerTool(); |
765 | |
766 | bool parseOption(const char*) override { return false; } |
767 | |
768 | // Variables |
769 | QStringList AdditionalIncludeDirectories; |
770 | QStringList AdditionalOptions; |
771 | enumResourceLangID Culture; |
772 | QStringList FullIncludePath; |
773 | triState IgnoreStandardIncludePath; |
774 | QStringList PreprocessorDefinitions; |
775 | QString ResourceOutputFileName; |
776 | linkProgressOption ShowProgress; |
777 | QString ToolPath; |
778 | triState SuppressStartupBanner; |
779 | }; |
780 | |
781 | class VCDeploymentTool |
782 | { |
783 | public: |
784 | // Functions |
785 | VCDeploymentTool(); |
786 | |
787 | // Variables |
788 | QString DeploymentTag; |
789 | QString RemoteDirectory; |
790 | RegisterDeployOption RegisterOutput; |
791 | QString AdditionalFiles; |
792 | }; |
793 | |
794 | class VCEventTool : public VCToolBase |
795 | { |
796 | protected: |
797 | // Functions |
798 | VCEventTool(const QString &eventName); |
799 | |
800 | bool parseOption(const char*) override { return false; } |
801 | |
802 | public: |
803 | // Variables |
804 | QStringList CommandLine; |
805 | QString Description; |
806 | triState ExcludedFromBuild; |
807 | QString EventName; |
808 | QString ToolName; |
809 | QString ToolPath; |
810 | }; |
811 | |
812 | class VCPostBuildEventTool : public VCEventTool |
813 | { |
814 | public: |
815 | VCPostBuildEventTool(); |
816 | }; |
817 | |
818 | class VCPreBuildEventTool : public VCEventTool |
819 | { |
820 | public: |
821 | VCPreBuildEventTool(); |
822 | }; |
823 | |
824 | class VCPreLinkEventTool : public VCEventTool |
825 | { |
826 | public: |
827 | VCPreLinkEventTool(); |
828 | }; |
829 | |
830 | class VCWinDeployQtTool : public VCToolBase |
831 | { |
832 | public: |
833 | VCWinDeployQtTool() {} |
834 | |
835 | protected: |
836 | bool parseOption(const char *) override { return false; } |
837 | |
838 | public: |
839 | // Variables |
840 | QString Record; |
841 | QString CommandLine; |
842 | bool ExcludedFromBuild; |
843 | |
844 | VCConfiguration * config; |
845 | }; |
846 | |
847 | class VCConfiguration |
848 | { |
849 | public: |
850 | // Functions |
851 | VCConfiguration(); |
852 | |
853 | bool suppressUnknownOptionWarnings; |
854 | DotNET CompilerVersion; |
855 | |
856 | // Variables |
857 | triState ATLMinimizesCRunTimeLibraryUsage; |
858 | triState BuildBrowserInformation; |
859 | charSet CharacterSet; |
860 | ConfigurationTypes ConfigurationType; |
861 | QString DeleteExtensionsOnClean; |
862 | QString ImportLibrary; |
863 | QString IntermediateDirectory; |
864 | QString Name; // "ConfigurationName|PlatformName" |
865 | QString ConfigurationName; |
866 | QString OutputDirectory; |
867 | QString PrimaryOutput; |
868 | QString PrimaryOutputExtension; |
869 | QString ProgramDatabase; |
870 | QString PlatformToolSet; |
871 | triState RegisterOutput; |
872 | useOfATL UseOfATL; |
873 | useOfMfc UseOfMfc; |
874 | triState WholeProgramOptimization; |
875 | |
876 | // XML sub-parts |
877 | VCCLCompilerTool compiler; |
878 | VCLinkerTool linker; |
879 | VCLibrarianTool librarian; |
880 | VCManifestTool manifestTool; |
881 | VCMIDLTool idl; |
882 | VCPostBuildEventTool postBuild; |
883 | VCPreBuildEventTool preBuild; |
884 | VCDeploymentTool deployment; |
885 | VCPreLinkEventTool preLink; |
886 | VCResourceCompilerTool resource; |
887 | VCWinDeployQtTool windeployqt; |
888 | }; |
889 | |
890 | struct VCFilterFile |
891 | { |
892 | VCFilterFile() |
893 | { excludeFromBuild = false; } |
894 | VCFilterFile(const QString &filename, bool exclude = false ) |
895 | { file = filename; excludeFromBuild = exclude; } |
896 | |
897 | bool excludeFromBuild; |
898 | QString file; |
899 | }; |
900 | |
901 | #ifndef QT_NO_DEBUG_OUTPUT |
902 | inline QDebug operator<<(QDebug dbg, const VCFilterFile &p) |
903 | { |
904 | dbg.nospace() << "VCFilterFile(file(" << p.file |
905 | << ") excludeFromBuild(" << p.excludeFromBuild << "))" << Qt::endl; |
906 | return dbg.space(); |
907 | } |
908 | #endif |
909 | |
910 | class VcprojGenerator; |
911 | class VCFilter |
912 | { |
913 | public: |
914 | // Functions |
915 | VCFilter(); |
916 | |
917 | void addFile(const QString& filename); |
918 | void addFile(const VCFilterFile& fileInfo); |
919 | void addFiles(const QStringList& fileList); |
920 | void addFiles(const ProStringList& fileList); |
921 | bool (const VCFilterFile &info); |
922 | void modifyPCHstage(QString str); |
923 | VCFilterFile findFile(const QString &filePath, bool *found) const; |
924 | |
925 | // Variables |
926 | QString Name; |
927 | QString Filter; |
928 | QString Guid; |
929 | triState ParseFiles; |
930 | VcprojGenerator* Project; |
931 | VCConfiguration* Config; |
932 | QList<VCFilterFile> Files; |
933 | |
934 | bool useCustomBuildTool; |
935 | VCCustomBuildTool CustomBuildTool; |
936 | |
937 | bool useCompilerTool; |
938 | VCCLCompilerTool CompilerTool; |
939 | }; |
940 | |
941 | typedef QList<VCFilter> VCFilterList; |
942 | class VCProjectSingleConfig |
943 | { |
944 | public: |
945 | enum FilterTypes { |
946 | None, |
947 | Source, |
948 | , |
949 | Generated, |
950 | LexYacc, |
951 | Translation, |
952 | Resources, |
953 | |
954 | }; |
955 | |
956 | // Variables |
957 | QString Name; |
958 | QString Version; |
959 | QString ProjectGUID; |
960 | QString Keyword; |
961 | QString SccProjectName; |
962 | QString SccLocalPath; |
963 | QString PlatformName; |
964 | QString SdkVersion; |
965 | |
966 | // XML sub-parts |
967 | VCConfiguration Configuration; |
968 | VCFilter RootFiles; |
969 | VCFilter SourceFiles; |
970 | VCFilter ; |
971 | VCFilter GeneratedFiles; |
972 | VCFilter LexYaccFiles; |
973 | VCFilter TranslationFiles; |
974 | VCFilter FormFiles; |
975 | VCFilter ResourceFiles; |
976 | VCFilter DeploymentFiles; |
977 | VCFilter DistributionFiles; |
978 | VCFilterList ; |
979 | |
980 | bool flat_files; |
981 | |
982 | const VCFilter &filterByName(const QString &name) const; |
983 | const VCFilter &(const QString &compilerName) const; |
984 | }; |
985 | Q_DECLARE_TYPEINFO(VCProjectSingleConfig, Q_RELOCATABLE_TYPE); |
986 | |
987 | // Tree & Flat view of files -------------------------------------------------- |
988 | class VCFilter; |
989 | class Node |
990 | { |
991 | public: |
992 | virtual ~Node() { } |
993 | void addElement(const VCFilterFile &file) { |
994 | addElement(filepath: file.file, allInfo: file); |
995 | } |
996 | virtual void addElement(const QString &filepath, const VCFilterFile &allInfo) = 0; |
997 | virtual void removeElements()= 0; |
998 | virtual void generateXML(XmlOutput &xml, const QString &tagName, VCProject &tool, const QString &filter) = 0; |
999 | virtual bool hasElements() = 0; |
1000 | }; |
1001 | |
1002 | class TreeNode : public Node |
1003 | { |
1004 | typedef QMap<QString, TreeNode*> ChildrenMap; |
1005 | VCFilterFile info; |
1006 | ChildrenMap children; |
1007 | |
1008 | public: |
1009 | virtual ~TreeNode() { removeElements(); } |
1010 | |
1011 | int pathIndex(const QString &filepath) { |
1012 | int Windex = filepath.indexOf(s: "\\" ); |
1013 | int Uindex = filepath.indexOf(s: "/" ); |
1014 | if (Windex != -1 && Uindex != -1) |
1015 | return qMin(a: Windex, b: Uindex); |
1016 | else if (Windex != -1) |
1017 | return Windex; |
1018 | return Uindex; |
1019 | } |
1020 | |
1021 | void addElement(const QString &filepath, const VCFilterFile &allInfo) override { |
1022 | QString newNodeName(filepath); |
1023 | |
1024 | int index = pathIndex(filepath); |
1025 | if (index != -1) |
1026 | newNodeName = filepath.left(n: index); |
1027 | |
1028 | TreeNode *n = children.value(key: newNodeName); |
1029 | if (!n) { |
1030 | n = new TreeNode; |
1031 | n->info = allInfo; |
1032 | children.insert(key: newNodeName, value: n); |
1033 | } |
1034 | if (index != -1) |
1035 | n->addElement(filepath: filepath.mid(position: index+1), allInfo); |
1036 | } |
1037 | |
1038 | void removeElements() override { |
1039 | ChildrenMap::ConstIterator it = children.constBegin(); |
1040 | ChildrenMap::ConstIterator end = children.constEnd(); |
1041 | for( ; it != end; it++) { |
1042 | (*it)->removeElements(); |
1043 | delete it.value(); |
1044 | } |
1045 | children.clear(); |
1046 | } |
1047 | |
1048 | void generateXML(XmlOutput &xml, const QString &tagName, VCProject &tool, const QString &filter) override; |
1049 | bool hasElements() override { |
1050 | return children.size() != 0; |
1051 | } |
1052 | }; |
1053 | |
1054 | class FlatNode : public Node |
1055 | { |
1056 | typedef QMap<QString, VCFilterFile> ChildrenMapFlat; |
1057 | ChildrenMapFlat children; |
1058 | |
1059 | public: |
1060 | virtual ~FlatNode() { removeElements(); } |
1061 | |
1062 | int pathIndex(const QString &filepath) { |
1063 | int Windex = filepath.lastIndexOf(s: "\\" ); |
1064 | int Uindex = filepath.lastIndexOf(s: "/" ); |
1065 | if (Windex != -1 && Uindex != -1) |
1066 | return qMax(a: Windex, b: Uindex); |
1067 | else if (Windex != -1) |
1068 | return Windex; |
1069 | return Uindex; |
1070 | } |
1071 | |
1072 | void addElement(const QString &filepath, const VCFilterFile &allInfo) override { |
1073 | QString newKey(filepath); |
1074 | |
1075 | int index = pathIndex(filepath); |
1076 | if (index != -1) |
1077 | newKey = filepath.mid(position: index+1); |
1078 | |
1079 | // Key designed to sort files with same |
1080 | // name in different paths correctly |
1081 | children.insert(key: newKey + "\0" + allInfo.file, value: allInfo); |
1082 | } |
1083 | |
1084 | void removeElements() override { |
1085 | children.clear(); |
1086 | } |
1087 | |
1088 | void generateXML(XmlOutput &xml, const QString &tagName, VCProject &proj, const QString &filter) override; |
1089 | bool hasElements() override { |
1090 | return children.size() != 0; |
1091 | } |
1092 | }; |
1093 | // ---------------------------------------------------------------------------- |
1094 | |
1095 | class VCProject |
1096 | { |
1097 | public: |
1098 | // Variables |
1099 | QString Name; |
1100 | QString Version; |
1101 | QString ProjectGUID; |
1102 | QString Keyword; |
1103 | QString SccProjectName; |
1104 | QString SccLocalPath; |
1105 | QString PlatformName; |
1106 | QString SdkVersion; |
1107 | QString WindowsTargetPlatformVersion; |
1108 | QString WindowsTargetPlatformMinVersion; |
1109 | |
1110 | // Single projects |
1111 | QList<VCProjectSingleConfig> SingleProjects; |
1112 | |
1113 | // List of all extracompilers |
1114 | QStringList ; |
1115 | }; |
1116 | |
1117 | class VCProjectWriter |
1118 | { |
1119 | public: |
1120 | virtual ~VCProjectWriter() {} |
1121 | |
1122 | virtual void write(XmlOutput &, VCProjectSingleConfig &); |
1123 | virtual void write(XmlOutput &, VCProject &); |
1124 | |
1125 | virtual void write(XmlOutput &, const VCCLCompilerTool &); |
1126 | virtual void write(XmlOutput &, const VCLinkerTool &); |
1127 | virtual void write(XmlOutput &, const VCManifestTool &); |
1128 | virtual void write(XmlOutput &, const VCMIDLTool &); |
1129 | virtual void write(XmlOutput &, const VCCustomBuildTool &); |
1130 | virtual void write(XmlOutput &, const VCLibrarianTool &); |
1131 | virtual void write(XmlOutput &, const VCResourceCompilerTool &); |
1132 | virtual void write(XmlOutput &, const VCEventTool &); |
1133 | virtual void write(XmlOutput &, const VCDeploymentTool &); |
1134 | virtual void write(XmlOutput &, const VCWinDeployQtTool &); |
1135 | virtual void write(XmlOutput &, const VCConfiguration &); |
1136 | virtual void write(XmlOutput &, VCFilter &); |
1137 | |
1138 | private: |
1139 | static void outputFilter(VCProject &project, XmlOutput &xml, const QString &filtername); |
1140 | static void outputFileConfigs(VCProject &project, XmlOutput &xml, const VCFilterFile &info, const QString &filtername); |
1141 | static void outputFileConfig(VCFilter &filter, XmlOutput &xml, const QString &filename); |
1142 | |
1143 | friend class TreeNode; |
1144 | friend class FlatNode; |
1145 | }; |
1146 | |
1147 | QT_END_NAMESPACE |
1148 | |
1149 | #endif // MSVC_OBJECTMODEL_H |
1150 | |