// Copyright Epic Games, Inc. All Rights Reserved.
using System;
using System.Collections.Generic;
using System.Text;
using System.Diagnostics;
using System.IO;
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)
{
}
///
/// Enumerate all the platforms that this generator supports
///
public override IEnumerable GetPlatforms()
{
yield return UnrealTargetPlatform.Win64;
}
///
/// VisualStudio project generation functions
///
///
/// Return the VisualStudio platform name for this build platform
///
/// The UnrealTargetPlatform being built
/// The UnrealTargetConfiguration being built
/// string The name of the platform that VisualStudio recognizes
public override string GetVisualStudioPlatformName(UnrealTargetPlatform InPlatform, UnrealTargetConfiguration InConfiguration)
{
if (InPlatform == UnrealTargetPlatform.Win64)
{
return "x64";
}
return InPlatform.ToString();
}
public override string GetVisualStudioUserFileStrings(UnrealTargetPlatform InPlatform, UnrealTargetConfiguration InConfiguration, string InConditionString, TargetRules InTargetRules, FileReference TargetRulesPath, FileReference ProjectFilePath, string ProjectName, string? ForeignUProjectPath)
{
StringBuilder VCUserFileContent = new StringBuilder();
VCUserFileContent.AppendLine(" ", InConditionString);
if (InTargetRules.Type != TargetType.Game)
{
string DebugOptions = "";
if (ForeignUProjectPath != null)
{
DebugOptions += ForeignUProjectPath;
DebugOptions += " -skipcompile";
}
else if (InTargetRules.Type == TargetType.Editor && ProjectName != ProjectFileGenerator.EngineProjectFileNameBase)
{
DebugOptions += ProjectName;
}
VCUserFileContent.AppendLine(" {0}", DebugOptions);
}
VCUserFileContent.AppendLine(" WindowsLocalDebugger");
VCUserFileContent.AppendLine(" ");
return VCUserFileContent.ToString();
}
public override bool RequiresVSUserFileGeneration()
{
return true;
}
}
}