Skip to content

Instantly share code, notes, and snippets.

@jerobarraco
Created September 13, 2020 23:16
Show Gist options
  • Save jerobarraco/92839db6e6305fb04a04bab415ec8ae4 to your computer and use it in GitHub Desktop.
Save jerobarraco/92839db6e6305fb04a04bab415ec8ae4 to your computer and use it in GitHub Desktop.
ue4_26-defines-fix.patch
diff --git a/Engine/Source/Programs/UnrealBuildTool/Configuration/UEBuildModuleCPP.cs b/Engine/Source/Programs/UnrealBuildTool/Configuration/UEBuildModuleCPP.cs
index ad61e4bdf57..9971b8ca9fa 100644
--- a/Engine/Source/Programs/UnrealBuildTool/Configuration/UEBuildModuleCPP.cs
+++ b/Engine/Source/Programs/UnrealBuildTool/Configuration/UEBuildModuleCPP.cs
@@ -437,6 +437,11 @@ namespace UnrealBuildTool
// Write all the definitions to a separate file
CreateHeaderForDefinitions(CompileEnvironment, IntermediateDirectory, null, Graph);
+ // patch
+ if (CompileEnvironment.Definitions.Count > 0)
+ {
+ CompileEnvironment.Definitions.Clear();
+ }
+
// Mapping of source file to unity file. We output this to intermediate directories for other tools (eg. live coding) to use.
Dictionary<FileItem, FileItem> SourceFileToUnityFile = new Dictionary<FileItem, FileItem>();
@@ -923,6 +928,11 @@ namespace UnrealBuildTool
// Write all the definitions out to a separate file
CreateHeaderForDefinitions(CompileEnvironment, IntermediateDirectory, "Adaptive", Graph);
+ // patch
+ if (CompileEnvironment.Definitions.Count > 0)
+ {
+ CompileEnvironment.Definitions.Clear();
+ }
+
// Compile the files
return ToolChain.CompileCPPFiles(CompileEnvironment, Files, IntermediateDirectory, ModuleName, Graph);
}
@@ -935,6 +945,11 @@ namespace UnrealBuildTool
// Write all the definitions out to a separate file
CreateHeaderForDefinitions(CompileEnvironment, IntermediateDirectory, "Adaptive", Graph);
+ // patch
+ if (CompileEnvironment.Definitions.Count > 0){
+ CompileEnvironment.Definitions.Clear();
+ }
+
// Compile the files
return ToolChain.CompileCPPFiles(CompileEnvironment, Files, IntermediateDirectory, ModuleName, Graph);
}
@@ -1005,7 +1020,7 @@ namespace UnrealBuildTool
PrecompiledHeaderInstance Instance = CreatePrivatePCH(ToolChain, FileItem.GetItemByFileReference(FileReference.Combine(ModuleDirectory, Rules.PrivatePCHHeaderFile)), CompileEnvironment, Graph);
CompileEnvironment = new CppCompileEnvironment(CompileEnvironment);
- CompileEnvironment.Definitions.Clear();
+ // CompileEnvironment.Definitions.Clear(); // @TODO: Do not clear definitions prior to end of their usefulness
CompileEnvironment.PrecompiledHeaderAction = PrecompiledHeaderAction.Include;
CompileEnvironment.PrecompiledHeaderIncludeFilename = Instance.HeaderFile.Location;
CompileEnvironment.PrecompiledHeaderFile = Instance.Output.PrecompiledHeaderFile;
@@ -1049,7 +1064,7 @@ namespace UnrealBuildTool
}
CompileEnvironment = new CppCompileEnvironment(CompileEnvironment);
- CompileEnvironment.Definitions.Clear();
+ // CompileEnvironment.Definitions.Clear(); // @todo: Do not clear definitions prior to end of their usefulness
CompileEnvironment.ForceIncludeFiles.Add(PrivateDefinitionsFileItem);
CompileEnvironment.PrecompiledHeaderAction = PrecompiledHeaderAction.Include;
CompileEnvironment.PrecompiledHeaderIncludeFilename = Instance.HeaderFile.Location;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment