Add support for an "Update #" appendix to the version string

This is for informative output only, so that any code depending
on the LAMMPS_VERSION define will not have to be changed and no
warnings will be printed etc.
This commit is contained in:
Axel Kohlmeyer
2021-10-17 18:05:29 -04:00
parent 1e9da5a25b
commit 26b368848b
2 changed files with 10 additions and 4 deletions

View File

@ -59,6 +59,12 @@
#include "lmpinstalledpkgs.h"
#include "lmpgitversion.h"
#if defined(LAMMPS_UPDATE)
#define UPDATE_STRING " - " LAMMPS_UPDATE
#else
#define UPDATE_STRING ""
#endif
static void print_style(FILE *fp, const char *str, int &pos);
struct LAMMPS_NS::package_styles_lists {
@ -509,7 +515,7 @@ LAMMPS::LAMMPS(int narg, char **arg, MPI_Comm communicator) :
}
if ((universe->me == 0) && !helpflag)
utils::logmesg(this,fmt::format("LAMMPS ({})\n",version));
utils::logmesg(this,fmt::format("LAMMPS ({}{})\n",version,UPDATE_STRING));
// universe is one or more worlds, as setup by partition switch
// split universe communicator into separate world communicators
@ -1137,10 +1143,10 @@ void _noopt LAMMPS::help()
if (has_git_info) {
fprintf(fp,"\nLarge-scale Atomic/Molecular Massively Parallel Simulator - "
LAMMPS_VERSION "\nGit info (%s / %s)\n\n",git_branch, git_descriptor);
LAMMPS_VERSION UPDATE_STRING "\nGit info (%s / %s)\n\n",git_branch, git_descriptor);
} else {
fprintf(fp,"\nLarge-scale Atomic/Molecular Massively Parallel Simulator - "
LAMMPS_VERSION "\n\n");
LAMMPS_VERSION UPDATE_STRING "\n\n");
}
fprintf(fp,
"Usage example: %s -var t 300 -echo screen -in in.alloy\n\n"

View File

@ -8,7 +8,7 @@ add_test(NAME RunLammps
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
set_tests_properties(RunLammps PROPERTIES
ENVIRONMENT "TSAN_OPTIONS=ignore_noninstrumented_modules=1;HWLOC_HIDE_ERRORS=1"
PASS_REGULAR_EXPRESSION "^LAMMPS \\([0-9]+ [A-Za-z]+ 2[0-9][0-9][0-9]\\)")
PASS_REGULAR_EXPRESSION "LAMMPS \\([0-9]+ [A-Za-z]+ 2[0-9][0-9][0-9]( - Update [0-9]+)?\\)")
# check if the compiled executable will print the help message
add_test(NAME HelpMessage