mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2025-12-23 07:43:01 +01:00
Use git describe to express version in terms of closest tag.
This commit is contained in:
@@ -47,6 +47,16 @@ if (PORTABLE OR WIN32)
|
|||||||
set(CMAKE_INSTALL_RPATH "$ORIGIN")
|
set(CMAKE_INSTALL_RPATH "$ORIGIN")
|
||||||
endif ()
|
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
|
# Define current git branch
|
||||||
execute_process(
|
execute_process(
|
||||||
COMMAND git rev-parse --abbrev-ref HEAD
|
COMMAND git rev-parse --abbrev-ref HEAD
|
||||||
|
|||||||
@@ -168,6 +168,9 @@ endif ()
|
|||||||
# definitions: Version.cpp and Crash/Platform.cpp
|
# definitions: Version.cpp and Crash/Platform.cpp
|
||||||
set_property(SOURCE ${CMAKE_CURRENT_LIST_DIR}/Version.cpp
|
set_property(SOURCE ${CMAKE_CURRENT_LIST_DIR}/Version.cpp
|
||||||
${CMAKE_CURRENT_LIST_DIR}/Crash/Platform.cpp PROPERTY
|
${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}")
|
COMPILE_DEFINITIONS OPENRCT2_BRANCH="${OPENRCT2_BRANCH}")
|
||||||
if (NOT OPENRCT2_COMMIT_SHA1_SHORT STREQUAL "HEAD")
|
if (NOT OPENRCT2_COMMIT_SHA1_SHORT STREQUAL "HEAD")
|
||||||
set_property(SOURCE ${CMAKE_CURRENT_LIST_DIR}/Version.cpp
|
set_property(SOURCE ${CMAKE_CURRENT_LIST_DIR}/Version.cpp
|
||||||
|
|||||||
@@ -22,17 +22,27 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
const char gVersionInfoFull[] =
|
const char gVersionInfoFull[] =
|
||||||
OPENRCT2_NAME ", v" OPENRCT2_VERSION
|
OPENRCT2_NAME ", "
|
||||||
#ifdef OPENRCT2_BRANCH
|
#ifdef OPENRCT2_VERSION_TAG
|
||||||
"-" OPENRCT2_BRANCH
|
OPENRCT2_VERSION_TAG
|
||||||
|
#else
|
||||||
|
"v" OPENRCT2_VERSION
|
||||||
#endif
|
#endif
|
||||||
#ifdef OPENRCT2_COMMIT_SHA1_SHORT
|
#if defined(OPENRCT2_BRANCH) || defined(OPENRCT2_COMMIT_SHA1_SHORT) || !defined(NDEBUG)
|
||||||
" build " OPENRCT2_COMMIT_SHA1_SHORT
|
" ("
|
||||||
|
#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
|
#endif
|
||||||
#ifdef OPENRCT2_BUILD_SERVER
|
#ifdef OPENRCT2_BUILD_SERVER
|
||||||
" provided by " OPENRCT2_BUILD_SERVER
|
" provided by " OPENRCT2_BUILD_SERVER
|
||||||
#endif
|
|
||||||
#ifndef NDEBUG
|
|
||||||
" (DEBUG)"
|
|
||||||
#endif
|
#endif
|
||||||
;
|
;
|
||||||
|
|||||||
Reference in New Issue
Block a user