diff --git a/CMakeLists.txt b/CMakeLists.txt index 2dfa939..d3cd740 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -31,6 +31,24 @@ ELSEIF (CMAKE_CXX_COMPILER_ID STREQUAL "GNU") ENDIF () ENDIF () +EXECUTE_PROCESS( + COMMAND git rev-parse HEAD + OUTPUT_VARIABLE GIT_COMMIT_HASH + OUTPUT_STRIP_TRAILING_WHITESPACE +) + +EXECUTE_PROCESS( + COMMAND date "+%Y-%m-%d %H:%M:%S %Z%z" + OUTPUT_VARIABLE BUILD_DATE + OUTPUT_STRIP_TRAILING_WHITESPACE +) + +MESSAGE (status "GIT_COMMIT_HASH: ${GIT_COMMIT_HASH}") +MESSAGE (status "GIT_COMMIT_DATE: ${BUILD_DATE}") + +ADD_DEFINITIONS(-DKkiwi_GIT_COMMIT_ID=\"${GIT_COMMIT_HASH}\") +ADD_DEFINITIONS(-DKkiwi_BUILD_DATE=\"${BUILD_DATE}\") + IF(CMAKE_BUILD_TYPE STREQUAL "Release") MESSAGE("Building in Release mode") ELSE() diff --git a/etc/script/build.sh b/etc/script/build.sh index 46882b9..74bda98 100755 --- a/etc/script/build.sh +++ b/etc/script/build.sh @@ -6,12 +6,6 @@ C_GREEN="\033[32m" C_END="\033[0m" -BUILD_TIME=$(git log -1 --format=%ai) -BUILD_TIME=${BUILD_TIME: 0: 10} - -COMMIT_ID=$(git rev-parse HEAD) -SHORT_COMMIT_ID=${COMMIT_ID: 0: 8} - BUILD_TYPE=Release VERBOSE=0 CMAKE_FLAGS="" diff --git a/src/kiwi.cc b/src/kiwi.cc index a73187a..1fc5455 100644 --- a/src/kiwi.cc +++ b/src/kiwi.cc @@ -10,28 +10,25 @@ incarnation. */ -#include "kiwi.h" - #include #include #include #include -#include #include #include #include +#include #include #include -#include "praft/praft.h" -#include "pstd/log.h" -#include "pstd/pstd_util.h" - #include "client.h" #include "config.h" #include "helper.h" #include "kiwi.h" #include "kiwi_logo.h" +#include "praft/praft.h" +#include "pstd/log.h" +#include "pstd/pstd_util.h" #include "slow_log.h" #include "store.h"