1
0
mirror of https://github.com/aportelli/LatAnalyze.git synced 2024-11-10 00:45:36 +00:00

adding git information

This commit is contained in:
Antonin Portelli 2024-02-10 10:55:49 +01:00
parent 341b4bc73b
commit 656ae91fe5
4 changed files with 22 additions and 5 deletions

View File

@ -1,8 +1,16 @@
# rpath config
set(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE)
set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_LIBDIR}")
# config.h header for package version and name
execute_process(
COMMAND git rev-parse --short HEAD
OUTPUT_VARIABLE LATAN_SHORT_SHA
OUTPUT_STRIP_TRAILING_WHITESPACE)
execute_process(
COMMAND git rev-parse HEAD
OUTPUT_VARIABLE LATAN_SHA
OUTPUT_STRIP_TRAILING_WHITESPACE)
execute_process(
COMMAND git rev-parse --abbrev-ref HEAD
OUTPUT_VARIABLE LATAN_BRANCH
OUTPUT_STRIP_TRAILING_WHITESPACE)
configure_file(config.h.in ${CMAKE_CURRENT_BINARY_DIR}/config.h @ONLY)
# find bison & flex

View File

@ -25,9 +25,12 @@ using namespace Latan;
PlaceHolder Latan::_;
const string Env::fullName = strFrom(PROJECT_NAME) + " v" + strFrom(PROJECT_VERSION);
const string Env::fullName = strFrom(PROJECT_NAME) + " " + strFrom(LATAN_SHORT_SHA) + " (v" + strFrom(PROJECT_VERSION) + ")";
const string Env::name = PROJECT_NAME;
const string Env::version = PROJECT_VERSION;
const string Env::gitShortSha = LATAN_SHORT_SHA;
const string Env::gitSha = LATAN_SHA;
const string Env::gitBranch = LATAN_BRANCH;
const string Env::msgPrefix = "[" + Env::fullName + "] ";
void Env::function(void)

View File

@ -54,6 +54,9 @@ namespace Env
extern const std::string fullName;
extern const std::string name;
extern const std::string version;
extern const std::string gitShortSha;
extern const std::string gitSha;
extern const std::string gitBranch;
extern const std::string msgPrefix;
// empty function for library test
void function(void);

View File

@ -1,2 +1,5 @@
#cmakedefine PROJECT_NAME "@PROJECT_NAME@"
#cmakedefine PROJECT_VERSION "@PROJECT_VERSION@"
#cmakedefine LATAN_SHORT_SHA "@LATAN_SHORT_SHA@"
#cmakedefine LATAN_SHA "@LATAN_SHA@"
#cmakedefine LATAN_BRANCH "@LATAN_BRANCH@"