A new and innovative C++ build system generation mechanism
– a good start point for fully automatic meta-build system technologies
In this article, I want to represent a new and interesting C++ build system generation approach to the C++ developers. It is obvious that the implementation of any new idea requires long therm and dedicated research studies. Therefore, for a long time, as a personal research study, I have been developing a list of software systems to be able to realize this new idea. In my opinion, the lack of automatic and easy to use build system generator stands as a real obstacle on the expansion of C++ ecosystem. However, the new approach which will be explained on the following of this article can be a good start point for developing a fully automatic C++ build system generation technology.
Currently, I have named this technology and its all components as “Pcynlitx.Nova” platform and in the following of this article, I will refer this new build system construction technology with the name “Pcynlitx.Nova”. The Pcynlitx.Nova platform is an open-source, free to use software development tool and it can be available with GPLv3 open-source software license.
– The organization of the source files on the automatic build system generation –
The most critical operation on the build system construction is to determination of the dependencies of each source file existing on the repository. However, in order to construct a C++ build system automatically, the “pcynlitx.nova” needs two different dependency information. The first one is the internal dependencies. In fact, the internal dependencies specifies how the source files on the git repository dependent each others. More specifically, it specifies how the source files of the git repository must be organized in order to perform a successful compilation. On the other hand, the external dependencies specifies the relation of the other libraries, source files and/or header files rather than the git repository itself.

– How this new approach automatizes C++ build systemgeneration process ?
The classical meta build systems (CMAKE and Basel ext.) require writing configuration files manually by the software developer. In many cases, writing the necessary scripts and configuration files (the files such as “CMakeLists.txt” files) requires expertise and significant amount effort. However, on the contrary, in this new approach, the software developer only points the directory location of the git-repository and the external source file locations (the locations of the linking libraries and related header files) to the Pcynlitx.Nova by means of its graphical user interface.

After the selection of the source file directories, the “Pcynlitx.Nova” platform is ready for build system construction process and it reads each source file existing on the project repository line by line and it extracts each dependency information that is required for build system construction. The dependencies are extracted from the key words indicating a dependency to another source. A simple illustration to the dependency resolution process is given below figure.

Finally, the Pcynlitx.Nova writes each configuration files and/or scripts which are required on build system construction with the help of the meta-programs included by “Pcynlitx.Nova” kernel. The target of the pcynlitx.nova project is to provide automation on C++ build system generation and dependency management.
– How this new approach differs form the tools provided by the classical IDEs ?
In this approach, the configuration files of an existing project can be automatically produced from zero to top level. In other words, a relatively big and existing complex project’s configuration files can be totally and automatically are written by the pcynlitx.nova from scratch. Therefore, if a migration is necessary from one build system generator to the others, pcynlitx.nova platform can be used as a translator from one build system to the others ( For instance, CMAKE to Basel ). More specifically, on the current version of the pcynlitx.nova, the platform automatically determines CMAKE targets and writes the related CMakeLists.txt files for you. By this way, the pcynlitx.nova can act as an abstraction mechanism between the C++ developers and the classical meta-build systems and it works on top of the meta-build systems. The relation between the pcynlitx.nova and classical meta-build systems has been depicted on below figure.

– In this approach the version control system as an actor on build system generation
In this new approach, the version control systems ( in the current version of the pcynlitx.nova which only uses git as a version control system ) play crucial role. The pcynlitx.nova platform receives the names files and their corresponding paths which exist on the project repository form the version control system. In addition, the platform can track the change on the repository in therms of file addition or remove. In other words, the version control system ( it is git on the current version of the platform ) works as an actor observing the status of the files on the repository.
– How targets and their dependency relations are determined ?
In brief, as indicated before sections, dependency relations of the each source file are determined from the header files and/or modules which are included on the source files. In this process, various information are collected about each source file which has a dependency relation with the target source file. Meanwhile, the dependency information which is collected is stored into list of data structures including the name of the source files, their paths and their corresponding dependencies in the form of vector data. In order to make an illustration, a very simplified version of this data structures has been illustrated below.

On the next stage, as an upper level container, these data structures are accumulated into a vector. A simplified version of the vector working as top level container for dependency data has been illustrated on below.

Finally, the elements of the vector data including data structures are re-ordered from bigger to the lower according the size of the vector elements including dependency information. In other words, on this operation, the source files are re-ordered based on the total number of their dependencies.

In the figure given above, total dependencies of “source file -2 : ( Src-2 )” is bigger than to the “source file -1: ( Src-1 )”. Therefore, the positions of the data structures are exchanges. This operation is shown in below.

Finally, the source files which are also dependencies of another source file is removed recursively from the vector. The remaining source files are assumed as build system targets. A simple illustration of this operation is given below figure

– Time efficiency of the configuration file generation process
In the kernel of the platform, the code runs in parallel ( the computing intensive parts are multi-threaded ). Therefore, “CMAKE” configuration files and/or GNU-Make files can be written automatically in a reasonable time interval for nontrivial real C++ repositories.
– What about compilation and linking options that are received by the compiler
These options can be set by the developer from pcynlitx.nova platform GUI and the selection of the true options is still on developer responsibility.
– Conclusion
On the current software industry, the one of the most painful problem is the complexity of dependency management. Especially, in C++ applications, the complexity of the dependency management shifts one step further. Therefore, increasing the automation level on the dependency management can be significantly improve the productivity of the C++ developers. The approach which is in fact adding another meta-programming layer on the build system generation can be a good start point for fully automatic C++ build system generation and dependency management technology. The project that has been resented on this article and its outcomes ( the Pcynlitx.Nova ) provides a bright projection to the future studies. Personally, I have perform many tests and I have observed that the pcynlitx.nova can easily write configuration files automatically for non-trivial C++ project. For instance, it can write its own configuration files automatically and the configuration files which are written successfully build its own binaries. In other words, pcynlitx nova can succesfully generate the configuration files for its own build automation. The project Github repository and contact informations for the developer has been given on below.
https://github.com/Erkam-Murat-Bozkurt/pcynlitx.nova
www.linkedin.com/in/erkam-murat-bozkurt
Have a nice day.
Thanks for reading and giving time.
Erkam Murat Bozkurt.