Files
UnrealEngineUWP/Engine/Source/Programs/UnrealBuildTool/System/PrecompiledHeaderInstance.cs
henrik karlsson 5f74d114d5 [UBT]
Changed how single files are built. We don't want to invalidate makefile everytime we build single files since it destroys turnaround times. With this change a single file compile can take 2s (+ the actual compile time).

The new behavior injects a special action per module when creating the makefile. These actions can be used to on-the-fly create a proper compile action that follows the rules of the module that the specific file belongs to.. In a normal build these actions are ignored since the logic deciding which actions to build is backtraced from which binaries we want to create.

When a specific file compile is triggered, the logic deciding which files to build search up all these special actions and create a lookup based on which folders the special actions handle. It then try to find the special action that handles the specific file. The matching special action then creates a compile action that can handle that specific file and then queue up the action for execution. If no special action is found it falls back to try to use actions that have this specific file as input (ispc files for example)

Details:
* Removed lots of custom code for "specific files" handling
* Changed so pch (both private and shared) always use definition file. Added #pragma once and change so pch wrapper file include definition file. This made the adaptive path and specific file easy to implement (just disable pch in compile environment and it will just work)
* Added SingleFileAction for both VCToolChain and ClangToolChain. It now works to compile specific headers and cpp files. (It creates wrapper files on the fly to be able to compile all header files (compiling headers directly blow up if there are circular includes)
* Fixed so GenerateClangDatabase mode works with new changes
* Moved the logic that makes sure all (directly) depending cpp files are recompiled when .h are included in the singlefile option

#preflight 63dcc46f78716a01e8069649
#rb joe.kirchoff

[CL 24094027 by henrik karlsson in ue5-main branch]
2023-02-09 04:20:43 -05:00

69 lines
1.8 KiB
C#

// Copyright Epic Games, Inc. All Rights Reserved.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using UnrealBuildBase;
namespace UnrealBuildTool
{
/// <summary>
/// Information about a PCH instance
/// </summary>
class PrecompiledHeaderInstance
{
/// <summary>
/// The file to include to use this shared PCH
/// </summary>
public FileItem HeaderFile;
/// <summary>
/// The definitions file
/// </summary>
public FileItem DefinitionsFile;
/// <summary>
/// The compile environment for this shared PCH
/// </summary>
public CppCompileEnvironment CompileEnvironment;
/// <summary>
/// The output files for the shared PCH
/// </summary>
public CPPOutput Output;
/// <summary>
/// List of modules using this instance
/// </summary>
public List<UEBuildModuleCPP> Modules = new List<UEBuildModuleCPP>();
/// <summary>
/// These are definitions that are immutable and should never be #undef. There are a few exceptions and we make sure those are not ending up in this list
/// </summary>
public HashSet<string> ImmutableDefinitions;
/// <summary>
/// Constructor
/// </summary>
public PrecompiledHeaderInstance(FileItem HeaderFile, FileItem DefinitionsFile, CppCompileEnvironment CompileEnvironment, CPPOutput Output, HashSet<string> ImmutableDefinitions)
{
this.HeaderFile = HeaderFile;
this.DefinitionsFile = DefinitionsFile;
this.CompileEnvironment = CompileEnvironment;
this.Output = Output;
this.ImmutableDefinitions = ImmutableDefinitions;
}
/// <summary>
/// Return a string representation of this object for debugging
/// </summary>
/// <returns>String representation of the object</returns>
public override string ToString()
{
return HeaderFile.Location.GetFileName();
}
}
}