Debian Codegraph @

qmake/generators/win32/msvc_objectmodel.h

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