build: override git description on mainline builds

Note: might not work for Early Access builds

right now it appears that the output of like:
git describe  --long --always --dirty
is something like: mainline-636-9139-g0ec190c16-dirty

and the title for yuzu-cmd: HEAD-mainline-636-9139-g0ec190c16-dirty

the goal here is to change this title to:
mainline-<build id>-<shorthash>

so as an example trying for: mainline-1107-0ec190c16

dirty flag on github actions builds are due to discord-rpc
and its desire to run clang-format on itself as part of
compiling. that library is retired and deprecated, so no updates.
This commit is contained in:
Kyle Kienapfel 2022-07-24 07:36:19 -07:00
parent 97729fd8e9
commit 644dc6c93c

View File

@ -38,6 +38,21 @@ if (BUILD_REPOSITORY)
string(TOUPPER ${FIRST_LETTER} FIRST_LETTER)
set(REPO_NAME "${REPO_NAME}${FIRST_LETTER}${REMAINDER}")
endforeach()
# git describe output looks odd for mainline builds, override this
string(SUBSTRING "${GIT_REV}" 0 9 GIT_REV_SHORT)
if (GIT_BRANCH STREQUAL "HEAD" AND BUILD_ID AND REPO_NAME STREQUAL "Mainline")
set(GIT_BRANCH "mainline")
set(GIT_DESC "${BUILD_ID}-${GIT_REV_SHORT}")
message(STATUS "mainline, overrode GIT_BRANCH: ${GIT_BRANCH} GIT_DESC: ${GIT_DESC}")
elseif (BUILD_ID AND REPO_NAME STREQUAL "Mainline")
set(GIT_DESC "mainline-${BUILD_ID}-${GIT_REV_SHORT}")
message(STATUS "mainline, overrode GIT_DESC: ${GIT_DESC}")
elseif (BUILD_ID AND REPO_NAME STREQUAL "Early Access")
set(GIT_DESC "ea-${BUILD_ID}-${GIT_REV_SHORT}")
message(STATUS "ea, overrode GIT_DESC: ${GIT_DESC}")
endif()
if (BUILD_TAG)
string(REGEX MATCH "${CMAKE_MATCH_1}-([0-9]+)" OUTVAR ${BUILD_TAG})
if (${CMAKE_MATCH_COUNT} GREATER 0)