-
Notifications
You must be signed in to change notification settings - Fork 1
Unity build
Robert Doczi edited this page Oct 29, 2015
·
1 revision
The main idea behind unity build is to create several unity files that include multiple .cc
files. The build then consists of compiling these unity files (instead of the original .cc
files) and linking them together.
Pros | Cons |
---|---|
Faster compilation | limited incrementality |
Faster linking | |
Better code optimalization | |
Smaller output size |
Unity build requires the following components to be generated:
- for each uml component a unity build file containing includes to every class inside the component
- a unity build file for the external components including every
.cc
for external classes - a unity build file for the runtime including every
.cc
file inside the runtime - a unity build file including
main.cc
To avoid interference with regular build, the unity build files either have to have different extensions (so rules.mk files don't try to include them in normal build), this requires a separate makefile, or collecting the unity build files in a separate directory, this way the original makefile can be extended with the additional make rule unity
which allows specifying build type via a parameter to the make call.