Unity Build Technique for C++ Application Compilation
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
Current software development build cycles for large C++ projects are processor, memory, and hard drive intensive, leading to significantly reduced developer productivity due to long build times, which can delay time-to-market and increase defect counts.
Innovation Solution
Implementing a unity build technique that compiles all source files into a single or few object files by referencing all source files in a unity file, reducing disk reads and writes, and automating the generation of unity source files to streamline the build process.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Productivity
If traditional compilation method is used for large C++ projects, then each source file is compiled separately into object files which are then linked, but this results in repeated reading and parsing of header files and long build times
Solution Approach 1:
The patent merges multiple source files into a single unity file that includes all source code. This unity file is then compiled once to produce a single object file, eliminating the need for separate compilation and linking of individual source files. The merging principle directly resolves the technical contradiction by consolidating the build process to avoid repeated header file parsing and multiple disk I/O operations.
2Productivity
If build frequency is increased to improve productivity, then more unit testing can be performed, but build times become excessively long and consume excessive processor, memory and hard drive resources
Solution Approach 1:
By merging all source files into a unity file and compiling them as a single unit, the patent dramatically reduces the computational resources required per build. The single compilation pass eliminates redundant header file parsing and reduces the number of object file generations, allowing developers to build more frequently without overloading system resources.
3Ease of manufacture
If source files are compiled separately into multiple object files, then modular compilation is achieved, but this results in multiple disk reads and writes and extended link times
Solution Approach 1:
The patent combines multiple compilation stages into a single compilation operation. Instead of compiling each source file separately and then linking object files, the unity file approach performs one compilation that produces a single object file ready for linking. This reduces the number of build stages and disk I/O operations while maintaining the ability to organize source code in a structured manner within the unity file.
Data Source
AI summary
An apparatus is provided for building an application. The apparatus may include at least one memory and at least one processor configured to generate a build of an application in a C Object-Oriented Programming Language. The processor is also configured to generate a unity file including a plurality of source files having references to one or more header files. At least two of the source files include references to a same header file. The processor is also configured to compile the unity file including the plurality of source files to obtain an object file. The processor is also configured to link the object file to generate an executable of the application. Corresponding computer program products and methods are also provided.


