Commit 8dd3b045 authored by Peter W. Draper's avatar Peter W. Draper
Browse files

Add current branch name to version descriptions


Former-commit-id: b9db083e67ef819b3cb19a11a6cfabb8dadb44c4
parent a52199ae
......@@ -62,13 +62,16 @@ libswiftsim_mpi_la_SHORTNAME = mpi
# download), allow that, but make sure we know it.
version.h: version.h.in $(AM_SOURCES) $(include_HEADERS) $(noinst_HEADERS)
if test "X$(GIT_CMD)" != "X"; then \
GIT_REVISION=`git describe --abbrev=8 --always --tags --dirty`; \
GIT_REVISION=`$(GIT_CMD) describe --abbrev=8 --always --tags --dirty`; \
GIT_BRANCH=`$(GIT_CMD) symbolic-ref --short HEAD`; \
sed -e "s,@PACKAGE_VERSION\@,$(PACKAGE_VERSION)," \
-e "s,@GIT_REVISION\@,$${GIT_REVISION}," version.h.in > version.h; \
-e "s,@GIT_REVISION\@,$${GIT_REVISION}," \
-e "s,@GIT_BRANCH\@,$${GIT_BRANCH}," version.h.in > version.h; \
else \
if test ! -f version.h; then \
sed -e "s,@PACKAGE_VERSION\@,$(PACKAGE_VERSION)," \
-e "s,@GIT_REVISION\@,unknown," version.h.in > version.h; \
-e "s,@GIT_REVISION\@,unknown," \
-e "s,@GIT_BRANCH\@,unknown," version.h.in > version.h; \
fi; \
fi
......
......@@ -35,6 +35,17 @@ const char *git_revision(void) {
return revision;
}
/**
* @brief Return the source code git branch
*
* @details The name of the current branch when the code was last built.
*/
const char *git_branch(void) {
static const char *branch = GIT_BRANCH;
return branch;
}
/**
* @brief The version of SWIFT
*/
......@@ -50,8 +61,8 @@ const char *package_description(void) {
static char buf[256];
static int initialised = 0;
if (!initialised) {
sprintf(buf, "SWIFT version: %s, at revision: %s", PACKAGE_VERSION,
GIT_REVISION);
sprintf(buf, "SWIFT version: %s, at revision: %s, branch: %s",
PACKAGE_VERSION, GIT_REVISION, GIT_BRANCH);
initialised = 1;
}
return buf;
......@@ -72,6 +83,6 @@ void greetings(void) {
printf(" SPH With Inter-dependent Fine-grained Tasking\n\n");
printf(" Version : %s\n", package_version());
printf(" Revision: %s\n", git_revision());
printf(" Revision: %s, branch: %s\n", git_revision(), git_branch());
printf(" Webpage : www.swiftsim.com\n\n");
}
......@@ -27,10 +27,12 @@
#define PACKAGE_VERSION "@PACKAGE_VERSION@"
#define GIT_REVISION "@GIT_REVISION@"
#define GIT_BRANCH "@GIT_BRANCH@"
const char* package_description( void );
const char* package_description(void);
const char* package_version(void);
const char* git_revision(void);
const char* git_branch(void);
void greetings(void);
#endif /* SWIFT_VERSION_H */
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment