stepcode/stepcode — pull request #289 by mpictor (2014-02-27 02:15:06+00:00)
Title: Split generated code

Create a header and an implementation file for each generated class.

Smaller files load much faster in debuggers and IDEs, but actually increase compilation time. To solve this, we do a 'unity' build unless a limited compiler is detected. In unity builds, many small files are #included in one larger file, reducing the number of translation units the compiler must deal with. Using two unity files per schema seems to be faster than both many small files and the original, where 95% of the code was in a single file.

For CMake to know what the many small generated files will be named, it is necessary to parse the schemas during the configure stage. A parser is built using libexpress which reads each schema and creates a CMakeLists.txt for that schema. This turned out to be far faster than an earlier attempt of mine where file names were printed on stdout and reassembled into lists by CMake.