1
0
mirror of https://github.com/RPCS3/rpcs3.git synced 2024-11-22 02:32:36 +01:00

When debugging, put the git revision in the title

Useful for bug reports, user-friendly version still used when building
in release mode. A unix script for generating the git version is still
needed.
This commit is contained in:
Cornee Traas 2013-08-11 00:09:27 +02:00
parent cd3ad0b149
commit d249bfef4d
4 changed files with 87 additions and 2 deletions

View File

@ -0,0 +1,73 @@
@echo off
rem // This program is free software: you can redistribute it and/or modify
rem // it under the terms of the GNU General Public License as published by
rem // the Free Software Foundation, version 2.0 or later versions.
rem // This program is distributed in the hope that it will be useful,
rem // but WITHOUT ANY WARRANTY; without even the implied warranty of
rem // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
rem // GNU General Public License 2.0 for more details.
rem // A copy of the GPL 2.0 should have been included with the program.
rem // If not, see http://www.gnu.org/licenses/
rem // Official git repository and contact information can be found at
rem // https://github.com/hrydgard/RPCS3 and http://www.RPCS3.org/.
setlocal ENABLEDELAYEDEXPANSION
set GIT_VERSION_FILE=%~p0..\rpcs3\git-version.h
if not defined GIT (
set GIT="git"
)
call %GIT% describe > NUL 2> NUL
if errorlevel 1 (
echo Git not on path, trying default Msysgit paths
set GIT="%ProgramFiles(x86)%\Git\bin\git.exe"
call !GIT! describe > NUL 2> NUL
if errorlevel 1 (
set GIT="%ProgramFiles%\Git\bin\git.exe"
)
)
if exist "%GIT_VERSION_FILE%" (
rem // Skip updating the file if RPCS3_GIT_VERSION_NO_UPDATE is 1.
findstr /B /C:"#define RPCS3_GIT_VERSION_NO_UPDATE 1" "%GIT_VERSION_FILE%" > NUL
if not errorlevel 1 (
goto done
)
)
call %GIT% describe --always > NUL 2> NUL
if errorlevel 1 (
echo Unable to update git-version.h, git not found.
echo If you don't want to add it to your path, set the GIT environment variable.
echo // This is a generated file. > "%GIT_VERSION_FILE%"
echo. >> "%GIT_VERSION_FILE%"
echo #define RPCS3_GIT_VERSION "unknown" >> "%GIT_VERSION_FILE%"
echo. >> "%GIT_VERSION_FILE%"
echo // If you don't want this file to update/recompile, change to 1. >> "%GIT_VERSION_FILE%"
echo #define RPCS3_GIT_VERSION_NO_UPDATE 0 >> "%GIT_VERSION_FILE%"
goto done
)
for /F %%I IN ('call %GIT% describe --always') do set GIT_VERSION=%%I
rem // Don't modify the file if it already has the current version.
if exist "%GIT_VERSION_FILE%" (
findstr /C:"%GIT_VERSION%" "%GIT_VERSION_FILE%" > NUL
if not errorlevel 1 (
goto done
)
)
echo // This is a generated file. > "%GIT_VERSION_FILE%"
echo. >> "%GIT_VERSION_FILE%"
echo #define RPCS3_GIT_VERSION "%GIT_VERSION%" >> "%GIT_VERSION_FILE%"
echo. >> "%GIT_VERSION_FILE%"
echo // If you don't want this file to update/recompile, change to 1. >> "%GIT_VERSION_FILE%"
echo #define RPCS3_GIT_VERSION_NO_UPDATE 0 >> "%GIT_VERSION_FILE%"
:done

View File

@ -2,6 +2,7 @@
#include "MainFrame.h"
#include "CompilerELF.h"
#include "git-version.h"
#include "Emu/System.h"
#include "Ini.h"
#include "Emu/GS/sysutil_video.h"
@ -34,7 +35,13 @@ MainFrame::MainFrame()
: FrameBase(NULL, wxID_ANY, "", "MainFrame", wxSize(280, 180))
, m_aui_mgr(this)
{
#ifdef _DEBUG
SetLabel(wxString::Format(_PRGNAME_ " git-" RPCS3_GIT_VERSION));
#else
SetLabel(wxString::Format(_PRGNAME_ " " _PRGVER_));
#endif
wxMenuBar& menubar(*new wxMenuBar());
wxMenu& menu_boot(*new wxMenu());

6
rpcs3/git-version.h Normal file
View File

@ -0,0 +1,6 @@
// This is a generated file.
#define RPCS3_GIT_VERSION "cd3ad0b"
// If you don't want this file to update/recompile, change to 1.
#define RPCS3_GIT_VERSION_NO_UPDATE 0

View File

@ -128,8 +128,7 @@
<IgnoreSpecificDefaultLibraries>%(IgnoreSpecificDefaultLibraries)</IgnoreSpecificDefaultLibraries>
</Link>
<PreBuildEvent>
<Command>
</Command>
<Command>$(SolutionDir)\Utilities\git-version-gen.cmd</Command>
</PreBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">