public UHTManifest(UEBuildTarget Target, string InRootLocalPath, string InRootBuildPath, IEnumerable <UHTModuleInfo> ModuleInfo)
        {
            IsGameTarget  = TargetRules.IsGameType(Target.TargetType);
            RootLocalPath = InRootLocalPath;
            RootBuildPath = InRootBuildPath;
            TargetName    = Target.GetTargetName();

            Modules = ModuleInfo.Select(Info => new Module {
                Name                     = Info.ModuleName,
                ModuleType               = Info.ModuleType,
                BaseDirectory            = Info.ModuleDirectory,
                IncludeBase              = Info.ModuleDirectory,
                OutputDirectory          = Path.GetDirectoryName(Info.GeneratedCPPFilenameBase),
                ClassesHeaders           = Info.PublicUObjectClassesHeaders.Select((Header) => Header.AbsolutePath).ToList(),
                PublicHeaders            = Info.PublicUObjectHeaders.Select((Header) => Header.AbsolutePath).ToList(),
                PrivateHeaders           = Info.PrivateUObjectHeaders.Select((Header) => Header.AbsolutePath).ToList(),
                PCH                      = Info.PCH,
                GeneratedCPPFilenameBase = Info.GeneratedCPPFilenameBase,
                //@todo.Rocket: This assumes Engine/Source is a 'safe' folder name to check for
                SaveExportedHeaders = !UnrealBuildTool.RunningRocket() || !Info.ModuleDirectory.Contains("Engine\\Source\\")
            }).ToList();
        }
        public UHTManifest(UEBuildTarget Target, string InRootLocalPath, string InRootBuildPath, IEnumerable <UHTModuleInfo> ModuleInfo)
        {
            IsGameTarget  = TargetRules.IsGameType(Target.TargetType);
            RootLocalPath = InRootLocalPath;
            RootBuildPath = InRootBuildPath;
            TargetName    = Target.GetTargetName();

            Modules = ModuleInfo.Select(Info => new Module
            {
                Name                     = Info.ModuleName,
                ModuleType               = Info.ModuleType,
                BaseDirectory            = Info.ModuleDirectory,
                IncludeBase              = Info.ModuleDirectory,
                OutputDirectory          = Path.GetDirectoryName(Info.GeneratedCPPFilenameBase),
                ClassesHeaders           = Info.PublicUObjectClassesHeaders.Select((Header) => Header.AbsolutePath).ToList(),
                PublicHeaders            = Info.PublicUObjectHeaders.Select((Header) => Header.AbsolutePath).ToList(),
                PrivateHeaders           = Info.PrivateUObjectHeaders.Select((Header) => Header.AbsolutePath).ToList(),
                PCH                      = Info.PCH,
                GeneratedCPPFilenameBase = Info.GeneratedCPPFilenameBase,
                SaveExportedHeaders      = !UnrealBuildTool.IsEngineInstalled() || !new DirectoryReference(Info.ModuleDirectory).IsUnderDirectory(UnrealBuildTool.EngineDirectory),
                UHTGeneratedCodeVersion  = Info.GeneratedCodeVersion,
            }).ToList();
        }
        /**
         *	Setup the target environment for building
         *
         *	@param	InBuildTarget		The target being built
         */
        public override void SetUpEnvironment(UEBuildTarget InBuildTarget)
        {
            InBuildTarget.GlobalCompileEnvironment.Config.Definitions.Add("WIN32=1");

            // Should we enable Windows XP support
            if ((InBuildTarget.TargetType == TargetRules.TargetType.Program) && (GetCPPTargetPlatform(InBuildTarget.Platform) == CPPTargetPlatform.Win32))
            {
                // Check if the target has requested XP support.
                if (String.Equals(InBuildTarget.Rules.PreferredSubPlatform, "WindowsXP", StringComparison.InvariantCultureIgnoreCase))
                {
                    SupportWindowsXP = true;
                }
            }

            if (WindowsPlatform.bUseWindowsSDK10 && WindowsPlatform.Compiler == WindowsCompiler.VisualStudio2015)
            {
                if (SupportWindowsXP)
                {
                    throw new NotSupportedException("Windows XP support is not possible when targeting the Windows 10 SDK");
                }
                // Windows 8 or higher required
                InBuildTarget.GlobalCompileEnvironment.Config.Definitions.Add("_WIN32_WINNT=0x0602");
                InBuildTarget.GlobalCompileEnvironment.Config.Definitions.Add("WINVER=0x0602");
            }
            else
            {
                if (SupportWindowsXP)
                {
                    // Windows XP SP3 or higher required
                    InBuildTarget.GlobalCompileEnvironment.Config.Definitions.Add("_WIN32_WINNT=0x0502");
                    InBuildTarget.GlobalCompileEnvironment.Config.Definitions.Add("WINVER=0x0502");
                }
                else
                {
                    // Windows Vista or higher required
                    InBuildTarget.GlobalCompileEnvironment.Config.Definitions.Add("_WIN32_WINNT=0x0600");
                    InBuildTarget.GlobalCompileEnvironment.Config.Definitions.Add("WINVER=0x0600");
                }
            }
            InBuildTarget.GlobalCompileEnvironment.Config.Definitions.Add("PLATFORM_WINDOWS=1");

            String MorpheusShaderPath = Path.Combine(BuildConfiguration.RelativeEnginePath, "Shaders/PS4/PostProcessHMDMorpheus.usf");

            if (File.Exists(MorpheusShaderPath))
            {
                InBuildTarget.GlobalCompileEnvironment.Config.Definitions.Add("HAS_MORPHEUS=1");

                //on PS4 the SDK now handles distortion correction.  On PC we will still have to handle it manually,
                InBuildTarget.GlobalCompileEnvironment.Config.Definitions.Add("MORPHEUS_ENGINE_DISTORTION=1");
            }

            if (InBuildTarget.Rules != null)
            {
                // Explicitly exclude the MS C++ runtime libraries we're not using, to ensure other libraries we link with use the same
                // runtime library as the engine.
                bool bUseDebugCRT = InBuildTarget.Configuration == UnrealTargetConfiguration.Debug && BuildConfiguration.bDebugBuildsActuallyUseDebugCRT;
                if (!InBuildTarget.Rules.bUseStaticCRT || bUseDebugCRT)
                {
                    InBuildTarget.GlobalLinkEnvironment.Config.ExcludedLibraries.Add("LIBCMT");
                    InBuildTarget.GlobalLinkEnvironment.Config.ExcludedLibraries.Add("LIBCPMT");
                }
                if (!InBuildTarget.Rules.bUseStaticCRT || !bUseDebugCRT)
                {
                    InBuildTarget.GlobalLinkEnvironment.Config.ExcludedLibraries.Add("LIBCMTD");
                    InBuildTarget.GlobalLinkEnvironment.Config.ExcludedLibraries.Add("LIBCPMTD");
                }
                if (InBuildTarget.Rules.bUseStaticCRT || bUseDebugCRT)
                {
                    InBuildTarget.GlobalLinkEnvironment.Config.ExcludedLibraries.Add("MSVCRT");
                    InBuildTarget.GlobalLinkEnvironment.Config.ExcludedLibraries.Add("MSVCPRT");
                }
                if (InBuildTarget.Rules.bUseStaticCRT || !bUseDebugCRT)
                {
                    InBuildTarget.GlobalLinkEnvironment.Config.ExcludedLibraries.Add("MSVCRTD");
                    InBuildTarget.GlobalLinkEnvironment.Config.ExcludedLibraries.Add("MSVCPRTD");
                }
                InBuildTarget.GlobalLinkEnvironment.Config.ExcludedLibraries.Add("LIBC");
                InBuildTarget.GlobalLinkEnvironment.Config.ExcludedLibraries.Add("LIBCP");
                InBuildTarget.GlobalLinkEnvironment.Config.ExcludedLibraries.Add("LIBCD");
                InBuildTarget.GlobalLinkEnvironment.Config.ExcludedLibraries.Add("LIBCPD");

                //@todo ATL: Currently, only VSAccessor requires ATL (which is only used in editor builds)
                // When compiling games, we do not want to include ATL - and we can't when compiling Rocket games
                // due to VS 2012 Express not including ATL.
                // If more modules end up requiring ATL, this should be refactored into a BuildTarget flag (bNeedsATL)
                // that is set by the modules the target includes to allow for easier tracking.
                // Alternatively, if VSAccessor is modified to not require ATL than we should always exclude the libraries.
                if (InBuildTarget.ShouldCompileMonolithic() && (InBuildTarget.Rules != null) &&
                    (TargetRules.IsGameType(InBuildTarget.TargetType)) && (TargetRules.IsEditorType(InBuildTarget.TargetType) == false))
                {
                    InBuildTarget.GlobalLinkEnvironment.Config.ExcludedLibraries.Add("atl");
                    InBuildTarget.GlobalLinkEnvironment.Config.ExcludedLibraries.Add("atls");
                    InBuildTarget.GlobalLinkEnvironment.Config.ExcludedLibraries.Add("atlsd");
                    InBuildTarget.GlobalLinkEnvironment.Config.ExcludedLibraries.Add("atlsn");
                    InBuildTarget.GlobalLinkEnvironment.Config.ExcludedLibraries.Add("atlsnd");
                }

                // Add the library used for the delayed loading of DLLs.
                InBuildTarget.GlobalLinkEnvironment.Config.AdditionalLibraries.Add("delayimp.lib");

                //@todo - remove once FB implementation uses Http module
                if (UEBuildConfiguration.bCompileAgainstEngine)
                {
                    // link against wininet (used by FBX and Facebook)
                    InBuildTarget.GlobalLinkEnvironment.Config.AdditionalLibraries.Add("wininet.lib");
                }

                // Compile and link with Win32 API libraries.
                InBuildTarget.GlobalLinkEnvironment.Config.AdditionalLibraries.Add("rpcrt4.lib");
                //InBuildTarget.GlobalLinkEnvironment.Config.AdditionalLibraries.Add("wsock32.lib");
                InBuildTarget.GlobalLinkEnvironment.Config.AdditionalLibraries.Add("ws2_32.lib");
                InBuildTarget.GlobalLinkEnvironment.Config.AdditionalLibraries.Add("dbghelp.lib");
                InBuildTarget.GlobalLinkEnvironment.Config.AdditionalLibraries.Add("comctl32.lib");
                InBuildTarget.GlobalLinkEnvironment.Config.AdditionalLibraries.Add("Winmm.lib");
                InBuildTarget.GlobalLinkEnvironment.Config.AdditionalLibraries.Add("kernel32.lib");
                InBuildTarget.GlobalLinkEnvironment.Config.AdditionalLibraries.Add("user32.lib");
                InBuildTarget.GlobalLinkEnvironment.Config.AdditionalLibraries.Add("gdi32.lib");
                InBuildTarget.GlobalLinkEnvironment.Config.AdditionalLibraries.Add("winspool.lib");
                InBuildTarget.GlobalLinkEnvironment.Config.AdditionalLibraries.Add("comdlg32.lib");
                InBuildTarget.GlobalLinkEnvironment.Config.AdditionalLibraries.Add("advapi32.lib");
                InBuildTarget.GlobalLinkEnvironment.Config.AdditionalLibraries.Add("shell32.lib");
                InBuildTarget.GlobalLinkEnvironment.Config.AdditionalLibraries.Add("ole32.lib");
                InBuildTarget.GlobalLinkEnvironment.Config.AdditionalLibraries.Add("oleaut32.lib");
                InBuildTarget.GlobalLinkEnvironment.Config.AdditionalLibraries.Add("uuid.lib");
                InBuildTarget.GlobalLinkEnvironment.Config.AdditionalLibraries.Add("odbc32.lib");
                InBuildTarget.GlobalLinkEnvironment.Config.AdditionalLibraries.Add("odbccp32.lib");
                InBuildTarget.GlobalLinkEnvironment.Config.AdditionalLibraries.Add("netapi32.lib");
                InBuildTarget.GlobalLinkEnvironment.Config.AdditionalLibraries.Add("iphlpapi.lib");
                InBuildTarget.GlobalLinkEnvironment.Config.AdditionalLibraries.Add("setupapi.lib"); //  Required for access monitor device enumeration

                // Windows Vista/7 Desktop Windows Manager API for Slate Windows Compliance
                if (IsWindowsXPSupported() == false)                            // Windows XP does not support DWM
                {
                    InBuildTarget.GlobalLinkEnvironment.Config.AdditionalLibraries.Add("dwmapi.lib");
                }

                // IME
                InBuildTarget.GlobalLinkEnvironment.Config.AdditionalLibraries.Add("imm32.lib");

                // Setup assembly path for .NET modules.  This will only be used when CLR is enabled. (CPlusPlusCLR module types)
                InBuildTarget.GlobalCompileEnvironment.Config.SystemDotNetAssemblyPaths.Add(
                    Environment.GetFolderPath(Environment.SpecialFolder.ProgramFilesX86) +
                    "/Reference Assemblies/Microsoft/Framework/.NETFramework/v4.0");

                // Setup default assemblies for .NET modules.  These will only be used when CLR is enabled. (CPlusPlusCLR module types)
                InBuildTarget.GlobalCompileEnvironment.Config.FrameworkAssemblyDependencies.Add("System.dll");
                InBuildTarget.GlobalCompileEnvironment.Config.FrameworkAssemblyDependencies.Add("System.Data.dll");
                InBuildTarget.GlobalCompileEnvironment.Config.FrameworkAssemblyDependencies.Add("System.Drawing.dll");
                InBuildTarget.GlobalCompileEnvironment.Config.FrameworkAssemblyDependencies.Add("System.Xml.dll");
                InBuildTarget.GlobalCompileEnvironment.Config.FrameworkAssemblyDependencies.Add("System.Management.dll");
                InBuildTarget.GlobalCompileEnvironment.Config.FrameworkAssemblyDependencies.Add("System.Windows.Forms.dll");
                InBuildTarget.GlobalCompileEnvironment.Config.FrameworkAssemblyDependencies.Add("WindowsBase.dll");
            }

            // Disable Simplygon support if compiling against the NULL RHI.
            if (InBuildTarget.GlobalCompileEnvironment.Config.Definitions.Contains("USE_NULL_RHI=1"))
            {
                UEBuildConfiguration.bCompileSimplygon = false;
            }

            // For 64-bit builds, we'll forcibly ignore a linker warning with DirectInput.  This is
            // Microsoft's recommended solution as they don't have a fixed .lib for us.
            if (InBuildTarget.Platform == UnrealTargetPlatform.Win64)
            {
                InBuildTarget.GlobalLinkEnvironment.Config.AdditionalArguments += " /ignore:4078";
            }
        }