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