Merge pull request #1655 from PCSX2/greg/git-rev-title

pcsx2 gui: use git desribe as version name
This commit is contained in:
Gregory Hainaut 2016-11-08 23:42:15 +01:00 committed by GitHub
commit cf739d2493
3 changed files with 19 additions and 9 deletions

View File

@ -37,6 +37,7 @@ endfunction()
function(write_svnrev_h)
set(PCSX2_WC_TIME 0)
set(PCSX2_GIT_REV "")
if (GIT_FOUND AND EXISTS ${PROJECT_SOURCE_DIR}/.git)
EXECUTE_PROCESS(WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} COMMAND ${GIT_EXECUTABLE} show -s --format=%ci HEAD
OUTPUT_VARIABLE PCSX2_WC_TIME
@ -44,11 +45,15 @@ function(write_svnrev_h)
# Output: "YYYY-MM-DD HH:MM:SS +HHMM" (last part is time zone, offset from UTC)
string(REGEX REPLACE "[%:\\-]" "" PCSX2_WC_TIME "${PCSX2_WC_TIME}")
string(REGEX REPLACE "([0-9]+) ([0-9]+).*" "\\1\\2" PCSX2_WC_TIME "${PCSX2_WC_TIME}")
EXECUTE_PROCESS(WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} COMMAND ${GIT_EXECUTABLE} describe
OUTPUT_VARIABLE PCSX2_GIT_REV
OUTPUT_STRIP_TRAILING_WHITESPACE)
endif()
if ("${PCSX2_WC_TIME}" STREQUAL "")
set(PCSX2_WC_TIME 0)
endif()
file(WRITE ${CMAKE_BINARY_DIR}/common/include/svnrev.h "#define SVN_REV ${PCSX2_WC_TIME}ll \n#define SVN_MODS 0")
file(WRITE ${CMAKE_BINARY_DIR}/common/include/svnrev.h "#define SVN_REV ${PCSX2_WC_TIME}ll \n#define SVN_MODS 0\n#define GIT_REV \"${PCSX2_GIT_REV}\"")
endfunction()
function(check_compiler_version version_warn version_err)
@ -57,7 +62,7 @@ function(check_compiler_version version_warn version_err)
string(STRIP "${GCC_VERSION}" GCC_VERSION)
if(GCC_VERSION VERSION_LESS ${version_err})
message(FATAL_ERROR "PCSX2 doesn't support your old GCC ${GCC_VERSION}! Please upgrade it!
The minimum supported version is ${version_err} but ${version_warn} is warmly recommended")
else()
if(GCC_VERSION VERSION_LESS ${version_warn})

View File

@ -22,6 +22,10 @@ FOR /F "tokens=1-2" %%i IN ('"git show -s --format=%%%ci HEAD 2> NUL"') do (
set REV3=%%i%%j
)
FOR /F %%i IN ('"git describe 2> NUL"') do (
set GIT_REV=%%i
)
set REV2=%REV3: =%
set REV1=%REV2:-=%
set REV=%REV1::=%
@ -37,9 +41,11 @@ if %ERRORLEVEL% NEQ 0 (
echo #define SVN_REV_UNKNOWN > "%CD%\svnrev.h"
echo #define SVN_REV 0ll >> "%CD%\svnrev.h"
echo #define SVN_MODS 0 >> "%CD%\svnrev.h"
echo #define GIT_REV "" >> "%CD%\svnrev.h"
) else (
echo #define SVN_REV %REV%ll > "%CD%\svnrev.h"
echo #define SVN_MODS 0 /* Not implemented at the moment. */ >> "%CD%\svnrev.h"
echo #define GIT_REV "%GIT_REV%" >> "%CD%\svnrev.h"
)
ENDLOCAL

View File

@ -360,13 +360,12 @@ MainEmuFrame::MainEmuFrame(wxWindow* parent, const wxString& title)
else
{
// beta / development editions, which feature revision number and compile date.
#ifndef DISABLE_BUILD_DATE
wintitle.Printf( L"%s %d.%d.%d-%lld%s (git) %s", pxGetAppName().c_str(), PCSX2_VersionHi, PCSX2_VersionMid, PCSX2_VersionLo,
SVN_REV, SVN_MODS ? L"m" : wxEmptyString, fromUTF8(__DATE__).c_str() );
#else
wintitle.Printf( L"%s %d.%d.%d-%lld%s (git)", pxGetAppName().c_str(), PCSX2_VersionHi, PCSX2_VersionMid, PCSX2_VersionLo,
SVN_REV, SVN_MODS ? L"m" : wxEmptyString );
#endif
if (strlen(GIT_REV) > 5) {
wintitle.Printf( L"%s %s", pxGetAppName().c_str(), GIT_REV);
} else {
wintitle.Printf( L"%s %d.%d.%d-%lld%s (git)", pxGetAppName().c_str(), PCSX2_VersionHi, PCSX2_VersionMid,
PCSX2_VersionLo, SVN_REV, SVN_MODS ? L"m" : wxEmptyString );
}
}
SetTitle( wintitle );