Mentions légales du service

Skip to content

[aevol] Print compile commit branch, hash and date

Théotime Grohens requested to merge tgrohens/aevol:print-commit into aevol_7

This commit adds the ability to get the branch, date and hash of the commit that was used to compile Aevol from within the C++ source of Aevol.

This is useful because it allows us to print it (for example) at the beginning of the execution of one of the Aevol programs, making it easier to see whether we're running the right version.

In order to do this, a special file aevol_version.cpp.in is introduced. This file is modified by CMake a first time at configure time, replacing a placeholder with the value of the PROJECT_VERSION CMake variable, and a second time at compile time, replacing a placeholder with a custom CMake variable that holds the branch, hash and date.

This turns the file into a regular C++ source file, that is then compiled and linked with the rest of Aevol through the aevol_version.h header.

Finally, we print this string in the two most commonly used Aevol executables, aevol_create and aevol_run.

Merge request reports