forked from Mirrors/openclonk
CMake: Add date of commit to logfile
But only if the build is from a clean index. Otherwise, the logfile will contain the date of build.alut-include-path
parent
94608179f3
commit
bc5df7f35b
|
@ -1 +1,2 @@
|
|||
node: $Format:%H$
|
||||
date: $Format:%ci$
|
||||
|
|
|
@ -37,6 +37,11 @@ function(git_get_changeset_id VAR)
|
|||
APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS
|
||||
"${GIT_INDEX}"
|
||||
)
|
||||
execute_process(WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
||||
COMMAND "${GIT_EXECUTABLE}" "show" "--format=%ci" "-s" "HEAD"
|
||||
OUTPUT_VARIABLE GIT_TIMESTAMP
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
)
|
||||
endif()
|
||||
endif()
|
||||
if (NOT C4REVISION)
|
||||
|
@ -53,9 +58,17 @@ function(git_get_changeset_id VAR)
|
|||
string(SUBSTRING "${C4REVISION}" 6 12 C4REVISION)
|
||||
endif()
|
||||
unset(revlength)
|
||||
|
||||
file(STRINGS "${CMAKE_CURRENT_SOURCE_DIR}/.git_archival" C4REVISION_TS
|
||||
LIMIT_COUNT 1
|
||||
REGEX "date: .+"
|
||||
)
|
||||
string(SUBSTRING "${C4REVISION_TS}" 6 -1 GIT_TIMESTAMP)
|
||||
endif()
|
||||
if(WORKDIR_DIRTY)
|
||||
set(C4REVISION "${C4REVISION}+")
|
||||
set(WORKDIR_DIRTY 1)
|
||||
endif()
|
||||
set(${VAR} "${C4REVISION}" PARENT_SCOPE)
|
||||
set(${VAR}_DIRTY ${WORKDIR_DIRTY} PARENT_SCOPE)
|
||||
set(${VAR}_TS "${GIT_TIMESTAMP}" PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
|
|
@ -32,7 +32,14 @@
|
|||
|
||||
#define C4XVER1 @C4XVER1@
|
||||
#define C4XVER2 @C4XVER2@
|
||||
#cmakedefine01 C4REVISION_DIRTY
|
||||
#if C4REVISION_DIRTY
|
||||
#define C4REVISION "@C4REVISION@+"
|
||||
#define C4REVISION_TS __DATE__ " " __TIME__
|
||||
#else
|
||||
#define C4REVISION "@C4REVISION@"
|
||||
#define C4REVISION_TS "@C4REVISION_TS@"
|
||||
#endif
|
||||
|
||||
// Build Options
|
||||
#ifdef _DEBUG
|
||||
|
|
|
@ -104,7 +104,7 @@ bool C4Application::DoInit(int argc, char * argv[])
|
|||
|
||||
// Engine header message
|
||||
Log(C4ENGINECAPTION);
|
||||
LogF("Version: %s %s (%s)", C4VERSION, C4_OS, GetRevision());
|
||||
LogF("Version: %s %s (%s - %s)", C4VERSION, C4_OS, GetRevision(), C4REVISION_TS);
|
||||
LogF("ExePath: \"%s\"", Config.General.ExePath.getData());
|
||||
LogF("SystemDataPath: \"%s\"", Config.General.SystemDataPath);
|
||||
LogF("UserDataPath: \"%s\"", Config.General.UserDataPath);
|
||||
|
|
Loading…
Reference in New Issue