// Copyright Epic Games, Inc. All Rights Reserved. using System.Collections.Generic; using EpicGames.Core; using UnrealBuildBase; namespace UnrealBuildTool { /// /// A template for creating a shared PCH. Instances of it are created depending on the configurations required. /// class PrecompiledHeaderTemplate { /// /// Module providing this PCH. /// public UEBuildModuleCPP Module; /// /// The base compile environment, including all the public compile environment that all consuming modules inherit. /// public CppCompileEnvironment BaseCompileEnvironment; /// /// The header file /// public FileItem HeaderFile; /// /// Output directory for instances of this PCH. /// public DirectoryReference OutputDir; /// /// Instances of this PCH /// public List Instances = new List(); /// /// All the module dependencies this template has /// public HashSet ModuleDependencies = new HashSet(); /// /// Constructor /// /// The module with a valid shared PCH /// The compile environment to use /// The header file to generate a PCH from /// Output directory for instances of this PCH /// All the module dependencies this template has public PrecompiledHeaderTemplate(UEBuildModuleCPP Module, CppCompileEnvironment BaseCompileEnvironment, FileItem HeaderFile, DirectoryReference OutputDir, HashSet ModuleDependencies) { this.Module = Module; this.BaseCompileEnvironment = BaseCompileEnvironment; this.HeaderFile = HeaderFile; this.OutputDir = OutputDir; this.ModuleDependencies = ModuleDependencies; } /// /// Checks whether this template is valid for the given compile environment /// /// Compile environment to check with /// True if the template is compatible with the given compile environment public bool IsValidFor(CppCompileEnvironment CompileEnvironment) { if (CompileEnvironment.bIsBuildingDLL != BaseCompileEnvironment.bIsBuildingDLL) { return false; } if (CompileEnvironment.bIsBuildingLibrary != BaseCompileEnvironment.bIsBuildingLibrary) { return false; } return true; } /// /// Return a string representation of this object for debugging /// /// String representation of the object public override string ToString() { return HeaderFile.AbsolutePath; } } }