mirror of
https://github.com/OpenRCT2/OpenRCT2.git
synced 2025-01-22 10:21:57 -05:00
Use git describe
to express version in terms of closest tag.
This commit is contained in:
parent
e39f89c6ad
commit
56250b43ab
3 changed files with 31 additions and 8 deletions
|
@ -47,6 +47,16 @@ if (PORTABLE OR WIN32)
|
|||
set(CMAKE_INSTALL_RPATH "$ORIGIN")
|
||||
endif ()
|
||||
|
||||
# Describe current version in terms of closest tag
|
||||
execute_process(
|
||||
COMMAND git describe HEAD
|
||||
COMMAND sed -E "s/-g.+$//"
|
||||
WORKING_DIRECTORY ${ROOT_DIR}
|
||||
OUTPUT_VARIABLE OPENRCT2_VERSION_TAG
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
ERROR_QUIET
|
||||
)
|
||||
|
||||
# Define current git branch
|
||||
execute_process(
|
||||
COMMAND git rev-parse --abbrev-ref HEAD
|
||||
|
|
|
@ -168,6 +168,9 @@ endif ()
|
|||
# definitions: Version.cpp and Crash/Platform.cpp
|
||||
set_property(SOURCE ${CMAKE_CURRENT_LIST_DIR}/Version.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/Crash/Platform.cpp PROPERTY
|
||||
COMPILE_DEFINITIONS OPENRCT2_VERSION_TAG="${OPENRCT2_VERSION_TAG}")
|
||||
set_property(SOURCE ${CMAKE_CURRENT_LIST_DIR}/Version.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/Crash/Platform.cpp APPEND PROPERTY
|
||||
COMPILE_DEFINITIONS OPENRCT2_BRANCH="${OPENRCT2_BRANCH}")
|
||||
if (NOT OPENRCT2_COMMIT_SHA1_SHORT STREQUAL "HEAD")
|
||||
set_property(SOURCE ${CMAKE_CURRENT_LIST_DIR}/Version.cpp
|
||||
|
|
|
@ -22,17 +22,27 @@
|
|||
#endif
|
||||
|
||||
const char gVersionInfoFull[] =
|
||||
OPENRCT2_NAME ", v" OPENRCT2_VERSION
|
||||
#ifdef OPENRCT2_BRANCH
|
||||
"-" OPENRCT2_BRANCH
|
||||
OPENRCT2_NAME ", "
|
||||
#ifdef OPENRCT2_VERSION_TAG
|
||||
OPENRCT2_VERSION_TAG
|
||||
#else
|
||||
"v" OPENRCT2_VERSION
|
||||
#endif
|
||||
#ifdef OPENRCT2_COMMIT_SHA1_SHORT
|
||||
" build " OPENRCT2_COMMIT_SHA1_SHORT
|
||||
#if defined(OPENRCT2_BRANCH) || defined(OPENRCT2_COMMIT_SHA1_SHORT) || !defined(NDEBUG)
|
||||
" ("
|
||||
#if defined(OPENRCT2_BRANCH) && defined(OPENRCT2_COMMIT_SHA1_SHORT)
|
||||
OPENRCT2_COMMIT_SHA1_SHORT " on " OPENRCT2_BRANCH
|
||||
#elif defined(OPENRCT2_COMMIT_SHA1_SHORT)
|
||||
OPENRCT2_COMMIT_SHA1_SHORT
|
||||
#elif defined(OPENRCT2_BRANCH)
|
||||
OPENRCT2_BRANCH
|
||||
#endif
|
||||
#ifndef NDEBUG
|
||||
", DEBUG"
|
||||
#endif
|
||||
")"
|
||||
#endif
|
||||
#ifdef OPENRCT2_BUILD_SERVER
|
||||
" provided by " OPENRCT2_BUILD_SERVER
|
||||
#endif
|
||||
#ifndef NDEBUG
|
||||
" (DEBUG)"
|
||||
#endif
|
||||
;
|
||||
|
|
Loading…
Reference in a new issue