2013-03-02 09:31:37 +00:00
|
|
|
@echo off
|
|
|
|
rem // Copyright (c) 2012- PPSSPP Project.
|
|
|
|
|
|
|
|
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/ppsspp and http://www.ppsspp.org/.
|
|
|
|
|
2013-03-03 10:16:01 +00:00
|
|
|
setlocal ENABLEDELAYEDEXPANSION
|
2013-03-02 09:31:37 +00:00
|
|
|
|
2013-03-02 20:31:11 +00:00
|
|
|
set GIT_VERSION_FILE=%~p0..\git-version.cpp
|
2013-03-03 10:21:34 +00:00
|
|
|
if not defined GIT (
|
2013-03-03 10:16:01 +00:00
|
|
|
set GIT="git"
|
2013-03-02 09:31:37 +00:00
|
|
|
)
|
2013-03-04 22:02:15 +00:00
|
|
|
call %GIT% describe > NUL 2> NUL
|
2013-03-03 09:57:00 +00:00
|
|
|
if errorlevel 1 (
|
|
|
|
echo Git not on path, trying default Msysgit paths
|
2013-03-03 10:16:01 +00:00
|
|
|
set GIT="%ProgramFiles(x86)%\Git\bin\git.exe"
|
2013-03-04 22:02:15 +00:00
|
|
|
call !GIT! describe > NUL 2> NUL
|
2013-03-03 09:57:00 +00:00
|
|
|
if errorlevel 1 (
|
2013-03-03 10:16:01 +00:00
|
|
|
set GIT="%ProgramFiles%\Git\bin\git.exe"
|
2013-03-03 09:57:00 +00:00
|
|
|
)
|
|
|
|
)
|
|
|
|
|
2013-03-02 09:31:37 +00:00
|
|
|
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
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
2013-03-04 22:02:15 +00:00
|
|
|
call %GIT% describe --always > NUL 2> NUL
|
2013-03-02 09:31:37 +00:00
|
|
|
if errorlevel 1 (
|
2013-03-03 09:57:00 +00:00
|
|
|
echo Unable to update git-version.cpp, git not found.
|
2013-03-03 10:18:24 +00:00
|
|
|
echo If you don't want to add it to your path, set the GIT environment variable.
|
2013-03-02 09:31:37 +00:00
|
|
|
|
|
|
|
echo // This is a generated file. > "%GIT_VERSION_FILE%"
|
|
|
|
echo. >> "%GIT_VERSION_FILE%"
|
|
|
|
echo const char *PPSSPP_GIT_VERSION = "unknown"; >> "%GIT_VERSION_FILE%"
|
|
|
|
goto done
|
|
|
|
)
|
|
|
|
|
2013-03-04 22:02:15 +00:00
|
|
|
for /F %%I IN ('call %GIT% describe --always') do set GIT_VERSION=%%I
|
2013-03-02 09:31:37 +00:00
|
|
|
|
|
|
|
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 const char *PPSSPP_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 PPSSPP_GIT_VERSION_NO_UPDATE 0 >> "%GIT_VERSION_FILE%"
|
|
|
|
|
|
|
|
:done
|