| 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 |
#include "msvc_objectmodel.h" |
| 5 |
#include "msvc_vcproj.h" |
| 6 |
#include "msvc_vcxproj.h" |
| 7 |
|
| 8 |
#include <ioutils.h> |
| 9 |
|
| 10 |
#include <qscopedpointer.h> |
| 11 |
#include <qfileinfo.h> |
| 12 |
#include <qregularexpression.h> |
| 13 |
|
| 14 |
using namespace QMakeInternal; |
| 15 |
|
| 16 |
QT_BEGIN_NAMESPACE |
| 17 |
|
| 18 |
DotNET vsVersionFromString(const ProString &versionString) |
| 19 |
{ |
| 20 |
int idx = versionString.indexOf(QLatin1Char('.')); |
| 21 |
if (idx == -1) |
| 22 |
return NETUnknown; |
| 23 |
|
| 24 |
QStringView versionView = versionString.toQStringView(); |
| 25 |
int versionMajor = versionView.left(idx).toInt(); |
| 26 |
int versionMinor = versionView.mid(idx + 1).toInt(); |
| 27 |
|
| 28 |
if (versionMajor == 18) |
| 29 |
return NET2026; |
| 30 |
if (versionMajor == 17) |
| 31 |
return NET2022; |
| 32 |
if (versionMajor == 16) |
| 33 |
return NET2019; |
| 34 |
if (versionMajor == 15) |
| 35 |
return NET2017; |
| 36 |
if (versionMajor == 14) |
| 37 |
return NET2015; |
| 38 |
if (versionMajor == 12) |
| 39 |
return NET2013; |
| 40 |
if (versionMajor == 11) |
| 41 |
return NET2012; |
| 42 |
if (versionMajor == 10) |
| 43 |
return NET2010; |
| 44 |
if (versionMajor == 9) |
| 45 |
return NET2008; |
| 46 |
if (versionMajor == 8) |
| 47 |
return NET2005; |
| 48 |
if (versionMajor == 7) { |
| 49 |
if (versionMinor == 0) |
| 50 |
return NET2002; |
| 51 |
if (versionMinor == 1) |
| 52 |
return NET2003; |
| 53 |
} |
| 54 |
|
| 55 |
return NETUnknown; |
| 56 |
} |
| 57 |
|
| 58 |
// XML Tags --------------------------------------------------------- |
| 59 |
const char _Configuration[] = "Configuration"; |
| 60 |
const char _Configurations[] = "Configurations"; |
| 61 |
const char q_File[] = "File"; |
| 62 |
const char _FileConfiguration[] = "FileConfiguration"; |
| 63 |
const char q_Files[] = "Files"; |
| 64 |
const char _Filter[] = "Filter"; |
| 65 |
const char _Globals[] = "Globals"; |
| 66 |
const char _Platform[] = "Platform"; |
| 67 |
const char _Platforms[] = "Platforms"; |
| 68 |
const char _Tool[] = "Tool"; |
| 69 |
const char _VisualStudioProject[] = "VisualStudioProject"; |
| 70 |
|
| 71 |
// XML Properties --------------------------------------------------- |
| 72 |
const char _AddModuleNamesToAssembly[] = "AddModuleNamesToAssembly"; |
| 73 |
const char _AdditionalDependencies[] = "AdditionalDependencies"; |
| 74 |
const char _AdditionalFiles[] = "AdditionalFiles"; |
| 75 |
const char _AdditionalIncludeDirectories[] = "AdditionalIncludeDirectories"; |
| 76 |
const char _AdditionalLibraryDirectories[] = "AdditionalLibraryDirectories"; |
| 77 |
const char _AdditionalOptions[] = "AdditionalOptions"; |
| 78 |
const char _AdditionalUsingDirectories[] = "AdditionalUsingDirectories"; |
| 79 |
const char _AssemblerListingLocation[] = "AssemblerListingLocation"; |
| 80 |
const char _AssemblerOutput[] = "AssemblerOutput"; |
| 81 |
const char _ATLMinimizesCRunTimeLibraryUsage[] = "ATLMinimizesCRunTimeLibraryUsage"; |
| 82 |
const char _BaseAddress[] = "BaseAddress"; |
| 83 |
const char _BasicRuntimeChecks[] = "BasicRuntimeChecks"; |
| 84 |
const char _BrowseInformation[] = "BrowseInformation"; |
| 85 |
const char _BrowseInformationFile[] = "BrowseInformationFile"; |
| 86 |
const char _BufferSecurityCheck[] = "BufferSecurityCheck"; |
| 87 |
const char _BuildBrowserInformation[] = "BuildBrowserInformation"; |
| 88 |
const char _CPreprocessOptions[] = "CPreprocessOptions"; |
| 89 |
const char _CallingConvention[] = "CallingConvention"; |
| 90 |
const char _CharacterSet[] = "CharacterSet"; |
| 91 |
const char _CommandLine[] = "CommandLine"; |
| 92 |
const char _CompileAs[] = "CompileAs"; |
| 93 |
const char _CompileAsManaged[] = "CompileAsManaged"; |
| 94 |
const char _CompileOnly[] = "CompileOnly"; |
| 95 |
const char _ConfigurationType[] = "ConfigurationType"; |
| 96 |
const char _Culture[] = "Culture"; |
| 97 |
const char _DLLDataFileName[] = "DLLDataFileName"; |
| 98 |
const char _DataExecutionPrevention[] = "DataExecutionPrevention"; |
| 99 |
const char _DebugInformationFormat[] = "DebugInformationFormat"; |
| 100 |
const char _DefaultCharType[] = "DefaultCharType"; |
| 101 |
const char _DelayLoadDLLs[] = "DelayLoadDLLs"; |
| 102 |
const char _DeleteExtensionsOnClean[] = "DeleteExtensionsOnClean"; |
| 103 |
const char _Description[] = "Description"; |
| 104 |
const char _Detect64BitPortabilityProblems[] = "Detect64BitPortabilityProblems"; |
| 105 |
const char _DisableLanguageExtensions[] = "DisableLanguageExtensions"; |
| 106 |
const char _DisableSpecificWarnings[] = "DisableSpecificWarnings"; |
| 107 |
const char _EmbedManifest[] = "EmbedManifest"; |
| 108 |
const char _EnableCOMDATFolding[] = "EnableCOMDATFolding"; |
| 109 |
const char _EnableErrorChecks[] = "EnableErrorChecks"; |
| 110 |
const char _EnableEnhancedInstructionSet[] = "EnableEnhancedInstructionSet"; |
| 111 |
const char _EnableFiberSafeOptimizations[] = "EnableFiberSafeOptimizations"; |
| 112 |
const char _EnableFunctionLevelLinking[] = "EnableFunctionLevelLinking"; |
| 113 |
const char _EnableIntrinsicFunctions[] = "EnableIntrinsicFunctions"; |
| 114 |
const char _EntryPointSymbol[] = "EntryPointSymbol"; |
| 115 |
const char _ErrorCheckAllocations[] = "ErrorCheckAllocations"; |
| 116 |
const char _ErrorCheckBounds[] = "ErrorCheckBounds"; |
| 117 |
const char _ErrorCheckEnumRange[] = "ErrorCheckEnumRange"; |
| 118 |
const char _ErrorCheckRefPointers[] = "ErrorCheckRefPointers"; |
| 119 |
const char _ErrorCheckStubData[] = "ErrorCheckStubData"; |
| 120 |
const char _ExceptionHandling[] = "ExceptionHandling"; |
| 121 |
const char _ExcludedFromBuild[] = "ExcludedFromBuild"; |
| 122 |
const char _ExpandAttributedSource[] = "ExpandAttributedSource"; |
| 123 |
const char _ExportNamedFunctions[] = "ExportNamedFunctions"; |
| 124 |
const char _FavorSizeOrSpeed[] = "FavorSizeOrSpeed"; |
| 125 |
const char _FloatingPointModel[] = "FloatingPointModel"; |
| 126 |
const char _FloatingPointExceptions[] = "FloatingPointExceptions"; |
| 127 |
const char _ForceConformanceInForLoopScope[] = "ForceConformanceInForLoopScope"; |
| 128 |
const char _ForceSymbolReferences[] = "ForceSymbolReferences"; |
| 129 |
const char _ForcedIncludeFiles[] = "ForcedIncludeFiles"; |
| 130 |
const char _ForcedUsingFiles[] = "ForcedUsingFiles"; |
| 131 |
const char _FullIncludePath[] = "FullIncludePath"; |
| 132 |
const char _FunctionOrder[] = "FunctionOrder"; |
| 133 |
const char _GenerateDebugInformation[] = "GenerateDebugInformation"; |
| 134 |
const char _GenerateMapFile[] = "GenerateMapFile"; |
| 135 |
const char _GeneratePreprocessedFile[] = "GeneratePreprocessedFile"; |
| 136 |
const char _GenerateStublessProxies[] = "GenerateStublessProxies"; |
| 137 |
const char _GenerateTypeLibrary[] = "GenerateTypeLibrary"; |
| 138 |
const char _GlobalOptimizations[] = "GlobalOptimizations"; |
| 139 |
const char _HeaderFileName[] = "HeaderFileName"; |
| 140 |
const char _HeapCommitSize[] = "HeapCommitSize"; |
| 141 |
const char _HeapReserveSize[] = "HeapReserveSize"; |
| 142 |
const char _IgnoreAllDefaultLibraries[] = "IgnoreAllDefaultLibraries"; |
| 143 |
const char _IgnoreDefaultLibraryNames[] = "IgnoreDefaultLibraryNames"; |
| 144 |
const char _IgnoreEmbeddedIDL[] = "IgnoreEmbeddedIDL"; |
| 145 |
const char _IgnoreImportLibrary[] = "IgnoreImportLibrary"; |
| 146 |
const char _IgnoreStandardIncludePath[] = "IgnoreStandardIncludePath"; |
| 147 |
const char _ImportLibrary[] = "ImportLibrary"; |
| 148 |
const char _ImproveFloatingPointConsistency[] = "ImproveFloatingPointConsistency"; |
| 149 |
const char _InlineFunctionExpansion[] = "InlineFunctionExpansion"; |
| 150 |
const char _InterfaceIdentifierFileName[] = "InterfaceIdentifierFileName"; |
| 151 |
const char _IntermediateDirectory[] = "IntermediateDirectory"; |
| 152 |
const char _KeepComments[] = "KeepComments"; |
| 153 |
const char _LargeAddressAware[] = "LargeAddressAware"; |
| 154 |
const char _LinkDLL[] = "LinkDLL"; |
| 155 |
const char _LinkIncremental[] = "LinkIncremental"; |
| 156 |
const char _LinkTimeCodeGeneration[] = "LinkTimeCodeGeneration"; |
| 157 |
const char _LinkToManagedResourceFile[] = "LinkToManagedResourceFile"; |
| 158 |
const char _MapExports[] = "MapExports"; |
| 159 |
const char _MapFileName[] = "MapFileName"; |
| 160 |
const char _MapLines[] = "MapLines "; |
| 161 |
const char _MergeSections[] = "MergeSections"; |
| 162 |
const char _MergedIDLBaseFileName[] = "MergedIDLBaseFileName"; |
| 163 |
const char _MidlCommandFile[] = "MidlCommandFile"; |
| 164 |
const char _MinimalRebuild[] = "MinimalRebuild"; |
| 165 |
const char _MkTypLibCompatible[] = "MkTypLibCompatible"; |
| 166 |
const char _ModuleDefinitionFile[] = "ModuleDefinitionFile"; |
| 167 |
const char _Name[] = "Name"; |
| 168 |
const char _ObjectFile[] = "ObjectFile"; |
| 169 |
const char _OmitFramePointers[] = "OmitFramePointers"; |
| 170 |
const char _OpenMP[] = "OpenMP"; |
| 171 |
const char _Optimization[] = "Optimization "; |
| 172 |
const char _OptimizeForProcessor[] = "OptimizeForProcessor"; |
| 173 |
const char _OptimizeForWindows98[] = "OptimizeForWindows98"; |
| 174 |
const char _OptimizeForWindowsApplication[] = "OptimizeForWindowsApplication"; |
| 175 |
const char _OptimizeReferences[] = "OptimizeReferences"; |
| 176 |
const char _OutputDirectory[] = "OutputDirectory"; |
| 177 |
const char _OutputFile[] = "OutputFile"; |
| 178 |
const char _Outputs[] = "Outputs"; |
| 179 |
const char _ParseFiles[] = "ParseFiles"; |
| 180 |
const char _PrecompiledHeaderFile[] = "PrecompiledHeaderFile"; |
| 181 |
const char _PrecompiledHeaderThrough[] = "PrecompiledHeaderThrough"; |
| 182 |
const char _PreprocessorDefinitions[] = "PreprocessorDefinitions"; |
| 183 |
const char _PrimaryOutput[] = "PrimaryOutput"; |
| 184 |
const char _ProjectGUID[] = "ProjectGUID"; |
| 185 |
const char _Keyword[] = "Keyword"; |
| 186 |
const char _ProjectType[] = "ProjectType"; |
| 187 |
const char _ProgramDatabase[] = "ProgramDatabase"; |
| 188 |
const char _ProgramDataBaseFileName[] = "ProgramDataBaseFileName"; |
| 189 |
const char _ProgramDatabaseFile[] = "ProgramDatabaseFile"; |
| 190 |
const char _ProxyFileName[] = "ProxyFileName"; |
| 191 |
const char _RandomizedBaseAddress[] = "RandomizedBaseAddress"; |
| 192 |
const char _RedirectOutputAndErrors[] = "RedirectOutputAndErrors"; |
| 193 |
const char _RegisterOutput[] = "RegisterOutput"; |
| 194 |
const char _RelativePath[] = "RelativePath"; |
| 195 |
const char _RemoteDirectory[] = "RemoteDirectory"; |
| 196 |
const char _ResourceOnlyDLL[] = "ResourceOnlyDLL"; |
| 197 |
const char _ResourceOutputFileName[] = "ResourceOutputFileName"; |
| 198 |
const char _RuntimeLibrary[] = "RuntimeLibrary"; |
| 199 |
const char _RuntimeTypeInfo[] = "RuntimeTypeInfo"; |
| 200 |
const char _SccProjectName[] = "SccProjectName"; |
| 201 |
const char _SccLocalPath[] = "SccLocalPath"; |
| 202 |
const char _SetChecksum[] = "SetChecksum"; |
| 203 |
const char _ShowIncludes[] = "ShowIncludes"; |
| 204 |
const char _ShowProgress[] = "ShowProgress"; |
| 205 |
const char _SmallerTypeCheck[] = "SmallerTypeCheck"; |
| 206 |
const char _StackCommitSize[] = "StackCommitSize"; |
| 207 |
const char _StackReserveSize[] = "StackReserveSize"; |
| 208 |
const char _StringPooling[] = "StringPooling"; |
| 209 |
const char _StripPrivateSymbols[] = "StripPrivateSymbols"; |
| 210 |
const char _StructMemberAlignment[] = "StructMemberAlignment"; |
| 211 |
const char _SubSystem[] = "SubSystem"; |
| 212 |
const char _SupportUnloadOfDelayLoadedDLL[] = "SupportUnloadOfDelayLoadedDLL"; |
| 213 |
const char _SuppressStartupBanner[] = "SuppressStartupBanner"; |
| 214 |
const char _SwapRunFromCD[] = "SwapRunFromCD"; |
| 215 |
const char _SwapRunFromNet[] = "SwapRunFromNet"; |
| 216 |
const char _TargetEnvironment[] = "TargetEnvironment"; |
| 217 |
const char _TargetMachine[] = "TargetMachine"; |
| 218 |
const char _TerminalServerAware[] = "TerminalServerAware"; |
| 219 |
const char _Path[] = "Path"; |
| 220 |
const char _TreatWChar_tAsBuiltInType[] = "TreatWChar_tAsBuiltInType"; |
| 221 |
const char _TurnOffAssemblyGeneration[] = "TurnOffAssemblyGeneration"; |
| 222 |
const char _TypeLibraryFile[] = "TypeLibraryFile"; |
| 223 |
const char _TypeLibraryName[] = "TypeLibraryName"; |
| 224 |
const char _TypeLibraryResourceID[] = "TypeLibraryResourceID"; |
| 225 |
const char _UndefineAllPreprocessorDefinitions[]= "UndefineAllPreprocessorDefinitions"; |
| 226 |
const char _UndefinePreprocessorDefinitions[] = "UndefinePreprocessorDefinitions"; |
| 227 |
const char _UniqueIdentifier[] = "UniqueIdentifier"; |
| 228 |
const char _UseOfATL[] = "UseOfATL"; |
| 229 |
const char _UseOfMfc[] = "UseOfMfc"; |
| 230 |
const char _UsePrecompiledHeader[] = "UsePrecompiledHeader"; |
| 231 |
const char _ValidateParameters[] = "ValidateParameters"; |
| 232 |
const char _VCCLCompilerTool[] = "VCCLCompilerTool"; |
| 233 |
const char _VCLibrarianTool[] = "VCLibrarianTool"; |
| 234 |
const char _VCLinkerTool[] = "VCLinkerTool"; |
| 235 |
const char _VCManifestTool[] = "VCManifestTool"; |
| 236 |
const char _VCCustomBuildTool[] = "VCCustomBuildTool"; |
| 237 |
const char _VCResourceCompilerTool[] = "VCResourceCompilerTool"; |
| 238 |
const char _VCMIDLTool[] = "VCMIDLTool"; |
| 239 |
const char _Version[] = "Version"; |
| 240 |
const char _WarnAsError[] = "WarnAsError"; |
| 241 |
const char _WarningLevel[] = "WarningLevel"; |
| 242 |
const char _WholeProgramOptimization[] = "WholeProgramOptimization"; |
| 243 |
const char _CompileForArchitecture[] = "CompileForArchitecture"; |
| 244 |
const char _InterworkCalls[] = "InterworkCalls"; |
| 245 |
const char _GenerateManifest[] = "GenerateManifest"; |
| 246 |
|
| 247 |
// XmlOutput stream functions ------------------------------ |
| 248 |
inline XmlOutput::xml_output attrT(const char *name, const triState v) |
| 249 |
{ |
| 250 |
if(v == unset) |
| 251 |
return noxml(); |
| 252 |
return attr(name, (v == _True ? "true" : "false")); |
| 253 |
} |
| 254 |
|
| 255 |
inline XmlOutput::xml_output attrE(const char *name, int v) |
| 256 |
{ |
| 257 |
return attr(name, QString::number(v)); |
| 258 |
} |
| 259 |
|
| 260 |
/*ifNot version*/ |
| 261 |
inline XmlOutput::xml_output attrE(const char *name, int v, int ifn) |
| 262 |
{ |
| 263 |
if (v == ifn) |
| 264 |
return noxml(); |
| 265 |
return attr(name, QString::number(v)); |
| 266 |
} |
| 267 |
|
| 268 |
inline XmlOutput::xml_output attrL(const char *name, qint64 v) |
| 269 |
{ |
| 270 |
return attr(name, QString::number(v)); |
| 271 |
} |
| 272 |
|
| 273 |
/*ifNot version*/ |
| 274 |
inline XmlOutput::xml_output attrL(const char *name, qint64 v, qint64 ifn) |
| 275 |
{ |
| 276 |
if (v == ifn) |
| 277 |
return noxml(); |
| 278 |
return attr(name, QString::number(v)); |
| 279 |
} |
| 280 |
|
| 281 |
inline XmlOutput::xml_output attrS(const char *name, const QString &v) |
| 282 |
{ |
| 283 |
if(v.isEmpty()) |
| 284 |
return noxml(); |
| 285 |
return attr(name, v); |
| 286 |
} |
| 287 |
|
| 288 |
inline XmlOutput::xml_output attrX(const char *name, const QStringList &v, const char *s = ",") |
| 289 |
{ |
| 290 |
if(v.isEmpty()) |
| 291 |
return noxml(); |
| 292 |
return attr(name, v.join(s)); |
| 293 |
} |
| 294 |
|
| 295 |
triState operator!(const triState &rhs) |
| 296 |
{ |
| 297 |
if (rhs == unset) |
| 298 |
return rhs; |
| 299 |
triState lhs = (rhs == _True ? _False : _True); |
| 300 |
return lhs; |
| 301 |
} |
| 302 |
|
| 303 |
// VCToolBase ------------------------------------------------- |
| 304 |
QStringList VCToolBase::fixCommandLine(const QString &input) |
| 305 |
{ |
| 306 |
// The splitting regexp is a bit bizarre for backwards compat reasons (why else ...). |
| 307 |
return input.split(QRegularExpression(QLatin1String("(\n\t|\r\\\\h|\r\n)\\s*"))); |
| 308 |
} |
| 309 |
|
| 310 |
static QString vcCommandSeparator() |
| 311 |
{ |
| 312 |
// MSVC transforms the build tree into a single batch file, simply pasting the contents |
| 313 |
// of the custom commands into it, and putting an "if errorlevel goto" statement behind it. |
| 314 |
// As we want every sub-command to be error-checked (as is done by makefile-based |
| 315 |
// backends), we insert the checks ourselves, using the undocumented jump target. |
| 316 |
return QStringLiteral("
if errorlevel 1 goto VCReportError
"); |
| 317 |
} |
| 318 |
|
| 319 |
static void unknownOptionWarning(const char *tool, const char *option) |
| 320 |
{ |
| 321 |
Q_CONSTINIT static bool firstCall = true; |
| 322 |
warn_msg(WarnLogic, "Could not parse %s option '%s'; added to AdditionalOptions.", tool, option); |
| 323 |
if (firstCall) { |
| 324 |
firstCall = false; |
| 325 |
warn_msg(WarnLogic, |
| 326 |
"You can suppress these warnings with CONFIG+=suppress_vcproj_warnings."); |
| 327 |
} |
| 328 |
} |
| 329 |
|
| 330 |
|
| 331 |
// VCCLCompilerTool ------------------------------------------------- |
| 332 |
VCCLCompilerTool::VCCLCompilerTool() |
| 333 |
: AssemblerOutput(asmListingNone), |
| 334 |
BasicRuntimeChecks(runtimeBasicCheckNone), |
| 335 |
BrowseInformation(brInfoNone), |
| 336 |
BufferSecurityCheck(unset), |
| 337 |
CallingConvention(callConventionDefault), |
| 338 |
CompileAs(compileAsDefault), |
| 339 |
CompileAsManaged(managedDefault), |
| 340 |
CompileAsWinRT(unset), |
| 341 |
CompileOnly(unset), |
| 342 |
DebugInformationFormat(debugDisabled), |
| 343 |
Detect64BitPortabilityProblems(unset), |
| 344 |
DisableLanguageExtensions(unset), |
| 345 |
EnableEnhancedInstructionSet(archNotSet), |
| 346 |
EnableFiberSafeOptimizations(unset), |
| 347 |
EnableFunctionLevelLinking(unset), |
| 348 |
EnableIntrinsicFunctions(unset), |
| 349 |
ExceptionHandling(ehDefault), |
| 350 |
ExpandAttributedSource(unset), |
| 351 |
FavorSizeOrSpeed(favorNone), |
| 352 |
FloatingPointModel(floatingPointNotSet), |
| 353 |
FloatingPointExceptions(unset), |
| 354 |
ForceConformanceInForLoopScope(unset), |
| 355 |
GeneratePreprocessedFile(preprocessNo), |
| 356 |
PreprocessSuppressLineNumbers(unset), |
| 357 |
GlobalOptimizations(unset), |
| 358 |
IgnoreStandardIncludePath(unset), |
| 359 |
ImproveFloatingPointConsistency(unset), |
| 360 |
InlineFunctionExpansion(expandDefault), |
| 361 |
KeepComments(unset), |
| 362 |
MinimalRebuild(unset), |
| 363 |
OmitDefaultLibName(unset), |
| 364 |
OmitFramePointers(unset), |
| 365 |
OpenMP(unset), |
| 366 |
Optimization(optimizeCustom), |
| 367 |
OptimizeForProcessor(procOptimizeBlended), |
| 368 |
OptimizeForWindowsApplication(unset), |
| 369 |
ProgramDataBaseFileName(""), |
| 370 |
RuntimeLibrary(rtMultiThreaded), |
| 371 |
RuntimeTypeInfo(unset), |
| 372 |
ShowIncludes(unset), |
| 373 |
SmallerTypeCheck(unset), |
| 374 |
StringPooling(unset), |
| 375 |
StructMemberAlignment(alignNotSet), |
| 376 |
SuppressStartupBanner(unset), |
| 377 |
TreatWChar_tAsBuiltInType(unset), |
| 378 |
TurnOffAssemblyGeneration(unset), |
| 379 |
UndefineAllPreprocessorDefinitions(unset), |
| 380 |
UsePrecompiledHeader(pchUnset), |
| 381 |
UseUnicodeForAssemblerListing(unset), |
| 382 |
WarnAsError(unset), |
| 383 |
WarningLevel(warningLevel_0), |
| 384 |
WholeProgramOptimization(unset), |
| 385 |
CompileForArchitecture(archUnknown), |
| 386 |
InterworkCalls(unset), |
| 387 |
EnablePREfast(unset), |
| 388 |
DisplayFullPaths(_False), |
| 389 |
MultiProcessorCompilation(unset), |
| 390 |
GenerateXMLDocumentationFiles(unset), |
| 391 |
CreateHotpatchableImage(unset) |
| 392 |
{ |
| 393 |
} |
| 394 |
|
| 395 |
/* |
| 396 |
* Some values for the attribute UsePrecompiledHeader have changed from VS 2003 to VS 2005, |
| 397 |
* see the following chart, so we need a function that transforms those values if we are |
| 398 |
* using NET2005: |
| 399 |
* |
| 400 |
* Meaning 2003 2005 |
| 401 |
* ----------------------------------------- |
| 402 |
* Don't use PCH 0 0 |
| 403 |
* Create PCH (/Yc) 1 1 |
| 404 |
* Automatically generate (/YX) 2 (seems that it was removed) |
| 405 |
* Use specific PCH (/Yu) 3 2 |
| 406 |
* |
| 407 |
*/ |
| 408 |
inline XmlOutput::xml_output xformUsePrecompiledHeaderForNET2005(pchOption whatPch, DotNET compilerVersion) |
| 409 |
{ |
| 410 |
if (compilerVersion >= NET2005) { |
| 411 |
if (whatPch == pchGenerateAuto) whatPch = (pchOption)0; |
| 412 |
if (whatPch == pchUseUsingSpecific) whatPch = (pchOption)2; |
| 413 |
} |
| 414 |
return attrE(_UsePrecompiledHeader, whatPch, /*ifNot*/ pchUnset); |
| 415 |
} |
| 416 |
|
| 417 |
inline XmlOutput::xml_output xformExceptionHandlingNET2005(exceptionHandling eh, DotNET compilerVersion) |
| 418 |
{ |
| 419 |
if (eh == ehDefault) |
| 420 |
return noxml(); |
| 421 |
|
| 422 |
if (compilerVersion >= NET2005) |
| 423 |
return attrE(_ExceptionHandling, eh); |
| 424 |
|
| 425 |
return attrS(_ExceptionHandling, (eh == ehNoSEH ? "true" : "false")); |
| 426 |
} |
| 427 |
|
| 428 |
bool VCCLCompilerTool::parseOption(const char* option) |
| 429 |
{ |
| 430 |
// skip index 0 ('/' or '-') |
| 431 |
char first = option[1]; |
| 432 |
char second = option[2]; |
| 433 |
char third = option[3]; |
| 434 |
char fourth = option[4]; |
| 435 |
bool found = true; |
| 436 |
|
| 437 |
switch (first) { |
| 438 |
case '?': |
| 439 |
case 'h': |
| 440 |
if(second == 'o' && third == 't' && fourth == 'p') { |
| 441 |
CreateHotpatchableImage = _True; |
| 442 |
break; |
| 443 |
} |
| 444 |
qWarning("Generator: Option '/?', '/help': MSVC.NET projects do not support outputting help info"); |
| 445 |
found = false; |
| 446 |
break; |
| 447 |
case '@': |
| 448 |
qWarning("Generator: Option '/@': MSVC.NET projects do not support the use of a response file"); |
| 449 |
found = false; |
| 450 |
break; |
| 451 |
case 'l': |
| 452 |
qWarning("Generator: Option '/link': qmake generator does not support passing link options through the compiler tool"); |
| 453 |
found = false; |
| 454 |
break; |
| 455 |
case 'A': |
| 456 |
if(second != 'I') { |
| 457 |
found = false; break; |
| 458 |
} |
| 459 |
AdditionalUsingDirectories += option+3; |
| 460 |
break; |
| 461 |
case 'C': |
| 462 |
KeepComments = _True; |
| 463 |
break; |
| 464 |
case 'D': |
| 465 |
PreprocessorDefinitions += option+2; |
| 466 |
break; |
| 467 |
case 'E': |
| 468 |
if(second == 'H') { |
| 469 |
QByteArray opt(option + 2); |
| 470 |
if (opt.contains('a') && !opt.contains('s') && !opt.contains('c')) |
| 471 |
ExceptionHandling = ehSEH; |
| 472 |
else if (!opt.contains('a') && opt.contains("s-") && opt.contains("c-")) |
| 473 |
ExceptionHandling = ehNone; |
| 474 |
else if (!opt.contains('a') && opt.contains('s') && opt.contains('c')) |
| 475 |
ExceptionHandling = ehNoSEH; |
| 476 |
else { |
| 477 |
// ExceptionHandling must be false, or it will override |
| 478 |
// with an /EHsc option |
| 479 |
ExceptionHandling = ehNone; |
| 480 |
AdditionalOptions += option; |
| 481 |
} |
| 482 |
if (config->CompilerVersion < NET2005 |
| 483 |
&& ExceptionHandling == ehSEH) { |
| 484 |
ExceptionHandling = ehNone; |
| 485 |
AdditionalOptions += option; |
| 486 |
} |
| 487 |
break; |
| 488 |
} else if (second == 'P') { |
| 489 |
PreprocessSuppressLineNumbers = _True; |
| 490 |
} |
| 491 |
GeneratePreprocessedFile = preprocessYes; |
| 492 |
break; |
| 493 |
case 'F': |
| 494 |
if(second <= '9' && second >= '0') { |
| 495 |
AdditionalOptions += option; |
| 496 |
break; |
| 497 |
} else { |
| 498 |
switch (second) { |
| 499 |
case 'A': |
| 500 |
if(third == 'c') { |
| 501 |
AssemblerOutput = asmListingAsmMachine; |
| 502 |
if(fourth == 's') |
| 503 |
AssemblerOutput = asmListingAsmMachineSrc; |
| 504 |
} else if(third == 's') { |
| 505 |
AssemblerOutput = asmListingAsmSrc; |
| 506 |
} else if (third == 'u') { |
| 507 |
UseUnicodeForAssemblerListing = _True; |
| 508 |
} else { |
| 509 |
AssemblerOutput = asmListingAssemblyOnly; |
| 510 |
} |
| 511 |
break; |
| 512 |
case 'C': |
| 513 |
DisplayFullPaths = _True; |
| 514 |
break; |
| 515 |
case 'a': |
| 516 |
AssemblerListingLocation = option+3; |
| 517 |
break; |
| 518 |
case 'I': |
| 519 |
ForcedIncludeFiles += option+3; |
| 520 |
break; |
| 521 |
case 'i': |
| 522 |
PreprocessOutputPath += option+3; |
| 523 |
break; |
| 524 |
case 'R': |
| 525 |
BrowseInformation = brAllInfo; |
| 526 |
BrowseInformationFile = option+3; |
| 527 |
break; |
| 528 |
case 'S': |
| 529 |
if (config->CompilerVersion < NET2013) |
| 530 |
found = false; |
| 531 |
// Ignore this flag. Visual Studio 2013 takes care of this setting. |
| 532 |
break; |
| 533 |
case 'r': |
| 534 |
BrowseInformation = brNoLocalSymbols; |
| 535 |
BrowseInformationFile = option+3; |
| 536 |
break; |
| 537 |
case 'U': |
| 538 |
ForcedUsingFiles += option+3; |
| 539 |
break; |
| 540 |
case 'd': |
| 541 |
ProgramDataBaseFileName = option+3; |
| 542 |
break; |
| 543 |
case 'e': |
| 544 |
OutputFile = option+3; |
| 545 |
break; |
| 546 |
case 'm': |
| 547 |
AdditionalOptions += option; |
| 548 |
break; |
| 549 |
case 'o': |
| 550 |
ObjectFile = option+3; |
| 551 |
break; |
| 552 |
case 'p': |
| 553 |
PrecompiledHeaderFile = option+3; |
| 554 |
break; |
| 555 |
case 'x': |
| 556 |
ExpandAttributedSource = _True; |
| 557 |
break; |
| 558 |
default: |
| 559 |
found = false; break; |
| 560 |
} |
| 561 |
} |
| 562 |
break; |
| 563 |
case 'G': |
| 564 |
switch (second) { |
| 565 |
case '3': |
| 566 |
case '4': |
| 567 |
qWarning("Option '/G3' and '/G4' were phased out in Visual C++ 5.0"); |
| 568 |
found = false; break; |
| 569 |
case '5': |
| 570 |
OptimizeForProcessor = procOptimizePentium; |
| 571 |
break; |
| 572 |
case '6': |
| 573 |
case 'B': |
| 574 |
OptimizeForProcessor = procOptimizePentiumProAndAbove; |
| 575 |
break; |
| 576 |
case '7': |
| 577 |
OptimizeForProcessor = procOptimizePentium4AndAbove; |
| 578 |
break; |
| 579 |
case 'A': |
| 580 |
OptimizeForWindowsApplication = _True; |
| 581 |
break; |
| 582 |
case 'F': |
| 583 |
StringPooling = _True; |
| 584 |
break; |
| 585 |
case 'H': |
| 586 |
AdditionalOptions += option; |
| 587 |
break; |
| 588 |
case 'L': |
| 589 |
WholeProgramOptimization = _True; |
| 590 |
if(third == '-') |
| 591 |
WholeProgramOptimization = _False; |
| 592 |
break; |
| 593 |
case 'R': |
| 594 |
RuntimeTypeInfo = _True; |
| 595 |
if(third == '-') |
| 596 |
RuntimeTypeInfo = _False; |
| 597 |
break; |
| 598 |
case 'S': |
| 599 |
BufferSecurityCheck = _True; |
| 600 |
if(third == '-') |
| 601 |
BufferSecurityCheck = _False; |
| 602 |
break; |
| 603 |
case 'T': |
| 604 |
EnableFiberSafeOptimizations = _True; |
| 605 |
break; |
| 606 |
case 'X': |
| 607 |
// Same as the /EHsc option, which is Exception Handling without SEH |
| 608 |
ExceptionHandling = ehNoSEH; |
| 609 |
if (third == '-') |
| 610 |
ExceptionHandling = ehNone; |
| 611 |
break; |
| 612 |
case 'Z': |
| 613 |
case 'e': |
| 614 |
case 'h': |
| 615 |
AdditionalOptions += option; |
| 616 |
break; |
| 617 |
case 'd': |
| 618 |
CallingConvention = callConventionCDecl; |
| 619 |
break; |
| 620 |
case 'f': |
| 621 |
StringPooling = _True; |
| 622 |
AdditionalOptions += option; |
| 623 |
break; |
| 624 |
case 'm': |
| 625 |
MinimalRebuild = _True; |
| 626 |
if(third == '-') |
| 627 |
MinimalRebuild = _False; |
| 628 |
break; |
| 629 |
case 'r': |
| 630 |
CallingConvention = callConventionFastCall; |
| 631 |
break; |
| 632 |
case 's': |
| 633 |
AdditionalOptions += option; |
| 634 |
break; |
| 635 |
case 'y': |
| 636 |
EnableFunctionLevelLinking = _True; |
| 637 |
break; |
| 638 |
case 'z': |
| 639 |
CallingConvention = callConventionStdCall; |
| 640 |
break; |
| 641 |
default: |
| 642 |
found = false; break; |
| 643 |
} |
| 644 |
break; |
| 645 |
case 'H': |
| 646 |
AdditionalOptions += option; |
| 647 |
break; |
| 648 |
case 'I': |
| 649 |
AdditionalIncludeDirectories += option+2; |
| 650 |
break; |
| 651 |
case 'J': |
| 652 |
AdditionalOptions += option; |
| 653 |
break; |
| 654 |
case 'L': |
| 655 |
if(second == 'D') { |
| 656 |
AdditionalOptions += option; |
| 657 |
break; |
| 658 |
} |
| 659 |
found = false; break; |
| 660 |
case 'M': |
| 661 |
if(second == 'D') { |
| 662 |
RuntimeLibrary = rtMultiThreadedDLL; |
| 663 |
if(third == 'd') |
| 664 |
RuntimeLibrary = rtMultiThreadedDebugDLL; |
| 665 |
break; |
| 666 |
} else if(second == 'L') { |
| 667 |
RuntimeLibrary = rtSingleThreaded; |
| 668 |
if(third == 'd') |
| 669 |
RuntimeLibrary = rtSingleThreadedDebug; |
| 670 |
break; |
| 671 |
} else if(second == 'T') { |
| 672 |
RuntimeLibrary = rtMultiThreaded; |
| 673 |
if(third == 'd') |
| 674 |
RuntimeLibrary = rtMultiThreadedDebug; |
| 675 |
break; |
| 676 |
} else if (second == 'P') { |
| 677 |
if (config->CompilerVersion >= NET2010) { |
| 678 |
MultiProcessorCompilation = _True; |
| 679 |
MultiProcessorCompilationProcessorCount = option+3; |
| 680 |
} else if (config->CompilerVersion >= NET2005) { |
| 681 |
AdditionalOptions += option; |
| 682 |
} else { |
| 683 |
warn_msg(WarnLogic, "/MP option is not supported in Visual C++ < 2005, ignoring."); |
| 684 |
} |
| 685 |
break; |
| 686 |
} |
| 687 |
found = false; break; |
| 688 |
case 'O': |
| 689 |
switch (second) { |
| 690 |
case '1': |
| 691 |
Optimization = optimizeMinSpace; |
| 692 |
break; |
| 693 |
case '2': |
| 694 |
Optimization = optimizeMaxSpeed; |
| 695 |
break; |
| 696 |
case 'a': |
| 697 |
AdditionalOptions += option; |
| 698 |
break; |
| 699 |
case 'b': |
| 700 |
if(third == '0') |
| 701 |
InlineFunctionExpansion = expandDisable; |
| 702 |
else if(third == '1') |
| 703 |
InlineFunctionExpansion = expandOnlyInline; |
| 704 |
else if(third == '2') |
| 705 |
InlineFunctionExpansion = expandAnySuitable; |
| 706 |
else |
| 707 |
found = false; |
| 708 |
break; |
| 709 |
case 'd': |
| 710 |
Optimization = optimizeDisabled; |
| 711 |
break; |
| 712 |
case 'g': |
| 713 |
GlobalOptimizations = _True; |
| 714 |
break; |
| 715 |
case 'i': |
| 716 |
EnableIntrinsicFunctions = _True; |
| 717 |
break; |
| 718 |
case 'p': |
| 719 |
ImproveFloatingPointConsistency = _True; |
| 720 |
if(third == '-') |
| 721 |
ImproveFloatingPointConsistency = _False; |
| 722 |
break; |
| 723 |
case 's': |
| 724 |
FavorSizeOrSpeed = favorSize; |
| 725 |
break; |
| 726 |
case 't': |
| 727 |
FavorSizeOrSpeed = favorSpeed; |
| 728 |
break; |
| 729 |
case 'w': |
| 730 |
AdditionalOptions += option; |
| 731 |
break; |
| 732 |
case 'x': |
| 733 |
Optimization = optimizeFull; |
| 734 |
break; |
| 735 |
case 'y': |
| 736 |
OmitFramePointers = _True; |
| 737 |
if(third == '-') |
| 738 |
OmitFramePointers = _False; |
| 739 |
break; |
| 740 |
default: |
| 741 |
found = false; break; |
| 742 |
} |
| 743 |
break; |
| 744 |
case 'P': |
| 745 |
GeneratePreprocessedFile = preprocessYes; |
| 746 |
break; |
| 747 |
case 'Q': |
| 748 |
if(second == 'I') { |
| 749 |
AdditionalOptions += option; |
| 750 |
break; |
| 751 |
} else if (second == 'R') { |
| 752 |
QString opt = option + 3; |
| 753 |
if (opt == "interwork-return") { |
| 754 |
InterworkCalls = _True; |
| 755 |
break; |
| 756 |
} else if (opt == "arch4") { |
| 757 |
CompileForArchitecture = archArmv4; |
| 758 |
break; |
| 759 |
} else if (opt == "arch5") { |
| 760 |
CompileForArchitecture = archArmv5; |
| 761 |
break; |
| 762 |
} else if (opt == "arch4T") { |
| 763 |
CompileForArchitecture = archArmv4T; |
| 764 |
break; |
| 765 |
} else if (opt == "arch5T") { |
| 766 |
CompileForArchitecture = archArmv5T; |
| 767 |
break; |
| 768 |
} |
| 769 |
} else if (second == 'M') { |
| 770 |
QString opt = option + 3; |
| 771 |
if (opt == "mips1") { |
| 772 |
CompileForArchitecture = archMips1; |
| 773 |
break; |
| 774 |
} |
| 775 |
else if (opt == "mips2") { |
| 776 |
CompileForArchitecture = archMips2; |
| 777 |
break; |
| 778 |
} |
| 779 |
else if (opt == "mips3") { |
| 780 |
CompileForArchitecture = archMips3; |
| 781 |
break; |
| 782 |
} |
| 783 |
else if (opt == "mips4") { |
| 784 |
CompileForArchitecture = archMips4; |
| 785 |
break; |
| 786 |
} |
| 787 |
else if (opt == "mips5") { |
| 788 |
CompileForArchitecture = archMips5; |
| 789 |
break; |
| 790 |
} |
| 791 |
else if (opt == "mips16") { |
| 792 |
CompileForArchitecture = archMips16; |
| 793 |
break; |
| 794 |
} |
| 795 |
else if (opt == "mips32") { |
| 796 |
CompileForArchitecture = archMips32; |
| 797 |
break; |
| 798 |
} |
| 799 |
else if (opt == "mips64") { |
| 800 |
CompileForArchitecture = archMips64; |
| 801 |
break; |
| 802 |
} |
| 803 |
} |
| 804 |
found = false; break; |
| 805 |
case 'R': |
| 806 |
if(second == 'T' && third == 'C') { |
| 807 |
int rtc = BasicRuntimeChecks; |
| 808 |
for (size_t i = 4; option[i]; ++i) { |
| 809 |
if (!parseRuntimeCheckOption(option[i], &rtc)) { |
| 810 |
found = false; |
| 811 |
break; |
| 812 |
} |
| 813 |
} |
| 814 |
BasicRuntimeChecks = static_cast<basicRuntimeCheckOption>(rtc); |
| 815 |
} |
| 816 |
break; |
| 817 |
case 'T': |
| 818 |
if(second == 'C') { |
| 819 |
CompileAs = compileAsC; |
| 820 |
} else if(second == 'P') { |
| 821 |
CompileAs = compileAsCPlusPlus; |
| 822 |
} else { |
| 823 |
qWarning("Generator: Options '/Tp<filename>' and '/Tc<filename>' are not supported by qmake"); |
| 824 |
found = false; break; |
| 825 |
} |
| 826 |
break; |
| 827 |
case 'U': |
| 828 |
UndefinePreprocessorDefinitions += option+2; |
| 829 |
break; |
| 830 |
case 'V': |
| 831 |
AdditionalOptions += option; |
| 832 |
break; |
| 833 |
case 'W': |
| 834 |
switch (second) { |
| 835 |
case 'a': |
| 836 |
case '4': |
| 837 |
WarningLevel = warningLevel_4; |
| 838 |
break; |
| 839 |
case '3': |
| 840 |
WarningLevel = warningLevel_3; |
| 841 |
break; |
| 842 |
case '2': |
| 843 |
WarningLevel = warningLevel_2; |
| 844 |
break; |
| 845 |
case '1': |
| 846 |
WarningLevel = warningLevel_1; |
| 847 |
break; |
| 848 |
case '0': |
| 849 |
WarningLevel = warningLevel_0; |
| 850 |
break; |
| 851 |
case 'L': |
| 852 |
AdditionalOptions += option; |
| 853 |
break; |
| 854 |
case 'X': |
| 855 |
WarnAsError = _True; |
| 856 |
break; |
| 857 |
case 'p': |
| 858 |
if(third == '6' && fourth == '4') { |
| 859 |
if (config->CompilerVersion >= NET2010) { |
| 860 |
// Deprecated for VS2010 but can be used under Additional Options. |
| 861 |
AdditionalOptions += option; |
| 862 |
} else { |
| 863 |
Detect64BitPortabilityProblems = _True; |
| 864 |
} |
| 865 |
break; |
| 866 |
} |
| 867 |
[[fallthrough]]; |
| 868 |
default: |
| 869 |
found = false; break; |
| 870 |
} |
| 871 |
break; |
| 872 |
case 'X': |
| 873 |
IgnoreStandardIncludePath = _True; |
| 874 |
break; |
| 875 |
case 'Y': |
| 876 |
switch (second) { |
| 877 |
case '\0': |
| 878 |
case '-': |
| 879 |
AdditionalOptions += option; |
| 880 |
break; |
| 881 |
case 'X': |
| 882 |
UsePrecompiledHeader = pchGenerateAuto; |
| 883 |
PrecompiledHeaderThrough = option+3; |
| 884 |
break; |
| 885 |
case 'c': |
| 886 |
UsePrecompiledHeader = pchCreateUsingSpecific; |
| 887 |
PrecompiledHeaderThrough = option+3; |
| 888 |
break; |
| 889 |
case 'd': |
| 890 |
case 'l': |
| 891 |
AdditionalOptions += option; |
| 892 |
break; |
| 893 |
case 'u': |
| 894 |
UsePrecompiledHeader = pchUseUsingSpecific; |
| 895 |
PrecompiledHeaderThrough = option+3; |
| 896 |
break; |
| 897 |
default: |
| 898 |
found = false; break; |
| 899 |
} |
| 900 |
break; |
| 901 |
case 'Z': |
| 902 |
switch (second) { |
| 903 |
case '7': |
| 904 |
DebugInformationFormat = debugOldStyleInfo; |
| 905 |
break; |
| 906 |
case 'I': |
| 907 |
DebugInformationFormat = debugEditAndContinue; |
| 908 |
break; |
| 909 |
case 'd': |
| 910 |
DebugInformationFormat = debugLineInfoOnly; |
| 911 |
break; |
| 912 |
case 'i': |
| 913 |
DebugInformationFormat = debugEnabled; |
| 914 |
break; |
| 915 |
case 'l': |
| 916 |
OmitDefaultLibName = _True; |
| 917 |
break; |
| 918 |
case 'a': |
| 919 |
DisableLanguageExtensions = _True; |
| 920 |
break; |
| 921 |
case 'e': |
| 922 |
DisableLanguageExtensions = _False; |
| 923 |
break; |
| 924 |
case 'c': |
| 925 |
if(third == ':') { |
| 926 |
const char *c = option + 4; |
| 927 |
// Go to the end of the option |
| 928 |
while ( *c != '\0' && *c != ' ' && *c != '-') |
| 929 |
++c; |
| 930 |
if(fourth == 'f') |
| 931 |
ForceConformanceInForLoopScope = ((*c) == '-' ? _False : _True); |
| 932 |
else if(fourth == 'w') |
| 933 |
TreatWChar_tAsBuiltInType = ((*c) == '-' ? _False : _True); |
| 934 |
else |
| 935 |
AdditionalOptions += option; |
| 936 |
} else { |
| 937 |
found = false; break; |
| 938 |
} |
| 939 |
break; |
| 940 |
case 'g': |
| 941 |
case 'm': |
| 942 |
case 's': |
| 943 |
AdditionalOptions += option; |
| 944 |
break; |
| 945 |
case 'p': |
| 946 |
switch (third) |
| 947 |
{ |
| 948 |
case '\0': |
| 949 |
case '1': |
| 950 |
StructMemberAlignment = alignSingleByte; |
| 951 |
if(fourth == '6') |
| 952 |
StructMemberAlignment = alignSixteenBytes; |
| 953 |
break; |
| 954 |
case '2': |
| 955 |
StructMemberAlignment = alignTwoBytes; |
| 956 |
break; |
| 957 |
case '4': |
| 958 |
StructMemberAlignment = alignFourBytes; |
| 959 |
break; |
| 960 |
case '8': |
| 961 |
StructMemberAlignment = alignEightBytes; |
| 962 |
break; |
| 963 |
default: |
| 964 |
found = false; break; |
| 965 |
} |
| 966 |
break; |
| 967 |
case 'W': |
| 968 |
if (third == '-') |
| 969 |
CompileAsWinRT = _False; |
| 970 |
else |
| 971 |
CompileAsWinRT = _True; |
| 972 |
break; |
| 973 |
default: |
| 974 |
found = false; break; |
| 975 |
} |
| 976 |
break; |
| 977 |
case 'a': |
| 978 |
if (second == 'r' && third == 'c' && fourth == 'h') { |
| 979 |
if (option[5] == ':') { |
| 980 |
const char *o = option; |
| 981 |
if (o[6] == 'S' && o[7] == 'S' && o[8] == 'E') { |
| 982 |
EnableEnhancedInstructionSet = o[9] == '2' ? archSSE2 : archSSE; |
| 983 |
break; |
| 984 |
} |
| 985 |
} |
| 986 |
} else if (second == 'n' && third == 'a' && fourth == 'l') { |
| 987 |
EnablePREfast = _True; |
| 988 |
break; |
| 989 |
} |
| 990 |
found = false; |
| 991 |
break; |
| 992 |
case 'b': // see http://msdn2.microsoft.com/en-us/library/ms173499.aspx |
| 993 |
if (second == 'i' && third == 'g' && fourth == 'o') { |
| 994 |
const char *o = option; |
| 995 |
if (o[5] == 'b' && o[6] == 'j') { |
| 996 |
AdditionalOptions += option; |
| 997 |
break; |
| 998 |
} |
| 999 |
} |
| 1000 |
found = false; |
| 1001 |
break; |
| 1002 |
case 'c': |
| 1003 |
if(second == '\0') { |
| 1004 |
CompileOnly = _True; |
| 1005 |
} else if(second == 'l') { |
| 1006 |
if (config->CompilerVersion < NET2005) { |
| 1007 |
if(*(option+5) == 'n') { |
| 1008 |
CompileAsManaged = managedAssemblyPure; |
| 1009 |
TurnOffAssemblyGeneration = _True; |
| 1010 |
} else if(*(option+5) == 'p') { |
| 1011 |
CompileAsManaged = managedAssemblyPure; |
| 1012 |
warn_msg(WarnLogic, "/clr:pure option only for .NET >= 2005, using /clr"); |
| 1013 |
} else if(*(option+5) == 's') { |
| 1014 |
CompileAsManaged = managedAssemblyPure; |
| 1015 |
warn_msg(WarnLogic, "/clr:safe option only for .NET >= 2005, using /clr"); |
| 1016 |
} else if(*(option+5) == 'o') { |
| 1017 |
CompileAsManaged = managedAssemblyPure; |
| 1018 |
warn_msg(WarnLogic, "/clr:oldSyntax option only for .NET >= 2005, using /clr"); |
| 1019 |
} else if(*(option+5) == 'i') { |
| 1020 |
CompileAsManaged = managedAssemblyPure; |
| 1021 |
warn_msg(WarnLogic, "initialAppDomain enum value unknown, using /crl"); |
| 1022 |
} else { |
| 1023 |
CompileAsManaged = managedAssemblyPure; |
| 1024 |
} |
| 1025 |
} else { |
| 1026 |
if(*(option+5) == 'n') { |
| 1027 |
CompileAsManaged = managedAssembly; |
| 1028 |
TurnOffAssemblyGeneration = _True; |
| 1029 |
} else if(*(option+5) == 'p') { |
| 1030 |
CompileAsManaged = managedAssemblyPure; |
| 1031 |
} else if(*(option+5) == 's') { |
| 1032 |
CompileAsManaged = managedAssemblySafe; |
| 1033 |
} else if(*(option+5) == 'o') { |
| 1034 |
CompileAsManaged = managedAssemblyOldSyntax; |
| 1035 |
} else if(*(option+5) == 'i') { |
| 1036 |
CompileAsManaged = managedAssembly; |
| 1037 |
warn_msg(WarnLogic, "initialAppDomain enum value unknown, using /crl default"); |
| 1038 |
} else { |
| 1039 |
CompileAsManaged = managedAssembly; |
| 1040 |
} |
| 1041 |
} |
| 1042 |
} else { |
| 1043 |
found = false; break; |
| 1044 |
} |
| 1045 |
break; |
| 1046 |
case 'd': |
| 1047 |
if (second == 'r') { |
| 1048 |
CompileAsManaged = managedAssembly; |
| 1049 |
break; |
| 1050 |
} else if (second != 'o' && third == 'c') { |
| 1051 |
GenerateXMLDocumentationFiles = _True; |
| 1052 |
XMLDocumentationFileName += option+4; |
| 1053 |
break; |
| 1054 |
} |
| 1055 |
found = false; |
| 1056 |
break; |
| 1057 |
case 'e': |
| 1058 |
if (second == 'r' && third == 'r' && fourth == 'o') { |
| 1059 |
if (option[12] == ':') { |
| 1060 |
if ( option[13] == 'n') { |
| 1061 |
ErrorReporting = "None"; |
| 1062 |
} else if (option[13] == 'p') { |
| 1063 |
ErrorReporting = "Prompt"; |
| 1064 |
} else if (option[13] == 'q') { |
| 1065 |
ErrorReporting = "Queue"; |
| 1066 |
} else if (option[13] == 's') { |
| 1067 |
ErrorReporting = "Send"; |
| 1068 |
} else { |
| 1069 |
found = false; |
| 1070 |
} |
| 1071 |
break; |
| 1072 |
} |
| 1073 |
} |
| 1074 |
found = false; |
| 1075 |
break; |
| 1076 |
case 'f': |
| 1077 |
if(second == 'p' && third == ':') { |
| 1078 |
// Go to the end of the option |
| 1079 |
const char *c = option + 4; |
| 1080 |
while (*c != '\0' && *c != ' ' && *c != '-') |
| 1081 |
++c; |
| 1082 |
switch (fourth) { |
| 1083 |
case 'e': |
| 1084 |
FloatingPointExceptions = ((*c) == '-' ? _False : _True); |
| 1085 |
break; |
| 1086 |
case 'f': |
| 1087 |
FloatingPointModel = floatingPointFast; |
| 1088 |
break; |
| 1089 |
case 'p': |
| 1090 |
FloatingPointModel = floatingPointPrecise; |
| 1091 |
break; |
| 1092 |
case 's': |
| 1093 |
FloatingPointModel = floatingPointStrict; |
| 1094 |
break; |
| 1095 |
default: |
| 1096 |
found = false; |
| 1097 |
break; |
| 1098 |
} |
| 1099 |
} |
| 1100 |
break; |
| 1101 |
case 'n': |
| 1102 |
if(second == 'o' && third == 'B' && fourth == 'o') { |
| 1103 |
AdditionalOptions += "/noBool"; |
| 1104 |
break; |
| 1105 |
} |
| 1106 |
if(second == 'o' && third == 'l' && fourth == 'o') { |
| 1107 |
SuppressStartupBanner = _True; |
| 1108 |
break; |
| 1109 |
} |
| 1110 |
found = false; break; |
| 1111 |
case 'o': |
| 1112 |
{ |
| 1113 |
const char *str = option + 2; |
| 1114 |
const size_t len = strlen(str); |
| 1115 |
if (len >= 5 && len <= 6 && strncmp(str, "penmp", 5) == 0) { |
| 1116 |
if (len == 5) { |
| 1117 |
OpenMP = _True; |
| 1118 |
break; |
| 1119 |
} else if (str[5] == '-') { |
| 1120 |
OpenMP = _False; |
| 1121 |
break; |
| 1122 |
} |
| 1123 |
} |
| 1124 |
found = false; break; |
| 1125 |
} |
| 1126 |
case 's': |
| 1127 |
if(second == 'h' && third == 'o' && fourth == 'w') { |
| 1128 |
ShowIncludes = _True; |
| 1129 |
break; |
| 1130 |
} |
| 1131 |
if (strlen(option) > 7 && second == 't' && third == 'd' && fourth == ':') { |
| 1132 |
static const QRegularExpression rex("(c(?:\\+\\+)?)(.+)"); |
| 1133 |
auto m = rex.match(option + 5); |
| 1134 |
if (m.hasMatch()) { |
| 1135 |
QString *var = nullptr; |
| 1136 |
const QStringList *knownVersions = nullptr; |
| 1137 |
QString valuePrefix; |
| 1138 |
auto lang = m.capturedView(1); |
| 1139 |
auto version = m.capturedView(2); |
| 1140 |
if (lang == QStringLiteral("c++")) { |
| 1141 |
// Turn /std:c++17 into <LanguageStandard>stdcpp17</LanguageStandard> |
| 1142 |
static const QStringList knownCxxVersions = { |
| 1143 |
"14", |
| 1144 |
"17", |
| 1145 |
"20", |
| 1146 |
"latest" |
| 1147 |
}; |
| 1148 |
var = &LanguageStandard; |
| 1149 |
knownVersions = &knownCxxVersions; |
| 1150 |
valuePrefix = "stdcpp"; |
| 1151 |
} else if (lang == QStringLiteral("c")) { |
| 1152 |
// Turn /std:c17 into <LanguageStandard_C>stdc17</LanguageStandard_C> |
| 1153 |
static const QStringList knownCVersions = { |
| 1154 |
"11", |
| 1155 |
"17" |
| 1156 |
}; |
| 1157 |
var = &LanguageStandard_C; |
| 1158 |
knownVersions = &knownCVersions; |
| 1159 |
valuePrefix = "stdc"; |
| 1160 |
} |
| 1161 |
if (var && knownVersions->contains(version)) { |
| 1162 |
*var = valuePrefix + version; |
| 1163 |
break; |
| 1164 |
} |
| 1165 |
} |
| 1166 |
} |
| 1167 |
found = false; break; |
| 1168 |
case 'u': |
| 1169 |
if (!second) |
| 1170 |
UndefineAllPreprocessorDefinitions = _True; |
| 1171 |
else if (strcmp(option + 2, "tf-8") == 0) |
| 1172 |
AdditionalOptions += option; |
| 1173 |
else |
| 1174 |
found = false; |
| 1175 |
break; |
| 1176 |
case 'v': |
| 1177 |
if(second == 'd' || second == 'm') { |
| 1178 |
AdditionalOptions += option; |
| 1179 |
break; |
| 1180 |
} |
| 1181 |
found = false; break; |
| 1182 |
case 'w': |
| 1183 |
switch (second) { |
| 1184 |
case '\0': |
| 1185 |
WarningLevel = warningLevel_0; |
| 1186 |
break; |
| 1187 |
case 'd': |
| 1188 |
DisableSpecificWarnings += option+3; |
| 1189 |
break; |
| 1190 |
case 'e': |
| 1191 |
if (config->CompilerVersion <= NET2008) |
| 1192 |
AdditionalOptions += option; |
| 1193 |
else |
| 1194 |
TreatSpecificWarningsAsErrors += option + 3; |
| 1195 |
break; |
| 1196 |
default: |
| 1197 |
AdditionalOptions += option; |
| 1198 |
} |
| 1199 |
break; |
| 1200 |
default: |
| 1201 |
AdditionalOptions += option; |
| 1202 |
break; |
| 1203 |
} |
| 1204 |
if(!found) { |
| 1205 |
if (!config->suppressUnknownOptionWarnings) |
| 1206 |
unknownOptionWarning("Compiler", option); |
| 1207 |
AdditionalOptions += option; |
| 1208 |
} |
| 1209 |
return true; |
| 1210 |
} |
| 1211 |
|
| 1212 |
bool VCCLCompilerTool::parseRuntimeCheckOption(char c, int *rtc) |
| 1213 |
{ |
| 1214 |
if (c == '1') |
| 1215 |
*rtc = runtimeBasicCheckAll; |
| 1216 |
else if (c == 'c') |
| 1217 |
SmallerTypeCheck = _True; |
| 1218 |
else if (c == 's') |
| 1219 |
*rtc |= runtimeCheckStackFrame; |
| 1220 |
else if (c == 'u') |
| 1221 |
*rtc |= runtimeCheckUninitVariables; |
| 1222 |
else |
| 1223 |
return false; |
| 1224 |
return true; |
| 1225 |
} |
| 1226 |
|
| 1227 |
// VCLinkerTool ----------------------------------------------------- |
| 1228 |
VCLinkerTool::VCLinkerTool() |
| 1229 |
: DataExecutionPrevention(unset), |
| 1230 |
EnableCOMDATFolding(optFoldingDefault), |
| 1231 |
GenerateDebugInformation(unset), |
| 1232 |
DebugInfoOption(linkerDebugOptionNone), |
| 1233 |
GenerateMapFile(unset), |
| 1234 |
HeapCommitSize(-1), |
| 1235 |
HeapReserveSize(-1), |
| 1236 |
IgnoreAllDefaultLibraries(unset), |
| 1237 |
IgnoreEmbeddedIDL(unset), |
| 1238 |
IgnoreImportLibrary(_True), |
| 1239 |
ImageHasSafeExceptionHandlers(unset), |
| 1240 |
LargeAddressAware(addrAwareDefault), |
| 1241 |
LinkDLL(unset), |
| 1242 |
LinkIncremental(linkIncrementalDefault), |
| 1243 |
LinkTimeCodeGeneration(optLTCGDefault), |
| 1244 |
MapExports(unset), |
| 1245 |
MapLines(unset), |
| 1246 |
OptimizeForWindows98(optWin98Default), |
| 1247 |
OptimizeReferences(optReferencesDefault), |
| 1248 |
RandomizedBaseAddress(unset), |
| 1249 |
RegisterOutput(unset), |
| 1250 |
ResourceOnlyDLL(unset), |
| 1251 |
SetChecksum(unset), |
| 1252 |
ShowProgress(linkProgressNotSet), |
| 1253 |
StackCommitSize(-1), |
| 1254 |
StackReserveSize(-1), |
| 1255 |
SubSystem(subSystemNotSet), |
| 1256 |
SupportUnloadOfDelayLoadedDLL(unset), |
| 1257 |
SuppressStartupBanner(unset), |
| 1258 |
SwapRunFromCD(unset), |
| 1259 |
SwapRunFromNet(unset), |
| 1260 |
TargetMachine(machineNotSet), |
| 1261 |
TerminalServerAware(termSvrAwareDefault), |
| 1262 |
TreatWarningsAsErrors(unset), |
| 1263 |
TurnOffAssemblyGeneration(unset), |
| 1264 |
TypeLibraryResourceID(0), |
| 1265 |
GenerateManifest(unset), |
| 1266 |
EnableUAC(unset), |
| 1267 |
UACUIAccess(unset), |
| 1268 |
SectionAlignment(-1), |
| 1269 |
PreventDllBinding(unset), |
| 1270 |
AllowIsolation(unset), |
| 1271 |
AssemblyDebug(unset), |
| 1272 |
CLRUnmanagedCodeCheck(unset), |
| 1273 |
DelaySign(unset), |
| 1274 |
GenerateWindowsMetadata(unset) |
| 1275 |
{ |
| 1276 |
} |
| 1277 |
|
| 1278 |
// Hashing routine to do fast option lookups ---- |
| 1279 |
// Slightly rewritten to stop on ':' ',' and '\0' |
| 1280 |
// Original routine in qtranslator.cpp ---------- |
| 1281 |
static uint elfHash(const char* name) |
| 1282 |
{ |
| 1283 |
const uchar *k; |
| 1284 |
uint h = 0; |
| 1285 |
uint g; |
| 1286 |
|
| 1287 |
if(name) { |
| 1288 |
k = (const uchar *) name; |
| 1289 |
while((*k) && |
| 1290 |
(*k)!= ':' && |
| 1291 |
(*k)!=',' && |
| 1292 |
(*k)!=' ') { |
| 1293 |
h = (h << 4) + *k++; |
| 1294 |
if((g = (h & 0xf0000000)) != 0) |
| 1295 |
h ^= g >> 24; |
| 1296 |
h &= ~g; |
| 1297 |
} |
| 1298 |
} |
| 1299 |
if(!h) |
| 1300 |
h = 1; |
| 1301 |
return h; |
| 1302 |
} |
| 1303 |
|
| 1304 |
//#define USE_DISPLAY_HASH |
| 1305 |
#ifdef USE_DISPLAY_HASH |
| 1306 |
static void displayHash(const char* str) |
| 1307 |
{ |
| 1308 |
printf("case 0x%07x: // %s\n break;\n", elfHash(str), str); |
| 1309 |
} |
| 1310 |
#endif |
| 1311 |
|
| 1312 |
bool VCLinkerTool::parseOption(const char* option) |
| 1313 |
{ |
| 1314 |
#ifdef USE_DISPLAY_HASH |
| 1315 |
// Main options |
| 1316 |
displayHash("/ALIGN"); displayHash("/ALLOWBIND"); displayHash("/ASSEMBLYMODULE"); |
| 1317 |
displayHash("/ASSEMBLYRESOURCE"); displayHash("/BASE"); displayHash("/DEBUG"); |
| 1318 |
displayHash("/DEF"); displayHash("/DEFAULTLIB"); displayHash("/DELAY"); |
| 1319 |
displayHash("/DELAYLOAD"); displayHash("/DLL"); displayHash("/DRIVER"); |
| 1320 |
displayHash("/ENTRY"); displayHash("/EXETYPE"); displayHash("/EXPORT"); |
| 1321 |
displayHash("/FIXED"); displayHash("/FORCE"); displayHash("/HEAP"); |
| 1322 |
displayHash("/IDLOUT"); displayHash("/IGNORE"); displayHash("/IGNOREIDL"); displayHash("/IMPLIB"); |
| 1323 |
displayHash("/INCLUDE"); displayHash("/INCREMENTAL"); displayHash("/LARGEADDRESSAWARE"); |
| 1324 |
displayHash("/LIBPATH"); displayHash("/LTCG"); displayHash("/MACHINE"); |
| 1325 |
displayHash("/MAP"); displayHash("/MAPINFO"); displayHash("/MERGE"); |
| 1326 |
displayHash("/MIDL"); displayHash("/NOASSEMBLY"); displayHash("/NODEFAULTLIB"); |
| 1327 |
displayHash("/NOENTRY"); displayHash("/NOLOGO"); displayHash("/OPT"); |
| 1328 |
displayHash("/ORDER"); displayHash("/OUT"); displayHash("/PDB"); |
| 1329 |
displayHash("/PDBSTRIPPED"); displayHash("/RELEASE"); displayHash("/SECTION"); |
| 1330 |
displayHash("/STACK"); displayHash("/STUB"); displayHash("/SUBSYSTEM"); |
| 1331 |
displayHash("/SWAPRUN"); displayHash("/TLBID"); displayHash("/TLBOUT"); |
| 1332 |
displayHash("/TSAWARE"); displayHash("/VERBOSE"); displayHash("/VERSION"); |
| 1333 |
displayHash("/VXD"); displayHash("/WS "); displayHash("/libpath"); |
| 1334 |
displayHash("/WINMD"); displayHash("/WINMDFILE:"); |
| 1335 |
|
| 1336 |
#endif |
| 1337 |
#ifdef USE_DISPLAY_HASH |
| 1338 |
// Sub options |
| 1339 |
displayHash("UNLOAD"); displayHash("NOBIND"); displayHash("no"); displayHash("NOSTATUS"); displayHash("STATUS"); |
| 1340 |
displayHash("AM33"); displayHash("ARM"); displayHash("CEE"); displayHash("EBC"); displayHash("IA64"); displayHash("X86"); displayHash("X64"); displayHash("M32R"); |
| 1341 |
displayHash("MIPS"); displayHash("MIPS16"); displayHash("MIPSFPU"); displayHash("MIPSFPU16"); displayHash("MIPSR41XX"); displayHash("PPC"); |
| 1342 |
displayHash("SH3"); displayHash("SH3DSP"); displayHash("SH4"); displayHash("SH5"); displayHash("THUMB"); displayHash("TRICORE"); displayHash("EXPORTS"); |
| 1343 |
displayHash("LINES"); displayHash("REF"); displayHash("NOREF"); displayHash("ICF"); displayHash("WIN98"); displayHash("NOWIN98"); |
| 1344 |
displayHash("CONSOLE"); displayHash("EFI_APPLICATION"); displayHash("EFI_BOOT_SERVICE_DRIVER"); displayHash("EFI_ROM"); displayHash("EFI_RUNTIME_DRIVER"); displayHash("NATIVE"); |
| 1345 |
displayHash("POSIX"); displayHash("WINDOWS"); displayHash("WINDOWSCE"); displayHash("NET"); displayHash("CD"); displayHash("NO"); |
| 1346 |
#endif |
| 1347 |
bool found = true; |
| 1348 |
const uint optionHash = elfHash(option); |
| 1349 |
if (config->CompilerVersion < NET2010) { |
| 1350 |
switch (optionHash) { |
| 1351 |
case 0x3360dbe: // /ALIGN[:number] |
| 1352 |
case 0x1485c34: // /ALLOWBIND[:NO] |
| 1353 |
case 0x33aec94: // /FIXED[:NO] |
| 1354 |
case 0x7988f7e: // /SECTION:name,[E][R][W][S][D][K][L][P][X][,ALIGN=#] |
| 1355 |
case 0x0348992: // /STUB:filename |
| 1356 |
AdditionalOptions += option; |
| 1357 |
return true; |
| 1358 |
} |
| 1359 |
} |
| 1360 |
|
| 1361 |
switch (optionHash) { |
| 1362 |
case 0x6b21972: // /DEFAULTLIB:library |
| 1363 |
case 0x396ea92: // /DRIVER[:UPONLY | :WDM] |
| 1364 |
case 0xaca9d75: // /EXETYPE[:DYNAMIC | :DEV386] |
| 1365 |
case 0x3ad5444: // /EXPORT:entryname[,@ordinal[,NONAME]][,DATA] |
| 1366 |
case 0x33b4675: // /FORCE:[MULTIPLE|UNRESOLVED] |
| 1367 |
case 0x3dc3455: // /IGNORE:number,number,number,number ### NOTE: This one is undocumented, but it is even used by Microsoft. |
| 1368 |
// In recent versions of the Microsoft linker they have disabled this undocumented feature. |
| 1369 |
case 0x0034bc4: // /VXD |
| 1370 |
AdditionalOptions += option; |
| 1371 |
break; |
| 1372 |
case 0x3360dbe: // /ALIGN[:number] |
| 1373 |
SectionAlignment = QString(option+7).toLongLong(); |
| 1374 |
break; |
| 1375 |
case 0x1485c34: // /ALLOWBIND[:NO] |
| 1376 |
if(*(option+10) == ':' && (*(option+11) == 'n' || *(option+11) == 'N')) |
| 1377 |
PreventDllBinding = _False; |
| 1378 |
else |
| 1379 |
PreventDllBinding = _True; |
| 1380 |
break; |
| 1381 |
case 0x312011e: // /ALLOWISOLATION[:NO] |
| 1382 |
if(*(option+15) == ':' && (*(option+16) == 'n' || *(option+16) == 'N')) |
| 1383 |
AllowIsolation = _False; |
| 1384 |
else |
| 1385 |
AllowIsolation = _True; |
| 1386 |
break; |
| 1387 |
case 0x679c075: // /ASSEMBLYMODULE:filename |
| 1388 |
AddModuleNamesToAssembly += option+15; |
| 1389 |
break; |
| 1390 |
case 0x75f35f7: // /ASSEMBLYDEBUG[:DISABLE] |
| 1391 |
if(*(option+14) == ':' && (*(option+15) == 'D')) |
| 1392 |
AssemblyDebug = _False; |
| 1393 |
else |
| 1394 |
AssemblyDebug = _True; |
| 1395 |
break; |
| 1396 |
case 0x43294a5: // /ASSEMBLYLINKRESOURCE:filename |
| 1397 |
AssemblyLinkResource += option+22; |
| 1398 |
break; |
| 1399 |
case 0x062d065: // /ASSEMBLYRESOURCE:filename |
| 1400 |
LinkToManagedResourceFile = option+18; |
| 1401 |
break; |
| 1402 |
case 0x0336675: // /BASE:{address | @filename,key} |
| 1403 |
// Do we need to do a manual lookup when '@filename,key'? |
| 1404 |
// Seems BaseAddress only can contain the location... |
| 1405 |
// We don't use it in Qt, so keep it simple for now |
| 1406 |
BaseAddress = option+6; |
| 1407 |
break; |
| 1408 |
case 0x63bf065: // /CLRIMAGETYPE:{IJW|PURE|SAFE} |
| 1409 |
if(*(option+14) == 'I') |
| 1410 |
CLRImageType = "ForceIJWImage"; |
| 1411 |
else if(*(option+14) == 'P') |
| 1412 |
CLRImageType = "ForcePureILImage"; |
| 1413 |
else if(*(option+14) == 'S') |
| 1414 |
CLRImageType = "ForceSafeILImage"; |
| 1415 |
break; |
| 1416 |
case 0x5f2a6a2: // /CLRSUPPORTLASTERROR{:NO | SYSTEMDLL} |
| 1417 |
if(*(option+20) == ':') { |
| 1418 |
if(*(option+21) == 'N') { |
| 1419 |
CLRSupportLastError = "Disabled"; |
| 1420 |
} else if(*(option+21) == 'S') { |
| 1421 |
CLRSupportLastError = "SystemDlls"; |
| 1422 |
} |
| 1423 |
} else { |
| 1424 |
CLRSupportLastError = "Enabled"; |
| 1425 |
} |
| 1426 |
break; |
| 1427 |
case 0xc7984f5: // /CLRTHREADATTRIBUTE:{STA|MTA|NONE} |
| 1428 |
if(*(option+20) == 'N') |
| 1429 |
CLRThreadAttribute = "DefaultThreadingAttribute"; |
| 1430 |
else if(*(option+20) == 'M') |
| 1431 |
CLRThreadAttribute = "MTAThreadingAttribute"; |
| 1432 |
else if(*(option+20) == 'S') |
| 1433 |
CLRThreadAttribute = "STAThreadingAttribute"; |
| 1434 |
break; |
| 1435 |
case 0xa8c637b: // /CLRUNMANAGEDCODECHECK[:NO] |
| 1436 |
if(*(option+23) == 'N') |
| 1437 |
CLRUnmanagedCodeCheck = _False; |
| 1438 |
else |
| 1439 |
CLRUnmanagedCodeCheck = _True; |
| 1440 |
break; |
| 1441 |
case 0x62d9e94: // /MANIFEST[:NO] |
| 1442 |
if ((*(option+9) == ':' && (*(option+10) == 'N' || *(option+10) == 'n'))) |
| 1443 |
GenerateManifest = _False; |
| 1444 |
else |
| 1445 |
GenerateManifest = _True; |
| 1446 |
break; |
| 1447 |
case 0x34be314: // /WINMD[:NO] |
| 1448 |
if ((*(option+6) == ':' && (*(option+7) == 'N' || *(option+7) == 'n'))) |
| 1449 |
GenerateWindowsMetadata = _False; |
| 1450 |
else |
| 1451 |
GenerateWindowsMetadata = _True; |
| 1452 |
break; |
| 1453 |
case 0x31be7e5: // /WINMDFILE:filename |
| 1454 |
WindowsMetadataFile = option+11; |
| 1455 |
break; |
| 1456 |
case 0x8b64559: // /MANIFESTDEPENDENCY:manifest_dependency |
| 1457 |
AdditionalManifestDependencies += option+20; |
| 1458 |
break; |
| 1459 |
case 0xe9e8195: // /MANIFESTFILE:filename |
| 1460 |
ManifestFile = option+14; |
| 1461 |
break; |
| 1462 |
case 0x9e9fb83: // /MANIFESTUAC http://msdn.microsoft.com/en-us/library/bb384691%28VS.100%29.aspx |
| 1463 |
if ((*(option+12) == ':' && (*(option+13) == 'N' || *(option+13) == 'n'))) |
| 1464 |
EnableUAC = _False; |
| 1465 |
else if((*(option+12) == ':' && (*(option+13) == 'l' || *(option+14) == 'e'))) { // level |
| 1466 |
if(*(option+20) == 'a') |
| 1467 |
UACExecutionLevel = "AsInvoker"; |
| 1468 |
else if(*(option+20) == 'h') |
| 1469 |
UACExecutionLevel = "HighestAvailable"; |
| 1470 |
else if(*(option+20) == 'r') |
| 1471 |
UACExecutionLevel = "RequireAdministrator"; |
| 1472 |
} else if((*(option+12) == ':' && (*(option+13) == 'u' || *(option+14) == 'i'))) { // uiAccess |
| 1473 |
if(*(option+22) == 't') |
| 1474 |
UACUIAccess = _True; |
| 1475 |
else |
| 1476 |
UACUIAccess = _False; |
| 1477 |
} else if((*(option+12) == ':' && (*(option+13) == 'f' || *(option+14) == 'r'))) { // fragment |
| 1478 |
AdditionalOptions += option; |
| 1479 |
}else |
| 1480 |
EnableUAC = _True; |
| 1481 |
break; |
| 1482 |
case 0x3389797: // /DEBUG[:{FASTLINK|FULL|NONE}] |
| 1483 |
DebugInfoOption = linkerDebugOptionEnabled; |
| 1484 |
if (config->CompilerVersion >= NET2015 && *(option + 6) == ':') { |
| 1485 |
const char *str = option + 7; |
| 1486 |
if (qstricmp(str, "fastlink") == 0) |
| 1487 |
DebugInfoOption = linkerDebugOptionFastLink; |
| 1488 |
else if (qstricmp(str, "full") == 0) |
| 1489 |
DebugInfoOption = linkerDebugOptionFull; |
| 1490 |
else if (qstricmp(str, "none") == 0) |
| 1491 |
DebugInfoOption = linkerDebugOptionNone; |
| 1492 |
else |
| 1493 |
AdditionalOptions += option; |
| 1494 |
} |
| 1495 |
if (DebugInfoOption == linkerDebugOptionNone) |
| 1496 |
GenerateDebugInformation = _False; |
| 1497 |
else |
| 1498 |
GenerateDebugInformation = _True; |
| 1499 |
break; |
| 1500 |
case 0x0033896: // /DEF:filename |
| 1501 |
ModuleDefinitionFile = option+5; |
| 1502 |
break; |
| 1503 |
case 0x338a069: // /DELAY:{UNLOAD | NOBIND} |
| 1504 |
// MS documentation does not specify what to do with |
| 1505 |
// this option, so we'll put it in AdditionalOptions |
| 1506 |
AdditionalOptions += option; |
| 1507 |
break; |
| 1508 |
case 0x06f4bf4: // /DELAYLOAD:dllname |
| 1509 |
DelayLoadDLLs += option+11; |
| 1510 |
break; |
| 1511 |
case 0x06d451e: // /DELAYSIGN[:NO] |
| 1512 |
if(*(option+10) == ':' && (*(option+11) == 'n' || *(option+11) == 'N')) |
| 1513 |
DelaySign = _False; |
| 1514 |
else |
| 1515 |
DelaySign = _True; |
| 1516 |
break; |
| 1517 |
case 0x003390c: // /DLL |
| 1518 |
// This option is not used for vcproj files |
| 1519 |
break; |
| 1520 |
case 0x2ee8415: // /DYNAMICBASE[:NO] |
| 1521 |
if(*(option+12) == ':' && (*(option+13) == 'n' || *(option+13) == 'N')) |
| 1522 |
RandomizedBaseAddress = _False; |
| 1523 |
else |
| 1524 |
RandomizedBaseAddress = _True; |
| 1525 |
break; |
| 1526 |
case 0x33a3979: // /ENTRY:function |
| 1527 |
EntryPointSymbol = option+7; |
| 1528 |
break; |
| 1529 |
case 0x4504334: // /ERRORREPORT:[ NONE | PROMPT | QUEUE | SEND ] |
| 1530 |
if(*(option+12) == ':' ) { |
| 1531 |
if(*(option+13) == 'N') |
| 1532 |
LinkErrorReporting = "NoErrorReport"; |
| 1533 |
else if(*(option+13) == 'P') |
| 1534 |
LinkErrorReporting = "PromptImmediately"; |
| 1535 |
else if(*(option+13) == 'Q') |
| 1536 |
LinkErrorReporting = "QueueForNextLogin"; |
| 1537 |
else if(*(option+13) == 'S') |
| 1538 |
LinkErrorReporting = "SendErrorReport"; |
| 1539 |
} |
| 1540 |
break; |
| 1541 |
case 0x033c960: // /HEAP:reserve[,commit] |
| 1542 |
{ |
| 1543 |
QStringList both = QString(option+6).split(","); |
| 1544 |
HeapReserveSize = both[0].toLongLong(); |
| 1545 |
if(both.size() == 2) |
| 1546 |
HeapCommitSize = both[1].toLongLong(); |
| 1547 |
} |
| 1548 |
break; |
| 1549 |
case 0x3d91494: // /IDLOUT:[path\]filename |
| 1550 |
MergedIDLBaseFileName = option+8; |
| 1551 |
break; |
| 1552 |
case 0x345a04c: // /IGNOREIDL |
| 1553 |
IgnoreEmbeddedIDL = _True; |
| 1554 |
break; |
| 1555 |
case 0x3e250e2: // /IMPLIB:filename |
| 1556 |
ImportLibrary = option+8; |
| 1557 |
break; |
| 1558 |
case 0xe281ab5: // /INCLUDE:symbol |
| 1559 |
ForceSymbolReferences += option+9; |
| 1560 |
break; |
| 1561 |
case 0xb28103c: // /INCREMENTAL[:no] |
| 1562 |
if(*(option+12) == ':' && |
| 1563 |
(*(option+13) == 'n' || *(option+13) == 'N')) |
| 1564 |
LinkIncremental = linkIncrementalNo; |
| 1565 |
else |
| 1566 |
LinkIncremental = linkIncrementalYes; |
| 1567 |
break; |
| 1568 |
case 0x07f1ab2: // /KEYCONTAINER:name |
| 1569 |
KeyContainer = option+14; |
| 1570 |
break; |
| 1571 |
case 0xfadaf35: // /KEYFILE:filename |
| 1572 |
KeyFile = option+9; |
| 1573 |
break; |
| 1574 |
case 0x26e4675: // /LARGEADDRESSAWARE[:no] |
| 1575 |
if(*(option+18) == ':' && |
| 1576 |
*(option+19) == 'n') |
| 1577 |
LargeAddressAware = addrAwareNoLarge; |
| 1578 |
else |
| 1579 |
LargeAddressAware = addrAwareLarge; |
| 1580 |
break; |
| 1581 |
case 0x2f96bc8: // /libpath:dir |
| 1582 |
case 0x0d745c8: // /LIBPATH:dir |
| 1583 |
AdditionalLibraryDirectories += option+9; |
| 1584 |
break; |
| 1585 |
case 0x0341877: // /LTCG[:{INCREMENTAL|NOSTATUS|STATUS|OFF}] |
| 1586 |
// /LTCG:{PGINSTRUMENT|PGOPTIMIZE|PGUPDATE} |
| 1587 |
LinkTimeCodeGeneration = optLTCGEnabled; |
| 1588 |
if (*(option + 5) == ':') { |
| 1589 |
const char* str = option + 6; |
| 1590 |
if (qstricmp(str, "status") == 0) |
| 1591 |
ShowProgress = linkProgressAll; |
| 1592 |
else if (qstricmp(str, "off") == 0) |
| 1593 |
LinkTimeCodeGeneration = optLTCGDefault; |
| 1594 |
else if (qstricmp(str, "incremental") == 0) |
| 1595 |
LinkTimeCodeGeneration = optLTCGIncremental; |
| 1596 |
else if (qstricmp(str, "pginstrument") == 0) |
| 1597 |
LinkTimeCodeGeneration = optLTCGInstrument; |
| 1598 |
else if (qstricmp(str, "pgoptimize") == 0) |
| 1599 |
LinkTimeCodeGeneration = optLTCGOptimize; |
| 1600 |
else if (qstricmp(str, "pgupdate") == 0) |
| 1601 |
LinkTimeCodeGeneration = optLTCGUpdate; |
| 1602 |
else |
| 1603 |
AdditionalOptions.append(option); |
| 1604 |
} |
| 1605 |
if (LinkTimeCodeGeneration != optLTCGDefault) |
| 1606 |
config->WholeProgramOptimization = _True; |
| 1607 |
break; |
| 1608 |
case 0x379ED25: |
| 1609 |
case 0x157cf65: // /MACHINE:{AM33|ARM|CEE|IA64|X86|M32R|MIPS|MIPS16|MIPSFPU|MIPSFPU16|MIPSR41XX|PPC|SH3|SH4|SH5|THUMB|TRICORE} |
| 1610 |
switch (elfHash(option+9)) { |
| 1611 |
// Very limited documentation on all options but X86, |
| 1612 |
case 0x0005bb6: // X86 |
| 1613 |
TargetMachine = machineX86; |
| 1614 |
break; |
| 1615 |
case 0x0005b94: // X64 |
| 1616 |
TargetMachine = machineX64; |
| 1617 |
break; |
| 1618 |
// so we put the others in AdditionalOptions... |
| 1619 |
case 0x0046063: // AM33 |
| 1620 |
case 0x000466d: // ARM |
| 1621 |
case 0x0004795: // CEE |
| 1622 |
case 0x0004963: // EBC |
| 1623 |
case 0x004d494: // IA64 |
| 1624 |
case 0x0050672: // M32R |
| 1625 |
case 0x0051e53: // MIPS |
| 1626 |
case 0x51e5646: // MIPS16 |
| 1627 |
case 0x1e57b05: // MIPSFPU |
| 1628 |
case 0x57b09a6: // MIPSFPU16 |
| 1629 |
case 0x5852738: // MIPSR41XX |
| 1630 |
case 0x0005543: // PPC |
| 1631 |
case 0x00057b3: // SH3 |
| 1632 |
case 0x57b7980: // SH3DSP |
| 1633 |
case 0x00057b4: // SH4 |
| 1634 |
case 0x00057b5: // SH5 |
| 1635 |
case 0x058da12: // THUMB |
| 1636 |
case 0x96d8435: // TRICORE |
| 1637 |
default: |
| 1638 |
AdditionalOptions += option; |
| 1639 |
break; |
| 1640 |
} |
| 1641 |
break; |
| 1642 |
case 0x0034160: // /MAP[:filename] |
| 1643 |
GenerateMapFile = _True; |
| 1644 |
if (option[4] == ':') |
| 1645 |
MapFileName = option+5; |
| 1646 |
break; |
| 1647 |
case 0x164e1ef: // /MAPINFO:{EXPORTS|LINES} |
| 1648 |
if(*(option+9) == 'E') |
| 1649 |
MapExports = _True; |
| 1650 |
else if(*(option+9) == 'L') |
| 1651 |
MapLines = _True; |
| 1652 |
break; |
| 1653 |
case 0x341a6b5: // /MERGE:from=to |
| 1654 |
if (MergeSections.isEmpty()) { |
| 1655 |
MergeSections = option+7; |
| 1656 |
} else { |
| 1657 |
// vcxproj files / the VS property editor do not support multiple MergeSections entries. |
| 1658 |
// Add them as additional options. |
| 1659 |
AdditionalOptions += option; |
| 1660 |
} |
| 1661 |
break; |
| 1662 |
case 0x0341d8c: // /MIDL:@file |
| 1663 |
MidlCommandFile = option+7; |
| 1664 |
break; |
| 1665 |
case 0x84e2679: // /NOASSEMBLY |
| 1666 |
TurnOffAssemblyGeneration = _True; |
| 1667 |
break; |
| 1668 |
case 0x2b21942: // /NODEFAULTLIB[:library] |
| 1669 |
if(*(option+13) == '\0') |
| 1670 |
IgnoreAllDefaultLibraries = _True; |
| 1671 |
else |
| 1672 |
IgnoreDefaultLibraryNames += option+14; |
| 1673 |
break; |
| 1674 |
case 0x33a3a39: // /NOENTRY |
| 1675 |
ResourceOnlyDLL = _True; |
| 1676 |
break; |
| 1677 |
case 0x434138f: // /NOLOGO |
| 1678 |
SuppressStartupBanner = _True; |
| 1679 |
break; |
| 1680 |
case 0xc841054: // /NXCOMPAT[:NO] |
| 1681 |
if ((*(option+9) == ':' && (*(option+10) == 'N' || *(option+10) == 'n'))) |
| 1682 |
DataExecutionPrevention = _False; |
| 1683 |
else |
| 1684 |
DataExecutionPrevention = _True; |
| 1685 |
break; |
| 1686 |
case 0x0034454: // /OPT:{REF | NOREF | ICF[=iterations] | NOICF | WIN98 | NOWIN98} |
| 1687 |
{ |
| 1688 |
char third = *(option+7); |
| 1689 |
switch (third) { |
| 1690 |
case 'F': // REF |
| 1691 |
if(*(option+5) == 'R') { |
| 1692 |
OptimizeReferences = optReferences; |
| 1693 |
} else { // ICF[=iterations] |
| 1694 |
EnableCOMDATFolding = optFolding; |
| 1695 |
// [=iterations] case is not documented |
| 1696 |
} |
| 1697 |
break; |
| 1698 |
case 'R': // NOREF |
| 1699 |
OptimizeReferences = optNoReferences; |
| 1700 |
break; |
| 1701 |
case 'I': // NOICF |
| 1702 |
EnableCOMDATFolding = optNoFolding; |
| 1703 |
break; |
| 1704 |
case 'N': // WIN98 |
| 1705 |
OptimizeForWindows98 = optWin98Yes; |
| 1706 |
break; |
| 1707 |
case 'W': // NOWIN98 |
| 1708 |
OptimizeForWindows98 = optWin98No; |
| 1709 |
break; |
| 1710 |
default: |
| 1711 |
found = false; |
| 1712 |
} |
| 1713 |
} |
| 1714 |
break; |
| 1715 |
case 0x34468a2: // /ORDER:@filename |
| 1716 |
FunctionOrder = option+8; |
| 1717 |
break; |
| 1718 |
case 0x00344a4: // /OUT:filename |
| 1719 |
OutputFile = option+5; |
| 1720 |
break; |
| 1721 |
case 0x0034482: // /PDB:filename |
| 1722 |
ProgramDatabaseFile = option+5; |
| 1723 |
break; |
| 1724 |
case 0xa2ad314: // /PDBSTRIPPED:pdb_file_name |
| 1725 |
StripPrivateSymbols = option+13; |
| 1726 |
break; |
| 1727 |
case 0x6a09535: // /RELEASE |
| 1728 |
SetChecksum = _True; |
| 1729 |
break; |
| 1730 |
case 0x348857b: // /STACK:reserve[,commit] |
| 1731 |
{ |
| 1732 |
QStringList both = QString(option+7).split(","); |
| 1733 |
StackReserveSize = both[0].toLongLong(); |
| 1734 |
if(both.size() == 2) |
| 1735 |
StackCommitSize = both[1].toLongLong(); |
| 1736 |
} |
| 1737 |
break; |
| 1738 |
case 0x75AA4D8: // /SAFESEH:{NO} |
| 1739 |
if (config->CompilerVersion >= NET2010) |
| 1740 |
ImageHasSafeExceptionHandlers = (option[8] == ':') ? _False : _True; |
| 1741 |
else |
| 1742 |
AdditionalOptions += option; |
| 1743 |
break; |
| 1744 |
case 0x9B3C00D: |
| 1745 |
case 0x78dc00d: // /SUBSYSTEM:{CONSOLE|EFI_APPLICATION|EFI_BOOT_SERVICE_DRIVER|EFI_ROM|EFI_RUNTIME_DRIVER|NATIVE|POSIX|WINDOWS|WINDOWSCE}[,major[.minor]] |
| 1746 |
{ |
| 1747 |
// Split up in subsystem, and version number |
| 1748 |
QStringList both = QString(option+11).split(","); |
| 1749 |
switch (elfHash(both[0].toLatin1().constData())) { |
| 1750 |
case 0x8438445: // CONSOLE |
| 1751 |
SubSystem = subSystemConsole; |
| 1752 |
break; |
| 1753 |
case 0xbe29493: // WINDOWS |
| 1754 |
SubSystem = subSystemWindows; |
| 1755 |
break; |
| 1756 |
// The following are undocumented, so add them to AdditionalOptions |
| 1757 |
case 0x240949e: // EFI_APPLICATION |
| 1758 |
case 0xe617652: // EFI_BOOT_SERVICE_DRIVER |
| 1759 |
case 0x9af477d: // EFI_ROM |
| 1760 |
case 0xd34df42: // EFI_RUNTIME_DRIVER |
| 1761 |
case 0x5268ea5: // NATIVE |
| 1762 |
case 0x05547e8: // POSIX |
| 1763 |
case 0x2949c95: // WINDOWSCE |
| 1764 |
case 0x4B69795: // windowsce |
| 1765 |
AdditionalOptions += option; |
| 1766 |
break; |
| 1767 |
default: |
| 1768 |
found = false; |
| 1769 |
} |
| 1770 |
} |
| 1771 |
break; |
| 1772 |
case 0x8b654de: // /SWAPRUN:{NET | CD} |
| 1773 |
if(*(option+9) == 'N') |
| 1774 |
SwapRunFromNet = _True; |
| 1775 |
else if(*(option+9) == 'C') |
| 1776 |
SwapRunFromCD = _True; |
| 1777 |
else |
| 1778 |
found = false; |
| 1779 |
break; |
| 1780 |
case 0x34906d4: // /TLBID:id |
| 1781 |
TypeLibraryResourceID = QString(option+7).toLongLong(); |
| 1782 |
break; |
| 1783 |
case 0x4907494: // /TLBOUT:[path\]filename |
| 1784 |
TypeLibraryFile = option+8; |
| 1785 |
break; |
| 1786 |
case 0x976b525: // /TSAWARE[:NO] |
| 1787 |
if(*(option+8) == ':') |
| 1788 |
TerminalServerAware = termSvrAwareNo; |
| 1789 |
else |
| 1790 |
TerminalServerAware = termSvrAwareYes; |
| 1791 |
break; |
| 1792 |
case 0xaa67735: // /VERBOSE[:lib] |
| 1793 |
if(*(option+9) == ':') { |
| 1794 |
ShowProgress = linkProgressLibs; |
| 1795 |
AdditionalOptions += option; |
| 1796 |
} else { |
| 1797 |
ShowProgress = linkProgressAll; |
| 1798 |
} |
| 1799 |
break; |
| 1800 |
case 0xaa77f7e: // /VERSION:major[.minor] |
| 1801 |
Version = option+9; |
| 1802 |
break; |
| 1803 |
case 0x0034c50: // /WS[:NO] |
| 1804 |
if (config->CompilerVersion >= NET2010) { |
| 1805 |
if(*(option+3) == ':') |
| 1806 |
TreatWarningsAsErrors = _False; |
| 1807 |
else |
| 1808 |
TreatWarningsAsErrors = _True; |
| 1809 |
} else { |
| 1810 |
AdditionalOptions += option; |
| 1811 |
} |
| 1812 |
break; |
| 1813 |
default: |
| 1814 |
AdditionalOptions += option; |
| 1815 |
break; |
| 1816 |
} |
| 1817 |
if(!found) { |
| 1818 |
if (!config->suppressUnknownOptionWarnings) |
| 1819 |
unknownOptionWarning("Linker", option); |
| 1820 |
AdditionalOptions += option; |
| 1821 |
} |
| 1822 |
return found; |
| 1823 |
} |
| 1824 |
|
| 1825 |
// VCManifestTool --------------------------------------------------- |
| 1826 |
VCManifestTool::VCManifestTool() |
| 1827 |
: EmbedManifest(unset) |
| 1828 |
{ |
| 1829 |
} |
| 1830 |
|
| 1831 |
bool VCManifestTool::parseOption(const char *option) |
| 1832 |
{ |
| 1833 |
Q_UNUSED(option); |
| 1834 |
// ### implement if we introduce QMAKE_MT_FLAGS |
| 1835 |
return false; |
| 1836 |
} |
| 1837 |
|
| 1838 |
// VCMIDLTool ------------------------------------------------------- |
| 1839 |
VCMIDLTool::VCMIDLTool() |
| 1840 |
: DefaultCharType(midlCharUnsigned), |
| 1841 |
EnableErrorChecks(midlDisableAll), |
| 1842 |
ErrorCheckAllocations(unset), |
| 1843 |
ErrorCheckBounds(unset), |
| 1844 |
ErrorCheckEnumRange(unset), |
| 1845 |
ErrorCheckRefPointers(unset), |
| 1846 |
ErrorCheckStubData(unset), |
| 1847 |
GenerateStublessProxies(unset), |
| 1848 |
GenerateTypeLibrary(unset), |
| 1849 |
IgnoreStandardIncludePath(unset), |
| 1850 |
MkTypLibCompatible(unset), |
| 1851 |
StructMemberAlignment(midlAlignNotSet), |
| 1852 |
SuppressStartupBanner(unset), |
| 1853 |
TargetEnvironment(midlTargetNotSet), |
| 1854 |
ValidateParameters(unset), |
| 1855 |
WarnAsError(unset), |
| 1856 |
WarningLevel(midlWarningLevel_0), |
| 1857 |
ApplicationConfigurationMode(unset), |
| 1858 |
ValidateAllParameters(unset), |
| 1859 |
SuppressCompilerWarnings(unset), |
| 1860 |
LocaleID(-1) |
| 1861 |
{ |
| 1862 |
} |
| 1863 |
|
| 1864 |
bool VCMIDLTool::parseOption(const char* option) |
| 1865 |
{ |
| 1866 |
#ifdef USE_DISPLAY_HASH |
| 1867 |
displayHash("/D name[=def]"); displayHash("/I directory-list"); displayHash("/Oi"); |
| 1868 |
displayHash("/Oic"); displayHash("/Oicf"); displayHash("/Oif"); displayHash("/Os"); |
| 1869 |
displayHash("/U name"); displayHash("/WX"); displayHash("/W{0|1|2|3|4}"); |
| 1870 |
displayHash("/Zp {N}"); displayHash("/Zs"); displayHash("/acf filename"); |
| 1871 |
displayHash("/align {N}"); displayHash("/app_config"); displayHash("/c_ext"); |
| 1872 |
displayHash("/char ascii7"); displayHash("/char signed"); displayHash("/char unsigned"); |
| 1873 |
displayHash("/client none"); displayHash("/client stub"); displayHash("/confirm"); |
| 1874 |
displayHash("/cpp_cmd cmd_line"); displayHash("/cpp_opt options"); |
| 1875 |
displayHash("/cstub filename"); displayHash("/dlldata filename"); displayHash("/env win32"); |
| 1876 |
displayHash("/env win64"); displayHash("/error all"); displayHash("/error allocation"); |
| 1877 |
displayHash("/error bounds_check"); displayHash("/error enum"); displayHash("/error none"); |
| 1878 |
displayHash("/error ref"); displayHash("/error stub_data"); displayHash("/h filename"); |
| 1879 |
displayHash("/header filename"); displayHash("/iid filename"); displayHash("/lcid"); |
| 1880 |
displayHash("/mktyplib203"); displayHash("/ms_ext"); displayHash("/ms_union"); |
| 1881 |
displayHash("/msc_ver <nnnn>"); displayHash("/newtlb"); displayHash("/no_cpp"); |
| 1882 |
displayHash("/no_def_idir"); displayHash("/no_default_epv"); displayHash("/no_format_opt"); |
| 1883 |
displayHash("/no_warn"); displayHash("/nocpp"); displayHash("/nologo"); displayHash("/notlb"); |
| 1884 |
displayHash("/o filename"); displayHash("/oldnames"); displayHash("/oldtlb"); |
| 1885 |
displayHash("/osf"); displayHash("/out directory"); displayHash("/pack {N}"); |
| 1886 |
displayHash("/prefix all"); displayHash("/prefix client"); displayHash("/prefix server"); |
| 1887 |
displayHash("/prefix switch"); displayHash("/protocol all"); displayHash("/protocol dce"); |
| 1888 |
displayHash("/protocol ndr64"); displayHash("/proxy filename"); displayHash("/robust"); |
| 1889 |
displayHash("/rpcss"); displayHash("/savePP"); displayHash("/server none"); |
| 1890 |
displayHash("/server stub"); displayHash("/sstub filename"); displayHash("/syntax_check"); |
| 1891 |
displayHash("/target {system}"); displayHash("/tlb filename"); displayHash("/use_epv"); |
| 1892 |
displayHash("/win32"); displayHash("/win64"); |
| 1893 |
#endif |
| 1894 |
bool found = true; |
| 1895 |
int offset = 0; |
| 1896 |
|
| 1897 |
const uint optionHash = elfHash(option); |
| 1898 |
|
| 1899 |
if (config->CompilerVersion < NET2010) { |
| 1900 |
switch (optionHash) { |
| 1901 |
case 0x5b1cb97: // /app_config |
| 1902 |
case 0x5a2fc64: // /client {none|stub} |
| 1903 |
case 0x35aabb2: // /cstub filename |
| 1904 |
case 0x64ceb12: // /newtlb |
| 1905 |
case 0x556dbee: // /no_warn |
| 1906 |
case 0x662bb12: // /oldtlb |
| 1907 |
case 0x69c9cf2: // /server {none|stub} |
| 1908 |
case 0x36aabb2: // /sstub filename |
| 1909 |
AdditionalOptions += option; |
| 1910 |
return true; |
| 1911 |
} |
| 1912 |
} |
| 1913 |
|
| 1914 |
switch(optionHash) { |
| 1915 |
case 0x0000334: // /D name[=def] |
| 1916 |
PreprocessorDefinitions += option+3; |
| 1917 |
break; |
| 1918 |
case 0x0000339: // /I directory-list |
| 1919 |
AdditionalIncludeDirectories += option+3; |
| 1920 |
break; |
| 1921 |
case 0x0345f96: // /Oicf |
| 1922 |
case 0x00345f6: // /Oif |
| 1923 |
GenerateStublessProxies = _True; |
| 1924 |
break; |
| 1925 |
case 0x0000345: // /U name |
| 1926 |
UndefinePreprocessorDefinitions += option+3; |
| 1927 |
break; |
| 1928 |
case 0x00034c8: // /WX |
| 1929 |
WarnAsError = _True; |
| 1930 |
break; |
| 1931 |
case 0x3582fde: // /align {N} |
| 1932 |
offset = 3; |
| 1933 |
Q_FALLTHROUGH(); |
| 1934 |
case 0x0003510: // /Zp {N} |
| 1935 |
switch (*(option+offset+4)) { |
| 1936 |
case '1': |
| 1937 |
StructMemberAlignment = (*(option+offset+5) == '\0') ? midlAlignSingleByte : midlAlignSixteenBytes; |
| 1938 |
break; |
| 1939 |
case '2': |
| 1940 |
StructMemberAlignment = midlAlignTwoBytes; |
| 1941 |
break; |
| 1942 |
case '4': |
| 1943 |
StructMemberAlignment = midlAlignFourBytes; |
| 1944 |
break; |
| 1945 |
case '8': |
| 1946 |
StructMemberAlignment = midlAlignEightBytes; |
| 1947 |
break; |
| 1948 |
default: |
| 1949 |
found = false; |
| 1950 |
} |
| 1951 |
break; |
| 1952 |
case 0x5b1cb97: // /app_config |
| 1953 |
ApplicationConfigurationMode = _True; |
| 1954 |
break; |
| 1955 |
case 0x0359e82: // /char {ascii7|signed|unsigned} |
| 1956 |
switch(*(option+6)) { |
| 1957 |
case 'a': |
| 1958 |
DefaultCharType = midlCharAscii7; |
| 1959 |
break; |
| 1960 |
case 's': |
| 1961 |
DefaultCharType = midlCharSigned; |
| 1962 |
break; |
| 1963 |
case 'u': |
| 1964 |
DefaultCharType = midlCharUnsigned; |
| 1965 |
break; |
| 1966 |
default: |
| 1967 |
found = false; |
| 1968 |
} |
| 1969 |
break; |
| 1970 |
case 0x5a2fc64: // /client {none|stub} |
| 1971 |
if(*(option+8) == 's') |
| 1972 |
GenerateClientFiles = "Stub"; |
| 1973 |
else |
| 1974 |
GenerateClientFiles = "None"; |
| 1975 |
break; |
| 1976 |
case 0xa766524: // /cpp_opt options |
| 1977 |
CPreprocessOptions += option+9; |
| 1978 |
break; |
| 1979 |
case 0x35aabb2: // /cstub filename |
| 1980 |
ClientStubFile = option+7; |
| 1981 |
break; |
| 1982 |
case 0xb32abf1: // /dlldata filename |
| 1983 |
DLLDataFileName = option + 9; |
| 1984 |
break; |
| 1985 |
case 0x0035c56: // /env {win32|win64} |
| 1986 |
TargetEnvironment = (*(option+8) == '6') ? midlTargetWin64 : midlTargetWin32; |
| 1987 |
break; |
| 1988 |
case 0x35c9962: // /error {all|allocation|bounds_check|enum|none|ref|stub_data} |
| 1989 |
EnableErrorChecks = midlEnableCustom; |
| 1990 |
switch (*(option+7)) { |
| 1991 |
case 'a': |
| 1992 |
if(*(option+10) == '\0') |
| 1993 |
EnableErrorChecks = midlEnableAll; |
| 1994 |
else |
| 1995 |
ErrorCheckAllocations = _True; |
| 1996 |
break; |
| 1997 |
case 'b': |
| 1998 |
ErrorCheckBounds = _True; |
| 1999 |
break; |
| 2000 |
case 'e': |
| 2001 |
ErrorCheckEnumRange = _True; |
| 2002 |
break; |
| 2003 |
case 'n': |
| 2004 |
EnableErrorChecks = midlDisableAll; |
| 2005 |
break; |
| 2006 |
case 'r': |
| 2007 |
ErrorCheckRefPointers = _True; |
| 2008 |
break; |
| 2009 |
case 's': |
| 2010 |
ErrorCheckStubData = _True; |
| 2011 |
break; |
| 2012 |
default: |
| 2013 |
found = false; |
| 2014 |
} |
| 2015 |
break; |
| 2016 |
case 0x5eb7af2: // /header filename |
| 2017 |
offset = 5; |
| 2018 |
Q_FALLTHROUGH(); |
| 2019 |
case 0x0000358: // /h filename |
| 2020 |
HeaderFileName = option + offset + 3; |
| 2021 |
break; |
| 2022 |
case 0x0035ff4: // /iid filename |
| 2023 |
InterfaceIdentifierFileName = option+5; |
| 2024 |
break; |
| 2025 |
case 0x64b7933: // /mktyplib203 |
| 2026 |
MkTypLibCompatible = _True; |
| 2027 |
break; |
| 2028 |
case 0x64ceb12: // /newtlb |
| 2029 |
TypeLibFormat = "NewFormat"; |
| 2030 |
break; |
| 2031 |
case 0x8e0b0a2: // /no_def_idir |
| 2032 |
IgnoreStandardIncludePath = _True; |
| 2033 |
break; |
| 2034 |
case 0x65635ef: // /nologo |
| 2035 |
SuppressStartupBanner = _True; |
| 2036 |
break; |
| 2037 |
case 0x695e9f4: // /no_robust |
| 2038 |
ValidateAllParameters = _False; |
| 2039 |
break; |
| 2040 |
case 0x3656b22: // /notlb |
| 2041 |
GenerateTypeLibrary = _True; |
| 2042 |
break; |
| 2043 |
case 0x556dbee: // /no_warn |
| 2044 |
SuppressCompilerWarnings = _True; |
| 2045 |
break; |
| 2046 |
case 0x000035f: // /o filename |
| 2047 |
RedirectOutputAndErrors = option+3; |
| 2048 |
break; |
| 2049 |
case 0x662bb12: // /oldtlb |
| 2050 |
TypeLibFormat = "OldFormat"; |
| 2051 |
break; |
| 2052 |
case 0x00366c4: // /out directory |
| 2053 |
OutputDirectory = option+5; |
| 2054 |
break; |
| 2055 |
case 0x36796f9: // /proxy filename |
| 2056 |
ProxyFileName = option+7; |
| 2057 |
break; |
| 2058 |
case 0x6959c94: // /robust |
| 2059 |
ValidateParameters = _True; |
| 2060 |
break; |
| 2061 |
case 0x6a88df4: // /target {system} |
| 2062 |
if(*(option+11) == '6') |
| 2063 |
TargetEnvironment = midlTargetWin64; |
| 2064 |
else |
| 2065 |
TargetEnvironment = midlTargetWin32; |
| 2066 |
break; |
| 2067 |
case 0x69c9cf2: // /server {none|stub} |
| 2068 |
if(*(option+8) == 's') |
| 2069 |
GenerateServerFiles = "Stub"; |
| 2070 |
else |
| 2071 |
GenerateServerFiles = "None"; |
| 2072 |
break; |
| 2073 |
case 0x36aabb2: // /sstub filename |
| 2074 |
ServerStubFile = option+7; |
| 2075 |
break; |
| 2076 |
case 0x0036b22: // /tlb filename |
| 2077 |
TypeLibraryName = option+5; |
| 2078 |
break; |
| 2079 |
case 0x36e0162: // /win32 |
| 2080 |
TargetEnvironment = midlTargetWin32; |
| 2081 |
break; |
| 2082 |
case 0x36e0194: // /win64 |
| 2083 |
TargetEnvironment = midlTargetWin64; |
| 2084 |
break; |
| 2085 |
case 0x0003459: // /Oi |
| 2086 |
case 0x00345f3: // /Oic |
| 2087 |
case 0x0003463: // /Os |
| 2088 |
case 0x0003513: // /Zs |
| 2089 |
case 0x0035796: // /acf filename |
| 2090 |
case 0x3595cf4: // /c_ext |
| 2091 |
case 0xa64d3dd: // /confirm |
| 2092 |
case 0xa765b64: // /cpp_cmd cmd_line |
| 2093 |
case 0x03629f4: // /lcid |
| 2094 |
case 0x6495cc4: // /ms_ext |
| 2095 |
case 0x96c7a1e: // /ms_union |
| 2096 |
case 0x4996fa2: // /msc_ver <nnnn> |
| 2097 |
case 0x6555a40: // /no_cpp |
| 2098 |
case 0xf64d6a6: // /no_default_epv |
| 2099 |
case 0x6dd9384: // /no_format_opt |
| 2100 |
case 0x3655a70: // /nocpp |
| 2101 |
case 0x2b455a3: // /oldnames |
| 2102 |
case 0x0036696: // /osf |
| 2103 |
case 0x036679b: // /pack {N} |
| 2104 |
case 0x678bd38: // /prefix {all|client|server|switch} |
| 2105 |
case 0x96b702c: // /protocol {all|dce|ndr64} |
| 2106 |
case 0x3696aa3: // /rpcss |
| 2107 |
case 0x698ca60: // /savePP |
| 2108 |
case 0xce9b12b: // /syntax_check |
| 2109 |
case 0xc9b5f16: // /use_epv |
| 2110 |
AdditionalOptions += option; |
| 2111 |
break; |
| 2112 |
default: |
| 2113 |
// /W{0|1|2|3|4} case |
| 2114 |
if(*(option+1) == 'W') { |
| 2115 |
switch (*(option+2)) { |
| 2116 |
case '0': |
| 2117 |
WarningLevel = midlWarningLevel_0; |
| 2118 |
break; |
| 2119 |
case '1': |
| 2120 |
WarningLevel = midlWarningLevel_1; |
| 2121 |
break; |
| 2122 |
case '2': |
| 2123 |
WarningLevel = midlWarningLevel_2; |
| 2124 |
break; |
| 2125 |
case '3': |
| 2126 |
WarningLevel = midlWarningLevel_3; |
| 2127 |
break; |
| 2128 |
case '4': |
| 2129 |
WarningLevel = midlWarningLevel_4; |
| 2130 |
break; |
| 2131 |
default: |
| 2132 |
found = false; |
| 2133 |
} |
| 2134 |
} |
| 2135 |
break; |
| 2136 |
} |
| 2137 |
if(!found) |
| 2138 |
warn_msg(WarnLogic, "Could not parse MIDL option: %s", option); |
| 2139 |
return true; |
| 2140 |
} |
| 2141 |
|
| 2142 |
// VCLibrarianTool -------------------------------------------------- |
| 2143 |
VCLibrarianTool::VCLibrarianTool() |
| 2144 |
: IgnoreAllDefaultLibraries(unset), |
| 2145 |
SuppressStartupBanner(_True) |
| 2146 |
{ |
| 2147 |
} |
| 2148 |
|
| 2149 |
// VCCustomBuildTool ------------------------------------------------ |
| 2150 |
VCCustomBuildTool::VCCustomBuildTool() |
| 2151 |
{ |
| 2152 |
ToolName = "VCCustomBuildTool"; |
| 2153 |
} |
| 2154 |
|
| 2155 |
// VCResourceCompilerTool ------------------------------------------- |
| 2156 |
VCResourceCompilerTool::VCResourceCompilerTool() |
| 2157 |
: Culture(rcUseDefault), |
| 2158 |
IgnoreStandardIncludePath(unset), |
| 2159 |
ShowProgress(linkProgressNotSet), |
| 2160 |
SuppressStartupBanner(unset) |
| 2161 |
{ |
| 2162 |
} |
| 2163 |
|
| 2164 |
// VCDeploymentTool -------------------------------------------- |
| 2165 |
VCDeploymentTool::VCDeploymentTool() |
| 2166 |
: RegisterOutput(registerNo) |
| 2167 |
{ |
| 2168 |
DeploymentTag = "DeploymentTool"; |
| 2169 |
RemoteDirectory = ""; |
| 2170 |
} |
| 2171 |
|
| 2172 |
VCEventTool::VCEventTool(const QString &eventName) |
| 2173 |
: ExcludedFromBuild(unset) |
| 2174 |
{ |
| 2175 |
EventName = eventName; |
| 2176 |
ToolName = "VC"; |
| 2177 |
ToolName += eventName; |
| 2178 |
ToolName += "Tool"; |
| 2179 |
} |
| 2180 |
|
| 2181 |
// VCPostBuildEventTool --------------------------------------------- |
| 2182 |
VCPostBuildEventTool::VCPostBuildEventTool() |
| 2183 |
: VCEventTool("PostBuildEvent") |
| 2184 |
{ |
| 2185 |
} |
| 2186 |
|
| 2187 |
// VCPreBuildEventTool ---------------------------------------------- |
| 2188 |
VCPreBuildEventTool::VCPreBuildEventTool() |
| 2189 |
: VCEventTool("PreBuildEvent") |
| 2190 |
{ |
| 2191 |
} |
| 2192 |
|
| 2193 |
// VCPreLinkEventTool ----------------------------------------------- |
| 2194 |
VCPreLinkEventTool::VCPreLinkEventTool() |
| 2195 |
: VCEventTool("PreLinkEvent") |
| 2196 |
{ |
| 2197 |
} |
| 2198 |
|
| 2199 |
// VCConfiguration -------------------------------------------------- |
| 2200 |
|
| 2201 |
VCConfiguration::VCConfiguration() |
| 2202 |
: ATLMinimizesCRunTimeLibraryUsage(unset), |
| 2203 |
BuildBrowserInformation(unset), |
| 2204 |
CharacterSet(charSetNotSet), |
| 2205 |
ConfigurationType(typeApplication), |
| 2206 |
RegisterOutput(unset), |
| 2207 |
UseOfATL(useATLNotSet), |
| 2208 |
UseOfMfc(useMfcStdWin), |
| 2209 |
WholeProgramOptimization(unset) |
| 2210 |
{ |
| 2211 |
compiler.config = this; |
| 2212 |
linker.config = this; |
| 2213 |
idl.config = this; |
| 2214 |
} |
| 2215 |
|
| 2216 |
// VCFilter --------------------------------------------------------- |
| 2217 |
VCFilter::VCFilter() |
| 2218 |
: ParseFiles(unset), |
| 2219 |
Config(nullptr) |
| 2220 |
{ |
| 2221 |
useCustomBuildTool = false; |
| 2222 |
useCompilerTool = false; |
| 2223 |
} |
| 2224 |
|
| 2225 |
void VCFilter::addFile(const QString& filename) |
| 2226 |
{ |
| 2227 |
Files += VCFilterFile(filename); |
| 2228 |
} |
| 2229 |
|
| 2230 |
void VCFilter::addFile(const VCFilterFile& fileInfo) |
| 2231 |
{ |
| 2232 |
Files += VCFilterFile(fileInfo); |
| 2233 |
} |
| 2234 |
|
| 2235 |
void VCFilter::addFiles(const QStringList& fileList) |
| 2236 |
{ |
| 2237 |
for (int i = 0; i < fileList.size(); ++i) |
| 2238 |
addFile(fileList.at(i)); |
| 2239 |
} |
| 2240 |
|
| 2241 |
void VCFilter::addFiles(const ProStringList& fileList) |
| 2242 |
{ |
| 2243 |
for (int i = 0; i < fileList.size(); ++i) |
| 2244 |
addFile(fileList.at(i).toQString()); |
| 2245 |
} |
| 2246 |
|
| 2247 |
void VCFilter::modifyPCHstage(QString str) |
| 2248 |
{ |
| 2249 |
const bool isHFile = (str == Project->precompH); |
| 2250 |
const bool pchThroughSourceFile = !Project->precompSource.isEmpty(); |
| 2251 |
if (isHFile && pchThroughSourceFile && Project->autogenPrecompSource) { |
| 2252 |
useCustomBuildTool = true; |
| 2253 |
QString toFile(Project->precompSource); |
| 2254 |
CustomBuildTool.Description = "Generating precompiled header source file '" + toFile + "' ..."; |
| 2255 |
CustomBuildTool.Outputs += toFile; |
| 2256 |
|
| 2257 |
QStringList lines; |
| 2258 |
CustomBuildTool.CommandLine += |
| 2259 |
"echo /*-------------------------------------------------------------------- >" + toFile; |
| 2260 |
lines << "* Precompiled header source file used by Visual Studio.NET to generate"; |
| 2261 |
lines << "* the .pch file."; |
| 2262 |
lines << "*"; |
| 2263 |
lines << "* Due to issues with the dependencies checker within the IDE, it"; |
| 2264 |
lines << "* sometimes fails to recompile the PCH file, if we force the IDE to"; |
| 2265 |
lines << "* create the PCH file directly from the header file."; |
| 2266 |
lines << "*"; |
| 2267 |
lines << "* This file is auto-generated by qmake since no PRECOMPILED_SOURCE was"; |
| 2268 |
lines << "* specified, and is used as the common stdafx.cpp. The file is only"; |
| 2269 |
lines << QLatin1String("* generated when creating ") |
| 2270 |
+ (Config->CompilerVersion < NET2010 ? ".vcproj" : ".vcxproj") |
| 2271 |
+ " project files, and is not used for"; |
| 2272 |
lines << "* command line compilations by nmake."; |
| 2273 |
lines << "*"; |
| 2274 |
lines << "* WARNING: All changes made in this file will be lost."; |
| 2275 |
lines << "--------------------------------------------------------------------*/"; |
| 2276 |
lines << "#include \"" + Project->precompHFilename + "\""; |
| 2277 |
for (const QString &line : std::as_const(lines)) |
| 2278 |
CustomBuildTool.CommandLine += "echo " + line + ">>" + toFile; |
| 2279 |
return; |
| 2280 |
} |
| 2281 |
|
| 2282 |
useCompilerTool = true; |
| 2283 |
const bool isPrecompSource = pchThroughSourceFile && (str == Project->precompSource); |
| 2284 |
if (isPrecompSource) { |
| 2285 |
CompilerTool.UsePrecompiledHeader = pchCreateUsingSpecific; |
| 2286 |
if (Project->autogenPrecompSource) |
| 2287 |
CompilerTool.PrecompiledHeaderThrough = Project->precompHFilename; |
| 2288 |
CompilerTool.ForcedIncludeFiles = QStringList("$(NOINHERIT)"); |
| 2289 |
return; |
| 2290 |
} |
| 2291 |
|
| 2292 |
bool isCFile = false; |
| 2293 |
for (QStringList::Iterator it = Option::c_ext.begin(); it != Option::c_ext.end(); ++it) { |
| 2294 |
if (str.endsWith(*it)) { |
| 2295 |
isCFile = true; |
| 2296 |
break; |
| 2297 |
} |
| 2298 |
} |
| 2299 |
|
| 2300 |
bool pchCompatible = (isCFile == Project->pchIsCFile); |
| 2301 |
if (!pchCompatible) { |
| 2302 |
CompilerTool.UsePrecompiledHeader = pchNone; |
| 2303 |
CompilerTool.PrecompiledHeaderThrough = QLatin1String("$(NOINHERIT)"); |
| 2304 |
CompilerTool.ForcedIncludeFiles = QStringList("$(NOINHERIT)"); |
| 2305 |
} |
| 2306 |
} |
| 2307 |
|
| 2308 |
VCFilterFile VCFilter::findFile(const QString &filePath, bool *found) const |
| 2309 |
{ |
| 2310 |
for (int i = 0; i < Files.size(); ++i) { |
| 2311 |
const VCFilterFile &f = Files.at(i); |
| 2312 |
if (f.file == filePath) { |
| 2313 |
*found = true; |
| 2314 |
return f; |
| 2315 |
} |
| 2316 |
} |
| 2317 |
*found = false; |
| 2318 |
return VCFilterFile(); |
| 2319 |
} |
| 2320 |
|
| 2321 |
bool VCFilter::addExtraCompiler(const VCFilterFile &info) |
| 2322 |
{ |
| 2323 |
const QStringList &extraCompilers = Project->extraCompilerSources.value(info.file); |
| 2324 |
if (extraCompilers.isEmpty()) |
| 2325 |
return false; |
| 2326 |
|
| 2327 |
QString inFile = info.file; |
| 2328 |
|
| 2329 |
// is the extracompiler rule on a file with a built in compiler? |
| 2330 |
const QString objectMappedFile = Project->extraCompilerOutputs.value(inFile); |
| 2331 |
bool hasBuiltIn = false; |
| 2332 |
if (!objectMappedFile.isEmpty()) { |
| 2333 |
hasBuiltIn = Project->hasBuiltinCompiler(objectMappedFile); |
| 2334 |
|
| 2335 |
// Remove the fake file suffix we've added initially to generate correct command lines. |
| 2336 |
inFile.chop(Project->customBuildToolFilterFileSuffix.size()); |
| 2337 |
|
| 2338 |
// qDebug("*** Extra compiler file has object mapped file '%s' => '%s'", qPrintable(inFile), qPrintable(objectMappedFile.join(' '))); |
| 2339 |
} |
| 2340 |
|
| 2341 |
CustomBuildTool.AdditionalDependencies.clear(); |
| 2342 |
CustomBuildTool.CommandLine.clear(); |
| 2343 |
CustomBuildTool.Description.clear(); |
| 2344 |
CustomBuildTool.Outputs.clear(); |
| 2345 |
CustomBuildTool.ToolPath.clear(); |
| 2346 |
CustomBuildTool.ToolName = QLatin1String(_VCCustomBuildTool); |
| 2347 |
|
| 2348 |
for (int x = 0; x < extraCompilers.size(); ++x) { |
| 2349 |
const QString &extraCompilerName = extraCompilers.at(x); |
| 2350 |
|
| 2351 |
if (!Project->verifyExtraCompiler(extraCompilerName, inFile) && !hasBuiltIn) |
| 2352 |
continue; |
| 2353 |
|
| 2354 |
// All information about the extra compiler |
| 2355 |
QString tmp_out = Project->project->first(ProKey(extraCompilerName + ".output")).toQString(); |
| 2356 |
QString tmp_cmd = Project->project->values(ProKey(extraCompilerName + ".commands")).join(' '); |
| 2357 |
QString tmp_cmd_name = Project->project->values(ProKey(extraCompilerName + ".name")).join(' '); |
| 2358 |
QStringList tmp_dep = Project->project->values(ProKey(extraCompilerName + ".depends")).toQStringList(); |
| 2359 |
QString tmp_dep_cmd = Project->project->values(ProKey(extraCompilerName + ".depend_command")).join(' '); |
| 2360 |
const ProStringList &configs = Project->project->values(ProKey(extraCompilerName + ".CONFIG")); |
| 2361 |
bool combined = configs.indexOf("combine") != -1; |
| 2362 |
|
| 2363 |
QString cmd, cmd_name, out; |
| 2364 |
QStringList deps, inputs; |
| 2365 |
// Variabel replacement of output name |
| 2366 |
out = Option::fixPathToTargetOS(Project->replaceExtraCompilerVariables( |
| 2367 |
tmp_out, inFile, QString(), MakefileGenerator::NoShell), false); |
| 2368 |
|
| 2369 |
// If file has built-in compiler, we've swapped the input and output of |
| 2370 |
// the command, as we in Visual Studio cannot have a Custom Buildstep on |
| 2371 |
// a file which uses a built-in compiler. We would in this case only get |
| 2372 |
// the result from the extra compiler. If 'hasBuiltIn' is true, we know |
| 2373 |
// that we're actually on the _output_file_ of the result, and we |
| 2374 |
// therefore swap inFile and out below, since the extra-compiler still |
| 2375 |
// must see it as the original way. If the result also has a built-in |
| 2376 |
// compiler, too bad.. |
| 2377 |
if (hasBuiltIn) { |
| 2378 |
out = inFile; |
| 2379 |
inFile = objectMappedFile; |
| 2380 |
} |
| 2381 |
|
| 2382 |
// Dependency for the output |
| 2383 |
if (!tmp_dep.isEmpty()) |
| 2384 |
deps = tmp_dep; |
| 2385 |
if (!tmp_dep_cmd.isEmpty()) { |
| 2386 |
Project->callExtraCompilerDependCommand(extraCompilerName, tmp_dep_cmd, |
| 2387 |
inFile, out, |
| 2388 |
true, // dep_lines |
| 2389 |
&deps, |
| 2390 |
configs.contains("dep_existing_only"), |
| 2391 |
true /* checkCommandAvailability */); |
| 2392 |
} |
| 2393 |
for (int i = 0; i < deps.size(); ++i) |
| 2394 |
deps[i] = Option::fixPathToTargetOS( |
| 2395 |
Project->replaceExtraCompilerVariables( |
| 2396 |
deps.at(i), inFile, out, MakefileGenerator::NoShell), |
| 2397 |
false); |
| 2398 |
// Command for file |
| 2399 |
if (combined) { |
| 2400 |
// Add dependencies for each file |
| 2401 |
const ProStringList &tmp_in = Project->project->values(ProKey(extraCompilerName + ".input")); |
| 2402 |
for (int a = 0; a < tmp_in.size(); ++a) { |
| 2403 |
const ProStringList &files = Project->project->values(tmp_in.at(a).toKey()); |
| 2404 |
for (int b = 0; b < files.size(); ++b) { |
| 2405 |
QString file = files.at(b).toQString(); |
| 2406 |
deps += Project->findDependencies(file); |
| 2407 |
inputs += Option::fixPathToTargetOS(file, false); |
| 2408 |
} |
| 2409 |
} |
| 2410 |
deps = inputs + deps; // input files themselves too.. |
| 2411 |
|
| 2412 |
// Replace variables for command w/all input files |
| 2413 |
cmd = Project->replaceExtraCompilerVariables(tmp_cmd, |
| 2414 |
inputs, |
| 2415 |
QStringList(out), |
| 2416 |
MakefileGenerator::TargetShell); |
| 2417 |
} else { |
| 2418 |
deps.prepend(inFile); // input file itself too.. |
| 2419 |
cmd = Project->replaceExtraCompilerVariables(tmp_cmd, |
| 2420 |
inFile, |
| 2421 |
out, |
| 2422 |
MakefileGenerator::TargetShell); |
| 2423 |
} |
| 2424 |
// Name for command |
| 2425 |
if (!tmp_cmd_name.isEmpty()) { |
| 2426 |
cmd_name = Project->replaceExtraCompilerVariables( |
| 2427 |
tmp_cmd_name, inFile, out, MakefileGenerator::NoShell); |
| 2428 |
} else { |
| 2429 |
int space = cmd.indexOf(' '); |
| 2430 |
if (space != -1) |
| 2431 |
cmd_name = cmd.left(space); |
| 2432 |
else |
| 2433 |
cmd_name = cmd; |
| 2434 |
cmd_name = cmd_name.trimmed(); |
| 2435 |
} |
| 2436 |
|
| 2437 |
// Fixify paths |
| 2438 |
for (int i = 0; i < deps.size(); ++i) |
| 2439 |
deps[i] = Option::fixPathToTargetOS(deps[i], false); |
| 2440 |
|
| 2441 |
|
| 2442 |
// Output in info.additionalFile ----------- |
| 2443 |
if (!CustomBuildTool.Description.isEmpty()) |
| 2444 |
CustomBuildTool.Description += ", "; |
| 2445 |
CustomBuildTool.Description += cmd_name; |
| 2446 |
CustomBuildTool.CommandLine += VCToolBase::fixCommandLine(cmd.trimmed()); |
| 2447 |
int space = cmd.indexOf(' '); |
| 2448 |
QFileInfo finf(cmd.left(space)); |
| 2449 |
if (CustomBuildTool.ToolPath.isEmpty()) |
| 2450 |
CustomBuildTool.ToolPath += Option::fixPathToTargetOS(finf.path()); |
| 2451 |
CustomBuildTool.Outputs += out; |
| 2452 |
|
| 2453 |
deps += CustomBuildTool.AdditionalDependencies; |
| 2454 |
// Make sure that all deps are only once |
| 2455 |
QStringList uniqDeps; |
| 2456 |
for (int c = 0; c < deps.size(); ++c) { |
| 2457 |
QString aDep = deps.at(c); |
| 2458 |
if (!aDep.isEmpty()) |
| 2459 |
uniqDeps << aDep; |
| 2460 |
} |
| 2461 |
uniqDeps.removeDuplicates(); |
| 2462 |
CustomBuildTool.AdditionalDependencies = uniqDeps; |
| 2463 |
} |
| 2464 |
|
| 2465 |
// Ensure that none of the output files are also dependencies. Or else, the custom buildstep |
| 2466 |
// will be rebuild every time, even if nothing has changed. |
| 2467 |
for (const QString &output : std::as_const(CustomBuildTool.Outputs)) |
| 2468 |
CustomBuildTool.AdditionalDependencies.removeAll(output); |
| 2469 |
|
| 2470 |
useCustomBuildTool = !CustomBuildTool.CommandLine.isEmpty(); |
| 2471 |
return useCustomBuildTool; |
| 2472 |
} |
| 2473 |
|
| 2474 |
// VCProjectSingleConfig -------------------------------------------- |
| 2475 |
const VCFilter &VCProjectSingleConfig::filterByName(const QString &name) const |
| 2476 |
{ |
| 2477 |
if (name == "Root Files") |
| 2478 |
return RootFiles; |
| 2479 |
if (name == "Source Files") |
| 2480 |
return SourceFiles; |
| 2481 |
if (name == "Header Files") |
| 2482 |
return HeaderFiles; |
| 2483 |
if (name == "Generated Files") |
| 2484 |
return GeneratedFiles; |
| 2485 |
if (name == "LexYacc Files") |
| 2486 |
return LexYaccFiles; |
| 2487 |
if (name == "Translation Files") |
| 2488 |
return TranslationFiles; |
| 2489 |
if (name == "Form Files") |
| 2490 |
return FormFiles; |
| 2491 |
if (name == "Resource Files") |
| 2492 |
return ResourceFiles; |
| 2493 |
if (name == "Deployment Files") |
| 2494 |
return DeploymentFiles; |
| 2495 |
if (name == "Distribution Files") |
| 2496 |
return DistributionFiles; |
| 2497 |
return filterForExtraCompiler(name); |
| 2498 |
} |
| 2499 |
|
| 2500 |
const VCFilter &VCProjectSingleConfig::filterForExtraCompiler(const QString &compilerName) const |
| 2501 |
{ |
| 2502 |
for (int i = 0; i < ExtraCompilersFiles.size(); ++i) |
| 2503 |
if (ExtraCompilersFiles.at(i).Name == compilerName) |
| 2504 |
return ExtraCompilersFiles.at(i); |
| 2505 |
|
| 2506 |
static VCFilter nullFilter; |
| 2507 |
return nullFilter; |
| 2508 |
} |
| 2509 |
|
| 2510 |
// Tree file generation --------------------------------------------- |
| 2511 |
void TreeNode::generateXML(XmlOutput &xml, const QString &tagName, VCProject &tool, const QString &filter) { |
| 2512 |
if (children.size()) { |
| 2513 |
// Filter |
| 2514 |
ChildrenMap::ConstIterator it, end = children.constEnd(); |
| 2515 |
if (!tagName.isEmpty()) { |
| 2516 |
xml << tag("Filter") |
| 2517 |
<< attr("Name", tagName) |
| 2518 |
<< attr("Filter", ""); |
| 2519 |
} |
| 2520 |
// First round, do nested filters |
| 2521 |
for (it = children.constBegin(); it != end; ++it) |
| 2522 |
if ((*it)->children.size()) |
| 2523 |
(*it)->generateXML(xml, it.key(), tool, filter); |
| 2524 |
// Second round, do leafs |
| 2525 |
for (it = children.constBegin(); it != end; ++it) |
| 2526 |
if (!(*it)->children.size()) |
| 2527 |
(*it)->generateXML(xml, it.key(), tool, filter); |
| 2528 |
|
| 2529 |
if (!tagName.isEmpty()) |
| 2530 |
xml << closetag("Filter"); |
| 2531 |
} else { |
| 2532 |
// Leaf |
| 2533 |
VCProjectWriter::outputFileConfigs(tool, xml, info, filter); |
| 2534 |
} |
| 2535 |
} |
| 2536 |
|
| 2537 |
// Flat file generation --------------------------------------------- |
| 2538 |
void FlatNode::generateXML(XmlOutput &xml, const QString &/*tagName*/, VCProject &tool, const QString &filter) { |
| 2539 |
if (children.size()) { |
| 2540 |
ChildrenMapFlat::ConstIterator it = children.constBegin(); |
| 2541 |
ChildrenMapFlat::ConstIterator end = children.constEnd(); |
| 2542 |
for (; it != end; ++it) { |
| 2543 |
VCProjectWriter::outputFileConfigs(tool, xml, (*it), filter); |
| 2544 |
} |
| 2545 |
} |
| 2546 |
} |
| 2547 |
|
| 2548 |
void VCProjectWriter::write(XmlOutput &xml, VCProjectSingleConfig &tool) |
| 2549 |
{ |
| 2550 |
xml << decl("1.0", "Windows-1252") |
| 2551 |
<< tag(_VisualStudioProject) |
| 2552 |
<< attrS(_ProjectType, "Visual C++") |
| 2553 |
<< attrS(_Version, tool.Version) |
| 2554 |
<< attrS(_Name, tool.Name) |
| 2555 |
<< attrS(_ProjectGUID, tool.ProjectGUID) |
| 2556 |
<< attrS(_Keyword, tool.Keyword) |
| 2557 |
<< attrS(_SccProjectName, tool.SccProjectName) |
| 2558 |
<< attrS(_SccLocalPath, tool.SccLocalPath) |
| 2559 |
<< tag(_Platforms) |
| 2560 |
<< tag(_Platform) |
| 2561 |
<< attrS(_Name, tool.PlatformName) |
| 2562 |
<< closetag(_Platforms) |
| 2563 |
<< tag(_Configurations); |
| 2564 |
write(xml, tool.Configuration); |
| 2565 |
xml << closetag(_Configurations) |
| 2566 |
<< tag(q_Files); |
| 2567 |
// Add this configuration into a multi-config project, since that's where we have the flat/tree |
| 2568 |
// XML output functionality |
| 2569 |
VCProject tempProj; |
| 2570 |
tempProj.SingleProjects += tool; |
| 2571 |
outputFilter(tempProj, xml, "Source Files"); |
| 2572 |
outputFilter(tempProj, xml, "Header Files"); |
| 2573 |
outputFilter(tempProj, xml, "Generated Files"); |
| 2574 |
outputFilter(tempProj, xml, "LexYacc Files"); |
| 2575 |
outputFilter(tempProj, xml, "Translation Files"); |
| 2576 |
outputFilter(tempProj, xml, "Form Files"); |
| 2577 |
outputFilter(tempProj, xml, "Resource Files"); |
| 2578 |
outputFilter(tempProj, xml, "Deployment Files"); |
| 2579 |
outputFilter(tempProj, xml, "Distribution Files"); |
| 2580 |
|
| 2581 |
QSet<QString> extraCompilersInProject; |
| 2582 |
for (int i = 0; i < tool.ExtraCompilersFiles.size(); ++i) { |
| 2583 |
const QString &compilerName = tool.ExtraCompilersFiles.at(i).Name; |
| 2584 |
if (!extraCompilersInProject.contains(compilerName)) { |
| 2585 |
extraCompilersInProject += compilerName; |
| 2586 |
tempProj.ExtraCompilers += compilerName; |
| 2587 |
} |
| 2588 |
} |
| 2589 |
|
| 2590 |
for (int x = 0; x < tempProj.ExtraCompilers.size(); ++x) { |
| 2591 |
outputFilter(tempProj, xml, tempProj.ExtraCompilers.at(x)); |
| 2592 |
} |
| 2593 |
outputFilter(tempProj, xml, "Root Files"); |
| 2594 |
xml << closetag(q_Files) |
| 2595 |
<< tag(_Globals) |
| 2596 |
<< data(); // No "/>" end tag |
| 2597 |
} |
| 2598 |
|
| 2599 |
void VCProjectWriter::write(XmlOutput &xml, VCProject &tool) |
| 2600 |
{ |
| 2601 |
if (tool.SingleProjects.size() == 0) { |
| 2602 |
warn_msg(WarnLogic, "Generator: .NET: no single project in merge project, no output"); |
| 2603 |
return; |
| 2604 |
} |
| 2605 |
|
| 2606 |
xml << decl("1.0", "Windows-1252") |
| 2607 |
<< tag(_VisualStudioProject) |
| 2608 |
<< attrS(_ProjectType, "Visual C++") |
| 2609 |
<< attrS(_Version, tool.Version) |
| 2610 |
<< attrS(_Name, tool.Name) |
| 2611 |
<< attrS(_ProjectGUID, tool.ProjectGUID) |
| 2612 |
<< attrS(_Keyword, tool.Keyword) |
| 2613 |
<< attrS(_SccProjectName, tool.SccProjectName) |
| 2614 |
<< attrS(_SccLocalPath, tool.SccLocalPath) |
| 2615 |
<< tag(_Platforms) |
| 2616 |
<< tag(_Platform) |
| 2617 |
<< attrS(_Name, tool.PlatformName) |
| 2618 |
<< closetag(_Platforms) |
| 2619 |
<< tag(_Configurations); |
| 2620 |
// Output each configuration |
| 2621 |
for (int i = 0; i < tool.SingleProjects.size(); ++i) |
| 2622 |
write(xml, tool.SingleProjects.at(i).Configuration); |
| 2623 |
xml << closetag(_Configurations) |
| 2624 |
<< tag(q_Files); |
| 2625 |
outputFilter(tool, xml, "Source Files"); |
| 2626 |
outputFilter(tool, xml, "Header Files"); |
| 2627 |
outputFilter(tool, xml, "Generated Files"); |
| 2628 |
outputFilter(tool, xml, "LexYacc Files"); |
| 2629 |
outputFilter(tool, xml, "Translation Files"); |
| 2630 |
outputFilter(tool, xml, "Form Files"); |
| 2631 |
outputFilter(tool, xml, "Resource Files"); |
| 2632 |
outputFilter(tool, xml, "Deployment Files"); |
| 2633 |
outputFilter(tool, xml, "Distribution Files"); |
| 2634 |
for (int x = 0; x < tool.ExtraCompilers.size(); ++x) { |
| 2635 |
outputFilter(tool, xml, tool.ExtraCompilers.at(x)); |
| 2636 |
} |
| 2637 |
outputFilter(tool, xml, "Root Files"); |
| 2638 |
xml << closetag(q_Files) |
| 2639 |
<< tag(_Globals) |
| 2640 |
<< data(); // No "/>" end tag |
| 2641 |
} |
| 2642 |
|
| 2643 |
void VCProjectWriter::write(XmlOutput &xml, const VCCLCompilerTool &tool) |
| 2644 |
{ |
| 2645 |
xml << tag(_Tool) |
| 2646 |
<< attrS(_Name, _VCCLCompilerTool) |
| 2647 |
<< attrX(_AdditionalIncludeDirectories, tool.AdditionalIncludeDirectories) |
| 2648 |
<< attrX(_AdditionalOptions, tool.AdditionalOptions, " ") |
| 2649 |
<< attrX(_AdditionalUsingDirectories, tool.AdditionalUsingDirectories) |
| 2650 |
<< attrS(_AssemblerListingLocation, tool.AssemblerListingLocation) |
| 2651 |
<< attrE(_AssemblerOutput, tool.AssemblerOutput, /*ifNot*/ asmListingNone) |
| 2652 |
<< attrE(_BasicRuntimeChecks, tool.BasicRuntimeChecks, /*ifNot*/ runtimeBasicCheckNone) |
| 2653 |
<< attrE(_BrowseInformation, tool.BrowseInformation, /*ifNot*/ brInfoNone) |
| 2654 |
<< attrS(_BrowseInformationFile, tool.BrowseInformationFile) |
| 2655 |
<< attrT(_BufferSecurityCheck, tool.BufferSecurityCheck) |
| 2656 |
<< attrE(_CallingConvention, tool.CallingConvention, /*ifNot*/ callConventionDefault) |
| 2657 |
<< attrE(_CompileAs, tool.CompileAs, compileAsDefault) |
| 2658 |
<< attrE(_CompileAsManaged, tool.CompileAsManaged, /*ifNot*/ managedDefault) |
| 2659 |
<< attrT(_CompileOnly, tool.CompileOnly) |
| 2660 |
<< attrE(_DebugInformationFormat, tool.DebugInformationFormat, /*ifNot*/ debugUnknown) |
| 2661 |
<< attrT(_Detect64BitPortabilityProblems, tool.Detect64BitPortabilityProblems) |
| 2662 |
<< attrT(_DisableLanguageExtensions, tool.DisableLanguageExtensions) |
| 2663 |
<< attrX(_DisableSpecificWarnings, tool.DisableSpecificWarnings) |
| 2664 |
<< attrE(_EnableEnhancedInstructionSet, tool.EnableEnhancedInstructionSet, /*ifnot*/ archNotSet) |
| 2665 |
<< attrT(_EnableFiberSafeOptimizations, tool.EnableFiberSafeOptimizations) |
| 2666 |
<< attrT(_EnableFunctionLevelLinking, tool.EnableFunctionLevelLinking) |
| 2667 |
<< attrT(_EnableIntrinsicFunctions, tool.EnableIntrinsicFunctions) |
| 2668 |
<< xformExceptionHandlingNET2005(tool.ExceptionHandling, tool.config->CompilerVersion) |
| 2669 |
<< attrT(_ExpandAttributedSource, tool.ExpandAttributedSource) |
| 2670 |
<< attrE(_FavorSizeOrSpeed, tool.FavorSizeOrSpeed, /*ifNot*/ favorNone) |
| 2671 |
|
| 2672 |
<< attrE(_FloatingPointModel, tool.FloatingPointModel, /*ifNot*/ floatingPointNotSet) |
| 2673 |
<< attrT(_FloatingPointExceptions, tool.FloatingPointExceptions) |
| 2674 |
|
| 2675 |
<< attrT(_ForceConformanceInForLoopScope, tool.ForceConformanceInForLoopScope) |
| 2676 |
<< attrX(_ForcedIncludeFiles, tool.ForcedIncludeFiles) |
| 2677 |
<< attrX(_ForcedUsingFiles, tool.ForcedUsingFiles) |
| 2678 |
<< attrE(_GeneratePreprocessedFile, tool.GeneratePreprocessedFile, /*ifNot*/ preprocessUnknown) |
| 2679 |
<< attrT(_GlobalOptimizations, tool.GlobalOptimizations) |
| 2680 |
<< attrT(_IgnoreStandardIncludePath, tool.IgnoreStandardIncludePath) |
| 2681 |
<< attrT(_ImproveFloatingPointConsistency, tool.ImproveFloatingPointConsistency) |
| 2682 |
<< attrE(_InlineFunctionExpansion, tool.InlineFunctionExpansion, /*ifNot*/ expandDefault) |
| 2683 |
<< attrT(_KeepComments, tool.KeepComments) |
| 2684 |
<< attrT(_MinimalRebuild, tool.MinimalRebuild) |
| 2685 |
<< attrS(_ObjectFile, tool.ObjectFile) |
| 2686 |
<< attrT(_OmitFramePointers, tool.OmitFramePointers) |
| 2687 |
<< attrT(_OpenMP, tool.OpenMP) |
| 2688 |
<< attrE(_Optimization, tool.Optimization, /*ifNot*/ optimizeDefault) |
| 2689 |
<< attrE(_OptimizeForProcessor, tool.OptimizeForProcessor, /*ifNot*/ procOptimizeBlended) |
| 2690 |
<< attrT(_OptimizeForWindowsApplication, tool.OptimizeForWindowsApplication) |
| 2691 |
<< attrS(_OutputFile, tool.OutputFile) |
| 2692 |
<< attrS(_PrecompiledHeaderFile, tool.PrecompiledHeaderFile) |
| 2693 |
<< attrS(_PrecompiledHeaderThrough, tool.PrecompiledHeaderThrough) |
| 2694 |
<< attrX(_PreprocessorDefinitions, tool.PreprocessorDefinitions) |
| 2695 |
<< (tool.ProgramDataBaseFileName.isNull() ? noxml() : attr(_ProgramDataBaseFileName, tool.ProgramDataBaseFileName)) |
| 2696 |
<< attrE(_RuntimeLibrary, tool.RuntimeLibrary, /*ifNot*/ rtUnknown) |
| 2697 |
<< attrT(_RuntimeTypeInfo, tool.RuntimeTypeInfo) |
| 2698 |
<< attrT(_ShowIncludes, tool.ShowIncludes) |
| 2699 |
<< attrT(_SmallerTypeCheck, tool.SmallerTypeCheck) |
| 2700 |
<< attrT(_StringPooling, tool.StringPooling) |
| 2701 |
<< attrE(_StructMemberAlignment, tool.StructMemberAlignment, /*ifNot*/ alignNotSet) |
| 2702 |
<< attrT(_SuppressStartupBanner, tool.SuppressStartupBanner) |
| 2703 |
<< attrT(_TreatWChar_tAsBuiltInType, tool.TreatWChar_tAsBuiltInType) |
| 2704 |
<< attrT(_TurnOffAssemblyGeneration, tool.TurnOffAssemblyGeneration) |
| 2705 |
<< attrT(_UndefineAllPreprocessorDefinitions, tool.UndefineAllPreprocessorDefinitions) |
| 2706 |
<< attrX(_UndefinePreprocessorDefinitions, tool.UndefinePreprocessorDefinitions) |
| 2707 |
<< xformUsePrecompiledHeaderForNET2005(tool.UsePrecompiledHeader, tool.config->CompilerVersion) |
| 2708 |
<< attrT(_WarnAsError, tool.WarnAsError) |
| 2709 |
<< attrE(_WarningLevel, tool.WarningLevel, /*ifNot*/ warningLevelUnknown) |
| 2710 |
<< attrT(_WholeProgramOptimization, tool.WholeProgramOptimization) |
| 2711 |
<< attrE(_CompileForArchitecture, tool.CompileForArchitecture, /*ifNot*/ archUnknown) |
| 2712 |
<< attrT(_InterworkCalls, tool.InterworkCalls) |
| 2713 |
|
| 2714 |
<< closetag(_Tool); |
| 2715 |
} |
| 2716 |
|
| 2717 |
void VCProjectWriter::write(XmlOutput &xml, const VCLinkerTool &tool) |
| 2718 |
{ |
| 2719 |
xml << tag(_Tool) |
| 2720 |
<< attrS(_Name, _VCLinkerTool) |
| 2721 |
<< attrX(_AdditionalDependencies, tool.AdditionalDependencies, " ") |
| 2722 |
<< attrX(_AdditionalLibraryDirectories, tool.AdditionalLibraryDirectories) |
| 2723 |
<< attrX(_AdditionalOptions, tool.AdditionalOptions, " ") |
| 2724 |
<< attrX(_AddModuleNamesToAssembly, tool.AddModuleNamesToAssembly) |
| 2725 |
<< attrS(_BaseAddress, tool.BaseAddress) |
| 2726 |
<< attrT(_DataExecutionPrevention, tool.DataExecutionPrevention) |
| 2727 |
<< attrX(_DelayLoadDLLs, tool.DelayLoadDLLs) |
| 2728 |
<< attrE(_EnableCOMDATFolding, tool.EnableCOMDATFolding, /*ifNot*/ optFoldingDefault) |
| 2729 |
<< attrS(_EntryPointSymbol, tool.EntryPointSymbol) |
| 2730 |
<< attrX(_ForceSymbolReferences, tool.ForceSymbolReferences) |
| 2731 |
<< attrS(_FunctionOrder, tool.FunctionOrder) |
| 2732 |
<< attrT(_GenerateDebugInformation, tool.GenerateDebugInformation) |
| 2733 |
<< attrT(_GenerateMapFile, tool.GenerateMapFile) |
| 2734 |
<< attrL(_HeapCommitSize, tool.HeapCommitSize, /*ifNot*/ -1) |
| 2735 |
<< attrL(_HeapReserveSize, tool.HeapReserveSize, /*ifNot*/ -1) |
| 2736 |
<< attrT(_IgnoreAllDefaultLibraries, tool.IgnoreAllDefaultLibraries) |
| 2737 |
<< attrX(_IgnoreDefaultLibraryNames, tool.IgnoreDefaultLibraryNames) |
| 2738 |
<< attrT(_IgnoreEmbeddedIDL, tool.IgnoreEmbeddedIDL) |
| 2739 |
<< attrT(_IgnoreImportLibrary, tool.IgnoreImportLibrary) |
| 2740 |
<< attrS(_ImportLibrary, tool.ImportLibrary) |
| 2741 |
<< attrE(_LargeAddressAware, tool.LargeAddressAware, /*ifNot*/ addrAwareDefault) |
| 2742 |
<< attrT(_LinkDLL, tool.LinkDLL) |
| 2743 |
<< attrE(_LinkIncremental, tool.LinkIncremental, /*ifNot*/ linkIncrementalDefault) |
| 2744 |
<< attrE(_LinkTimeCodeGeneration, tool.LinkTimeCodeGeneration) |
| 2745 |
<< attrS(_LinkToManagedResourceFile, tool.LinkToManagedResourceFile) |
| 2746 |
<< attrT(_MapExports, tool.MapExports) |
| 2747 |
<< attrS(_MapFileName, tool.MapFileName) |
| 2748 |
<< attrT(_MapLines, tool.MapLines) |
| 2749 |
<< attrS(_MergedIDLBaseFileName, tool.MergedIDLBaseFileName) |
| 2750 |
<< attrS(_MergeSections, tool.MergeSections) |
| 2751 |
<< attrS(_MidlCommandFile, tool.MidlCommandFile) |
| 2752 |
<< attrS(_ModuleDefinitionFile, tool.ModuleDefinitionFile) |
| 2753 |
<< attrE(_OptimizeForWindows98, tool.OptimizeForWindows98, /*ifNot*/ optWin98Default) |
| 2754 |
<< attrE(_OptimizeReferences, tool.OptimizeReferences, /*ifNot*/ optReferencesDefault) |
| 2755 |
<< attrS(_OutputFile, tool.OutputFile) |
| 2756 |
<< attr(_ProgramDatabaseFile, tool.ProgramDatabaseFile) |
| 2757 |
<< attrT(_RandomizedBaseAddress, tool.RandomizedBaseAddress) |
| 2758 |
<< attrT(_RegisterOutput, tool.RegisterOutput) |
| 2759 |
<< attrT(_ResourceOnlyDLL, tool.ResourceOnlyDLL) |
| 2760 |
<< attrT(_SetChecksum, tool.SetChecksum) |
| 2761 |
<< attrE(_ShowProgress, tool.ShowProgress, /*ifNot*/ linkProgressNotSet) |
| 2762 |
<< attrL(_StackCommitSize, tool.StackCommitSize, /*ifNot*/ -1) |
| 2763 |
<< attrL(_StackReserveSize, tool.StackReserveSize, /*ifNot*/ -1) |
| 2764 |
<< attrS(_StripPrivateSymbols, tool.StripPrivateSymbols) |
| 2765 |
<< attrE(_SubSystem, tool.SubSystem) |
| 2766 |
<< attrT(_SupportUnloadOfDelayLoadedDLL, tool.SupportUnloadOfDelayLoadedDLL) |
| 2767 |
<< attrT(_SuppressStartupBanner, tool.SuppressStartupBanner) |
| 2768 |
<< attrT(_SwapRunFromCD, tool.SwapRunFromCD) |
| 2769 |
<< attrT(_SwapRunFromNet, tool.SwapRunFromNet) |
| 2770 |
<< attrE(_TargetMachine, tool.TargetMachine, /*ifNot*/ machineNotSet) |
| 2771 |
<< attrE(_TerminalServerAware, tool.TerminalServerAware, /*ifNot*/ termSvrAwareDefault) |
| 2772 |
<< attrT(_TurnOffAssemblyGeneration, tool.TurnOffAssemblyGeneration) |
| 2773 |
<< attrS(_TypeLibraryFile, tool.TypeLibraryFile) |
| 2774 |
<< attrL(_TypeLibraryResourceID, tool.TypeLibraryResourceID, /*ifNot*/ rcUseDefault) |
| 2775 |
<< attrS(_Version, tool.Version) |
| 2776 |
<< attrT(_GenerateManifest, tool.GenerateManifest) |
| 2777 |
<< closetag(_Tool); |
| 2778 |
} |
| 2779 |
|
| 2780 |
void VCProjectWriter::write(XmlOutput &xml, const VCManifestTool &tool) |
| 2781 |
{ |
| 2782 |
xml << tag(_Tool) |
| 2783 |
<< attrS(_Name, _VCManifestTool) |
| 2784 |
<< attrT(_EmbedManifest, tool.EmbedManifest) |
| 2785 |
<< closetag(_Tool); |
| 2786 |
} |
| 2787 |
|
| 2788 |
void VCProjectWriter::write(XmlOutput &xml, const VCMIDLTool &tool) |
| 2789 |
{ |
| 2790 |
xml << tag(_Tool) |
| 2791 |
<< attrS(_Name, _VCMIDLTool) |
| 2792 |
<< attrX(_AdditionalIncludeDirectories, tool.AdditionalIncludeDirectories) |
| 2793 |
<< attrX(_AdditionalOptions, tool.AdditionalOptions, " ") |
| 2794 |
<< attrX(_CPreprocessOptions, tool.CPreprocessOptions) |
| 2795 |
<< attrE(_DefaultCharType, tool.DefaultCharType) |
| 2796 |
<< attrS(_DLLDataFileName, tool.DLLDataFileName) |
| 2797 |
<< attrE(_EnableErrorChecks, tool.EnableErrorChecks) |
| 2798 |
<< attrT(_ErrorCheckAllocations, tool.ErrorCheckAllocations) |
| 2799 |
<< attrT(_ErrorCheckBounds, tool.ErrorCheckBounds) |
| 2800 |
<< attrT(_ErrorCheckEnumRange, tool.ErrorCheckEnumRange) |
| 2801 |
<< attrT(_ErrorCheckRefPointers, tool.ErrorCheckRefPointers) |
| 2802 |
<< attrT(_ErrorCheckStubData, tool.ErrorCheckStubData) |
| 2803 |
<< attrX(_FullIncludePath, tool.FullIncludePath) |
| 2804 |
<< attrT(_GenerateStublessProxies, tool.GenerateStublessProxies) |
| 2805 |
<< attrT(_GenerateTypeLibrary, tool.GenerateTypeLibrary) |
| 2806 |
<< attrS(_HeaderFileName, tool.HeaderFileName) |
| 2807 |
<< attrT(_IgnoreStandardIncludePath, tool.IgnoreStandardIncludePath) |
| 2808 |
<< attrS(_InterfaceIdentifierFileName, tool.InterfaceIdentifierFileName) |
| 2809 |
<< attrT(_MkTypLibCompatible, tool.MkTypLibCompatible) |
| 2810 |
<< attrS(_OutputDirectory, tool.OutputDirectory) |
| 2811 |
<< attrX(_PreprocessorDefinitions, tool.PreprocessorDefinitions) |
| 2812 |
<< attrS(_ProxyFileName, tool.ProxyFileName) |
| 2813 |
<< attrS(_RedirectOutputAndErrors, tool.RedirectOutputAndErrors) |
| 2814 |
<< attrE(_StructMemberAlignment, tool.StructMemberAlignment, /*ifNot*/ midlAlignNotSet) |
| 2815 |
<< attrT(_SuppressStartupBanner, tool.SuppressStartupBanner) |
| 2816 |
<< attrE(_TargetEnvironment, tool.TargetEnvironment, /*ifNot*/ midlTargetNotSet) |
| 2817 |
<< attrS(_TypeLibraryName, tool.TypeLibraryName) |
| 2818 |
<< attrX(_UndefinePreprocessorDefinitions, tool.UndefinePreprocessorDefinitions) |
| 2819 |
<< attrT(_ValidateParameters, tool.ValidateParameters) |
| 2820 |
<< attrT(_WarnAsError, tool.WarnAsError) |
| 2821 |
<< attrE(_WarningLevel, tool.WarningLevel) |
| 2822 |
<< closetag(_Tool); |
| 2823 |
} |
| 2824 |
|
| 2825 |
void VCProjectWriter::write(XmlOutput &xml, const VCCustomBuildTool &tool) |
| 2826 |
{ |
| 2827 |
xml << tag(_Tool) |
| 2828 |
<< attrS(_Name, tool.ToolName) |
| 2829 |
<< attrX(_AdditionalDependencies, tool.AdditionalDependencies, ";") |
| 2830 |
<< attrS(_CommandLine, tool.CommandLine.join(vcCommandSeparator())) |
| 2831 |
<< attrS(_Description, tool.Description) |
| 2832 |
<< attrX(_Outputs, tool.Outputs, ";") |
| 2833 |
<< attrS(_Path, tool.ToolPath) |
| 2834 |
<< closetag(_Tool); |
| 2835 |
} |
| 2836 |
|
| 2837 |
void VCProjectWriter::write(XmlOutput &xml, const VCLibrarianTool &tool) |
| 2838 |
{ |
| 2839 |
xml |
| 2840 |
<< tag(_Tool) |
| 2841 |
<< attrS(_Name, _VCLibrarianTool) |
| 2842 |
<< attrX(_AdditionalDependencies, tool.AdditionalDependencies) |
| 2843 |
<< attrX(_AdditionalLibraryDirectories, tool.AdditionalLibraryDirectories) |
| 2844 |
<< attrX(_AdditionalOptions, tool.AdditionalOptions, " ") |
| 2845 |
<< attrX(_ExportNamedFunctions, tool.ExportNamedFunctions) |
| 2846 |
<< attrX(_ForceSymbolReferences, tool.ForceSymbolReferences) |
| 2847 |
<< attrT(_IgnoreAllDefaultLibraries, tool.IgnoreAllDefaultLibraries) |
| 2848 |
<< attrX(_IgnoreDefaultLibraryNames, tool.IgnoreDefaultLibraryNames) |
| 2849 |
<< attrS(_ModuleDefinitionFile, tool.ModuleDefinitionFile) |
| 2850 |
<< attrS(_OutputFile, tool.OutputFile) |
| 2851 |
<< attrT(_SuppressStartupBanner, tool.SuppressStartupBanner) |
| 2852 |
<< closetag(_Tool); |
| 2853 |
} |
| 2854 |
|
| 2855 |
void VCProjectWriter::write(XmlOutput &xml, const VCResourceCompilerTool &tool) |
| 2856 |
{ |
| 2857 |
xml |
| 2858 |
<< tag(_Tool) |
| 2859 |
<< attrS(_Name, _VCResourceCompilerTool) |
| 2860 |
<< attrS(_Path, tool.ToolPath) |
| 2861 |
<< attrX(_AdditionalIncludeDirectories, tool.AdditionalIncludeDirectories) |
| 2862 |
<< attrX(_AdditionalOptions, tool.AdditionalOptions, " ") |
| 2863 |
<< attrE(_Culture, tool.Culture, /*ifNot*/ rcUseDefault) |
| 2864 |
<< attrX(_FullIncludePath, tool.FullIncludePath) |
| 2865 |
<< attrT(_IgnoreStandardIncludePath, tool.IgnoreStandardIncludePath) |
| 2866 |
<< attrX(_PreprocessorDefinitions, tool.PreprocessorDefinitions) |
| 2867 |
<< attrS(_ResourceOutputFileName, tool.ResourceOutputFileName) |
| 2868 |
<< attrE(_ShowProgress, tool.ShowProgress, /*ifNot*/ linkProgressNotSet) |
| 2869 |
<< closetag(_Tool); |
| 2870 |
} |
| 2871 |
|
| 2872 |
void VCProjectWriter::write(XmlOutput &xml, const VCEventTool &tool) |
| 2873 |
{ |
| 2874 |
xml |
| 2875 |
<< tag(_Tool) |
| 2876 |
<< attrS(_Name, tool.ToolName) |
| 2877 |
<< attrS(_Path, tool.ToolPath) |
| 2878 |
<< attrS(_CommandLine, tool.CommandLine.join(vcCommandSeparator())) |
| 2879 |
<< attrS(_Description, tool.Description) |
| 2880 |
<< attrT(_ExcludedFromBuild, tool.ExcludedFromBuild) |
| 2881 |
<< closetag(_Tool); |
| 2882 |
} |
| 2883 |
|
| 2884 |
void VCProjectWriter::write(XmlOutput &xml, const VCDeploymentTool &tool) |
| 2885 |
{ |
| 2886 |
if (tool.AdditionalFiles.isEmpty()) |
| 2887 |
return; |
| 2888 |
xml << tag(tool.DeploymentTag) |
| 2889 |
<< attrS(_RemoteDirectory, tool.RemoteDirectory) |
| 2890 |
<< attrE(_RegisterOutput, tool.RegisterOutput) |
| 2891 |
<< attrS(_AdditionalFiles, tool.AdditionalFiles) |
| 2892 |
<< closetag(tool.DeploymentTag); |
| 2893 |
} |
| 2894 |
|
| 2895 |
void VCProjectWriter::write(XmlOutput &xml, const VCWinDeployQtTool &tool) |
| 2896 |
{ |
| 2897 |
Q_UNUSED(xml); |
| 2898 |
Q_UNUSED(tool); |
| 2899 |
} |
| 2900 |
|
| 2901 |
void VCProjectWriter::write(XmlOutput &xml, const VCConfiguration &tool) |
| 2902 |
{ |
| 2903 |
xml << tag(_Configuration) |
| 2904 |
<< attrS(_Name, tool.Name) |
| 2905 |
<< attrS(_OutputDirectory, tool.OutputDirectory) |
| 2906 |
<< attrT(_ATLMinimizesCRunTimeLibraryUsage, tool.ATLMinimizesCRunTimeLibraryUsage) |
| 2907 |
<< attrT(_BuildBrowserInformation, tool.BuildBrowserInformation) |
| 2908 |
<< attrE(_CharacterSet, tool.CharacterSet, /*ifNot*/ charSetNotSet) |
| 2909 |
<< attrE(_ConfigurationType, tool.ConfigurationType) |
| 2910 |
<< attrS(_DeleteExtensionsOnClean, tool.DeleteExtensionsOnClean) |
| 2911 |
<< attrS(_ImportLibrary, tool.ImportLibrary) |
| 2912 |
<< attrS(_IntermediateDirectory, tool.IntermediateDirectory) |
| 2913 |
<< attrS(_PrimaryOutput, tool.PrimaryOutput) |
| 2914 |
<< attrS(_ProgramDatabase, tool.ProgramDatabase) |
| 2915 |
<< attrT(_RegisterOutput, tool.RegisterOutput) |
| 2916 |
<< attrE(_UseOfATL, tool.UseOfATL, /*ifNot*/ useATLNotSet) |
| 2917 |
<< attrE(_UseOfMfc, tool.UseOfMfc) |
| 2918 |
<< attrT(_WholeProgramOptimization, tool.WholeProgramOptimization); |
| 2919 |
write(xml, tool.compiler); |
| 2920 |
if (tool.ConfigurationType == typeStaticLibrary) |
| 2921 |
write(xml, tool.librarian); |
| 2922 |
else |
| 2923 |
write(xml, tool.linker); |
| 2924 |
write(xml, tool.manifestTool); |
| 2925 |
write(xml, tool.idl); |
| 2926 |
write(xml, tool.postBuild); |
| 2927 |
write(xml, tool.preBuild); |
| 2928 |
write(xml, tool.preLink); |
| 2929 |
write(xml, tool.resource); |
| 2930 |
write(xml, tool.deployment); |
| 2931 |
xml << closetag(_Configuration); |
| 2932 |
} |
| 2933 |
|
| 2934 |
void VCProjectWriter::write(XmlOutput &xml, VCFilter &tool) |
| 2935 |
{ |
| 2936 |
if(!tool.Files.size()) |
| 2937 |
return; |
| 2938 |
|
| 2939 |
if (!tool.Name.isEmpty()) { |
| 2940 |
xml << tag(_Filter) |
| 2941 |
<< attrS(_Name, tool.Name) |
| 2942 |
<< attrS(_Filter, tool.Filter) |
| 2943 |
<< attrS(_UniqueIdentifier, tool.Guid) |
| 2944 |
<< attrT(_ParseFiles, tool.ParseFiles); |
| 2945 |
} |
| 2946 |
for (int i = 0; i < tool.Files.size(); ++i) { |
| 2947 |
const VCFilterFile &info = tool.Files.at(i); |
| 2948 |
xml << tag(q_File) |
| 2949 |
<< attrS(_RelativePath, Option::fixPathToTargetOS(info.file)) |
| 2950 |
<< data(); // In case no custom builds, to avoid "/>" endings |
| 2951 |
outputFileConfig(tool, xml, tool.Files.at(i).file); |
| 2952 |
xml << closetag(q_File); |
| 2953 |
} |
| 2954 |
if (!tool.Name.isEmpty()) |
| 2955 |
xml << closetag(_Filter); |
| 2956 |
} |
| 2957 |
|
| 2958 |
// outputs a given filter for all existing configurations of a project |
| 2959 |
void VCProjectWriter::outputFilter(VCProject &project, XmlOutput &xml, const QString &filtername) |
| 2960 |
{ |
| 2961 |
QScopedPointer<Node> root; |
| 2962 |
if (project.SingleProjects.at(0).flat_files) |
| 2963 |
root.reset(new FlatNode); |
| 2964 |
else |
| 2965 |
root.reset(new TreeNode); |
| 2966 |
|
| 2967 |
QString name, extfilter, guid; |
| 2968 |
triState parse = unset; |
| 2969 |
|
| 2970 |
for (int i = 0; i < project.SingleProjects.size(); ++i) { |
| 2971 |
const VCFilter filter = project.SingleProjects.at(i).filterByName(filtername); |
| 2972 |
|
| 2973 |
// Merge all files in this filter to root tree |
| 2974 |
for (int x = 0; x < filter.Files.size(); ++x) |
| 2975 |
root->addElement(filter.Files.at(x)); |
| 2976 |
|
| 2977 |
// Save filter setting from first filter. Next filters |
| 2978 |
// may differ but we cannot handle that. (ex. extfilter) |
| 2979 |
if (name.isEmpty()) { |
| 2980 |
name = filter.Name; |
| 2981 |
extfilter = filter.Filter; |
| 2982 |
parse = filter.ParseFiles; |
| 2983 |
guid = filter.Guid; |
| 2984 |
} |
| 2985 |
} |
| 2986 |
|
| 2987 |
if (!root->hasElements()) |
| 2988 |
return; |
| 2989 |
|
| 2990 |
// Actual XML output ---------------------------------- |
| 2991 |
if (!name.isEmpty()) { |
| 2992 |
xml << tag(_Filter) |
| 2993 |
<< attrS(_Name, name) |
| 2994 |
<< attrS(_Filter, extfilter) |
| 2995 |
<< attrS(_UniqueIdentifier, guid) |
| 2996 |
<< attrT(_ParseFiles, parse); |
| 2997 |
} |
| 2998 |
root->generateXML(xml, "", project, filtername); // output root tree |
| 2999 |
if (!name.isEmpty()) |
| 3000 |
xml << closetag(_Filter); |
| 3001 |
} |
| 3002 |
|
| 3003 |
// Output all configurations (by filtername) for a file (by info) |
| 3004 |
// A filters config output is in VCFilter.outputFileConfig() |
| 3005 |
void VCProjectWriter::outputFileConfigs(VCProject &project, XmlOutput &xml, const VCFilterFile &info, const QString &filtername) |
| 3006 |
{ |
| 3007 |
xml << tag(q_File) |
| 3008 |
<< attrS(_RelativePath, Option::fixPathToTargetOS(info.file)); |
| 3009 |
for (int i = 0; i < project.SingleProjects.size(); ++i) { |
| 3010 |
VCFilter filter = project.SingleProjects.at(i).filterByName(filtername); |
| 3011 |
if (filter.Config) // only if the filter is not empty |
| 3012 |
outputFileConfig(filter, xml, info.file); |
| 3013 |
} |
| 3014 |
xml << closetag(q_File); |
| 3015 |
} |
| 3016 |
|
| 3017 |
void VCProjectWriter::outputFileConfig(VCFilter &filter, XmlOutput &xml, const QString &filename) |
| 3018 |
{ |
| 3019 |
// Clearing each filter tool |
| 3020 |
filter.useCustomBuildTool = false; |
| 3021 |
filter.useCompilerTool = false; |
| 3022 |
filter.CustomBuildTool = VCCustomBuildTool(); |
| 3023 |
filter.CompilerTool = VCCLCompilerTool(); |
| 3024 |
|
| 3025 |
// Unset some default options |
| 3026 |
filter.CustomBuildTool.config = filter.Config; |
| 3027 |
filter.CompilerTool.BufferSecurityCheck = unset; |
| 3028 |
filter.CompilerTool.DebugInformationFormat = debugUnknown; |
| 3029 |
filter.CompilerTool.ExceptionHandling = ehDefault; |
| 3030 |
filter.CompilerTool.GeneratePreprocessedFile = preprocessUnknown; |
| 3031 |
filter.CompilerTool.Optimization = optimizeDefault; |
| 3032 |
filter.CompilerTool.ProgramDataBaseFileName.clear(); |
| 3033 |
filter.CompilerTool.RuntimeLibrary = rtUnknown; |
| 3034 |
filter.CompilerTool.WarningLevel = warningLevelUnknown; |
| 3035 |
filter.CompilerTool.config = filter.Config; |
| 3036 |
|
| 3037 |
bool inBuild; |
| 3038 |
VCFilterFile info = filter.findFile(filename, &inBuild); |
| 3039 |
inBuild &= !info.excludeFromBuild; |
| 3040 |
|
| 3041 |
if (inBuild) { |
| 3042 |
filter.addExtraCompiler(info); |
| 3043 |
if(filter.Project->usePCH) |
| 3044 |
filter.modifyPCHstage(info.file); |
| 3045 |
} else { |
| 3046 |
// Excluded files uses an empty compiler stage |
| 3047 |
if(info.excludeFromBuild) |
| 3048 |
filter.useCompilerTool = true; |
| 3049 |
} |
| 3050 |
|
| 3051 |
// Actual XML output ---------------------------------- |
| 3052 |
if (filter.useCustomBuildTool || filter.useCompilerTool || !inBuild) { |
| 3053 |
xml << tag(_FileConfiguration) |
| 3054 |
<< attr(_Name, filter.Config->Name) |
| 3055 |
<< (!inBuild ? attrS(_ExcludedFromBuild, "true") : noxml()); |
| 3056 |
if (filter.useCustomBuildTool) |
| 3057 |
filter.Project->projectWriter->write(xml, filter.CustomBuildTool); |
| 3058 |
if (filter.useCompilerTool) |
| 3059 |
filter.Project->projectWriter->write(xml, filter.CompilerTool); |
| 3060 |
xml << closetag(_FileConfiguration); |
| 3061 |
} |
| 3062 |
} |
| 3063 |
|
| 3064 |
QT_END_NAMESPACE |