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
18QT_BEGIN_NAMESPACE
19
20enum 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
35DotNET 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*/
50enum triState {
51 unset = -1,
52 _False = 0,
53 _True = 1
54};
55
56triState operator!(const triState &rhs);
57
58enum addressAwarenessType {
59 addrAwareDefault,
60 addrAwareNoLarge,
61 addrAwareLarge
62};
63enum asmListingOption {
64 asmListingNone,
65 asmListingAssemblyOnly,
66 asmListingAsmMachineSrc,
67 asmListingAsmMachine,
68 asmListingAsmSrc
69};
70enum basicRuntimeCheckOption {
71 runtimeBasicCheckNone = 0,
72 runtimeCheckStackFrame = 1,
73 runtimeCheckUninitVariables = 2,
74 runtimeBasicCheckAll = runtimeCheckStackFrame | runtimeCheckUninitVariables
75};
76enum browseInfoOption {
77 brInfoNone,
78 brAllInfo,
79 brNoLocalSymbols
80};
81enum callingConventionOption {
82 callConventionDefault = -1,
83 callConventionCDecl,
84 callConventionFastCall,
85 callConventionStdCall
86};
87enum charSet {
88 charSetNotSet,
89 charSetUnicode,
90 charSetMBCS
91};
92enum compileAsManagedOptions {
93 managedDefault = -1, // Was: noAssembly
94 managedAssembly = 1,
95 managedAssemblyPure = 2, // Old was: Assembly
96 managedAssemblySafe = 3,
97 managedAssemblyOldSyntax = 4
98};
99enum CompileAsOptions{
100 compileAsDefault,
101 compileAsC,
102 compileAsCPlusPlus
103};
104enum ConfigurationTypes {
105 typeUnknown = 0,
106 typeApplication = 1,
107 typeDynamicLibrary = 2,
108 typeStaticLibrary = 4,
109 typeGeneric = 10
110};
111enum debugOption {
112 debugUnknown = -1,
113 debugDisabled,
114 debugOldStyleInfo,
115 debugLineInfoOnly,
116 debugEnabled,
117 debugEditAndContinue
118};
119enum eAppProtectionOption {
120 eAppProtectUnchanged,
121 eAppProtectLow,
122 eAppProtectMedium,
123 eAppProtectHigh
124};
125enum enhancedInstructionSetOption {
126 archNotSet = 0,
127 archSSE = 1,
128 archSSE2 = 2
129};
130enum exceptionHandling {
131 ehDefault = -1,
132 ehNone = 0,
133 ehNoSEH = 1,
134 ehSEH = 2
135};
136enum 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};
234enum enumSccEvent {
235 eProjectInScc,
236 ePreDirtyNotification
237};
238enum favorSizeOrSpeedOption {
239 favorNone,
240 favorSpeed,
241 favorSize
242};
243enum floatingPointModel {
244 floatingPointNotSet = -1,
245 floatingPointPrecise,
246 floatingPointStrict,
247 floatingPointFast
248};
249enum genProxyLanguage {
250 genProxyNative,
251 genProxyManaged
252};
253enum inlineExpansionOption {
254 expandDisable,
255 expandOnlyInline,
256 expandAnySuitable,
257 expandDefault // Not useful number, but stops the output
258};
259enum linkerDebugOption {
260 linkerDebugOptionNone,
261 linkerDebugOptionEnabled, // represents /DEBUG without further options
262 linkerDebugOptionFastLink,
263 linkerDebugOptionFull
264};
265enum linkIncrementalType {
266 linkIncrementalDefault,
267 linkIncrementalNo,
268 linkIncrementalYes
269};
270enum linkProgressOption {
271 linkProgressNotSet,
272 linkProgressAll,
273 linkProgressLibs
274};
275enum machineTypeOption {
276 machineNotSet,
277 machineX86,
278 machineX64 = 17
279};
280enum midlCharOption {
281 midlCharUnsigned,
282 midlCharSigned,
283 midlCharAscii7
284};
285enum midlErrorCheckOption {
286 midlEnableCustom,
287 midlDisableAll,
288 midlEnableAll
289};
290enum midlStructMemberAlignOption {
291 midlAlignNotSet,
292 midlAlignSingleByte,
293 midlAlignTwoBytes,
294 midlAlignFourBytes,
295 midlAlignEightBytes,
296 midlAlignSixteenBytes
297};
298enum midlTargetEnvironment {
299 midlTargetNotSet,
300 midlTargetWin32,
301 midlTargetWin64
302};
303enum midlWarningLevelOption {
304 midlWarningLevel_0,
305 midlWarningLevel_1,
306 midlWarningLevel_2,
307 midlWarningLevel_3,
308 midlWarningLevel_4
309};
310enum optFoldingType {
311 optFoldingDefault,
312 optNoFolding,
313 optFolding
314};
315enum optimizeOption {
316 optimizeDisabled,
317 optimizeMinSpace,
318 optimizeMaxSpeed,
319 optimizeFull,
320 optimizeCustom,
321 optimizeDefault // Not useful number, but stops the output
322};
323enum optRefType {
324 optReferencesDefault,
325 optNoReferences,
326 optReferences
327};
328enum optWin98Type {
329 optWin98Default,
330 optWin98No,
331 optWin98Yes
332};
333enum optLinkTimeCodeGenType {
334 optLTCGDefault,
335 optLTCGEnabled,
336 optLTCGIncremental,
337 optLTCGInstrument,
338 optLTCGOptimize,
339 optLTCGUpdate
340};
341enum pchOption {
342 pchUnset = -1,
343 pchNone,
344 pchCreateUsingSpecific,
345 pchGenerateAuto,
346 pchUseUsingSpecific
347};
348enum preprocessOption {
349 preprocessUnknown = -1,
350 preprocessNo,
351 preprocessYes,
352 preprocessNoLineNumbers
353};
354enum ProcessorOptimizeOption {
355 procOptimizeBlended, //GB
356 procOptimizePentium, //G5
357 procOptimizePentiumProAndAbove, //G6
358 procOptimizePentium4AndAbove //G7
359};
360enum RegisterDeployOption {
361 registerNo = 0,
362 registerYes
363};
364enum RemoteDebuggerType {
365 DbgLocal,
366 DbgRemote,
367 DbgRemoteTCPIP
368};
369enum runtimeLibraryOption {
370 rtUnknown = -1,
371 rtMultiThreaded,
372 rtMultiThreadedDebug,
373 rtMultiThreadedDLL,
374 rtMultiThreadedDebugDLL,
375 rtSingleThreaded,
376 rtSingleThreadedDebug
377};
378enum structMemberAlignOption {
379 alignNotSet,
380 alignSingleByte,
381 alignTwoBytes,
382 alignFourBytes,
383 alignEightBytes,
384 alignSixteenBytes
385};
386enum subSystemOption {
387 subSystemNotSet,
388 subSystemConsole,
389 subSystemWindows
390};
391enum termSvrAwarenessType {
392 termSvrAwareDefault,
393 termSvrAwareNo,
394 termSvrAwareYes
395};
396enum toolSetType {
397 toolSetUtility,
398 toolSetMakefile,
399 toolSetLinker,
400 toolSetLibrarian,
401 toolSetAll
402};
403enum TypeOfDebugger {
404 DbgNativeOnly,
405 DbgManagedOnly,
406 DbgMixed,
407 DbgAuto
408};
409enum useOfATL {
410 useATLNotSet,
411 useATLStatic,
412 useATLDynamic
413};
414enum useOfMfc {
415 useMfcStdWin,
416 useMfcStatic,
417 useMfcDynamic
418};
419enum 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};
434enum warningLevelOption {
435 warningLevelUnknown = -1,
436 warningLevel_0,
437 warningLevel_1,
438 warningLevel_2,
439 warningLevel_3,
440 warningLevel_4
441};
442
443
444class VCToolBase {
445protected:
446 // Functions
447 VCToolBase(){}
448 virtual ~VCToolBase(){}
449 virtual bool parseOption(const char* option) = 0;
450public:
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
458class VCConfiguration;
459class VCProject;
460
461class VCCLCompilerTool : public VCToolBase
462{
463public:
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 KeepComments;
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 PrecompiledHeaderFile;
520 QString PrecompiledHeaderThrough;
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 UsePrecompiledHeader;
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
556private:
557 bool parseRuntimeCheckOption(char c, int *rtc);
558};
559
560class VCLinkerTool : public VCToolBase
561{
562public:
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
656class VCManifestTool : public VCToolBase
657{
658public:
659 VCManifestTool();
660
661 bool parseOption(const char* option) override;
662
663 triState EmbedManifest;
664};
665
666class VCMIDLTool : public VCToolBase
667{
668public:
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 HeaderFileName;
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
720class VCLibrarianTool : public VCToolBase
721{
722public:
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
741class VCCustomBuildTool : public VCToolBase
742{
743public:
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
760class VCResourceCompilerTool : public VCToolBase
761{
762public:
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
781class VCDeploymentTool
782{
783public:
784 // Functions
785 VCDeploymentTool();
786
787 // Variables
788 QString DeploymentTag;
789 QString RemoteDirectory;
790 RegisterDeployOption RegisterOutput;
791 QString AdditionalFiles;
792};
793
794class VCEventTool : public VCToolBase
795{
796protected:
797 // Functions
798 VCEventTool(const QString &eventName);
799
800 bool parseOption(const char*) override { return false; }
801
802public:
803 // Variables
804 QStringList CommandLine;
805 QString Description;
806 triState ExcludedFromBuild;
807 QString EventName;
808 QString ToolName;
809 QString ToolPath;
810};
811
812class VCPostBuildEventTool : public VCEventTool
813{
814public:
815 VCPostBuildEventTool();
816};
817
818class VCPreBuildEventTool : public VCEventTool
819{
820public:
821 VCPreBuildEventTool();
822};
823
824class VCPreLinkEventTool : public VCEventTool
825{
826public:
827 VCPreLinkEventTool();
828};
829
830class VCWinDeployQtTool : public VCToolBase
831{
832public:
833 VCWinDeployQtTool() {}
834
835protected:
836 bool parseOption(const char *) override { return false; }
837
838public:
839 // Variables
840 QString Record;
841 QString CommandLine;
842 bool ExcludedFromBuild;
843
844 VCConfiguration * config;
845};
846
847class VCConfiguration
848{
849public:
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
890struct 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
902inline 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
910class VcprojGenerator;
911class VCFilter
912{
913public:
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 addExtraCompiler(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
941typedef QList<VCFilter> VCFilterList;
942class VCProjectSingleConfig
943{
944public:
945 enum FilterTypes {
946 None,
947 Source,
948 Header,
949 Generated,
950 LexYacc,
951 Translation,
952 Resources,
953 Extras
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 HeaderFiles;
971 VCFilter GeneratedFiles;
972 VCFilter LexYaccFiles;
973 VCFilter TranslationFiles;
974 VCFilter FormFiles;
975 VCFilter ResourceFiles;
976 VCFilter DeploymentFiles;
977 VCFilter DistributionFiles;
978 VCFilterList ExtraCompilersFiles;
979
980 bool flat_files;
981
982 const VCFilter &filterByName(const QString &name) const;
983 const VCFilter &filterForExtraCompiler(const QString &compilerName) const;
984};
985Q_DECLARE_TYPEINFO(VCProjectSingleConfig, Q_RELOCATABLE_TYPE);
986
987// Tree & Flat view of files --------------------------------------------------
988class VCFilter;
989class Node
990{
991public:
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
1002class TreeNode : public Node
1003{
1004 typedef QMap<QString, TreeNode*> ChildrenMap;
1005 VCFilterFile info;
1006 ChildrenMap children;
1007
1008public:
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
1054class FlatNode : public Node
1055{
1056 typedef QMap<QString, VCFilterFile> ChildrenMapFlat;
1057 ChildrenMapFlat children;
1058
1059public:
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
1095class VCProject
1096{
1097public:
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 ExtraCompilers;
1115};
1116
1117class VCProjectWriter
1118{
1119public:
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
1138private:
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
1147QT_END_NAMESPACE
1148
1149#endif // MSVC_OBJECTMODEL_H
1150

source code of qtbase/qmake/generators/win32/msvc_objectmodel.h