// Copyright Epic Games, Inc. All Rights Reserved.
using System.Collections.Generic;
using System.Text;
using EpicGames.Core;
using Microsoft.Extensions.Logging;
namespace UnrealBuildTool
{
///
/// Base class for platform-specific project generators
///
class WindowsProjectGenerator : PlatformProjectGenerator
{
///
/// Constructor
///
/// Command line arguments passed to the project generator
/// Logger for output
public WindowsProjectGenerator(CommandLineArguments Arguments, ILogger Logger)
: base(Arguments, Logger)
{
}
///
public override IEnumerable GetPlatforms()
{
yield return UnrealTargetPlatform.Win64;
}
///
public override string GetVisualStudioPlatformName(VSSettings InVSSettings)
{
if (InVSSettings.Platform == UnrealTargetPlatform.Win64)
{
if (InVSSettings.Architecture == UnrealArch.Arm64)
{
return "arm64";
}
else if (InVSSettings.Architecture == UnrealArch.Arm64ec)
{
return "arm64ec";
}
return "x64";
}
return InVSSettings.Platform.ToString();
}
///
public override string GetVisualStudioUserFileStrings(VisualStudioUserFileSettings VCUserFileSettings, VSSettings InVSSettings, string InConditionString, TargetRules InTargetRules, FileReference TargetRulesPath, FileReference ProjectFilePath, FileReference? NMakeOutputPath, string ProjectName, string? ForeignUProjectPath)
{
StringBuilder VCUserFileContent = new StringBuilder();
string LocalOrRemoteString = InVSSettings.Architecture == null || InVSSettings.Architecture.Value == UnrealArch.Host.Value
? "Local" : "Remote";
VCUserFileContent.AppendLine(" ", InConditionString);
if (InTargetRules.Type != TargetType.Game)
{
string DebugOptions = "";
if (ForeignUProjectPath != null)
{
DebugOptions += ForeignUProjectPath;
DebugOptions += " -skipcompile";
}
else if (InTargetRules.Type == TargetType.Editor && InTargetRules.ProjectFile != null)
{
DebugOptions += ProjectName;
}
VCUserFileContent.AppendLine($" <{LocalOrRemoteString}DebuggerCommandArguments>{DebugOptions}{LocalOrRemoteString}DebuggerCommandArguments>");
}
VCUserFileContent.AppendLine($" Windows{LocalOrRemoteString}Debugger");
VCUserFileContent.AppendLine(" ");
return VCUserFileContent.ToString();
}
///
public override bool RequiresVSUserFileGeneration()
{
return true;
}
///
public override IList GetSystemIncludePaths(UEBuildTarget InTarget)
{
List Result = new List();
foreach (DirectoryReference Path in InTarget.Rules.WindowsPlatform.Environment!.IncludePaths)
{
Result.Add(Path.FullName);
}
return Result;
}
}
}