From 644dc6c93c4a084f25fabf4613ef0c8ff6534c04 Mon Sep 17 00:00:00 2001 From: Kyle Kienapfel Date: Sun, 24 Jul 2022 07:36:19 -0700 Subject: [PATCH] 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-- 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. --- CMakeModules/GenerateSCMRev.cmake | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/CMakeModules/GenerateSCMRev.cmake b/CMakeModules/GenerateSCMRev.cmake index c7da2b91d6..a46251dd7e 100644 --- a/CMakeModules/GenerateSCMRev.cmake +++ b/CMakeModules/GenerateSCMRev.cmake @@ -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)