Add git commit information to libdfhack-version
git is run every time 'make' is run, but the generated include file is only updated when necessary. Plugins will be loaded successfully if their DFHack version matches core's (assuming OpenLibrary() succeeds), but will produce a warning if their git commit doesn't match core's.develop
parent
0fa5570349
commit
ee7a2c7db7
@ -1,8 +1,23 @@
|
|||||||
#include "DFHackVersion.h"
|
#include "DFHackVersion.h"
|
||||||
|
#include "git-describe.h"
|
||||||
|
#include "Export.h"
|
||||||
namespace DFHack {
|
namespace DFHack {
|
||||||
namespace Version {
|
namespace Version {
|
||||||
const char *dfhack_version() { return DFHACK_VERSION; }
|
const char *dfhack_version()
|
||||||
const char *df_version() { return DF_VERSION; }
|
{
|
||||||
const char *dfhack_release() { return DFHACK_RELEASE; }
|
return DFHACK_VERSION;
|
||||||
|
}
|
||||||
|
const char *df_version()
|
||||||
|
{
|
||||||
|
return DF_VERSION;
|
||||||
|
}
|
||||||
|
const char *dfhack_release()
|
||||||
|
{
|
||||||
|
return DFHACK_RELEASE;
|
||||||
|
}
|
||||||
|
const char *git_description()
|
||||||
|
{
|
||||||
|
return DFHACK_GIT_DESCRIPTION;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,9 @@
|
|||||||
|
execute_process(COMMAND git describe --tags
|
||||||
|
WORKING_DIRECTORY "${dfhack_SOURCE_DIR}"
|
||||||
|
OUTPUT_VARIABLE DFHACK_GIT_DESCRIPTION)
|
||||||
|
string(STRIP ${DFHACK_GIT_DESCRIPTION} DFHACK_GIT_DESCRIPTION)
|
||||||
|
file(WRITE ${dfhack_SOURCE_DIR}/library/include/git-describe.tmp.h
|
||||||
|
"#define DFHACK_GIT_DESCRIPTION \"${DFHACK_GIT_DESCRIPTION}\"")
|
||||||
|
execute_process(COMMAND ${CMAKE_COMMAND} -E copy_if_different
|
||||||
|
${dfhack_SOURCE_DIR}/library/include/git-describe.tmp.h
|
||||||
|
${dfhack_SOURCE_DIR}/library/include/git-describe.h)
|
@ -0,0 +1 @@
|
|||||||
|
git-describe.*
|
Loading…
Reference in New Issue