mirror of
https://github.com/ZLMediaKit/ZLMediaKit.git
synced 2024-11-22 10:40:05 +08:00
完善版本信息
This commit is contained in:
parent
04e2952d12
commit
44fd6b86bc
@ -97,11 +97,12 @@ set(LIBRARY_OUTPUT_PATH ${OUTPUT_DIR})
|
||||
set(EXECUTABLE_OUTPUT_PATH ${OUTPUT_DIR})
|
||||
|
||||
# 添加 git 版本信息
|
||||
set(COMMIT_HASH "Git_NotFound_Unkown_commit")
|
||||
set(BRANCH_NAME "Git_NotFound_Unkown_branch")
|
||||
set(COMMIT_HASH "Git_Unkown_commit")
|
||||
set(COMMIT_TIME "Git_Unkown_time")
|
||||
set(BRANCH_NAME "Git_Unkown_branch")
|
||||
set(BUILD_TIME "")
|
||||
|
||||
string(TIMESTAMP BUILD_TIME "%Y-%m-%d %H:%M:%S")
|
||||
string(TIMESTAMP BUILD_TIME "%Y-%m-%dT%H:%M:%S")
|
||||
|
||||
find_package(Git QUIET)
|
||||
if(GIT_FOUND)
|
||||
@ -117,6 +118,13 @@ if(GIT_FOUND)
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
ERROR_QUIET
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
|
||||
execute_process(
|
||||
COMMAND ${GIT_EXECUTABLE} log --format=format:%aI -1
|
||||
OUTPUT_VARIABLE COMMIT_TIME
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
ERROR_QUIET
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
endif()
|
||||
|
||||
configure_file(
|
||||
@ -124,7 +132,7 @@ configure_file(
|
||||
${CMAKE_CURRENT_BINARY_DIR}/version.h
|
||||
@ONLY)
|
||||
|
||||
message(STATUS "Git version is ${BRANCH_NAME}:${COMMIT_HASH}:${BUILD_TIME}")
|
||||
message(STATUS "Git version is ${BRANCH_NAME} ${COMMIT_HASH}/${COMMIT_TIME} ${BUILD_TIME}")
|
||||
|
||||
##############################################################################
|
||||
|
||||
|
@ -222,6 +222,9 @@ int start_main(int argc,char *argv[]) {
|
||||
|
||||
//启动异步日志线程
|
||||
Logger::Instance().setWriter(std::make_shared<AsyncLogWriter>());
|
||||
|
||||
InfoL << kServerName;
|
||||
|
||||
//加载配置文件,如果配置文件不存在就创建一个
|
||||
loadIniConfig(g_ini_file.data());
|
||||
|
||||
|
@ -35,9 +35,9 @@ namespace mediakit {
|
||||
|
||||
//请遵循MIT协议,勿修改服务器声明
|
||||
#if !defined(ENABLE_VERSION)
|
||||
const char kServerName[] = "ZLMediaKit-6.0(build in " __DATE__ " " __TIME__ ")";
|
||||
const char kServerName[] = "ZLMediaKit-7.0(build in " __DATE__ " " __TIME__ ")";
|
||||
#else
|
||||
const char kServerName[] = "ZLMediaKit(git hash:" COMMIT_HASH ",branch:" BRANCH_NAME ",build time:" __DATE__ " " __TIME__ ")";
|
||||
const char kServerName[] = "ZLMediaKit(git hash:" COMMIT_HASH "/" COMMIT_TIME ",branch:" BRANCH_NAME ",build time:" BUILD_TIME ")";
|
||||
#endif
|
||||
|
||||
}//namespace mediakit
|
@ -2,6 +2,7 @@
|
||||
#define __GIT_VERSION_H__
|
||||
|
||||
#define COMMIT_HASH "@COMMIT_HASH@"
|
||||
#define COMMIT_TIME "@COMMIT_TIME@"
|
||||
#define BRANCH_NAME "@BRANCH_NAME@"
|
||||
#define BUILD_TIME "@BUILD_TIME@"
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user