Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: build info not add to code, put the git information in cmake #49

Merged
merged 2 commits into from
Oct 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
6 changes: 0 additions & 6 deletions etc/script/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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=""
Expand Down
11 changes: 4 additions & 7 deletions src/kiwi.cc
Original file line number Diff line number Diff line change
Expand Up @@ -10,28 +10,25 @@
incarnation.
*/

#include "kiwi.h"

#include <getopt.h>
#include <sys/fcntl.h>
#include <sys/resource.h>
#include <sys/wait.h>
#include <time.h>
#include <unistd.h>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <iostream>
#include <thread>

#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"

Expand Down
Loading