Quake Wars Unity Build

Arne Olav Hallingstad
10th October 2009


Unity Build is a way of compiling a project where all the source files are combined into a single file before compilation. See this link for more information.

Some disadvantages:

I added a unity build configuration for debug and release for the Quake Wars 1.5 SDK. The SDK includes the game project files, idlib project files and iddecllib project files.

Unity build files were created for all three of them, a python script were used to extract the source files from the project files.

To exclude all source files from the build process except the unity files a simple find/replace regular expression were used in the 3 project files, although it would make more sense to use a define at the top of all source files so they could be excluded by defining/undefining it.

Regexp find:
Regexp replace:
\1\n\2\3\n<FileConfiguration\n\2\tName="Unity Build Debug with edit and continue|Win32"\n\2\tExcludedFromBuild="true"\n\2\t>\n\2\t<Tool\n\2\t\tName="VCCustomBuildTool"\n\2\t/>\n\2</FileConfiguration>

The idlib project constains 80 source files, iddecllib project contains 33 source files and game project contains 230 source files.

Compile Times

Compiles were run twice for each configuration, only the second run compile times were noted

=== Debug with edit and continue ===

idLib:		11 seconds
libGameDecl:	9 seconds
game:		2:00 seconds
Total time	2:20 seconds

=== Unity Build Debug with edit and continue ===

idLib:		3 seconds
libGameDecl:	3 seconds
game:		32 seconds
Total time	38 seconds

73,9% reduction in compile time from using a unity build

=== Release ===

idLib:		1:07 seconds
libGameDecl:	25 seconds
game:		6:00 seconds
Total time	7:32 seconds

=== Unity Build Release ===

idLib:		1:03 seconds
libGameDecl:	16 seconds
game:		5:03 seconds
Total time	6:22 seconds

15,5% reduction in compile time from using a unity build

Here's an example unity build output from a compile with some pragma messages to help see what's going on.


Greatly reduced build times for debug where a rebuild is needed, but for release there seems to be little benefit.


Creative Commons License
This work is licensed under a Creative Commons Attribution 3.0 Unported License.