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 43 QT_BEGIN_NAMESPACE 44 45 enum 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 59 DotNET 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 */ 74 enum triState { 75 unset = -1, 76 _False = 0, 77 _True = 1 78 }; 79 80 triState operator!(const triState &rhs); 81 82 enum addressAwarenessType { 83 addrAwareDefault, 84 addrAwareNoLarge, 85 addrAwareLarge 86 }; 87 enum asmListingOption { 88 asmListingNone, 89 asmListingAssemblyOnly, 90 asmListingAsmMachineSrc, 91 asmListingAsmMachine, 92 asmListingAsmSrc 93 }; 94 enum basicRuntimeCheckOption { 95 runtimeBasicCheckNone = 0, 96 runtimeCheckStackFrame = 1, 97 runtimeCheckUninitVariables = 2, 98 runtimeBasicCheckAll = runtimeCheckStackFrame | runtimeCheckUninitVariables 99 }; 100 enum browseInfoOption { 101 brInfoNone, 102 brAllInfo, 103 brNoLocalSymbols 104 }; 105 enum callingConventionOption { 106 callConventionDefault = -1, 107 callConventionCDecl, 108 callConventionFastCall, 109 callConventionStdCall 110 }; 111 enum charSet { 112 charSetNotSet, 113 charSetUnicode, 114 charSetMBCS 115 }; 116 enum compileAsManagedOptions { 117 managedDefault = -1, // Was: noAssembly 118 managedAssembly = 1, 119 managedAssemblyPure = 2, // Old was: Assembly 120 managedAssemblySafe = 3, 121 managedAssemblyOldSyntax = 4 122 }; 123 enum CompileAsOptions{ 124 compileAsDefault, 125 compileAsC, 126 compileAsCPlusPlus 127 }; 128 enum ConfigurationTypes { 129 typeUnknown = 0, 130 typeApplication = 1, 131 typeDynamicLibrary = 2, 132 typeStaticLibrary = 4, 133 typeGeneric = 10 134 }; 135 enum debugOption { 136 debugUnknown = -1, 137 debugDisabled, 138 debugOldStyleInfo, 139 debugLineInfoOnly, 140 debugEnabled, 141 debugEditAndContinue 142 }; 143 enum eAppProtectionOption { 144 eAppProtectUnchanged, 145 eAppProtectLow, 146 eAppProtectMedium, 147 eAppProtectHigh 148 }; 149 enum enhancedInstructionSetOption { 150 archNotSet = 0, 151 archSSE = 1, 152 archSSE2 = 2 153 }; 154 enum exceptionHandling { 155 ehDefault = -1, 156 ehNone = 0, 157 ehNoSEH = 1, 158 ehSEH = 2 159 }; 160 enum 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 }; 258 enum enumSccEvent { 259 eProjectInScc, 260 ePreDirtyNotification 261 }; 262 enum favorSizeOrSpeedOption { 263 favorNone, 264 favorSpeed, 265 favorSize 266 }; 267 enum floatingPointModel { 268 floatingPointNotSet = -1, 269 floatingPointPrecise, 270 floatingPointStrict, 271 floatingPointFast 272 }; 273 enum genProxyLanguage { 274 genProxyNative, 275 genProxyManaged 276 }; 277 enum inlineExpansionOption { 278 expandDisable, 279 expandOnlyInline, 280 expandAnySuitable, 281 expandDefault // Not useful number, but stops the output 282 }; 283 enum linkerDebugOption { 284 linkerDebugOptionNone, 285 linkerDebugOptionFastLink 286 }; 287 enum linkIncrementalType { 288 linkIncrementalDefault, 289 linkIncrementalNo, 290 linkIncrementalYes 291 }; 292 enum linkProgressOption { 293 linkProgressNotSet, 294 linkProgressAll, 295 linkProgressLibs 296 }; 297 enum machineTypeOption { 298 machineNotSet, 299 machineX86, 300 machineX64 = 17 301 }; 302 enum midlCharOption { 303 midlCharUnsigned, 304 midlCharSigned, 305 midlCharAscii7 306 }; 307 enum midlErrorCheckOption { 308 midlEnableCustom, 309 midlDisableAll, 310 midlEnableAll 311 }; 312 enum midlStructMemberAlignOption { 313 midlAlignNotSet, 314 midlAlignSingleByte, 315 midlAlignTwoBytes, 316 midlAlignFourBytes, 317 midlAlignEightBytes, 318 midlAlignSixteenBytes 319 }; 320 enum midlTargetEnvironment { 321 midlTargetNotSet, 322 midlTargetWin32, 323 midlTargetWin64 324 }; 325 enum midlWarningLevelOption { 326 midlWarningLevel_0, 327 midlWarningLevel_1, 328 midlWarningLevel_2, 329 midlWarningLevel_3, 330 midlWarningLevel_4 331 }; 332 enum optFoldingType { 333 optFoldingDefault, 334 optNoFolding, 335 optFolding 336 }; 337 enum optimizeOption { 338 optimizeDisabled, 339 optimizeMinSpace, 340 optimizeMaxSpeed, 341 optimizeFull, 342 optimizeCustom, 343 optimizeDefault // Not useful number, but stops the output 344 }; 345 enum optRefType { 346 optReferencesDefault, 347 optNoReferences, 348 optReferences 349 }; 350 enum optWin98Type { 351 optWin98Default, 352 optWin98No, 353 optWin98Yes 354 }; 355 enum optLinkTimeCodeGenType { 356 optLTCGDefault, 357 optLTCGEnabled, 358 optLTCGInstrument, 359 optLTCGOptimize, 360 optLTCGUpdate 361 }; 362 enum pchOption { 363 pchUnset = -1, 364 pchNone, 365 pchCreateUsingSpecific, 366 pchGenerateAuto, 367 pchUseUsingSpecific 368 }; 369 enum preprocessOption { 370 preprocessUnknown = -1, 371 preprocessNo, 372 preprocessYes, 373 preprocessNoLineNumbers 374 }; 375 enum ProcessorOptimizeOption { 376 procOptimizeBlended, //GB 377 procOptimizePentium, //G5 378 procOptimizePentiumProAndAbove, //G6 379 procOptimizePentium4AndAbove //G7 380 }; 381 enum RegisterDeployOption { 382 registerNo = 0, 383 registerYes 384 }; 385 enum RemoteDebuggerType { 386 DbgLocal, 387 DbgRemote, 388 DbgRemoteTCPIP 389 }; 390 enum runtimeLibraryOption { 391 rtUnknown = -1, 392 rtMultiThreaded, 393 rtMultiThreadedDebug, 394 rtMultiThreadedDLL, 395 rtMultiThreadedDebugDLL, 396 rtSingleThreaded, 397 rtSingleThreadedDebug 398 }; 399 enum structMemberAlignOption { 400 alignNotSet, 401 alignSingleByte, 402 alignTwoBytes, 403 alignFourBytes, 404 alignEightBytes, 405 alignSixteenBytes 406 }; 407 enum subSystemOption { 408 subSystemNotSet, 409 subSystemConsole, 410 subSystemWindows 411 }; 412 enum termSvrAwarenessType { 413 termSvrAwareDefault, 414 termSvrAwareNo, 415 termSvrAwareYes 416 }; 417 enum toolSetType { 418 toolSetUtility, 419 toolSetMakefile, 420 toolSetLinker, 421 toolSetLibrarian, 422 toolSetAll 423 }; 424 enum TypeOfDebugger { 425 DbgNativeOnly, 426 DbgManagedOnly, 427 DbgMixed, 428 DbgAuto 429 }; 430 enum useOfATL { 431 useATLNotSet, 432 useATLStatic, 433 useATLDynamic 434 }; 435 enum useOfMfc { 436 useMfcStdWin, 437 useMfcStatic, 438 useMfcDynamic 439 }; 440 enum 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 }; 455 enum warningLevelOption { 456 warningLevelUnknown = -1, 457 warningLevel_0, 458 warningLevel_1, 459 warningLevel_2, 460 warningLevel_3, 461 warningLevel_4 462 }; 463 464 465 class VCToolBase { 466 protected: 467 // Functions VCToolBase()468 VCToolBase(){} ~VCToolBase()469 virtual ~VCToolBase(){} 470 virtual bool parseOption(const char* option) = 0; 471 public: parseOptions(const ProStringList & options)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 479 class VCConfiguration; 480 class VCProject; 481 482 class VCCLCompilerTool : public VCToolBase 483 { 484 public: 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 576 private: 577 bool parseRuntimeCheckOption(char c, int *rtc); 578 }; 579 580 class VCLinkerTool : public VCToolBase 581 { 582 public: 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 676 class VCManifestTool : public VCToolBase 677 { 678 public: 679 VCManifestTool(); 680 681 bool parseOption(const char* option) override; 682 683 triState EmbedManifest; 684 }; 685 686 class VCMIDLTool : public VCToolBase 687 { 688 public: 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 740 class VCLibrarianTool : public VCToolBase 741 { 742 public: 743 // Functions 744 VCLibrarianTool(); 745 parseOption(const char *)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 761 class VCCustomBuildTool : public VCToolBase 762 { 763 public: 764 // Functions 765 VCCustomBuildTool(); 766 parseOption(const char *)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 780 class VCResourceCompilerTool : public VCToolBase 781 { 782 public: 783 // Functions 784 VCResourceCompilerTool(); 785 parseOption(const char *)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 801 class VCDeploymentTool 802 { 803 public: 804 // Functions 805 VCDeploymentTool(); 806 807 // Variables 808 QString DeploymentTag; 809 QString RemoteDirectory; 810 RegisterDeployOption RegisterOutput; 811 QString AdditionalFiles; 812 }; 813 814 class VCEventTool : public VCToolBase 815 { 816 protected: 817 // Functions 818 VCEventTool(const QString &eventName); 819 parseOption(const char *)820 bool parseOption(const char*) override { return false; } 821 822 public: 823 // Variables 824 QStringList CommandLine; 825 QString Description; 826 triState ExcludedFromBuild; 827 QString EventName; 828 QString ToolName; 829 QString ToolPath; 830 }; 831 832 class VCPostBuildEventTool : public VCEventTool 833 { 834 public: 835 VCPostBuildEventTool(); 836 }; 837 838 class VCPreBuildEventTool : public VCEventTool 839 { 840 public: 841 VCPreBuildEventTool(); 842 }; 843 844 class VCPreLinkEventTool : public VCEventTool 845 { 846 public: 847 VCPreLinkEventTool(); 848 }; 849 850 class VCWinDeployQtTool : public VCToolBase 851 { 852 public: VCWinDeployQtTool()853 VCWinDeployQtTool() {} 854 855 protected: parseOption(const char *)856 bool parseOption(const char *) override { return false; } 857 858 public: 859 // Variables 860 QString Record; 861 QString CommandLine; 862 bool ExcludedFromBuild; 863 864 VCConfiguration * config; 865 }; 866 867 class VCConfiguration 868 { 869 public: 870 // Functions 871 VCConfiguration(); 872 873 bool suppressUnknownOptionWarnings; 874 DotNET CompilerVersion; 875 bool WinRT; 876 877 // Variables 878 triState ATLMinimizesCRunTimeLibraryUsage; 879 triState BuildBrowserInformation; 880 charSet CharacterSet; 881 ConfigurationTypes ConfigurationType; 882 QString DeleteExtensionsOnClean; 883 QString ImportLibrary; 884 QString IntermediateDirectory; 885 QString Name; // "ConfigurationName|PlatformName" 886 QString ConfigurationName; 887 QString OutputDirectory; 888 QString PrimaryOutput; 889 QString PrimaryOutputExtension; 890 QString ProgramDatabase; 891 QString PlatformToolSet; 892 triState RegisterOutput; 893 useOfATL UseOfATL; 894 useOfMfc UseOfMfc; 895 triState WholeProgramOptimization; 896 897 // XML sub-parts 898 VCCLCompilerTool compiler; 899 VCLinkerTool linker; 900 VCLibrarianTool librarian; 901 VCManifestTool manifestTool; 902 VCMIDLTool idl; 903 VCPostBuildEventTool postBuild; 904 VCPreBuildEventTool preBuild; 905 VCDeploymentTool deployment; 906 VCPreLinkEventTool preLink; 907 VCResourceCompilerTool resource; 908 VCWinDeployQtTool windeployqt; 909 }; 910 911 struct VCFilterFile 912 { VCFilterFileVCFilterFile913 VCFilterFile() 914 { excludeFromBuild = false; } 915 VCFilterFile(const QString &filename, bool exclude = false ) 916 { file = filename; excludeFromBuild = exclude; } 917 918 bool excludeFromBuild; 919 QString file; 920 }; 921 922 #ifndef QT_NO_DEBUG_OUTPUT 923 inline QDebug operator<<(QDebug dbg, const VCFilterFile &p) 924 { 925 dbg.nospace() << "VCFilterFile(file(" << p.file 926 << ") excludeFromBuild(" << p.excludeFromBuild << "))" << Qt::endl; 927 return dbg.space(); 928 } 929 #endif 930 931 class VcprojGenerator; 932 class VCFilter 933 { 934 public: 935 // Functions 936 VCFilter(); 937 938 void addFile(const QString& filename); 939 void addFile(const VCFilterFile& fileInfo); 940 void addFiles(const QStringList& fileList); 941 void addFiles(const ProStringList& fileList); 942 bool addExtraCompiler(const VCFilterFile &info); 943 void modifyPCHstage(QString str); 944 VCFilterFile findFile(const QString &filePath, bool *found) const; 945 946 // Variables 947 QString Name; 948 QString Filter; 949 QString Guid; 950 triState ParseFiles; 951 VcprojGenerator* Project; 952 VCConfiguration* Config; 953 QList<VCFilterFile> Files; 954 955 bool useCustomBuildTool; 956 VCCustomBuildTool CustomBuildTool; 957 958 bool useCompilerTool; 959 VCCLCompilerTool CompilerTool; 960 }; 961 962 typedef QVector<VCFilter> VCFilterList; 963 class VCProjectSingleConfig 964 { 965 public: 966 enum FilterTypes { 967 None, 968 Source, 969 Header, 970 Generated, 971 LexYacc, 972 Translation, 973 Resources, 974 Extras 975 }; 976 977 // Variables 978 QString Name; 979 QString Version; 980 QString ProjectGUID; 981 QString Keyword; 982 QString SccProjectName; 983 QString SccLocalPath; 984 QString PlatformName; 985 QString SdkVersion; 986 987 // XML sub-parts 988 VCConfiguration Configuration; 989 VCFilter RootFiles; 990 VCFilter SourceFiles; 991 VCFilter HeaderFiles; 992 VCFilter GeneratedFiles; 993 VCFilter LexYaccFiles; 994 VCFilter TranslationFiles; 995 VCFilter FormFiles; 996 VCFilter ResourceFiles; 997 VCFilter DeploymentFiles; 998 VCFilter DistributionFiles; 999 VCFilterList ExtraCompilersFiles; 1000 1001 bool flat_files; 1002 1003 const VCFilter &filterByName(const QString &name) const; 1004 const VCFilter &filterForExtraCompiler(const QString &compilerName) const; 1005 }; 1006 Q_DECLARE_TYPEINFO(VCProjectSingleConfig, Q_MOVABLE_TYPE); 1007 1008 // Tree & Flat view of files -------------------------------------------------- 1009 class VCFilter; 1010 class Node 1011 { 1012 public: ~Node()1013 virtual ~Node() { } addElement(const VCFilterFile & file)1014 void addElement(const VCFilterFile &file) { 1015 addElement(file.file, file); 1016 } 1017 virtual void addElement(const QString &filepath, const VCFilterFile &allInfo) = 0; 1018 virtual void removeElements()= 0; 1019 virtual void generateXML(XmlOutput &xml, const QString &tagName, VCProject &tool, const QString &filter) = 0; 1020 virtual bool hasElements() = 0; 1021 }; 1022 1023 class TreeNode : public Node 1024 { 1025 typedef QMap<QString, TreeNode*> ChildrenMap; 1026 VCFilterFile info; 1027 ChildrenMap children; 1028 1029 public: ~TreeNode()1030 virtual ~TreeNode() { removeElements(); } 1031 pathIndex(const QString & filepath)1032 int pathIndex(const QString &filepath) { 1033 int Windex = filepath.indexOf("\\"); 1034 int Uindex = filepath.indexOf("/"); 1035 if (Windex != -1 && Uindex != -1) 1036 return qMin(Windex, Uindex); 1037 else if (Windex != -1) 1038 return Windex; 1039 return Uindex; 1040 } 1041 addElement(const QString & filepath,const VCFilterFile & allInfo)1042 void addElement(const QString &filepath, const VCFilterFile &allInfo) override { 1043 QString newNodeName(filepath); 1044 1045 int index = pathIndex(filepath); 1046 if (index != -1) 1047 newNodeName = filepath.left(index); 1048 1049 TreeNode *n = children.value(newNodeName); 1050 if (!n) { 1051 n = new TreeNode; 1052 n->info = allInfo; 1053 children.insert(newNodeName, n); 1054 } 1055 if (index != -1) 1056 n->addElement(filepath.mid(index+1), allInfo); 1057 } 1058 removeElements()1059 void removeElements() override { 1060 ChildrenMap::ConstIterator it = children.constBegin(); 1061 ChildrenMap::ConstIterator end = children.constEnd(); 1062 for( ; it != end; it++) { 1063 (*it)->removeElements(); 1064 delete it.value(); 1065 } 1066 children.clear(); 1067 } 1068 1069 void generateXML(XmlOutput &xml, const QString &tagName, VCProject &tool, const QString &filter) override; hasElements()1070 bool hasElements() override { 1071 return children.size() != 0; 1072 } 1073 }; 1074 1075 class FlatNode : public Node 1076 { 1077 typedef QMap<QString, VCFilterFile> ChildrenMapFlat; 1078 ChildrenMapFlat children; 1079 1080 public: ~FlatNode()1081 virtual ~FlatNode() { removeElements(); } 1082 pathIndex(const QString & filepath)1083 int pathIndex(const QString &filepath) { 1084 int Windex = filepath.lastIndexOf("\\"); 1085 int Uindex = filepath.lastIndexOf("/"); 1086 if (Windex != -1 && Uindex != -1) 1087 return qMax(Windex, Uindex); 1088 else if (Windex != -1) 1089 return Windex; 1090 return Uindex; 1091 } 1092 addElement(const QString & filepath,const VCFilterFile & allInfo)1093 void addElement(const QString &filepath, const VCFilterFile &allInfo) override { 1094 QString newKey(filepath); 1095 1096 int index = pathIndex(filepath); 1097 if (index != -1) 1098 newKey = filepath.mid(index+1); 1099 1100 // Key designed to sort files with same 1101 // name in different paths correctly 1102 children.insert(newKey + "\0" + allInfo.file, allInfo); 1103 } 1104 removeElements()1105 void removeElements() override { 1106 children.clear(); 1107 } 1108 1109 void generateXML(XmlOutput &xml, const QString &tagName, VCProject &proj, const QString &filter) override; hasElements()1110 bool hasElements() override { 1111 return children.size() != 0; 1112 } 1113 }; 1114 // ---------------------------------------------------------------------------- 1115 1116 class VCProject 1117 { 1118 public: 1119 // Variables 1120 QString Name; 1121 QString Version; 1122 QString ProjectGUID; 1123 QString Keyword; 1124 QString SccProjectName; 1125 QString SccLocalPath; 1126 QString PlatformName; 1127 QString SdkVersion; 1128 QString WindowsTargetPlatformVersion; 1129 QString WindowsTargetPlatformMinVersion; 1130 1131 // Single projects 1132 QList<VCProjectSingleConfig> SingleProjects; 1133 1134 // List of all extracompilers 1135 QStringList ExtraCompilers; 1136 }; 1137 1138 class VCProjectWriter 1139 { 1140 public: ~VCProjectWriter()1141 virtual ~VCProjectWriter() {} 1142 1143 virtual void write(XmlOutput &, VCProjectSingleConfig &); 1144 virtual void write(XmlOutput &, VCProject &); 1145 1146 virtual void write(XmlOutput &, const VCCLCompilerTool &); 1147 virtual void write(XmlOutput &, const VCLinkerTool &); 1148 virtual void write(XmlOutput &, const VCManifestTool &); 1149 virtual void write(XmlOutput &, const VCMIDLTool &); 1150 virtual void write(XmlOutput &, const VCCustomBuildTool &); 1151 virtual void write(XmlOutput &, const VCLibrarianTool &); 1152 virtual void write(XmlOutput &, const VCResourceCompilerTool &); 1153 virtual void write(XmlOutput &, const VCEventTool &); 1154 virtual void write(XmlOutput &, const VCDeploymentTool &); 1155 virtual void write(XmlOutput &, const VCWinDeployQtTool &); 1156 virtual void write(XmlOutput &, const VCConfiguration &); 1157 virtual void write(XmlOutput &, VCFilter &); 1158 1159 private: 1160 static void outputFilter(VCProject &project, XmlOutput &xml, const QString &filtername); 1161 static void outputFileConfigs(VCProject &project, XmlOutput &xml, const VCFilterFile &info, const QString &filtername); 1162 static void outputFileConfig(VCFilter &filter, XmlOutput &xml, const QString &filename); 1163 1164 friend class TreeNode; 1165 friend class FlatNode; 1166 }; 1167 1168 QT_END_NAMESPACE 1169 1170 #endif // MSVC_OBJECTMODEL_H 1171