mirror of
https://github.com/hrydgard/ppsspp.git
synced 2024-11-26 23:10:38 +00:00
Generate windows version automatically.
This allows for the same customization git-version.cpp allows. Also, improve messaging slightly during build if git is missing, and disallow reporting for builds generated without version info to make it clear to users.
This commit is contained in:
parent
14fd3136b1
commit
4ddc12ce40
@ -25,7 +25,6 @@ struct InputState;
|
||||
class Host {
|
||||
public:
|
||||
virtual ~Host() {}
|
||||
//virtual void StartThread()
|
||||
virtual void UpdateUI() {}
|
||||
|
||||
virtual void UpdateMemView() {}
|
||||
|
@ -347,6 +347,9 @@ namespace Reporting
|
||||
// Not sure if we should support locked cpu at all, but definitely not far out values.
|
||||
if (g_Config.iLockedCPUSpeed != 0 && (g_Config.iLockedCPUSpeed < 111 || g_Config.iLockedCPUSpeed > 333))
|
||||
return false;
|
||||
// Don't allow builds without version info from git. They're useless for reporting.
|
||||
if (strcmp(PPSSPP_GIT_VERSION, "unknown") == 0)
|
||||
return false;
|
||||
|
||||
// Some users run the exe from a zip or something, and don't have fonts.
|
||||
// This breaks things, but let's not report it since it's confusing.
|
||||
|
@ -16,13 +16,22 @@ 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/ppsspp and http://www.ppsspp.org/.
|
||||
|
||||
rem // This file automatically generates two files during build:
|
||||
rem // - git-version.cpp (contains the git version string for display.)
|
||||
rem // - Windows/win-version.h (contains git version for version.rc.)
|
||||
rem //
|
||||
rem // If git is not installed, "unknown" is the version.
|
||||
|
||||
setlocal ENABLEDELAYEDEXPANSION
|
||||
|
||||
set GIT_VERSION_FILE=%~p0..\git-version.cpp
|
||||
set WIN_VERSION_FILE=%~p0.\win-version.h
|
||||
set GIT_MISSING=0
|
||||
|
||||
if not defined GIT (
|
||||
set GIT="git"
|
||||
)
|
||||
call %GIT% describe > NUL 2> NUL
|
||||
call %GIT% describe --always > NUL 2> NUL
|
||||
if errorlevel 1 (
|
||||
echo Git not on path, trying default Msysgit paths
|
||||
set GIT="%ProgramFiles(x86)%\Git\bin\git.exe"
|
||||
@ -32,32 +41,37 @@ if errorlevel 1 (
|
||||
)
|
||||
)
|
||||
|
||||
call %GIT% describe --always > NUL 2> NUL
|
||||
if errorlevel 1 (
|
||||
set GIT_MISSING=1
|
||||
)
|
||||
|
||||
if exist "%GIT_VERSION_FILE%" (
|
||||
rem // Skip updating the file if PPSSPP_GIT_VERSION_NO_UPDATE is 1.
|
||||
findstr /B /C:"#define PPSSPP_GIT_VERSION_NO_UPDATE 1" "%GIT_VERSION_FILE%" > NUL
|
||||
if not errorlevel 1 (
|
||||
goto done
|
||||
goto gitdone
|
||||
)
|
||||
)
|
||||
|
||||
call %GIT% describe --always > NUL 2> NUL
|
||||
if errorlevel 1 (
|
||||
echo Unable to update git-version.cpp, git not found.
|
||||
if "%GIT_MISSING%" == "1" (
|
||||
echo WARNING: Unable to update git-version.cpp, 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 // ERROR: Unable to determine version - git not on path. > "%GIT_VERSION_FILE%"
|
||||
echo const char *PPSSPP_GIT_VERSION = "unknown"; >> "%GIT_VERSION_FILE%"
|
||||
goto done
|
||||
goto gitdone
|
||||
)
|
||||
|
||||
for /F %%I IN ('call %GIT% describe --always') do set GIT_VERSION=%%I
|
||||
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
|
||||
goto gitdone
|
||||
)
|
||||
)
|
||||
|
||||
@ -68,4 +82,45 @@ echo. >> "%GIT_VERSION_FILE%"
|
||||
echo // If you don't want this file to update/recompile, change to 1. >> "%GIT_VERSION_FILE%"
|
||||
echo #define PPSSPP_GIT_VERSION_NO_UPDATE 0 >> "%GIT_VERSION_FILE%"
|
||||
|
||||
:gitdone
|
||||
|
||||
if exist "%WIN_VERSION_FILE%" (
|
||||
rem // Skip updating the file if PPSSPP_WIN_VERSION_NO_UPDATE is 1.
|
||||
findstr /B /C:"#define PPSSPP_WIN_VERSION_NO_UPDATE 1" "%WIN_VERSION_FILE%" > NUL
|
||||
if not errorlevel 1 (
|
||||
goto done
|
||||
)
|
||||
)
|
||||
|
||||
if "%GIT_MISSING%" == "1" (
|
||||
echo WARNING: Unable to update Windows/win-version.h, git not found.
|
||||
|
||||
echo // This is a generated file. > "%WIN_VERSION_FILE%"
|
||||
echo. >> "%WIN_VERSION_FILE%"
|
||||
echo // ERROR: Unable to determine version - git not on path. > "%WIN_VERSION_FILE%"
|
||||
echo #define PPSSPP_WIN_VERSION_STRING "unknown" > "%WIN_VERSION_FILE%"
|
||||
echo #define PPSSPP_WIN_VERSION_COMMA 0,0,0,0 > "%WIN_VERSION_FILE%"
|
||||
|
||||
goto done
|
||||
)
|
||||
|
||||
if exist "%WIN_VERSION_FILE%" (
|
||||
rem // Don't modify the file if it already has the current version.
|
||||
findstr /C:"%GIT_VERSION%" "%WIN_VERSION_FILE%" > NUL
|
||||
if not errorlevel 1 (
|
||||
goto done
|
||||
)
|
||||
)
|
||||
|
||||
for /f "tokens=1 delims=-" %%a in ("%GIT_VERSION:~1%") do set WIN_RELEASE_VERSION=%%a
|
||||
for /f "tokens=2 delims=-" %%a in ("%GIT_VERSION%") do set WIN_BUILD_NUMBER=%%a
|
||||
|
||||
echo // This is a generated file. > "%WIN_VERSION_FILE%"
|
||||
echo. >> "%WIN_VERSION_FILE%"
|
||||
echo #define PPSSPP_WIN_VERSION_STRING "%GIT_VERSION%" >> "%WIN_VERSION_FILE%"
|
||||
echo #define PPSSPP_WIN_VERSION_COMMA %WIN_RELEASE_VERSION:.=,%,%WIN_BUILD_NUMBER% >> "%WIN_VERSION_FILE%"
|
||||
echo. >> "%WIN_VERSION_FILE%"
|
||||
echo // If you don't want this file to update/recompile, change to 1. >> "%WIN_VERSION_FILE%"
|
||||
echo #define PPSSPP_WIN_VERSION_NO_UPDATE 0 >> "%WIN_VERSION_FILE%"
|
||||
|
||||
:done
|
||||
|
Binary file not shown.
@ -24,7 +24,6 @@
|
||||
class HeadlessHost : public Host
|
||||
{
|
||||
public:
|
||||
// void StartThread() override
|
||||
void UpdateUI() override {}
|
||||
|
||||
void UpdateMemView() override {}
|
||||
|
Loading…
Reference in New Issue
Block a user