Hey so I have been doing some refactoring of our 2yr old codebase to boost our compile times, had some great increases by switching over from using our PCH setup to using the iwyu style.
our MyProject.Build.cs file now has
MinFilesUsingPrecompiledHeaderOverride = 1;
bFasterWithoutUnity = true;
PCHUsage = PCHUsageMode.UseExplicitOrSharedPCHs;
bEnforceIWYU = true;
PrivatePCHHeaderFile = "MyProject.h";
Which works very well, our pch file now just contains,
#include "CoreMinimal.h"
#include "ModuleManager.h"
class FMyProjectModule
: public IModuleInterface
{
public:
virtual void StartupModule() override;
virtual void ShutdownModule() override;
virtual bool IsGameModule() const override;
};
Which just has some of the startup stuff overridden to add a custom shader directory for our pak file to include correctly. The last thing I wanted to get running was the IncludeTool.exe (IncludeTool | Unreal Engine Documentation) to parse our project for additional dependencies that I could then remove from our compile times.
But atm when running the tool with the options
-Mode=Optimize -Target=MyProjectEditor -Platform=Linux -Configuration=Development -WorkingDir=D:/MyProject/ -OutputDir=D:\Output -SourceFiles=-/Engine/... -
I get an exception thrown in the Program.cs Line 867 which is trying to run the UnrealBuildTool over the project directory which is converted to
if (Utility.Run(UnrealBuildTool, String.Format("-Mode=JsonExport {0} {1} {2}{3} -disableunity -xgeexport -nobuilduht -nopch -nodebuginfo -outputfile=\"{4}\"", Target, Configuration, Platform, Precompile? " -precompile" : "", TaskListFile.ChangeExtension(".json").FullName), WorkingDir, Log) != 0)
Where
UnrealBuildTool = {D:\UnrealEngine\UnrealEngine-release\Engine\Binaries\DotNET\UnrealBuildTool.exe}
Target="MyProjectEditor"
Configuration=Development
Platform=Linux
Precompile=false
TaskListFile = { CanonicalName = "d:\\MyProject\\targets\\MyProjectEditor linux development.xml"; Directory = {D:\MyProject\Targets}; FullName = "D:\\MyProject\\Targets\\MyProjectEditor Linux Development.xml"; }
WorkingDir = {D:\UnrealEngine\UnrealEngine-release\Engine}
And I don’t know enough about this tool to know if I need to possibly change its working directory (like the visual studio option for the working directory) or if I need to pass a different param, the comments for the arguments are very ‘succinct’ but unfortunately as vague as a programmer can get
/// <summary>
/// Working directory for optimization data and reports
/// </summary>
[CommandLineOption(IsRequired = true)]
public string WorkingDir;
Any help about the environment setup for running this tool over a non-engine folder or setup that anyone else would know any information about would be appreciated, atm I am enjoying the fact that my incremental compile times have already dropped from 85secs to 25secs, which is massive for development, especially without needing to relaunch the editor with the 4.22 live coding (experimental) additions. It has already made development so much less of a headache to change source files, but I am always interested in knowing what our dependency chains in the project currently are and where I might be able to improve our architecture to possibly get this down as close to a 10sec compile as I can. Thanks in advance for any advice.