Improve Compile Times for Unreal Engine with FASTBuild
The Unreal Integration for Meta Quest now provides a distributed code compilation solution based on Unreal_FASTBuild, an open source build system intended for distributed compilation. The FASTBuild implementation can help you improve the build times for large code bases by using distributed Windows computers to build project code in parallel. You can use the Meta Quest integration for FASTBuild to compile your projects with either MSVC or Clang.
Implementation Features
The Meta Quest implementation is based on Unreal_FASTBuild but has been modified to work for newer MSVC toolchains and to support Clang.
FASTBuild relies on a host computer that starts the compilation process and one or more distributed or worker computers to complete the compilation in parallel. The compiler processes Unreal compile actions to determine the correct compiler toolchain to generate for FASTBuild and to rewrite any command line parameters to match the FASTBuild requirements. Any non-compile activities run on the local host machine, such as generating pre-compiled headers, linking libraries, or generating final binaries.
FASTBuild doesn’t support multiple outputs, so the compiler provides results in the FASTBuild report file after it has completed the build process. This functionality means if you cancel a build or it fails for some reason, the process does not save these outputs. In addition, FASTBuild provides built-in caching support for code compiles, so it can retrieve object files from the cache if all inputs match the full file path and checksum.
There is some overhead to running a FASTBuild compile because of preprocessing to gather input files, so don’t enable it unless you have at least one remote computer available.
To Use FASTBuild
The following steps describe prerequisites and how to set up FASTBuild.
Prerequisites
Windows computers accessible via port 31264 on your local network or VPN.
Important: The FASTBuild port should not be exposed on the public internet as anyone can connect to it and run arbitrary commands, which is a potential security risk.
Option 1: Set Up FASTBuild
Configure each remote worker to be discovered through a brokerage location. This value should be a network path accessible by the host and the worker computers. Configure a new environment variable called FASTBUILD_BROKERAGE_PATH to the brokerage location on each computer. For more information, see the FastBuild Network Distribution documentation.
Alternatively, if a network share is unavailable, you can configure a FASTBUILD_WORKERS environment variable on the host machine with a list of remote workers’ host names or IP addresses separated by semicolons (;).
On each remote Windows build computer, also called a worker, open a new command window and run FBuildWorker.exe. The program may prompt you to allow it through the Windows firewall.
Use the FBuildWorker app dialog to adjust the idle settings and the number of CPU cores on each worker. This is shown in the following example:
You should now be able to generate the FASTBuild config file for code compilation, and distribute tasks to remote workers.
Note: Unreal Engine prioritizes IncrediBuild over FASTBuild if you install both, so you may need to uninstall IncrediBuild to use FASTBuild.
See the Troubleshooting documentation on the FASTBuild site if you run into issues.
You can optionally use the open-source FASTBuild Dashboard to visualize the builds.
Option 2: BuildConfiguration.xml
You can also enable FASTBuild using the BuildConfiguration.xml file. You can find this file in various locations, but we recommend you place it in %APPADATA%\Unreal Engine\UnrealBuildTool\BuildConfiguration.xml so it is enabled for all your projects and engine versions.
To enable FASTBuild, edit your BuildConfiguration.xml file and add the line <bAllowFASTBuild>true</bAllowFASTBuild>.
You can also add the line <bUseUBTMakefiles>true</bUseUBTMakefiles> to speed up incremental builds.