| 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 "msbuild_objectmodel.h" |
| 5 |
|
| 6 |
#include "msvc_objectmodel.h" |
| 7 |
#include "msvc_vcproj.h" |
| 8 |
#include "msvc_vcxproj.h" |
| 9 |
#include <qscopedpointer.h> |
| 10 |
#include <qstringlist.h> |
| 11 |
#include <qfileinfo.h> |
| 12 |
#include <qregularexpression.h> |
| 13 |
#include <qvarlengtharray.h> |
| 14 |
|
| 15 |
QT_BEGIN_NAMESPACE |
| 16 |
|
| 17 |
// XML Tags --------------------------------------------------------- |
| 18 |
const char _CLCompile[] = "ClCompile"; |
| 19 |
const char _ItemGroup[] = "ItemGroup"; |
| 20 |
const char _Link[] = "Link"; |
| 21 |
const char _Lib[] = "Lib"; |
| 22 |
const char _Midl[] = "Midl"; |
| 23 |
const char _ResourceCompile[] = "ResourceCompile"; |
| 24 |
|
| 25 |
// XML Properties --------------------------------------------------- |
| 26 |
const char _AddModuleNamesToAssembly[] = "AddModuleNamesToAssembly"; |
| 27 |
const char _AdditionalDependencies[] = "AdditionalDependencies"; |
| 28 |
const char _AdditionalIncludeDirectories[] = "AdditionalIncludeDirectories"; |
| 29 |
const char _AdditionalLibraryDirectories[] = "AdditionalLibraryDirectories"; |
| 30 |
const char _AdditionalManifestDependencies[] = "AdditionalManifestDependencies"; |
| 31 |
const char _AdditionalOptions[] = "AdditionalOptions"; |
| 32 |
const char _AdditionalUsingDirectories[] = "AdditionalUsingDirectories"; |
| 33 |
const char _AllowIsolation[] = "AllowIsolation"; |
| 34 |
const char _ApplicationConfigurationMode[] = "ApplicationConfigurationMode"; |
| 35 |
const char _AssemblerListingLocation[] = "AssemblerListingLocation"; |
| 36 |
const char _AssemblerOutput[] = "AssemblerOutput"; |
| 37 |
const char _AssemblyDebug[] = "AssemblyDebug"; |
| 38 |
const char _AssemblyLinkResource[] = "AssemblyLinkResource"; |
| 39 |
const char _ATLMinimizesCRunTimeLibraryUsage[] = "ATLMinimizesCRunTimeLibraryUsage"; |
| 40 |
const char _BaseAddress[] = "BaseAddress"; |
| 41 |
const char _BasicRuntimeChecks[] = "BasicRuntimeChecks"; |
| 42 |
const char _BrowseInformation[] = "BrowseInformation"; |
| 43 |
const char _BrowseInformationFile[] = "BrowseInformationFile"; |
| 44 |
const char _BufferSecurityCheck[] = "BufferSecurityCheck"; |
| 45 |
const char _BuildBrowserInformation[] = "BuildBrowserInformation"; |
| 46 |
const char _CallingConvention[] = "CallingConvention"; |
| 47 |
const char _CharacterSet[] = "CharacterSet"; |
| 48 |
const char _ClientStubFile[] = "ClientStubFile"; |
| 49 |
const char _CLRImageType[] = "CLRImageType"; |
| 50 |
const char _CLRSupportLastError[] = "CLRSupportLastError"; |
| 51 |
const char _CLRThreadAttribute[] = "CLRThreadAttribute"; |
| 52 |
const char _CLRUnmanagedCodeCheck[] = "CLRUnmanagedCodeCheck"; |
| 53 |
const char _Command[] = "Command"; |
| 54 |
const char _CompileAs[] = "CompileAs"; |
| 55 |
const char _CompileAsManaged[] = "CompileAsManaged"; |
| 56 |
const char _CompileAsWinRT[] = "CompileAsWinRT"; |
| 57 |
const char _ConfigurationType[] = "ConfigurationType"; |
| 58 |
const char _CPreprocessOptions[] = "CPreprocessOptions"; |
| 59 |
const char _CreateHotpatchableImage[] = "CreateHotpatchableImage"; |
| 60 |
const char _Culture[] = "Culture"; |
| 61 |
const char _DataExecutionPrevention[] = "DataExecutionPrevention"; |
| 62 |
const char _DebugInformationFormat[] = "DebugInformationFormat"; |
| 63 |
const char _DefaultCharType[] = "DefaultCharType"; |
| 64 |
const char _DelayLoadDLLs[] = "DelayLoadDLLs"; |
| 65 |
const char _DelaySign[] = "DelaySign"; |
| 66 |
const char _DeleteExtensionsOnClean[] = "DeleteExtensionsOnClean"; |
| 67 |
const char _DisableLanguageExtensions[] = "DisableLanguageExtensions"; |
| 68 |
const char _DisableSpecificWarnings[] = "DisableSpecificWarnings"; |
| 69 |
const char _DLLDataFileName[] = "DLLDataFileName"; |
| 70 |
const char _EmbedManagedResourceFile[] = "EmbedManagedResourceFile"; |
| 71 |
const char _EmbedManifest[] = "EmbedManifest"; |
| 72 |
const char _EnableCOMDATFolding[] = "EnableCOMDATFolding"; |
| 73 |
const char _EnableUAC[] = "EnableUAC"; |
| 74 |
const char _EnableErrorChecks[] = "EnableErrorChecks"; |
| 75 |
const char _EnableEnhancedInstructionSet[] = "EnableEnhancedInstructionSet"; |
| 76 |
const char _EnableFiberSafeOptimizations[] = "EnableFiberSafeOptimizations"; |
| 77 |
const char _EnablePREfast[] = "EnablePREfast"; |
| 78 |
const char _EntryPointSymbol[] = "EntryPointSymbol"; |
| 79 |
const char _ErrorCheckAllocations[] = "ErrorCheckAllocations"; |
| 80 |
const char _ErrorCheckBounds[] = "ErrorCheckBounds"; |
| 81 |
const char _ErrorCheckEnumRange[] = "ErrorCheckEnumRange"; |
| 82 |
const char _ErrorCheckRefPointers[] = "ErrorCheckRefPointers"; |
| 83 |
const char _ErrorCheckStubData[] = "ErrorCheckStubData"; |
| 84 |
const char _ErrorReporting[] = "ErrorReporting"; |
| 85 |
const char _ExceptionHandling[] = "ExceptionHandling"; |
| 86 |
const char _ExpandAttributedSource[] = "ExpandAttributedSource"; |
| 87 |
const char _ExportNamedFunctions[] = "ExportNamedFunctions"; |
| 88 |
const char _FavorSizeOrSpeed[] = "FavorSizeOrSpeed"; |
| 89 |
const char _FloatingPointModel[] = "FloatingPointModel"; |
| 90 |
const char _FloatingPointExceptions[] = "FloatingPointExceptions"; |
| 91 |
const char _ForceConformanceInForLoopScope[] = "ForceConformanceInForLoopScope"; |
| 92 |
const char _ForceSymbolReferences[] = "ForceSymbolReferences"; |
| 93 |
const char _ForcedIncludeFiles[] = "ForcedIncludeFiles"; |
| 94 |
const char _ForcedUsingFiles[] = "ForcedUsingFiles"; |
| 95 |
const char _FunctionLevelLinking[] = "FunctionLevelLinking"; |
| 96 |
const char _FunctionOrder[] = "FunctionOrder"; |
| 97 |
const char _GenerateClientFiles[] = "GenerateClientFiles"; |
| 98 |
const char _GenerateDebugInformation[] = "GenerateDebugInformation"; |
| 99 |
const char _GenerateManifest[] = "GenerateManifest"; |
| 100 |
const char _GenerateMapFile[] = "GenerateMapFile"; |
| 101 |
const char _GenerateServerFiles[] = "GenerateServerFiles"; |
| 102 |
const char _GenerateStublessProxies[] = "GenerateStublessProxies"; |
| 103 |
const char _GenerateTypeLibrary[] = "GenerateTypeLibrary"; |
| 104 |
const char _GenerateWindowsMetadata[] = "GenerateWindowsMetadata"; |
| 105 |
const char _GenerateXMLDocumentationFiles[] = "GenerateXMLDocumentationFiles"; |
| 106 |
const char _HeaderFileName[] = "HeaderFileName"; |
| 107 |
const char _HeapCommitSize[] = "HeapCommitSize"; |
| 108 |
const char _HeapReserveSize[] = "HeapReserveSize"; |
| 109 |
const char _IgnoreAllDefaultLibraries[] = "IgnoreAllDefaultLibraries"; |
| 110 |
const char _IgnoreEmbeddedIDL[] = "IgnoreEmbeddedIDL"; |
| 111 |
const char _IgnoreImportLibrary[] = "IgnoreImportLibrary"; |
| 112 |
const char _ImageHasSafeExceptionHandlers[] = "ImageHasSafeExceptionHandlers"; |
| 113 |
const char _IgnoreSpecificDefaultLibraries[] = "IgnoreSpecificDefaultLibraries"; |
| 114 |
const char _IgnoreStandardIncludePath[] = "IgnoreStandardIncludePath"; |
| 115 |
const char _ImportLibrary[] = "ImportLibrary"; |
| 116 |
const char _InlineFunctionExpansion[] = "InlineFunctionExpansion"; |
| 117 |
const char _IntrinsicFunctions[] = "IntrinsicFunctions"; |
| 118 |
const char _InterfaceIdentifierFileName[] = "InterfaceIdentifierFileName"; |
| 119 |
const char _IntermediateDirectory[] = "IntermediateDirectory"; |
| 120 |
const char _KeyContainer[] = "KeyContainer"; |
| 121 |
const char _KeyFile[] = "KeyFile"; |
| 122 |
const char _LanguageStandard[] = "LanguageStandard"; |
| 123 |
const char _LanguageStandard_C[] = "LanguageStandard_C"; |
| 124 |
const char _LargeAddressAware[] = "LargeAddressAware"; |
| 125 |
const char _LinkDLL[] = "LinkDLL"; |
| 126 |
const char _LinkErrorReporting[] = "LinkErrorReporting"; |
| 127 |
const char _LinkIncremental[] = "LinkIncremental"; |
| 128 |
const char _LinkStatus[] = "LinkStatus"; |
| 129 |
const char _LinkTimeCodeGeneration[] = "LinkTimeCodeGeneration"; |
| 130 |
const char _LocaleID[] = "LocaleID"; |
| 131 |
const char _ManifestFile[] = "ManifestFile"; |
| 132 |
const char _MapExports[] = "MapExports"; |
| 133 |
const char _MapFileName[] = "MapFileName"; |
| 134 |
const char _MergedIDLBaseFileName[] = "MergedIDLBaseFileName"; |
| 135 |
const char _MergeSections[] = "MergeSections"; |
| 136 |
const char _Message[] = "Message"; |
| 137 |
const char _MidlCommandFile[] = "MidlCommandFile"; |
| 138 |
const char _MinimalRebuild[] = "MinimalRebuild"; |
| 139 |
const char _MkTypLibCompatible[] = "MkTypLibCompatible"; |
| 140 |
const char _ModuleDefinitionFile[] = "ModuleDefinitionFile"; |
| 141 |
const char _MultiProcessorCompilation[] = "MultiProcessorCompilation"; |
| 142 |
const char _Name[] = "Name"; |
| 143 |
const char _NoEntryPoint[] = "NoEntryPoint"; |
| 144 |
const char _ObjectFileName[] = "ObjectFileName"; |
| 145 |
const char _OmitDefaultLibName[] = "OmitDefaultLibName"; |
| 146 |
const char _OmitFramePointers[] = "OmitFramePointers"; |
| 147 |
const char _OpenMPSupport[] = "OpenMPSupport"; |
| 148 |
const char _Optimization[] = "Optimization"; |
| 149 |
const char _OptimizeReferences[] = "OptimizeReferences"; |
| 150 |
const char _OutputDirectory[] = "OutputDirectory"; |
| 151 |
const char _OutputFile[] = "OutputFile"; |
| 152 |
const char _PlatformToolSet[] = "PlatformToolset"; |
| 153 |
const char _PrecompiledHeader[] = "PrecompiledHeader"; |
| 154 |
const char _PrecompiledHeaderFile[] = "PrecompiledHeaderFile"; |
| 155 |
const char _PrecompiledHeaderOutputFile[] = "PrecompiledHeaderOutputFile"; |
| 156 |
const char _PreprocessorDefinitions[] = "PreprocessorDefinitions"; |
| 157 |
const char _PreprocessKeepComments[] = "PreprocessKeepComments"; |
| 158 |
const char _PreprocessOutputPath[] = "PreprocessOutputPath"; |
| 159 |
const char _PreprocessSuppressLineNumbers[] = "PreprocessSuppressLineNumbers"; |
| 160 |
const char _PreprocessToFile[] = "PreprocessToFile"; |
| 161 |
const char _PreventDllBinding[] = "PreventDllBinding"; |
| 162 |
const char _PrimaryOutput[] = "PrimaryOutput"; |
| 163 |
const char _ProcessorNumber[] = "ProcessorNumber"; |
| 164 |
const char _ProgramDatabase[] = "ProgramDatabase"; |
| 165 |
const char _ProgramDataBaseFileName[] = "ProgramDataBaseFileName"; |
| 166 |
const char _ProgramDatabaseFile[] = "ProgramDatabaseFile"; |
| 167 |
const char _ProxyFileName[] = "ProxyFileName"; |
| 168 |
const char _RandomizedBaseAddress[] = "RandomizedBaseAddress"; |
| 169 |
const char _RedirectOutputAndErrors[] = "RedirectOutputAndErrors"; |
| 170 |
const char _RegisterOutput[] = "RegisterOutput"; |
| 171 |
const char _ResourceOutputFileName[] = "ResourceOutputFileName"; |
| 172 |
const char _RuntimeLibrary[] = "RuntimeLibrary"; |
| 173 |
const char _RuntimeTypeInfo[] = "RuntimeTypeInfo"; |
| 174 |
const char _SectionAlignment[] = "SectionAlignment"; |
| 175 |
const char _ServerStubFile[] = "ServerStubFile"; |
| 176 |
const char _SetChecksum[] = "SetChecksum"; |
| 177 |
const char _ShowIncludes[] = "ShowIncludes"; |
| 178 |
const char _ShowProgress[] = "ShowProgress"; |
| 179 |
const char _SmallerTypeCheck[] = "SmallerTypeCheck"; |
| 180 |
const char _StackCommitSize[] = "StackCommitSize"; |
| 181 |
const char _StackReserveSize[] = "StackReserveSize"; |
| 182 |
const char _StringPooling[] = "StringPooling"; |
| 183 |
const char _StripPrivateSymbols[] = "StripPrivateSymbols"; |
| 184 |
const char _StructMemberAlignment[] = "StructMemberAlignment"; |
| 185 |
const char _SubSystem[] = "SubSystem"; |
| 186 |
const char _SupportUnloadOfDelayLoadedDLL[] = "SupportUnloadOfDelayLoadedDLL"; |
| 187 |
const char _SuppressCompilerWarnings[] = "SuppressCompilerWarnings"; |
| 188 |
const char _SuppressStartupBanner[] = "SuppressStartupBanner"; |
| 189 |
const char _SwapRunFromCD[] = "SwapRunFromCD"; |
| 190 |
const char _SwapRunFromNet[] = "SwapRunFromNet"; |
| 191 |
const char _TargetEnvironment[] = "TargetEnvironment"; |
| 192 |
const char _TargetMachine[] = "TargetMachine"; |
| 193 |
const char _TerminalServerAware[] = "TerminalServerAware"; |
| 194 |
const char _TreatLinkerWarningAsErrors[] = "TreatLinkerWarningAsErrors"; |
| 195 |
const char _TreatSpecificWarningsAsErrors[] = "TreatSpecificWarningsAsErrors"; |
| 196 |
const char _TreatWarningAsError[] = "TreatWarningAsError"; |
| 197 |
const char _TreatWChar_tAsBuiltInType[] = "TreatWChar_tAsBuiltInType"; |
| 198 |
const char _TurnOffAssemblyGeneration[] = "TurnOffAssemblyGeneration"; |
| 199 |
const char _TypeLibFormat[] = "TypeLibFormat"; |
| 200 |
const char _TypeLibraryFile[] = "TypeLibraryFile"; |
| 201 |
const char _TypeLibraryName[] = "TypeLibraryName"; |
| 202 |
const char _TypeLibraryResourceID[] = "TypeLibraryResourceID"; |
| 203 |
const char _UACExecutionLevel[] = "UACExecutionLevel"; |
| 204 |
const char _UACUIAccess[] = "UACUIAccess"; |
| 205 |
const char _UndefineAllPreprocessorDefinitions[]= "UndefineAllPreprocessorDefinitions"; |
| 206 |
const char _UndefinePreprocessorDefinitions[] = "UndefinePreprocessorDefinitions"; |
| 207 |
const char _UseFullPaths[] = "UseFullPaths"; |
| 208 |
const char _UseOfATL[] = "UseOfATL"; |
| 209 |
const char _UseOfMfc[] = "UseOfMfc"; |
| 210 |
const char _UseUnicodeForAssemblerListing[] = "UseUnicodeForAssemblerListing"; |
| 211 |
const char _ValidateAllParameters[] = "ValidateAllParameters"; |
| 212 |
const char _Version[] = "Version"; |
| 213 |
const char _WarnAsError[] = "WarnAsError"; |
| 214 |
const char _WarningLevel[] = "WarningLevel"; |
| 215 |
const char _WholeProgramOptimization[] = "WholeProgramOptimization"; |
| 216 |
const char _WindowsMetadataFile[] = "WindowsMetadataFile"; |
| 217 |
const char _XMLDocumentationFileName[] = "XMLDocumentationFileName"; |
| 218 |
|
| 219 |
|
| 220 |
// XmlOutput stream functions ------------------------------ |
| 221 |
inline XmlOutput::xml_output attrTagT(const char *name, const triState v) |
| 222 |
{ |
| 223 |
if(v == unset) |
| 224 |
return noxml(); |
| 225 |
return tagValue(name, (v == _True ? "true" : "false")); |
| 226 |
} |
| 227 |
|
| 228 |
inline XmlOutput::xml_output attrTagL(const char *name, qint64 v) |
| 229 |
{ |
| 230 |
return tagValue(name, QString::number(v)); |
| 231 |
} |
| 232 |
|
| 233 |
/*ifNot version*/ |
| 234 |
inline XmlOutput::xml_output attrTagL(const char *name, qint64 v, qint64 ifn) |
| 235 |
{ |
| 236 |
if (v == ifn) |
| 237 |
return noxml(); |
| 238 |
return tagValue(name, QString::number(v)); |
| 239 |
} |
| 240 |
|
| 241 |
inline XmlOutput::xml_output attrTagS(const char *name, const QString &v) |
| 242 |
{ |
| 243 |
if(v.isEmpty()) |
| 244 |
return noxml(); |
| 245 |
return tagValue(name, v); |
| 246 |
} |
| 247 |
|
| 248 |
inline XmlOutput::xml_output attrTagX(const char *name, const QStringList &v, const char *s = ",") |
| 249 |
{ |
| 250 |
if(v.isEmpty()) |
| 251 |
return noxml(); |
| 252 |
QStringList temp = v; |
| 253 |
temp.append(QString("%(%1)").arg(name)); |
| 254 |
return tagValue(name, temp.join(s)); |
| 255 |
} |
| 256 |
|
| 257 |
inline XmlOutput::xml_output valueTagX(const QStringList &v, const char *s = " ") |
| 258 |
{ |
| 259 |
if(v.isEmpty()) |
| 260 |
return noxml(); |
| 261 |
return valueTag(v.join(s)); |
| 262 |
} |
| 263 |
|
| 264 |
inline XmlOutput::xml_output valueTagDefX(const QStringList &v, const QString &tagName, const char *s = " ") |
| 265 |
{ |
| 266 |
if(v.isEmpty()) |
| 267 |
return noxml(); |
| 268 |
QStringList temp = v; |
| 269 |
temp.append(QString("%(%1)").arg(tagName)); |
| 270 |
return valueTag(temp.join(s)); |
| 271 |
} |
| 272 |
|
| 273 |
inline XmlOutput::xml_output valueTagT( const triState v) |
| 274 |
{ |
| 275 |
if(v == unset) |
| 276 |
return noxml(); |
| 277 |
return valueTag(v == _True ? "true" : "false"); |
| 278 |
} |
| 279 |
|
| 280 |
static QString commandLinesForOutput(QStringList commands) |
| 281 |
{ |
| 282 |
// MSBuild puts the contents of the custom commands into a batch file and calls it. |
| 283 |
// As we want every sub-command to be error-checked (as is done by makefile-based |
| 284 |
// backends), we insert the checks ourselves, using the undocumented jump target. |
| 285 |
static QString errchk = QStringLiteral("if errorlevel 1 goto VCEnd"); |
| 286 |
for (int i = commands.size() - 2; i >= 0; --i) { |
| 287 |
if (!commands.at(i).startsWith("rem", Qt::CaseInsensitive)) |
| 288 |
commands.insert(i + 1, errchk); |
| 289 |
} |
| 290 |
return commands.join("\r\n"); |
| 291 |
} |
| 292 |
|
| 293 |
static QString unquote(const QString &value) |
| 294 |
{ |
| 295 |
QString result = value; |
| 296 |
result.replace(QLatin1String("\\\""), QLatin1String("\"")); |
| 297 |
return result; |
| 298 |
} |
| 299 |
|
| 300 |
static QStringList unquote(const QStringList &values) |
| 301 |
{ |
| 302 |
QStringList result; |
| 303 |
result.reserve(values.size()); |
| 304 |
for (int i = 0; i < values.size(); ++i) |
| 305 |
result << unquote(values.at(i)); |
| 306 |
return result; |
| 307 |
} |
| 308 |
|
| 309 |
// Tree file generation --------------------------------------------- |
| 310 |
void XTreeNode::generateXML(XmlOutput &xml, XmlOutput &xmlFilter, const QString &tagName, |
| 311 |
VCProject &tool, const QString &filter) |
| 312 |
{ |
| 313 |
if (children.size()) { |
| 314 |
// Filter |
| 315 |
QString tempFilterName; |
| 316 |
ChildrenMap::ConstIterator it, end = children.constEnd(); |
| 317 |
if (!tagName.isEmpty()) { |
| 318 |
tempFilterName.append(filter); |
| 319 |
tempFilterName.append("\\"); |
| 320 |
tempFilterName.append(tagName); |
| 321 |
xmlFilter << tag(_ItemGroup); |
| 322 |
xmlFilter << tag("Filter") |
| 323 |
<< attrTag("Include", tempFilterName) |
| 324 |
<< closetag(); |
| 325 |
xmlFilter << closetag(); |
| 326 |
} |
| 327 |
// First round, do nested filters |
| 328 |
for (it = children.constBegin(); it != end; ++it) |
| 329 |
if ((*it)->children.size()) |
| 330 |
{ |
| 331 |
if ( !tempFilterName.isEmpty() ) |
| 332 |
(*it)->generateXML(xml, xmlFilter, it.key(), tool, tempFilterName); |
| 333 |
else |
| 334 |
(*it)->generateXML(xml, xmlFilter, it.key(), tool, filter); |
| 335 |
} |
| 336 |
// Second round, do leafs |
| 337 |
for (it = children.constBegin(); it != end; ++it) |
| 338 |
if (!(*it)->children.size()) |
| 339 |
{ |
| 340 |
if ( !tempFilterName.isEmpty() ) |
| 341 |
(*it)->generateXML(xml, xmlFilter, it.key(), tool, tempFilterName); |
| 342 |
else |
| 343 |
(*it)->generateXML(xml, xmlFilter, it.key(), tool, filter); |
| 344 |
} |
| 345 |
} else { |
| 346 |
// Leaf |
| 347 |
xml << tag(_ItemGroup); |
| 348 |
xmlFilter << tag(_ItemGroup); |
| 349 |
VCXProjectWriter::outputFileConfigs(tool, xml, xmlFilter, info, filter); |
| 350 |
xmlFilter << closetag(); |
| 351 |
xml << closetag(); |
| 352 |
} |
| 353 |
} |
| 354 |
|
| 355 |
// Flat file generation --------------------------------------------- |
| 356 |
void XFlatNode::generateXML(XmlOutput &xml, XmlOutput &xmlFilter, const QString &/*tagName*/, |
| 357 |
VCProject &tool, const QString &filter) |
| 358 |
{ |
| 359 |
if (children.size()) { |
| 360 |
ChildrenMapFlat::ConstIterator it = children.constBegin(); |
| 361 |
ChildrenMapFlat::ConstIterator end = children.constEnd(); |
| 362 |
xml << tag(_ItemGroup); |
| 363 |
xmlFilter << tag(_ItemGroup); |
| 364 |
for (; it != end; ++it) { |
| 365 |
VCXProjectWriter::outputFileConfigs(tool, xml, xmlFilter, (*it), filter); |
| 366 |
} |
| 367 |
xml << closetag(); |
| 368 |
xmlFilter << closetag(); |
| 369 |
} |
| 370 |
} |
| 371 |
|
| 372 |
void VCXProjectWriter::write(XmlOutput &xml, VCProjectSingleConfig &tool) |
| 373 |
{ |
| 374 |
xml.setIndentString(" "); |
| 375 |
|
| 376 |
xml << decl("1.0", "utf-8") |
| 377 |
<< tag("Project") |
| 378 |
<< attrTag("DefaultTargets","Build") |
| 379 |
<< attrTagToolsVersion(tool.Configuration) |
| 380 |
<< attrTag("xmlns", "http://schemas.microsoft.com/developer/msbuild/2003") |
| 381 |
<< tag("ItemGroup") |
| 382 |
<< attrTag("Label", "ProjectConfigurations"); |
| 383 |
|
| 384 |
xml << tag("ProjectConfiguration") |
| 385 |
<< attrTag("Include" , tool.Configuration.Name) |
| 386 |
<< tagValue("Configuration", tool.Configuration.ConfigurationName) |
| 387 |
<< tagValue("Platform", tool.PlatformName) |
| 388 |
<< closetag(); |
| 389 |
|
| 390 |
xml << closetag() |
| 391 |
<< tag("PropertyGroup") |
| 392 |
<< attrTag("Label", "Globals") |
| 393 |
<< tagValue("ProjectGuid", tool.ProjectGUID) |
| 394 |
<< tagValue("RootNamespace", tool.Name) |
| 395 |
<< tagValue("Keyword", tool.Keyword) |
| 396 |
<< closetag(); |
| 397 |
|
| 398 |
// config part. |
| 399 |
xml << import("Project", "$(VCTargetsPath)\\Microsoft.Cpp.Default.props"); |
| 400 |
|
| 401 |
write(xml, tool.Configuration); |
| 402 |
const QString condition = generateCondition(tool.Configuration); |
| 403 |
|
| 404 |
xml << import("Project", "$(VCTargetsPath)\\Microsoft.Cpp.props"); |
| 405 |
|
| 406 |
// Extension settings |
| 407 |
xml << tag("ImportGroup") |
| 408 |
<< attrTag("Label", "ExtensionSettings") |
| 409 |
<< closetag(); |
| 410 |
|
| 411 |
// PropertySheets |
| 412 |
xml << tag("ImportGroup") |
| 413 |
<< attrTag("Condition", condition) |
| 414 |
<< attrTag("Label", "PropertySheets"); |
| 415 |
|
| 416 |
xml << tag("Import") |
| 417 |
<< attrTag("Project", "$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props") |
| 418 |
<< attrTag("Condition", "exists('$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props')") |
| 419 |
<< closetag() |
| 420 |
<< closetag(); |
| 421 |
|
| 422 |
// UserMacros |
| 423 |
xml << tag("PropertyGroup") |
| 424 |
<< attrTag("Label", "UserMacros") |
| 425 |
<< closetag(); |
| 426 |
|
| 427 |
xml << tag("PropertyGroup"); |
| 428 |
|
| 429 |
if ( !tool.Configuration.OutputDirectory.isEmpty() ) { |
| 430 |
xml<< tag("OutDir") |
| 431 |
<< attrTag("Condition", condition) |
| 432 |
<< valueTag(tool.Configuration.OutputDirectory); |
| 433 |
} |
| 434 |
if ( !tool.Configuration.IntermediateDirectory.isEmpty() ) { |
| 435 |
xml<< tag("IntDir") |
| 436 |
<< attrTag("Condition", condition) |
| 437 |
<< valueTag(tool.Configuration.IntermediateDirectory); |
| 438 |
} |
| 439 |
if ( !tool.Configuration.PrimaryOutput.isEmpty() ) { |
| 440 |
xml<< tag("TargetName") |
| 441 |
<< attrTag("Condition", condition) |
| 442 |
<< valueTag(tool.Configuration.PrimaryOutput); |
| 443 |
} |
| 444 |
if (!tool.Configuration.PrimaryOutputExtension.isEmpty()) { |
| 445 |
xml<< tag("TargetExt") |
| 446 |
<< attrTag("Condition", condition) |
| 447 |
<< valueTag(tool.Configuration.PrimaryOutputExtension); |
| 448 |
} |
| 449 |
if ( tool.Configuration.linker.IgnoreImportLibrary != unset) { |
| 450 |
xml<< tag("IgnoreImportLibrary") |
| 451 |
<< attrTag("Condition", condition) |
| 452 |
<< valueTagT(tool.Configuration.linker.IgnoreImportLibrary); |
| 453 |
} |
| 454 |
|
| 455 |
if ( tool.Configuration.linker.LinkIncremental != linkIncrementalDefault) { |
| 456 |
const triState ts = (tool.Configuration.linker.LinkIncremental == linkIncrementalYes ? _True : _False); |
| 457 |
xml<< tag("LinkIncremental") |
| 458 |
<< attrTag("Condition", condition) |
| 459 |
<< valueTagT(ts); |
| 460 |
} |
| 461 |
|
| 462 |
if ( tool.Configuration.preBuild.ExcludedFromBuild != unset ) |
| 463 |
{ |
| 464 |
xml<< tag("PreBuildEventUseInBuild") |
| 465 |
<< attrTag("Condition", condition) |
| 466 |
<< valueTagT(!tool.Configuration.preBuild.ExcludedFromBuild); |
| 467 |
} |
| 468 |
|
| 469 |
if ( tool.Configuration.preLink.ExcludedFromBuild != unset ) |
| 470 |
{ |
| 471 |
xml<< tag("PreLinkEventUseInBuild") |
| 472 |
<< attrTag("Condition", condition) |
| 473 |
<< valueTagT(!tool.Configuration.preLink.ExcludedFromBuild); |
| 474 |
} |
| 475 |
|
| 476 |
if ( tool.Configuration.postBuild.ExcludedFromBuild != unset ) |
| 477 |
{ |
| 478 |
xml<< tag("PostBuildEventUseInBuild") |
| 479 |
<< attrTag("Condition", condition) |
| 480 |
<< valueTagT(!tool.Configuration.postBuild.ExcludedFromBuild); |
| 481 |
} |
| 482 |
xml << closetag(); |
| 483 |
|
| 484 |
xml << tag("ItemDefinitionGroup") |
| 485 |
<< attrTag("Condition", condition); |
| 486 |
|
| 487 |
// ClCompile |
| 488 |
write(xml, tool.Configuration.compiler); |
| 489 |
|
| 490 |
// Link |
| 491 |
write(xml, tool.Configuration.linker); |
| 492 |
|
| 493 |
// Midl |
| 494 |
write(xml, tool.Configuration.idl); |
| 495 |
|
| 496 |
// ResourceCompiler |
| 497 |
write(xml, tool.Configuration.resource); |
| 498 |
|
| 499 |
// Post build event |
| 500 |
if ( tool.Configuration.postBuild.ExcludedFromBuild != unset ) |
| 501 |
write(xml, tool.Configuration.postBuild); |
| 502 |
|
| 503 |
// Pre build event |
| 504 |
if ( tool.Configuration.preBuild.ExcludedFromBuild != unset ) |
| 505 |
write(xml, tool.Configuration.preBuild); |
| 506 |
|
| 507 |
// Pre link event |
| 508 |
if ( tool.Configuration.preLink.ExcludedFromBuild != unset ) |
| 509 |
write(xml, tool.Configuration.preLink); |
| 510 |
|
| 511 |
xml << closetag(); |
| 512 |
|
| 513 |
QFile filterFile; |
| 514 |
filterFile.setFileName(Option::output.fileName().append(".filters")); |
| 515 |
if (!filterFile.open(QIODevice::WriteOnly | QIODevice::Text | QIODevice::Truncate)) { |
| 516 |
warn_msg(WarnLogic, "Generator: cannot open output filter file"); |
| 517 |
return; |
| 518 |
} |
| 519 |
QTextStream ts(&filterFile); |
| 520 |
XmlOutput xmlFilter(ts, XmlOutput::NoConversion); |
| 521 |
|
| 522 |
xmlFilter.setIndentString(" "); |
| 523 |
|
| 524 |
xmlFilter << decl("1.0", "utf-8") |
| 525 |
<< tag("Project") |
| 526 |
<< attrTagToolsVersion(tool.Configuration) |
| 527 |
<< attrTag("xmlns", "http://schemas.microsoft.com/developer/msbuild/2003"); |
| 528 |
|
| 529 |
xmlFilter << tag("ItemGroup"); |
| 530 |
|
| 531 |
VCProject tempProj; |
| 532 |
tempProj.SingleProjects += tool; |
| 533 |
|
| 534 |
addFilters(tempProj, xmlFilter, "Form Files"); |
| 535 |
addFilters(tempProj, xmlFilter, "Generated Files"); |
| 536 |
addFilters(tempProj, xmlFilter, "Header Files"); |
| 537 |
addFilters(tempProj, xmlFilter, "LexYacc Files"); |
| 538 |
addFilters(tempProj, xmlFilter, "Resource Files"); |
| 539 |
addFilters(tempProj, xmlFilter, "Source Files"); |
| 540 |
addFilters(tempProj, xmlFilter, "Translation Files"); |
| 541 |
addFilters(tempProj, xmlFilter, "Deployment Files"); |
| 542 |
addFilters(tempProj, xmlFilter, "Distribution Files"); |
| 543 |
|
| 544 |
tempProj.ExtraCompilers.reserve(tool.ExtraCompilersFiles.size()); |
| 545 |
std::transform(tool.ExtraCompilersFiles.cbegin(), tool.ExtraCompilersFiles.cend(), |
| 546 |
std::back_inserter(tempProj.ExtraCompilers), |
| 547 |
[] (const VCFilter &filter) { return filter.Name; }); |
| 548 |
tempProj.ExtraCompilers.removeDuplicates(); |
| 549 |
|
| 550 |
for (int x = 0; x < tempProj.ExtraCompilers.size(); ++x) |
| 551 |
addFilters(tempProj, xmlFilter, tempProj.ExtraCompilers.at(x)); |
| 552 |
|
| 553 |
xmlFilter << closetag(); |
| 554 |
|
| 555 |
outputFilter(tempProj, xml, xmlFilter, "Source Files"); |
| 556 |
outputFilter(tempProj, xml, xmlFilter, "Header Files"); |
| 557 |
outputFilter(tempProj, xml, xmlFilter, "Generated Files"); |
| 558 |
outputFilter(tempProj, xml, xmlFilter, "LexYacc Files"); |
| 559 |
outputFilter(tempProj, xml, xmlFilter, "Translation Files"); |
| 560 |
outputFilter(tempProj, xml, xmlFilter, "Form Files"); |
| 561 |
outputFilter(tempProj, xml, xmlFilter, "Resource Files"); |
| 562 |
outputFilter(tempProj, xml, xmlFilter, "Deployment Files"); |
| 563 |
outputFilter(tempProj, xml, xmlFilter, "Distribution Files"); |
| 564 |
|
| 565 |
for (int x = 0; x < tempProj.ExtraCompilers.size(); ++x) { |
| 566 |
outputFilter(tempProj, xml, xmlFilter, tempProj.ExtraCompilers.at(x)); |
| 567 |
} |
| 568 |
|
| 569 |
outputFilter(tempProj, xml, xmlFilter, "Root Files"); |
| 570 |
|
| 571 |
xml << import("Project", "$(VCTargetsPath)\\Microsoft.Cpp.targets"); |
| 572 |
|
| 573 |
xml << tag("ImportGroup") |
| 574 |
<< attrTag("Label", "ExtensionTargets") |
| 575 |
<< closetag(); |
| 576 |
} |
| 577 |
|
| 578 |
void VCXProjectWriter::write(XmlOutput &xml, VCProject &tool) |
| 579 |
{ |
| 580 |
if (tool.SingleProjects.size() == 0) { |
| 581 |
warn_msg(WarnLogic, "Generator: .NET: no single project in merge project, no output"); |
| 582 |
return; |
| 583 |
} |
| 584 |
|
| 585 |
xml.setIndentString(" "); |
| 586 |
|
| 587 |
xml << decl("1.0", "utf-8") |
| 588 |
<< tag("Project") |
| 589 |
<< attrTag("DefaultTargets","Build") |
| 590 |
<< attrTagToolsVersion(tool.SingleProjects.first().Configuration) |
| 591 |
<< attrTag("xmlns", "http://schemas.microsoft.com/developer/msbuild/2003") |
| 592 |
<< tag("ItemGroup") |
| 593 |
<< attrTag("Label", "ProjectConfigurations"); |
| 594 |
|
| 595 |
for (int i = 0; i < tool.SingleProjects.size(); ++i) { |
| 596 |
xml << tag("ProjectConfiguration") |
| 597 |
<< attrTag("Include" , tool.SingleProjects.at(i).Configuration.Name) |
| 598 |
<< tagValue("Configuration", tool.SingleProjects.at(i).Configuration.ConfigurationName) |
| 599 |
<< tagValue("Platform", tool.SingleProjects.at(i).PlatformName) |
| 600 |
<< closetag(); |
| 601 |
} |
| 602 |
|
| 603 |
xml << closetag() |
| 604 |
<< tag("PropertyGroup") |
| 605 |
<< attrTag("Label", "Globals") |
| 606 |
<< tagValue("ProjectGuid", tool.ProjectGUID) |
| 607 |
<< tagValue("RootNamespace", tool.Name) |
| 608 |
<< tagValue("Keyword", tool.Keyword); |
| 609 |
|
| 610 |
if (!tool.WindowsTargetPlatformVersion.isEmpty()) |
| 611 |
xml << tagValue("WindowsTargetPlatformVersion", tool.WindowsTargetPlatformVersion); |
| 612 |
if (!tool.WindowsTargetPlatformMinVersion.isEmpty()) |
| 613 |
xml << tagValue("WindowsTargetPlatformMinVersion", tool.WindowsTargetPlatformMinVersion); |
| 614 |
|
| 615 |
xml << closetag(); |
| 616 |
|
| 617 |
// config part. |
| 618 |
xml << import("Project", "$(VCTargetsPath)\\Microsoft.Cpp.Default.props"); |
| 619 |
for (int i = 0; i < tool.SingleProjects.size(); ++i) |
| 620 |
write(xml, tool.SingleProjects.at(i).Configuration); |
| 621 |
xml << import("Project", "$(VCTargetsPath)\\Microsoft.Cpp.props"); |
| 622 |
|
| 623 |
// Extension settings |
| 624 |
xml << tag("ImportGroup") |
| 625 |
<< attrTag("Label", "ExtensionSettings") |
| 626 |
<< closetag(); |
| 627 |
|
| 628 |
// PropertySheets |
| 629 |
for (int i = 0; i < tool.SingleProjects.size(); ++i) { |
| 630 |
xml << tag("ImportGroup") |
| 631 |
<< attrTag("Condition", generateCondition(tool.SingleProjects.at(i).Configuration)) |
| 632 |
<< attrTag("Label", "PropertySheets"); |
| 633 |
|
| 634 |
xml << tag("Import") |
| 635 |
<< attrTag("Project", "$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props") |
| 636 |
<< attrTag("Condition", "exists('$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props')") |
| 637 |
<< closetag() |
| 638 |
<< closetag(); |
| 639 |
} |
| 640 |
|
| 641 |
// UserMacros |
| 642 |
xml << tag("PropertyGroup") |
| 643 |
<< attrTag("Label", "UserMacros") |
| 644 |
<< closetag(); |
| 645 |
|
| 646 |
xml << tag("PropertyGroup"); |
| 647 |
for (int i = 0; i < tool.SingleProjects.size(); ++i) { |
| 648 |
const VCConfiguration &config = tool.SingleProjects.at(i).Configuration; |
| 649 |
const QString condition = generateCondition(config); |
| 650 |
|
| 651 |
if (!config.OutputDirectory.isEmpty()) { |
| 652 |
xml << tag("OutDir") |
| 653 |
<< attrTag("Condition", condition) |
| 654 |
<< valueTag(config.OutputDirectory); |
| 655 |
} |
| 656 |
if (!config.IntermediateDirectory.isEmpty()) { |
| 657 |
xml << tag("IntDir") |
| 658 |
<< attrTag("Condition", condition) |
| 659 |
<< valueTag(config.IntermediateDirectory); |
| 660 |
} |
| 661 |
if (!config.PrimaryOutput.isEmpty()) { |
| 662 |
xml << tag("TargetName") |
| 663 |
<< attrTag("Condition", condition) |
| 664 |
<< valueTag(config.PrimaryOutput); |
| 665 |
} |
| 666 |
if (!config.PrimaryOutputExtension.isEmpty()) { |
| 667 |
xml << tag("TargetExt") |
| 668 |
<< attrTag("Condition", condition) |
| 669 |
<< valueTag(config.PrimaryOutputExtension); |
| 670 |
} |
| 671 |
if (config.linker.IgnoreImportLibrary != unset) { |
| 672 |
xml << tag("IgnoreImportLibrary") |
| 673 |
<< attrTag("Condition", condition) |
| 674 |
<< valueTagT(config.linker.IgnoreImportLibrary); |
| 675 |
} |
| 676 |
|
| 677 |
if (config.linker.LinkIncremental != linkIncrementalDefault) { |
| 678 |
const triState ts = (config.linker.LinkIncremental == linkIncrementalYes ? _True : _False); |
| 679 |
xml << tag("LinkIncremental") |
| 680 |
<< attrTag("Condition", condition) |
| 681 |
<< valueTagT(ts); |
| 682 |
} |
| 683 |
|
| 684 |
const triState generateManifest = config.linker.GenerateManifest; |
| 685 |
if (generateManifest != unset) { |
| 686 |
xml << tag("GenerateManifest") |
| 687 |
<< attrTag("Condition", condition) |
| 688 |
<< valueTagT(generateManifest); |
| 689 |
} |
| 690 |
|
| 691 |
if (config.preBuild.ExcludedFromBuild != unset) |
| 692 |
{ |
| 693 |
xml << tag("PreBuildEventUseInBuild") |
| 694 |
<< attrTag("Condition", condition) |
| 695 |
<< valueTagT(!config.preBuild.ExcludedFromBuild); |
| 696 |
} |
| 697 |
|
| 698 |
if (config.preLink.ExcludedFromBuild != unset) |
| 699 |
{ |
| 700 |
xml << tag("PreLinkEventUseInBuild") |
| 701 |
<< attrTag("Condition", condition) |
| 702 |
<< valueTagT(!config.preLink.ExcludedFromBuild); |
| 703 |
} |
| 704 |
|
| 705 |
if (config.postBuild.ExcludedFromBuild != unset) |
| 706 |
{ |
| 707 |
xml << tag("PostBuildEventUseInBuild") |
| 708 |
<< attrTag("Condition", condition) |
| 709 |
<< valueTagT(!config.postBuild.ExcludedFromBuild); |
| 710 |
} |
| 711 |
} |
| 712 |
xml << closetag(); |
| 713 |
|
| 714 |
for (int i = 0; i < tool.SingleProjects.size(); ++i) { |
| 715 |
const VCConfiguration &config = tool.SingleProjects.at(i).Configuration; |
| 716 |
|
| 717 |
xml << tag("ItemDefinitionGroup") |
| 718 |
<< attrTag("Condition", generateCondition(config)); |
| 719 |
|
| 720 |
// ClCompile |
| 721 |
write(xml, config.compiler); |
| 722 |
|
| 723 |
// Librarian / Linker |
| 724 |
if (config.ConfigurationType == typeStaticLibrary) |
| 725 |
write(xml, config.librarian); |
| 726 |
else |
| 727 |
write(xml, config.linker); |
| 728 |
|
| 729 |
// Midl |
| 730 |
write(xml, config.idl); |
| 731 |
|
| 732 |
// ResourceCompiler |
| 733 |
write(xml, config.resource); |
| 734 |
|
| 735 |
// Post build event |
| 736 |
if (config.postBuild.ExcludedFromBuild != unset) |
| 737 |
write(xml, config.postBuild); |
| 738 |
|
| 739 |
// Pre build event |
| 740 |
if (config.preBuild.ExcludedFromBuild != unset) |
| 741 |
write(xml, config.preBuild); |
| 742 |
|
| 743 |
// Pre link event |
| 744 |
if (config.preLink.ExcludedFromBuild != unset) |
| 745 |
write(xml, config.preLink); |
| 746 |
|
| 747 |
xml << closetag(); |
| 748 |
|
| 749 |
// windeployqt |
| 750 |
if (!config.windeployqt.ExcludedFromBuild) |
| 751 |
write(xml, config.windeployqt); |
| 752 |
} |
| 753 |
|
| 754 |
// The file filters are added in a separate file for MSBUILD. |
| 755 |
QFile filterFile; |
| 756 |
filterFile.setFileName(Option::output.fileName().append(".filters")); |
| 757 |
if (!filterFile.open(QIODevice::WriteOnly | QIODevice::Text | QIODevice::Truncate)) { |
| 758 |
warn_msg(WarnLogic, "Cannot open output filter file"); |
| 759 |
return; |
| 760 |
} |
| 761 |
QTextStream ts(&filterFile); |
| 762 |
XmlOutput xmlFilter(ts, XmlOutput::NoConversion); |
| 763 |
|
| 764 |
xmlFilter.setIndentString(" "); |
| 765 |
|
| 766 |
xmlFilter << decl("1.0", "utf-8") |
| 767 |
<< tag("Project") |
| 768 |
<< attrTagToolsVersion(tool.SingleProjects.first().Configuration) |
| 769 |
<< attrTag("xmlns", "http://schemas.microsoft.com/developer/msbuild/2003"); |
| 770 |
|
| 771 |
xmlFilter << tag("ItemGroup"); |
| 772 |
|
| 773 |
addFilters(tool, xmlFilter, "Form Files"); |
| 774 |
addFilters(tool, xmlFilter, "Generated Files"); |
| 775 |
addFilters(tool, xmlFilter, "Header Files"); |
| 776 |
addFilters(tool, xmlFilter, "LexYacc Files"); |
| 777 |
addFilters(tool, xmlFilter, "Resource Files"); |
| 778 |
addFilters(tool, xmlFilter, "Source Files"); |
| 779 |
addFilters(tool, xmlFilter, "Translation Files"); |
| 780 |
addFilters(tool, xmlFilter, "Deployment Files"); |
| 781 |
addFilters(tool, xmlFilter, "Distribution Files"); |
| 782 |
|
| 783 |
for (int x = 0; x < tool.ExtraCompilers.size(); ++x) |
| 784 |
addFilters(tool, xmlFilter, tool.ExtraCompilers.at(x)); |
| 785 |
|
| 786 |
xmlFilter << closetag(); |
| 787 |
|
| 788 |
outputFilter(tool, xml, xmlFilter, "Source Files"); |
| 789 |
outputFilter(tool, xml, xmlFilter, "Header Files"); |
| 790 |
outputFilter(tool, xml, xmlFilter, "Generated Files"); |
| 791 |
outputFilter(tool, xml, xmlFilter, "LexYacc Files"); |
| 792 |
outputFilter(tool, xml, xmlFilter, "Translation Files"); |
| 793 |
outputFilter(tool, xml, xmlFilter, "Form Files"); |
| 794 |
outputFilter(tool, xml, xmlFilter, "Resource Files"); |
| 795 |
outputFilter(tool, xml, xmlFilter, "Deployment Files"); |
| 796 |
outputFilter(tool, xml, xmlFilter, "Distribution Files"); |
| 797 |
for (int x = 0; x < tool.ExtraCompilers.size(); ++x) { |
| 798 |
outputFilter(tool, xml, xmlFilter, tool.ExtraCompilers.at(x)); |
| 799 |
} |
| 800 |
outputFilter(tool, xml, xmlFilter, "Root Files"); |
| 801 |
|
| 802 |
xml << import("Project", "$(VCTargetsPath)\\Microsoft.Cpp.targets") |
| 803 |
<< tag("ImportGroup") |
| 804 |
<< attrTag("Label", "ExtensionTargets") |
| 805 |
<< closetag(); |
| 806 |
} |
| 807 |
|
| 808 |
static inline QString toString(asmListingOption option) |
| 809 |
{ |
| 810 |
switch (option) { |
| 811 |
case asmListingNone: |
| 812 |
break; |
| 813 |
case asmListingAsmMachine: |
| 814 |
return "AssemblyAndMachineCode"; |
| 815 |
case asmListingAsmMachineSrc: |
| 816 |
return "All"; |
| 817 |
case asmListingAsmSrc: |
| 818 |
return "AssemblyAndSourceCode"; |
| 819 |
case asmListingAssemblyOnly: |
| 820 |
return "AssemblyCode"; |
| 821 |
} |
| 822 |
return QString(); |
| 823 |
} |
| 824 |
|
| 825 |
static inline QString toString(basicRuntimeCheckOption option) |
| 826 |
{ |
| 827 |
switch (option) { |
| 828 |
case runtimeBasicCheckNone: |
| 829 |
return ""; |
| 830 |
case runtimeCheckStackFrame: |
| 831 |
return "StackFrameRuntimeCheck"; |
| 832 |
case runtimeCheckUninitVariables: |
| 833 |
return "UninitializedLocalUsageCheck"; |
| 834 |
case runtimeBasicCheckAll: |
| 835 |
return "EnableFastChecks"; |
| 836 |
} |
| 837 |
return QString(); |
| 838 |
} |
| 839 |
|
| 840 |
static inline QString toString(callingConventionOption option) |
| 841 |
{ |
| 842 |
switch (option) { |
| 843 |
case callConventionDefault: |
| 844 |
break; |
| 845 |
case callConventionCDecl: |
| 846 |
return "Cdecl"; |
| 847 |
case callConventionFastCall: |
| 848 |
return "FastCall"; |
| 849 |
case callConventionStdCall: |
| 850 |
return "StdCall"; |
| 851 |
} |
| 852 |
return QString(); |
| 853 |
} |
| 854 |
|
| 855 |
static inline QString toString(CompileAsOptions option) |
| 856 |
{ |
| 857 |
switch (option) { |
| 858 |
case compileAsDefault: |
| 859 |
break; |
| 860 |
case compileAsC: |
| 861 |
return "CompileAsC"; |
| 862 |
case compileAsCPlusPlus: |
| 863 |
return "CompileAsCpp"; |
| 864 |
} |
| 865 |
return QString(); |
| 866 |
} |
| 867 |
|
| 868 |
static inline QString toString(compileAsManagedOptions option) |
| 869 |
{ |
| 870 |
switch (option) { |
| 871 |
case managedDefault: |
| 872 |
case managedAssemblySafe: |
| 873 |
break; |
| 874 |
case managedAssembly: |
| 875 |
return "true"; |
| 876 |
case managedAssemblyPure: |
| 877 |
return "Safe"; |
| 878 |
case managedAssemblyOldSyntax: |
| 879 |
return "OldSyntax"; |
| 880 |
} |
| 881 |
return QString(); |
| 882 |
} |
| 883 |
|
| 884 |
static inline QString toString(debugOption option, DotNET compilerVersion) |
| 885 |
{ |
| 886 |
switch (option) { |
| 887 |
case debugUnknown: |
| 888 |
case debugLineInfoOnly: |
| 889 |
break; |
| 890 |
case debugDisabled: |
| 891 |
if (compilerVersion <= NET2010) |
| 892 |
break; |
| 893 |
return "None"; |
| 894 |
case debugOldStyleInfo: |
| 895 |
return "OldStyle"; |
| 896 |
case debugEditAndContinue: |
| 897 |
return "EditAndContinue"; |
| 898 |
case debugEnabled: |
| 899 |
return "ProgramDatabase"; |
| 900 |
} |
| 901 |
return QString(); |
| 902 |
} |
| 903 |
|
| 904 |
static inline QString toString(enhancedInstructionSetOption option) |
| 905 |
{ |
| 906 |
switch (option) { |
| 907 |
case archNotSet: |
| 908 |
break; |
| 909 |
case archSSE: |
| 910 |
return "StreamingSIMDExtensions"; |
| 911 |
case archSSE2: |
| 912 |
return "StreamingSIMDExtensions2"; |
| 913 |
} |
| 914 |
return QString(); |
| 915 |
} |
| 916 |
|
| 917 |
static inline QString toString(exceptionHandling option) |
| 918 |
{ |
| 919 |
switch (option) { |
| 920 |
case ehDefault: |
| 921 |
break; |
| 922 |
case ehNone: |
| 923 |
return "false"; |
| 924 |
case ehNoSEH: |
| 925 |
return "Sync"; |
| 926 |
case ehSEH: |
| 927 |
return "Async"; |
| 928 |
} |
| 929 |
return QString(); |
| 930 |
} |
| 931 |
|
| 932 |
static inline QString toString(favorSizeOrSpeedOption option) |
| 933 |
{ |
| 934 |
switch (option) { |
| 935 |
case favorNone: |
| 936 |
break; |
| 937 |
case favorSize: |
| 938 |
return "Size"; |
| 939 |
case favorSpeed: |
| 940 |
return "Speed"; |
| 941 |
} |
| 942 |
return QString(); |
| 943 |
} |
| 944 |
|
| 945 |
static inline QString toString(floatingPointModel option) |
| 946 |
{ |
| 947 |
switch (option) { |
| 948 |
case floatingPointNotSet: |
| 949 |
break; |
| 950 |
case floatingPointFast: |
| 951 |
return "Fast"; |
| 952 |
case floatingPointPrecise: |
| 953 |
return "Precise"; |
| 954 |
case floatingPointStrict: |
| 955 |
return "Strict"; |
| 956 |
} |
| 957 |
return QString(); |
| 958 |
} |
| 959 |
|
| 960 |
static inline QString toString(inlineExpansionOption option) |
| 961 |
{ |
| 962 |
switch (option) { |
| 963 |
case expandDefault: |
| 964 |
break; |
| 965 |
case expandDisable: |
| 966 |
return "Disabled"; |
| 967 |
case expandOnlyInline: |
| 968 |
return "OnlyExplicitInline"; |
| 969 |
case expandAnySuitable: |
| 970 |
return "AnySuitable"; |
| 971 |
} |
| 972 |
return QString(); |
| 973 |
} |
| 974 |
|
| 975 |
static inline QString toString(optimizeOption option) |
| 976 |
{ |
| 977 |
switch (option) { |
| 978 |
case optimizeCustom: |
| 979 |
case optimizeDefault: |
| 980 |
break; |
| 981 |
case optimizeDisabled: |
| 982 |
return "Disabled"; |
| 983 |
case optimizeMinSpace: |
| 984 |
return "MinSpace"; |
| 985 |
case optimizeMaxSpeed: |
| 986 |
return "MaxSpeed"; |
| 987 |
case optimizeFull: |
| 988 |
return "Full"; |
| 989 |
} |
| 990 |
return QString(); |
| 991 |
} |
| 992 |
|
| 993 |
static inline QString toString(pchOption option) |
| 994 |
{ |
| 995 |
switch (option) { |
| 996 |
case pchUnset: |
| 997 |
case pchGenerateAuto: |
| 998 |
break; |
| 999 |
case pchNone: |
| 1000 |
return "NotUsing"; |
| 1001 |
case pchCreateUsingSpecific: |
| 1002 |
return "Create"; |
| 1003 |
case pchUseUsingSpecific: |
| 1004 |
return "Use"; |
| 1005 |
} |
| 1006 |
return QString(); |
| 1007 |
} |
| 1008 |
|
| 1009 |
static inline QString toString(runtimeLibraryOption option) |
| 1010 |
{ |
| 1011 |
switch (option) { |
| 1012 |
case rtUnknown: |
| 1013 |
case rtSingleThreaded: |
| 1014 |
case rtSingleThreadedDebug: |
| 1015 |
break; |
| 1016 |
case rtMultiThreaded: |
| 1017 |
return "MultiThreaded"; |
| 1018 |
case rtMultiThreadedDLL: |
| 1019 |
return "MultiThreadedDLL"; |
| 1020 |
case rtMultiThreadedDebug: |
| 1021 |
return "MultiThreadedDebug"; |
| 1022 |
case rtMultiThreadedDebugDLL: |
| 1023 |
return "MultiThreadedDebugDLL"; |
| 1024 |
} |
| 1025 |
return QString(); |
| 1026 |
} |
| 1027 |
|
| 1028 |
static inline QString toString(structMemberAlignOption option) |
| 1029 |
{ |
| 1030 |
switch (option) { |
| 1031 |
case alignNotSet: |
| 1032 |
break; |
| 1033 |
case alignSingleByte: |
| 1034 |
return "1Byte"; |
| 1035 |
case alignTwoBytes: |
| 1036 |
return "2Bytes"; |
| 1037 |
case alignFourBytes: |
| 1038 |
return "4Bytes"; |
| 1039 |
case alignEightBytes: |
| 1040 |
return "8Bytes"; |
| 1041 |
case alignSixteenBytes: |
| 1042 |
return "16Bytes"; |
| 1043 |
} |
| 1044 |
return QString(); |
| 1045 |
} |
| 1046 |
|
| 1047 |
static inline QString toString(warningLevelOption option) |
| 1048 |
{ |
| 1049 |
switch (option) { |
| 1050 |
case warningLevelUnknown: |
| 1051 |
break; |
| 1052 |
case warningLevel_0: |
| 1053 |
return "TurnOffAllWarnings"; |
| 1054 |
case warningLevel_1: |
| 1055 |
return "Level1"; |
| 1056 |
case warningLevel_2: |
| 1057 |
return "Level2"; |
| 1058 |
case warningLevel_3: |
| 1059 |
return "Level3"; |
| 1060 |
case warningLevel_4: |
| 1061 |
return "Level4"; |
| 1062 |
} |
| 1063 |
return QString(); |
| 1064 |
} |
| 1065 |
|
| 1066 |
static inline QString toString(optLinkTimeCodeGenType option) |
| 1067 |
{ |
| 1068 |
switch (option) { |
| 1069 |
case optLTCGDefault: |
| 1070 |
break; |
| 1071 |
case optLTCGEnabled: |
| 1072 |
return "UseLinkTimeCodeGeneration"; |
| 1073 |
case optLTCGIncremental: |
| 1074 |
return "UseFastLinkTimeCodeGeneration"; |
| 1075 |
case optLTCGInstrument: |
| 1076 |
return "PGInstrument"; |
| 1077 |
case optLTCGOptimize: |
| 1078 |
return "PGOptimization"; |
| 1079 |
case optLTCGUpdate: |
| 1080 |
return "PGUpdate"; |
| 1081 |
} |
| 1082 |
return QString(); |
| 1083 |
} |
| 1084 |
|
| 1085 |
static inline QString toString(subSystemOption option) |
| 1086 |
{ |
| 1087 |
switch (option) { |
| 1088 |
case subSystemNotSet: |
| 1089 |
break; |
| 1090 |
case subSystemConsole: |
| 1091 |
return "Console"; |
| 1092 |
case subSystemWindows: |
| 1093 |
return "Windows"; |
| 1094 |
} |
| 1095 |
return QString(); |
| 1096 |
} |
| 1097 |
|
| 1098 |
static inline QString toString(triState genDebugInfo, linkerDebugOption option) |
| 1099 |
{ |
| 1100 |
switch (genDebugInfo) { |
| 1101 |
case unset: |
| 1102 |
break; |
| 1103 |
case _False: |
| 1104 |
return "false"; |
| 1105 |
case _True: |
| 1106 |
if (option == linkerDebugOptionFastLink) |
| 1107 |
return "DebugFastLink"; |
| 1108 |
else if (option == linkerDebugOptionFull) |
| 1109 |
return "DebugFull"; |
| 1110 |
return "true"; |
| 1111 |
} |
| 1112 |
return QString(); |
| 1113 |
} |
| 1114 |
|
| 1115 |
static inline QString toString(machineTypeOption option) |
| 1116 |
{ |
| 1117 |
switch (option) { |
| 1118 |
case machineNotSet: |
| 1119 |
break; |
| 1120 |
case machineX86: |
| 1121 |
return "MachineX86"; |
| 1122 |
case machineX64: |
| 1123 |
return "MachineX64"; |
| 1124 |
} |
| 1125 |
return QString(); |
| 1126 |
} |
| 1127 |
|
| 1128 |
static inline QString toString(midlCharOption option) |
| 1129 |
{ |
| 1130 |
switch (option) { |
| 1131 |
case midlCharUnsigned: |
| 1132 |
return "Unsigned"; |
| 1133 |
case midlCharSigned: |
| 1134 |
return "Signed"; |
| 1135 |
case midlCharAscii7: |
| 1136 |
return "Ascii"; |
| 1137 |
} |
| 1138 |
return QString(); |
| 1139 |
} |
| 1140 |
|
| 1141 |
static inline QString toString(midlErrorCheckOption option) |
| 1142 |
{ |
| 1143 |
switch (option) { |
| 1144 |
case midlEnableCustom: |
| 1145 |
break; |
| 1146 |
case midlDisableAll: |
| 1147 |
return "None"; |
| 1148 |
case midlEnableAll: |
| 1149 |
return "All"; |
| 1150 |
} |
| 1151 |
return QString(); |
| 1152 |
} |
| 1153 |
|
| 1154 |
static inline QString toString(midlStructMemberAlignOption option) |
| 1155 |
{ |
| 1156 |
switch (option) { |
| 1157 |
case midlAlignNotSet: |
| 1158 |
break; |
| 1159 |
case midlAlignSingleByte: |
| 1160 |
return "1"; |
| 1161 |
case midlAlignTwoBytes: |
| 1162 |
return "2"; |
| 1163 |
case midlAlignFourBytes: |
| 1164 |
return "4"; |
| 1165 |
case midlAlignEightBytes: |
| 1166 |
return "8"; |
| 1167 |
case midlAlignSixteenBytes: |
| 1168 |
return "16"; |
| 1169 |
} |
| 1170 |
return QString(); |
| 1171 |
} |
| 1172 |
|
| 1173 |
static inline QString toString(midlTargetEnvironment option) |
| 1174 |
{ |
| 1175 |
switch (option) { |
| 1176 |
case midlTargetNotSet: |
| 1177 |
break; |
| 1178 |
case midlTargetWin32: |
| 1179 |
return "Win32"; |
| 1180 |
case midlTargetWin64: |
| 1181 |
return "X64"; |
| 1182 |
} |
| 1183 |
return QString(); |
| 1184 |
} |
| 1185 |
|
| 1186 |
static inline QString toString(midlWarningLevelOption option) |
| 1187 |
{ |
| 1188 |
switch (option) { |
| 1189 |
case midlWarningLevel_0: |
| 1190 |
return "0"; |
| 1191 |
case midlWarningLevel_1: |
| 1192 |
return "1"; |
| 1193 |
case midlWarningLevel_2: |
| 1194 |
return "2"; |
| 1195 |
case midlWarningLevel_3: |
| 1196 |
return "3"; |
| 1197 |
case midlWarningLevel_4: |
| 1198 |
return "4"; |
| 1199 |
} |
| 1200 |
return QString(); |
| 1201 |
} |
| 1202 |
|
| 1203 |
static inline QString toString(enumResourceLangID option) |
| 1204 |
{ |
| 1205 |
if (option == 0) |
| 1206 |
return QString(); |
| 1207 |
else |
| 1208 |
return QString::number(qlonglong(option)); |
| 1209 |
} |
| 1210 |
|
| 1211 |
static inline QString toString(charSet option) |
| 1212 |
{ |
| 1213 |
switch (option) { |
| 1214 |
case charSetNotSet: |
| 1215 |
return "NotSet"; |
| 1216 |
case charSetUnicode: |
| 1217 |
return "Unicode"; |
| 1218 |
case charSetMBCS: |
| 1219 |
return "MultiByte"; |
| 1220 |
} |
| 1221 |
return QString(); |
| 1222 |
} |
| 1223 |
|
| 1224 |
static inline QString toString(ConfigurationTypes option) |
| 1225 |
{ |
| 1226 |
switch (option) { |
| 1227 |
case typeUnknown: |
| 1228 |
case typeGeneric: |
| 1229 |
break; |
| 1230 |
case typeApplication: |
| 1231 |
return "Application"; |
| 1232 |
case typeDynamicLibrary: |
| 1233 |
return "DynamicLibrary"; |
| 1234 |
case typeStaticLibrary: |
| 1235 |
return "StaticLibrary"; |
| 1236 |
} |
| 1237 |
return QString(); |
| 1238 |
} |
| 1239 |
|
| 1240 |
static inline QString toString(useOfATL option) |
| 1241 |
{ |
| 1242 |
switch (option) { |
| 1243 |
case useATLNotSet: |
| 1244 |
break; |
| 1245 |
case useATLStatic: |
| 1246 |
return "Static"; |
| 1247 |
case useATLDynamic: |
| 1248 |
return "Dynamic"; |
| 1249 |
} |
| 1250 |
return QString(); |
| 1251 |
} |
| 1252 |
|
| 1253 |
static inline QString toString(useOfMfc option) |
| 1254 |
{ |
| 1255 |
switch (option) { |
| 1256 |
case useMfcStdWin: |
| 1257 |
break; |
| 1258 |
case useMfcStatic: |
| 1259 |
return "Static"; |
| 1260 |
case useMfcDynamic: |
| 1261 |
return "Dynamic"; |
| 1262 |
} |
| 1263 |
return QString(); |
| 1264 |
} |
| 1265 |
|
| 1266 |
static inline triState toTriState(browseInfoOption option) |
| 1267 |
{ |
| 1268 |
switch (option) |
| 1269 |
{ |
| 1270 |
case brInfoNone: |
| 1271 |
return _False; |
| 1272 |
case brAllInfo: |
| 1273 |
case brNoLocalSymbols: |
| 1274 |
return _True; |
| 1275 |
} |
| 1276 |
return unset; |
| 1277 |
} |
| 1278 |
|
| 1279 |
static inline triState toTriState(preprocessOption option) |
| 1280 |
{ |
| 1281 |
switch (option) |
| 1282 |
{ |
| 1283 |
case preprocessUnknown: |
| 1284 |
break; |
| 1285 |
case preprocessNo: |
| 1286 |
return _False; |
| 1287 |
case preprocessNoLineNumbers: |
| 1288 |
case preprocessYes: |
| 1289 |
return _True; |
| 1290 |
} |
| 1291 |
return unset; |
| 1292 |
} |
| 1293 |
|
| 1294 |
static inline triState toTriState(optFoldingType option) |
| 1295 |
{ |
| 1296 |
switch (option) |
| 1297 |
{ |
| 1298 |
case optFoldingDefault: |
| 1299 |
break; |
| 1300 |
case optNoFolding: |
| 1301 |
return _False; |
| 1302 |
case optFolding: |
| 1303 |
return _True; |
| 1304 |
} |
| 1305 |
return unset; |
| 1306 |
} |
| 1307 |
|
| 1308 |
static inline triState toTriState(addressAwarenessType option) |
| 1309 |
{ |
| 1310 |
switch (option) |
| 1311 |
{ |
| 1312 |
case addrAwareDefault: |
| 1313 |
return unset; |
| 1314 |
case addrAwareNoLarge: |
| 1315 |
return _False; |
| 1316 |
case addrAwareLarge: |
| 1317 |
return _True; |
| 1318 |
} |
| 1319 |
return unset; |
| 1320 |
} |
| 1321 |
|
| 1322 |
static inline triState toTriState(linkIncrementalType option) |
| 1323 |
{ |
| 1324 |
switch (option) |
| 1325 |
{ |
| 1326 |
case linkIncrementalDefault: |
| 1327 |
return unset; |
| 1328 |
case linkIncrementalNo: |
| 1329 |
return _False; |
| 1330 |
case linkIncrementalYes: |
| 1331 |
return _True; |
| 1332 |
} |
| 1333 |
return unset; |
| 1334 |
} |
| 1335 |
|
| 1336 |
static inline triState toTriState(linkProgressOption option) |
| 1337 |
{ |
| 1338 |
switch (option) |
| 1339 |
{ |
| 1340 |
case linkProgressNotSet: |
| 1341 |
return unset; |
| 1342 |
case linkProgressAll: |
| 1343 |
case linkProgressLibs: |
| 1344 |
return _True; |
| 1345 |
} |
| 1346 |
return unset; |
| 1347 |
} |
| 1348 |
|
| 1349 |
static inline triState toTriState(optRefType option) |
| 1350 |
{ |
| 1351 |
switch (option) |
| 1352 |
{ |
| 1353 |
case optReferencesDefault: |
| 1354 |
return unset; |
| 1355 |
case optNoReferences: |
| 1356 |
return _False; |
| 1357 |
case optReferences: |
| 1358 |
return _True; |
| 1359 |
} |
| 1360 |
return unset; |
| 1361 |
} |
| 1362 |
|
| 1363 |
static inline triState toTriState(termSvrAwarenessType option) |
| 1364 |
{ |
| 1365 |
switch (option) |
| 1366 |
{ |
| 1367 |
case termSvrAwareDefault: |
| 1368 |
return unset; |
| 1369 |
case termSvrAwareNo: |
| 1370 |
return _False; |
| 1371 |
case termSvrAwareYes: |
| 1372 |
return _True; |
| 1373 |
} |
| 1374 |
return unset; |
| 1375 |
} |
| 1376 |
|
| 1377 |
static XmlOutput::xml_output fixedProgramDataBaseFileNameOutput(const VCCLCompilerTool &tool) |
| 1378 |
{ |
| 1379 |
if (tool.config->CompilerVersion >= NET2012 |
| 1380 |
&& tool.DebugInformationFormat == debugDisabled |
| 1381 |
&& tool.ProgramDataBaseFileName.isEmpty()) { |
| 1382 |
// Force the creation of an empty tag to work-around Visual Studio bug. See QTBUG-35570. |
| 1383 |
return tagValue(_ProgramDataBaseFileName, tool.ProgramDataBaseFileName); |
| 1384 |
} |
| 1385 |
return attrTagS(_ProgramDataBaseFileName, tool.ProgramDataBaseFileName); |
| 1386 |
} |
| 1387 |
|
| 1388 |
void VCXProjectWriter::write(XmlOutput &xml, const VCCLCompilerTool &tool) |
| 1389 |
{ |
| 1390 |
xml |
| 1391 |
<< tag(_CLCompile) |
| 1392 |
<< attrTagX(_AdditionalIncludeDirectories, tool.AdditionalIncludeDirectories, ";") |
| 1393 |
<< attrTagX(_AdditionalOptions, tool.AdditionalOptions, " ") |
| 1394 |
<< attrTagX(_AdditionalUsingDirectories, tool.AdditionalUsingDirectories, ";") |
| 1395 |
<< attrTagS(_AssemblerListingLocation, tool.AssemblerListingLocation) |
| 1396 |
<< attrTagS(_AssemblerOutput, toString(tool.AssemblerOutput)) |
| 1397 |
<< attrTagS(_BasicRuntimeChecks, toString(tool.BasicRuntimeChecks)) |
| 1398 |
<< attrTagT(_BrowseInformation, toTriState(tool.BrowseInformation)) |
| 1399 |
<< attrTagS(_BrowseInformationFile, tool.BrowseInformationFile) |
| 1400 |
<< attrTagT(_BufferSecurityCheck, tool.BufferSecurityCheck) |
| 1401 |
<< attrTagS(_CallingConvention, toString(tool.CallingConvention)) |
| 1402 |
<< attrTagS(_CompileAs, toString(tool.CompileAs)) |
| 1403 |
<< attrTagS(_CompileAsManaged, toString(tool.CompileAsManaged)) |
| 1404 |
<< attrTagT(_CompileAsWinRT, tool.CompileAsWinRT) |
| 1405 |
<< attrTagT(_CreateHotpatchableImage, tool.CreateHotpatchableImage) |
| 1406 |
<< attrTagS(_DebugInformationFormat, toString(tool.DebugInformationFormat, |
| 1407 |
tool.config->CompilerVersion)) |
| 1408 |
<< attrTagT(_DisableLanguageExtensions, tool.DisableLanguageExtensions) |
| 1409 |
<< attrTagX(_DisableSpecificWarnings, tool.DisableSpecificWarnings, ";") |
| 1410 |
<< attrTagS(_EnableEnhancedInstructionSet, toString(tool.EnableEnhancedInstructionSet)) |
| 1411 |
<< attrTagT(_EnableFiberSafeOptimizations, tool.EnableFiberSafeOptimizations) |
| 1412 |
<< attrTagT(_EnablePREfast, tool.EnablePREfast) |
| 1413 |
<< attrTagS(_ErrorReporting, tool.ErrorReporting) |
| 1414 |
<< attrTagS(_ExceptionHandling, toString(tool.ExceptionHandling)) |
| 1415 |
<< attrTagT(_ExpandAttributedSource, tool.ExpandAttributedSource) |
| 1416 |
<< attrTagS(_FavorSizeOrSpeed, toString(tool.FavorSizeOrSpeed)) |
| 1417 |
<< attrTagT(_FloatingPointExceptions, tool.FloatingPointExceptions) |
| 1418 |
<< attrTagS(_FloatingPointModel, toString(tool.FloatingPointModel)) |
| 1419 |
<< attrTagT(_ForceConformanceInForLoopScope, tool.ForceConformanceInForLoopScope) |
| 1420 |
<< attrTagX(_ForcedIncludeFiles, tool.ForcedIncludeFiles, ";") |
| 1421 |
<< attrTagX(_ForcedUsingFiles, tool.ForcedUsingFiles, ";") |
| 1422 |
<< attrTagT(_FunctionLevelLinking, tool.EnableFunctionLevelLinking) |
| 1423 |
<< attrTagT(_GenerateXMLDocumentationFiles, tool.GenerateXMLDocumentationFiles) |
| 1424 |
<< attrTagT(_IgnoreStandardIncludePath, tool.IgnoreStandardIncludePath) |
| 1425 |
<< attrTagS(_InlineFunctionExpansion, toString(tool.InlineFunctionExpansion)) |
| 1426 |
<< attrTagT(_IntrinsicFunctions, tool.EnableIntrinsicFunctions) |
| 1427 |
<< attrTagT(_MinimalRebuild, tool.MinimalRebuild) |
| 1428 |
<< attrTagT(_MultiProcessorCompilation, tool.MultiProcessorCompilation) |
| 1429 |
<< attrTagS(_LanguageStandard, tool.LanguageStandard) |
| 1430 |
<< attrTagS(_LanguageStandard_C, tool.LanguageStandard_C) |
| 1431 |
<< attrTagS(_ObjectFileName, tool.ObjectFile) |
| 1432 |
<< attrTagT(_OmitDefaultLibName, tool.OmitDefaultLibName) |
| 1433 |
<< attrTagT(_OmitFramePointers, tool.OmitFramePointers) |
| 1434 |
<< attrTagT(_OpenMPSupport, tool.OpenMP) |
| 1435 |
<< attrTagS(_Optimization, toString(tool.Optimization)) |
| 1436 |
<< attrTagS(_PrecompiledHeader, toString(tool.UsePrecompiledHeader)) |
| 1437 |
<< attrTagS(_PrecompiledHeaderFile, tool.PrecompiledHeaderThrough) |
| 1438 |
<< attrTagS(_PrecompiledHeaderOutputFile, tool.PrecompiledHeaderFile) |
| 1439 |
<< attrTagT(_PreprocessKeepComments, tool.KeepComments) |
| 1440 |
<< attrTagX(_PreprocessorDefinitions, unquote(tool.PreprocessorDefinitions), ";") |
| 1441 |
<< attrTagS(_PreprocessOutputPath, tool.PreprocessOutputPath) |
| 1442 |
<< attrTagT(_PreprocessSuppressLineNumbers, tool.PreprocessSuppressLineNumbers) |
| 1443 |
<< attrTagT(_PreprocessToFile, toTriState(tool.GeneratePreprocessedFile)) |
| 1444 |
<< fixedProgramDataBaseFileNameOutput(tool) |
| 1445 |
<< attrTagS(_ProcessorNumber, tool.MultiProcessorCompilationProcessorCount) |
| 1446 |
<< attrTagS(_RuntimeLibrary, toString(tool.RuntimeLibrary)) |
| 1447 |
<< attrTagT(_RuntimeTypeInfo, tool.RuntimeTypeInfo) |
| 1448 |
<< attrTagT(_ShowIncludes, tool.ShowIncludes) |
| 1449 |
<< attrTagT(_SmallerTypeCheck, tool.SmallerTypeCheck) |
| 1450 |
<< attrTagT(_StringPooling, tool.StringPooling) |
| 1451 |
<< attrTagS(_StructMemberAlignment, toString(tool.StructMemberAlignment)) |
| 1452 |
<< attrTagT(_SuppressStartupBanner, tool.SuppressStartupBanner) |
| 1453 |
<< attrTagX(_TreatSpecificWarningsAsErrors, tool.TreatSpecificWarningsAsErrors, ";") |
| 1454 |
<< attrTagT(_TreatWarningAsError, tool.WarnAsError) |
| 1455 |
<< attrTagT(_TreatWChar_tAsBuiltInType, tool.TreatWChar_tAsBuiltInType) |
| 1456 |
<< attrTagT(_UndefineAllPreprocessorDefinitions, tool.UndefineAllPreprocessorDefinitions) |
| 1457 |
<< attrTagX(_UndefinePreprocessorDefinitions, tool.UndefinePreprocessorDefinitions, ";") |
| 1458 |
<< attrTagT(_UseFullPaths, tool.DisplayFullPaths) |
| 1459 |
<< attrTagT(_UseUnicodeForAssemblerListing, tool.UseUnicodeForAssemblerListing) |
| 1460 |
<< attrTagS(_WarningLevel, toString(tool.WarningLevel)) |
| 1461 |
<< attrTagT(_WholeProgramOptimization, tool.WholeProgramOptimization) |
| 1462 |
<< attrTagS(_XMLDocumentationFileName, tool.XMLDocumentationFileName) |
| 1463 |
<< closetag(_CLCompile); |
| 1464 |
} |
| 1465 |
|
| 1466 |
void VCXProjectWriter::write(XmlOutput &xml, const VCLinkerTool &tool) |
| 1467 |
{ |
| 1468 |
xml |
| 1469 |
<< tag(_Link) |
| 1470 |
<< attrTagX(_AdditionalDependencies, tool.AdditionalDependencies, ";") |
| 1471 |
<< attrTagX(_AdditionalLibraryDirectories, tool.AdditionalLibraryDirectories, ";") |
| 1472 |
<< attrTagX(_AdditionalManifestDependencies, tool.AdditionalManifestDependencies, ";") |
| 1473 |
<< attrTagX(_AdditionalOptions, tool.AdditionalOptions, " ") |
| 1474 |
<< attrTagX(_AddModuleNamesToAssembly, tool.AddModuleNamesToAssembly, ";") |
| 1475 |
<< attrTagT(_AllowIsolation, tool.AllowIsolation) |
| 1476 |
<< attrTagT(_AssemblyDebug, tool.AssemblyDebug) |
| 1477 |
<< attrTagX(_AssemblyLinkResource, tool.AssemblyLinkResource, ";") |
| 1478 |
<< attrTagS(_BaseAddress, tool.BaseAddress) |
| 1479 |
<< attrTagS(_CLRImageType, tool.CLRImageType) |
| 1480 |
<< attrTagS(_CLRSupportLastError, tool.CLRSupportLastError) |
| 1481 |
<< attrTagS(_CLRThreadAttribute, tool.CLRThreadAttribute) |
| 1482 |
<< attrTagT(_CLRUnmanagedCodeCheck, tool.CLRUnmanagedCodeCheck) |
| 1483 |
<< attrTagT(_DataExecutionPrevention, tool.DataExecutionPrevention) |
| 1484 |
<< attrTagX(_DelayLoadDLLs, tool.DelayLoadDLLs, ";") |
| 1485 |
<< attrTagT(_DelaySign, tool.DelaySign) |
| 1486 |
<< attrTagS(_EmbedManagedResourceFile, tool.LinkToManagedResourceFile) |
| 1487 |
<< attrTagT(_EnableCOMDATFolding, toTriState(tool.EnableCOMDATFolding)) |
| 1488 |
<< attrTagT(_EnableUAC, tool.EnableUAC) |
| 1489 |
<< attrTagS(_EntryPointSymbol, tool.EntryPointSymbol) |
| 1490 |
<< attrTagX(_ForceSymbolReferences, tool.ForceSymbolReferences, ";") |
| 1491 |
<< attrTagS(_FunctionOrder, tool.FunctionOrder) |
| 1492 |
<< attrTagS(_GenerateDebugInformation, toString(tool.GenerateDebugInformation, tool.DebugInfoOption)) |
| 1493 |
<< attrTagT(_GenerateManifest, tool.GenerateManifest) |
| 1494 |
<< attrTagT(_GenerateWindowsMetadata, tool.GenerateWindowsMetadata) |
| 1495 |
<< attrTagS(_WindowsMetadataFile, tool.GenerateWindowsMetadata == _True ? tool.WindowsMetadataFile : QString()) |
| 1496 |
<< attrTagT(_GenerateMapFile, tool.GenerateMapFile) |
| 1497 |
<< attrTagL(_HeapCommitSize, tool.HeapCommitSize, /*ifNot*/ -1) |
| 1498 |
<< attrTagL(_HeapReserveSize, tool.HeapReserveSize, /*ifNot*/ -1) |
| 1499 |
<< attrTagT(_IgnoreAllDefaultLibraries, tool.IgnoreAllDefaultLibraries) |
| 1500 |
<< attrTagT(_IgnoreEmbeddedIDL, tool.IgnoreEmbeddedIDL) |
| 1501 |
<< attrTagT(_IgnoreImportLibrary, tool.IgnoreImportLibrary) |
| 1502 |
<< attrTagT(_ImageHasSafeExceptionHandlers, tool.ImageHasSafeExceptionHandlers) |
| 1503 |
<< attrTagX(_IgnoreSpecificDefaultLibraries, tool.IgnoreDefaultLibraryNames, ";") |
| 1504 |
<< attrTagS(_ImportLibrary, tool.ImportLibrary) |
| 1505 |
<< attrTagS(_KeyContainer, tool.KeyContainer) |
| 1506 |
<< attrTagS(_KeyFile, tool.KeyFile) |
| 1507 |
<< attrTagT(_LargeAddressAware, toTriState(tool.LargeAddressAware)) |
| 1508 |
<< attrTagT(_LinkDLL, (tool.config->ConfigurationType == typeDynamicLibrary ? _True : unset)) |
| 1509 |
<< attrTagS(_LinkErrorReporting, tool.LinkErrorReporting) |
| 1510 |
<< attrTagT(_LinkIncremental, toTriState(tool.LinkIncremental)) |
| 1511 |
<< attrTagT(_LinkStatus, toTriState(tool.ShowProgress)) |
| 1512 |
<< attrTagS(_LinkTimeCodeGeneration, toString(tool.LinkTimeCodeGeneration)) |
| 1513 |
<< attrTagS(_ManifestFile, tool.ManifestFile) |
| 1514 |
<< attrTagT(_MapExports, tool.MapExports) |
| 1515 |
<< attrTagS(_MapFileName, tool.MapFileName) |
| 1516 |
<< attrTagS(_MergedIDLBaseFileName, tool.MergedIDLBaseFileName) |
| 1517 |
<< attrTagS(_MergeSections, tool.MergeSections) |
| 1518 |
<< attrTagS(_MidlCommandFile, tool.MidlCommandFile) |
| 1519 |
<< attrTagS(_ModuleDefinitionFile, tool.ModuleDefinitionFile) |
| 1520 |
<< attrTagT(_NoEntryPoint, tool.ResourceOnlyDLL) |
| 1521 |
<< attrTagT(_OptimizeReferences, toTriState(tool.OptimizeReferences)) |
| 1522 |
<< attrTagS(_OutputFile, tool.OutputFile) |
| 1523 |
<< attrTagT(_PreventDllBinding, tool.PreventDllBinding) |
| 1524 |
<< attrTagS(_ProgramDatabaseFile, tool.ProgramDatabaseFile) |
| 1525 |
<< attrTagT(_RandomizedBaseAddress, tool.RandomizedBaseAddress) |
| 1526 |
<< attrTagT(_RegisterOutput, tool.RegisterOutput) |
| 1527 |
<< attrTagL(_SectionAlignment, tool.SectionAlignment, /*ifNot*/ -1) |
| 1528 |
<< attrTagT(_SetChecksum, tool.SetChecksum) |
| 1529 |
<< attrTagL(_StackCommitSize, tool.StackCommitSize, /*ifNot*/ -1) |
| 1530 |
<< attrTagL(_StackReserveSize, tool.StackReserveSize, /*ifNot*/ -1) |
| 1531 |
<< attrTagS(_StripPrivateSymbols, tool.StripPrivateSymbols) |
| 1532 |
<< attrTagS(_SubSystem, toString(tool.SubSystem)) |
| 1533 |
// << attrTagT(_SupportNobindOfDelayLoadedDLL, tool.SupportNobindOfDelayLoadedDLL) |
| 1534 |
<< attrTagT(_SupportUnloadOfDelayLoadedDLL, tool.SupportUnloadOfDelayLoadedDLL) |
| 1535 |
<< attrTagT(_SuppressStartupBanner, tool.SuppressStartupBanner) |
| 1536 |
<< attrTagT(_SwapRunFromCD, tool.SwapRunFromCD) |
| 1537 |
<< attrTagT(_SwapRunFromNet, tool.SwapRunFromNet) |
| 1538 |
<< attrTagS(_TargetMachine, toString(tool.TargetMachine)) |
| 1539 |
<< attrTagT(_TerminalServerAware, toTriState(tool.TerminalServerAware)) |
| 1540 |
<< attrTagT(_TreatLinkerWarningAsErrors, tool.TreatWarningsAsErrors) |
| 1541 |
<< attrTagT(_TurnOffAssemblyGeneration, tool.TurnOffAssemblyGeneration) |
| 1542 |
<< attrTagS(_TypeLibraryFile, tool.TypeLibraryFile) |
| 1543 |
<< attrTagL(_TypeLibraryResourceID, tool.TypeLibraryResourceID, /*ifNot*/ 0) |
| 1544 |
<< attrTagS(_UACExecutionLevel, tool.UACExecutionLevel) |
| 1545 |
<< attrTagT(_UACUIAccess, tool.UACUIAccess) |
| 1546 |
<< attrTagS(_Version, tool.Version) |
| 1547 |
<< closetag(_Link); |
| 1548 |
} |
| 1549 |
|
| 1550 |
void VCXProjectWriter::write(XmlOutput &xml, const VCMIDLTool &tool) |
| 1551 |
{ |
| 1552 |
xml |
| 1553 |
<< tag(_Midl) |
| 1554 |
<< attrTagX(_AdditionalIncludeDirectories, tool.AdditionalIncludeDirectories, ";") |
| 1555 |
<< attrTagX(_AdditionalOptions, tool.AdditionalOptions, " ") |
| 1556 |
<< attrTagT(_ApplicationConfigurationMode, tool.ApplicationConfigurationMode) |
| 1557 |
<< attrTagS(_ClientStubFile, tool.ClientStubFile) |
| 1558 |
<< attrTagX(_CPreprocessOptions, tool.CPreprocessOptions, " ") |
| 1559 |
<< attrTagS(_DefaultCharType, toString(tool.DefaultCharType)) |
| 1560 |
<< attrTagS(_DLLDataFileName, tool.DLLDataFileName) |
| 1561 |
<< attrTagS(_EnableErrorChecks, toString(tool.EnableErrorChecks)) |
| 1562 |
<< attrTagT(_ErrorCheckAllocations, tool.ErrorCheckAllocations) |
| 1563 |
<< attrTagT(_ErrorCheckBounds, tool.ErrorCheckBounds) |
| 1564 |
<< attrTagT(_ErrorCheckEnumRange, tool.ErrorCheckEnumRange) |
| 1565 |
<< attrTagT(_ErrorCheckRefPointers, tool.ErrorCheckRefPointers) |
| 1566 |
<< attrTagT(_ErrorCheckStubData, tool.ErrorCheckStubData) |
| 1567 |
<< attrTagS(_GenerateClientFiles, tool.GenerateClientFiles) |
| 1568 |
<< attrTagS(_GenerateServerFiles, tool.GenerateServerFiles) |
| 1569 |
<< attrTagT(_GenerateStublessProxies, tool.GenerateStublessProxies) |
| 1570 |
<< attrTagT(_GenerateTypeLibrary, tool.GenerateTypeLibrary) |
| 1571 |
<< attrTagS(_HeaderFileName, tool.HeaderFileName) |
| 1572 |
<< attrTagT(_IgnoreStandardIncludePath, tool.IgnoreStandardIncludePath) |
| 1573 |
<< attrTagS(_InterfaceIdentifierFileName, tool.InterfaceIdentifierFileName) |
| 1574 |
<< attrTagL(_LocaleID, tool.LocaleID, /*ifNot*/ -1) |
| 1575 |
<< attrTagT(_MkTypLibCompatible, tool.MkTypLibCompatible) |
| 1576 |
<< attrTagS(_OutputDirectory, tool.OutputDirectory) |
| 1577 |
<< attrTagX(_PreprocessorDefinitions, tool.PreprocessorDefinitions, ";") |
| 1578 |
<< attrTagS(_ProxyFileName, tool.ProxyFileName) |
| 1579 |
<< attrTagS(_RedirectOutputAndErrors, tool.RedirectOutputAndErrors) |
| 1580 |
<< attrTagS(_ServerStubFile, tool.ServerStubFile) |
| 1581 |
<< attrTagS(_StructMemberAlignment, toString(tool.StructMemberAlignment)) |
| 1582 |
<< attrTagT(_SuppressCompilerWarnings, tool.SuppressCompilerWarnings) |
| 1583 |
<< attrTagT(_SuppressStartupBanner, tool.SuppressStartupBanner) |
| 1584 |
<< attrTagS(_TargetEnvironment, toString(tool.TargetEnvironment)) |
| 1585 |
<< attrTagS(_TypeLibFormat, tool.TypeLibFormat) |
| 1586 |
<< attrTagS(_TypeLibraryName, tool.TypeLibraryName) |
| 1587 |
<< attrTagX(_UndefinePreprocessorDefinitions, tool.UndefinePreprocessorDefinitions, ";") |
| 1588 |
<< attrTagT(_ValidateAllParameters, tool.ValidateAllParameters) |
| 1589 |
<< attrTagT(_WarnAsError, tool.WarnAsError) |
| 1590 |
<< attrTagS(_WarningLevel, toString(tool.WarningLevel)) |
| 1591 |
<< closetag(_Midl); |
| 1592 |
} |
| 1593 |
|
| 1594 |
void VCXProjectWriter::write(XmlOutput &xml, const VCCustomBuildTool &tool) |
| 1595 |
{ |
| 1596 |
const QString condition = generateCondition(*tool.config); |
| 1597 |
|
| 1598 |
if ( !tool.AdditionalDependencies.isEmpty() ) |
| 1599 |
{ |
| 1600 |
xml << tag("AdditionalInputs") |
| 1601 |
<< attrTag("Condition", condition) |
| 1602 |
<< valueTagDefX(tool.AdditionalDependencies, "AdditionalInputs", ";"); |
| 1603 |
} |
| 1604 |
|
| 1605 |
if( !tool.CommandLine.isEmpty() ) |
| 1606 |
{ |
| 1607 |
xml << tag("Command") |
| 1608 |
<< attrTag("Condition", condition) |
| 1609 |
<< valueTag(commandLinesForOutput(tool.CommandLine)); |
| 1610 |
} |
| 1611 |
|
| 1612 |
if ( !tool.Description.isEmpty() ) |
| 1613 |
{ |
| 1614 |
xml << tag("Message") |
| 1615 |
<< attrTag("Condition", condition) |
| 1616 |
<< valueTag(tool.Description); |
| 1617 |
} |
| 1618 |
|
| 1619 |
if ( !tool.Outputs.isEmpty() ) |
| 1620 |
{ |
| 1621 |
xml << tag("Outputs") |
| 1622 |
<< attrTag("Condition", condition) |
| 1623 |
<< valueTagDefX(tool.Outputs, "Outputs", ";"); |
| 1624 |
} |
| 1625 |
} |
| 1626 |
|
| 1627 |
void VCXProjectWriter::write(XmlOutput &xml, const VCLibrarianTool &tool) |
| 1628 |
{ |
| 1629 |
xml |
| 1630 |
<< tag(_Lib) |
| 1631 |
<< attrTagX(_AdditionalDependencies, tool.AdditionalDependencies, ";") |
| 1632 |
<< attrTagX(_AdditionalLibraryDirectories, tool.AdditionalLibraryDirectories, ";") |
| 1633 |
<< attrTagX(_AdditionalOptions, tool.AdditionalOptions, " ") |
| 1634 |
<< attrTagX(_ExportNamedFunctions, tool.ExportNamedFunctions, ";") |
| 1635 |
<< attrTagX(_ForceSymbolReferences, tool.ForceSymbolReferences, ";") |
| 1636 |
<< attrTagT(_IgnoreAllDefaultLibraries, tool.IgnoreAllDefaultLibraries) |
| 1637 |
<< attrTagX(_IgnoreSpecificDefaultLibraries, tool.IgnoreDefaultLibraryNames, ";") |
| 1638 |
<< attrTagS(_ModuleDefinitionFile, tool.ModuleDefinitionFile) |
| 1639 |
<< attrTagS(_OutputFile, tool.OutputFile) |
| 1640 |
<< attrTagT(_SuppressStartupBanner, tool.SuppressStartupBanner) |
| 1641 |
<< closetag(_Lib); |
| 1642 |
} |
| 1643 |
|
| 1644 |
void VCXProjectWriter::write(XmlOutput &xml, const VCResourceCompilerTool &tool) |
| 1645 |
{ |
| 1646 |
xml |
| 1647 |
<< tag(_ResourceCompile) |
| 1648 |
<< attrTagX(_AdditionalIncludeDirectories, tool.AdditionalIncludeDirectories, ";") |
| 1649 |
<< attrTagX(_AdditionalOptions, tool.AdditionalOptions, " ") |
| 1650 |
<< attrTagS(_Culture, toString(tool.Culture)) |
| 1651 |
<< attrTagT(_IgnoreStandardIncludePath, tool.IgnoreStandardIncludePath) |
| 1652 |
<< attrTagX(_PreprocessorDefinitions, tool.PreprocessorDefinitions, ";") |
| 1653 |
<< attrTagS(_ResourceOutputFileName, tool.ResourceOutputFileName) |
| 1654 |
<< attrTagT(_ShowProgress, toTriState(tool.ShowProgress)) |
| 1655 |
<< attrTagT(_SuppressStartupBanner, tool.SuppressStartupBanner) |
| 1656 |
<< closetag(_ResourceCompile); |
| 1657 |
} |
| 1658 |
|
| 1659 |
void VCXProjectWriter::write(XmlOutput &xml, const VCEventTool &tool) |
| 1660 |
{ |
| 1661 |
xml |
| 1662 |
<< tag(tool.EventName) |
| 1663 |
<< tag(_Command) << valueTag(commandLinesForOutput(tool.CommandLine)) |
| 1664 |
<< tag(_Message) << valueTag(tool.Description) |
| 1665 |
<< closetag(tool.EventName); |
| 1666 |
} |
| 1667 |
|
| 1668 |
void VCXProjectWriter::write(XmlOutput &xml, const VCDeploymentTool &tool) |
| 1669 |
{ |
| 1670 |
Q_UNUSED(xml); |
| 1671 |
Q_UNUSED(tool); |
| 1672 |
// SmartDevice deployment not supported in VS 2010 |
| 1673 |
} |
| 1674 |
|
| 1675 |
void VCXProjectWriter::write(XmlOutput &xml, const VCWinDeployQtTool &tool) |
| 1676 |
{ |
| 1677 |
const QString name = QStringLiteral("WinDeployQt_") + tool.config->Name; |
| 1678 |
xml << tag("Target") |
| 1679 |
<< attrTag(_Name, name) |
| 1680 |
<< attrTag("Condition", generateCondition(*tool.config)) |
| 1681 |
<< attrTag("Inputs", "$(OutDir)\\$(TargetName).exe") |
| 1682 |
<< attrTag("Outputs", tool.Record) |
| 1683 |
<< tag(_Message) |
| 1684 |
<< attrTag("Text", tool.CommandLine) |
| 1685 |
<< closetag() |
| 1686 |
<< tag("Exec") |
| 1687 |
<< attrTag("Command", tool.CommandLine) |
| 1688 |
<< closetag() |
| 1689 |
<< closetag() |
| 1690 |
<< tag("Target") |
| 1691 |
<< attrTag(_Name, QStringLiteral("PopulateWinDeployQtItems_") + tool.config->Name) |
| 1692 |
<< attrTag("Condition", generateCondition(*tool.config)) |
| 1693 |
<< attrTag("AfterTargets", "Link") |
| 1694 |
<< attrTag("DependsOnTargets", name) |
| 1695 |
<< tag("ReadLinesFromFile") |
| 1696 |
<< attrTag("File", tool.Record) |
| 1697 |
<< tag("Output") |
| 1698 |
<< attrTag("TaskParameter", "Lines") |
| 1699 |
<< attrTag("ItemName", "DeploymentItems") |
| 1700 |
<< closetag() |
| 1701 |
<< closetag() |
| 1702 |
<< tag(_ItemGroup) |
| 1703 |
<< tag("None") |
| 1704 |
<< attrTag("Include", "@(DeploymentItems)") |
| 1705 |
<< attrTagT("DeploymentContent", _True) |
| 1706 |
<< closetag() |
| 1707 |
<< closetag() |
| 1708 |
<< closetag(); |
| 1709 |
} |
| 1710 |
|
| 1711 |
void VCXProjectWriter::write(XmlOutput &xml, const VCConfiguration &tool) |
| 1712 |
{ |
| 1713 |
xml << tag("PropertyGroup") |
| 1714 |
<< attrTag("Condition", generateCondition(tool)) |
| 1715 |
<< attrTag("Label", "Configuration") |
| 1716 |
<< attrTagS(_PlatformToolSet, tool.PlatformToolSet) |
| 1717 |
<< attrTagS(_OutputDirectory, tool.OutputDirectory) |
| 1718 |
<< attrTagT(_ATLMinimizesCRunTimeLibraryUsage, tool.ATLMinimizesCRunTimeLibraryUsage) |
| 1719 |
<< attrTagT(_BuildBrowserInformation, tool.BuildBrowserInformation) |
| 1720 |
<< attrTagS(_CharacterSet, toString(tool.CharacterSet)) |
| 1721 |
<< attrTagS(_ConfigurationType, toString(tool.ConfigurationType)) |
| 1722 |
<< attrTagS(_DeleteExtensionsOnClean, tool.DeleteExtensionsOnClean) |
| 1723 |
<< attrTagS(_ImportLibrary, tool.ImportLibrary) |
| 1724 |
<< attrTagS(_IntermediateDirectory, tool.IntermediateDirectory) |
| 1725 |
<< attrTagS(_PrimaryOutput, tool.PrimaryOutput) |
| 1726 |
<< attrTagS(_ProgramDatabase, tool.ProgramDatabase) |
| 1727 |
<< attrTagT(_RegisterOutput, tool.RegisterOutput) |
| 1728 |
<< attrTagS(_UseOfATL, toString(tool.UseOfATL)) |
| 1729 |
<< attrTagS(_UseOfMfc, toString(tool.UseOfMfc)) |
| 1730 |
<< attrTagT(_WholeProgramOptimization, tool.WholeProgramOptimization) |
| 1731 |
<< attrTagT(_EmbedManifest, tool.manifestTool.EmbedManifest) |
| 1732 |
<< closetag(); |
| 1733 |
} |
| 1734 |
|
| 1735 |
void VCXProjectWriter::write(XmlOutput &xml, VCFilter &tool) |
| 1736 |
{ |
| 1737 |
Q_UNUSED(xml); |
| 1738 |
Q_UNUSED(tool); |
| 1739 |
// unused in this generator |
| 1740 |
} |
| 1741 |
|
| 1742 |
void VCXProjectWriter::addFilters(VCProject &project, XmlOutput &xmlFilter, const QString &filtername) |
| 1743 |
{ |
| 1744 |
bool added = false; |
| 1745 |
|
| 1746 |
for (int i = 0; i < project.SingleProjects.size(); ++i) { |
| 1747 |
const VCFilter filter = project.SingleProjects.at(i).filterByName(filtername); |
| 1748 |
if(!filter.Files.isEmpty() && !added) { |
| 1749 |
xmlFilter << tag("Filter") |
| 1750 |
<< attrTag("Include", filtername) |
| 1751 |
<< attrTagS("UniqueIdentifier", filter.Guid) |
| 1752 |
<< attrTagS("Extensions", filter.Filter) |
| 1753 |
<< attrTagT("ParseFiles", filter.ParseFiles) |
| 1754 |
<< closetag(); |
| 1755 |
} |
| 1756 |
} |
| 1757 |
} |
| 1758 |
|
| 1759 |
// outputs a given filter for all existing configurations of a project |
| 1760 |
void VCXProjectWriter::outputFilter(VCProject &project, XmlOutput &xml, XmlOutput &xmlFilter, const QString &filtername) |
| 1761 |
{ |
| 1762 |
QScopedPointer<XNode> root; |
| 1763 |
if (project.SingleProjects.at(0).flat_files) |
| 1764 |
root.reset(new XFlatNode); |
| 1765 |
else |
| 1766 |
root.reset(new XTreeNode); |
| 1767 |
|
| 1768 |
for (int i = 0; i < project.SingleProjects.size(); ++i) { |
| 1769 |
const VCFilter filter = project.SingleProjects.at(i).filterByName(filtername); |
| 1770 |
// Merge all files in this filter to root tree |
| 1771 |
for (int x = 0; x < filter.Files.size(); ++x) |
| 1772 |
root->addElement(filter.Files.at(x)); |
| 1773 |
} |
| 1774 |
|
| 1775 |
if (!root->hasElements()) |
| 1776 |
return; |
| 1777 |
|
| 1778 |
root->generateXML(xml, xmlFilter, "", project, filtername); // output root tree |
| 1779 |
} |
| 1780 |
|
| 1781 |
static QString stringBeforeFirstBackslash(const QString &str) |
| 1782 |
{ |
| 1783 |
int idx = str.indexOf(QLatin1Char('\\')); |
| 1784 |
return idx == -1 ? str : str.left(idx); |
| 1785 |
} |
| 1786 |
|
| 1787 |
// Output all configurations (by filtername) for a file (by info) |
| 1788 |
// A filters config output is in VCFilter.outputFileConfig() |
| 1789 |
void VCXProjectWriter::outputFileConfigs(VCProject &project, XmlOutput &xml, XmlOutput &xmlFilter, |
| 1790 |
const VCFilterFile &info, const QString &filtername) |
| 1791 |
{ |
| 1792 |
// In non-flat mode the filter names have directory suffixes, e.g. "Generated Files\subdir". |
| 1793 |
const QString cleanFilterName = stringBeforeFirstBackslash(filtername); |
| 1794 |
|
| 1795 |
// We need to check if the file has any custom build step. |
| 1796 |
// If there is one then it has to be included with "CustomBuild Include" |
| 1797 |
bool hasCustomBuildStep = false; |
| 1798 |
QVarLengthArray<OutputFilterData> data(project.SingleProjects.size()); |
| 1799 |
for (int i = 0; i < project.SingleProjects.size(); ++i) { |
| 1800 |
data[i].filter = project.SingleProjects.at(i).filterByName(cleanFilterName); |
| 1801 |
if (!data[i].filter.Config) // only if the filter is not empty |
| 1802 |
continue; |
| 1803 |
VCFilter &filter = data[i].filter; |
| 1804 |
|
| 1805 |
// Clearing each filter tool |
| 1806 |
filter.useCustomBuildTool = false; |
| 1807 |
filter.useCompilerTool = false; |
| 1808 |
filter.CustomBuildTool = VCCustomBuildTool(); |
| 1809 |
filter.CustomBuildTool.config = filter.Config; |
| 1810 |
filter.CompilerTool = VCCLCompilerTool(); |
| 1811 |
filter.CompilerTool.config = filter.Config; |
| 1812 |
|
| 1813 |
VCFilterFile fileInFilter = filter.findFile(info.file, &data[i].inBuild); |
| 1814 |
data[i].info = fileInFilter; |
| 1815 |
data[i].inBuild &= !fileInFilter.excludeFromBuild; |
| 1816 |
if (data[i].inBuild && filter.addExtraCompiler(fileInFilter)) |
| 1817 |
hasCustomBuildStep = true; |
| 1818 |
} |
| 1819 |
|
| 1820 |
bool fileAdded = false; |
| 1821 |
for (int i = 0; i < project.SingleProjects.size(); ++i) { |
| 1822 |
OutputFilterData *d = &data[i]; |
| 1823 |
if (!d->filter.Config) // only if the filter is not empty |
| 1824 |
continue; |
| 1825 |
if (outputFileConfig(d, xml, xmlFilter, info.file, filtername, fileAdded, |
| 1826 |
hasCustomBuildStep)) { |
| 1827 |
fileAdded = true; |
| 1828 |
} |
| 1829 |
} |
| 1830 |
|
| 1831 |
if ( !fileAdded ) |
| 1832 |
outputFileConfig(xml, xmlFilter, info.file, filtername); |
| 1833 |
|
| 1834 |
xml << closetag(); |
| 1835 |
xmlFilter << closetag(); |
| 1836 |
} |
| 1837 |
|
| 1838 |
bool VCXProjectWriter::outputFileConfig(OutputFilterData *d, XmlOutput &xml, XmlOutput &xmlFilter, |
| 1839 |
const QString &filename, const QString &fullFilterName, |
| 1840 |
bool fileAdded, bool hasCustomBuildStep) |
| 1841 |
{ |
| 1842 |
VCFilter &filter = d->filter; |
| 1843 |
if (d->inBuild) { |
| 1844 |
if (filter.Project->usePCH) |
| 1845 |
filter.modifyPCHstage(filename); |
| 1846 |
} else { |
| 1847 |
// Excluded files uses an empty compiler stage |
| 1848 |
if (d->info.excludeFromBuild) |
| 1849 |
filter.useCompilerTool = true; |
| 1850 |
} |
| 1851 |
|
| 1852 |
// Actual XML output ---------------------------------- |
| 1853 |
if (hasCustomBuildStep || filter.useCustomBuildTool || filter.useCompilerTool |
| 1854 |
|| !d->inBuild || filter.Name.startsWith("Deployment Files")) { |
| 1855 |
|
| 1856 |
if (hasCustomBuildStep || filter.useCustomBuildTool) |
| 1857 |
{ |
| 1858 |
if (!fileAdded) { |
| 1859 |
fileAdded = true; |
| 1860 |
|
| 1861 |
xmlFilter << tag("CustomBuild") |
| 1862 |
<< attrTag("Include", Option::fixPathToTargetOS(filename)) |
| 1863 |
<< attrTagS("Filter", fullFilterName); |
| 1864 |
|
| 1865 |
xml << tag("CustomBuild") |
| 1866 |
<< attrTag("Include", Option::fixPathToTargetOS(filename)); |
| 1867 |
|
| 1868 |
if (filter.Name.startsWith("Form Files") |
| 1869 |
|| filter.Name.startsWith("Generated Files") |
| 1870 |
|| filter.Name.startsWith("Resource Files") |
| 1871 |
|| filter.Name.startsWith("Deployment Files")) |
| 1872 |
xml << attrTagS("FileType", "Document"); |
| 1873 |
} |
| 1874 |
|
| 1875 |
filter.Project->projectWriter->write(xml, filter.CustomBuildTool); |
| 1876 |
} |
| 1877 |
|
| 1878 |
if (!fileAdded) |
| 1879 |
{ |
| 1880 |
fileAdded = true; |
| 1881 |
outputFileConfig(xml, xmlFilter, filename, fullFilterName); |
| 1882 |
} |
| 1883 |
|
| 1884 |
const QString condition = generateCondition(*filter.Config); |
| 1885 |
if (!d->inBuild) { |
| 1886 |
xml << tag("ExcludedFromBuild") |
| 1887 |
<< attrTag("Condition", condition) |
| 1888 |
<< valueTag("true"); |
| 1889 |
} |
| 1890 |
|
| 1891 |
if (filter.Name.startsWith("Deployment Files") && d->inBuild) { |
| 1892 |
xml << tag("DeploymentContent") |
| 1893 |
<< attrTag("Condition", condition) |
| 1894 |
<< valueTag("true"); |
| 1895 |
} |
| 1896 |
|
| 1897 |
if (filter.useCompilerTool) { |
| 1898 |
|
| 1899 |
if ( !filter.CompilerTool.ForcedIncludeFiles.isEmpty() ) { |
| 1900 |
xml << tag("ForcedIncludeFiles") |
| 1901 |
<< attrTag("Condition", condition) |
| 1902 |
<< valueTagX(filter.CompilerTool.ForcedIncludeFiles); |
| 1903 |
} |
| 1904 |
|
| 1905 |
if ( !filter.CompilerTool.PrecompiledHeaderThrough.isEmpty() ) { |
| 1906 |
xml << tag("PrecompiledHeaderFile") |
| 1907 |
<< attrTag("Condition", condition) |
| 1908 |
<< valueTag(filter.CompilerTool.PrecompiledHeaderThrough); |
| 1909 |
} |
| 1910 |
|
| 1911 |
if (filter.CompilerTool.UsePrecompiledHeader != pchUnset) { |
| 1912 |
xml << tag("PrecompiledHeader") |
| 1913 |
<< attrTag("Condition", condition) |
| 1914 |
<< valueTag(toString(filter.CompilerTool.UsePrecompiledHeader)); |
| 1915 |
} |
| 1916 |
} |
| 1917 |
} |
| 1918 |
|
| 1919 |
return fileAdded; |
| 1920 |
} |
| 1921 |
|
| 1922 |
static bool isFileClCompatible(const QString &filePath) |
| 1923 |
{ |
| 1924 |
auto filePathEndsWith = [&filePath] (const QString &ext) { |
| 1925 |
return filePath.endsWith(ext, Qt::CaseInsensitive); |
| 1926 |
}; |
| 1927 |
return std::any_of(Option::cpp_ext.cbegin(), Option::cpp_ext.cend(), filePathEndsWith) |
| 1928 |
|| std::any_of(Option::c_ext.cbegin(), Option::c_ext.cend(), filePathEndsWith); |
| 1929 |
} |
| 1930 |
|
| 1931 |
void VCXProjectWriter::outputFileConfig(XmlOutput &xml, XmlOutput &xmlFilter, |
| 1932 |
const QString &filePath, const QString &filterName) |
| 1933 |
{ |
| 1934 |
const QString nativeFilePath = Option::fixPathToTargetOS(filePath); |
| 1935 |
if (filterName.startsWith("Source Files")) { |
| 1936 |
xmlFilter << tag("ClCompile") |
| 1937 |
<< attrTag("Include", nativeFilePath) |
| 1938 |
<< attrTagS("Filter", filterName); |
| 1939 |
xml << tag("ClCompile") |
| 1940 |
<< attrTag("Include", nativeFilePath); |
| 1941 |
} else if (filterName.startsWith("Header Files")) { |
| 1942 |
xmlFilter << tag("ClInclude") |
| 1943 |
<< attrTag("Include", nativeFilePath) |
| 1944 |
<< attrTagS("Filter", filterName); |
| 1945 |
xml << tag("ClInclude") |
| 1946 |
<< attrTag("Include", nativeFilePath); |
| 1947 |
} else if (filterName.startsWith("Generated Files") || filterName.startsWith("Form Files")) { |
| 1948 |
if (filePath.endsWith(".h")) { |
| 1949 |
xmlFilter << tag("ClInclude") |
| 1950 |
<< attrTag("Include", nativeFilePath) |
| 1951 |
<< attrTagS("Filter", filterName); |
| 1952 |
xml << tag("ClInclude") |
| 1953 |
<< attrTag("Include", nativeFilePath); |
| 1954 |
} else if (isFileClCompatible(filePath)) { |
| 1955 |
xmlFilter << tag("ClCompile") |
| 1956 |
<< attrTag("Include", nativeFilePath) |
| 1957 |
<< attrTagS("Filter", filterName); |
| 1958 |
xml << tag("ClCompile") |
| 1959 |
<< attrTag("Include", nativeFilePath); |
| 1960 |
} else if (filePath.endsWith(".res")) { |
| 1961 |
xmlFilter << tag("CustomBuild") |
| 1962 |
<< attrTag("Include", nativeFilePath) |
| 1963 |
<< attrTagS("Filter", filterName); |
| 1964 |
xml << tag("CustomBuild") |
| 1965 |
<< attrTag("Include", nativeFilePath); |
| 1966 |
} else { |
| 1967 |
xmlFilter << tag("CustomBuild") |
| 1968 |
<< attrTag("Include", nativeFilePath) |
| 1969 |
<< attrTagS("Filter", filterName); |
| 1970 |
xml << tag("CustomBuild") |
| 1971 |
<< attrTag("Include", nativeFilePath); |
| 1972 |
} |
| 1973 |
} else if (filterName.startsWith("Root Files")) { |
| 1974 |
if (filePath.endsWith(".rc")) { |
| 1975 |
xmlFilter << tag("ResourceCompile") |
| 1976 |
<< attrTag("Include", nativeFilePath); |
| 1977 |
xml << tag("ResourceCompile") |
| 1978 |
<< attrTag("Include", nativeFilePath); |
| 1979 |
} |
| 1980 |
} else { |
| 1981 |
xmlFilter << tag("None") |
| 1982 |
<< attrTag("Include", nativeFilePath) |
| 1983 |
<< attrTagS("Filter", filterName); |
| 1984 |
xml << tag("None") |
| 1985 |
<< attrTag("Include", nativeFilePath); |
| 1986 |
} |
| 1987 |
} |
| 1988 |
|
| 1989 |
QString VCXProjectWriter::generateCondition(const VCConfiguration &config) |
| 1990 |
{ |
| 1991 |
return QStringLiteral("'$(Configuration)|$(Platform)'=='") + config.Name + QLatin1Char('\''); |
| 1992 |
} |
| 1993 |
|
| 1994 |
XmlOutput::xml_output VCXProjectWriter::attrTagToolsVersion(const VCConfiguration &config) |
| 1995 |
{ |
| 1996 |
if (config.CompilerVersion >= NET2013) |
| 1997 |
return noxml(); |
| 1998 |
return attrTag("ToolsVersion", "4.0"); |
| 1999 |
} |
| 2000 |
|
| 2001 |
QT_END_NAMESPACE |