Merge pull request #839 from unknownbrackets/version

Show the git version in the log + other places
This commit is contained in:
Henrik Rydgård committed 2013-03-02 12:45:37 -08:00
commit 1bb384f774
19 files changed
+240 -23

No files matched your search

+4
View File
@@ -23,6 +23,9 @@ Release
Windows/x64
Windows/ipch
# For Mac
.DS_Store
# For ppsspp.ini, etc.
*.ini
@@ -37,6 +40,7 @@ gen
libs
obj
build*/
/git-version.c
.pspsh.hist
__testoutput.txt
+14 -1
View File
@@ -136,6 +136,7 @@ if(NOT MSVC)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libstdc++")
elseif(APPLE)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++")
set(CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LIBRARY "libc++")
endif()
if(CMAKE_COMPILER_IS_GNUCXX AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.7.0)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x")
@@ -823,11 +824,23 @@ add_library(${CoreLibName} ${CoreLinkType}
Core/Util/ppge_atlas.cpp
Core/Util/ppge_atlas.h
$<TARGET_OBJECTS:GPU>
Globals.h)
Globals.h
git-version.cpp)
target_link_libraries(${CoreLibName} Common native kirk cityhash
${GLEW_LIBRARIES} ${OPENGL_LIBRARIES})
setup_target_project(${CoreLibName} Core)
# Generate git-version.cpp at build time.
add_custom_target(GitVersion ALL
DEPENDS something_that_never_exists)
add_custom_command(OUTPUT something_that_never_exists
COMMAND ${CMAKE_COMMAND} -DSOURCE_DIR=${CMAKE_CURRENT_SOURCE_DIR}
-P ${CMAKE_CURRENT_SOURCE_DIR}/git-version.cmake)
set_source_files_properties(${CMAKE_CURRENT_SOURCE_DIR}/git-version.cpp
PROPERTIES GENERATED TRUE)
add_dependencies(${CoreLibName} GitVersion)
add_library(GPU OBJECT
GPU/GLES/DisplayListInterpreter.cpp
GPU/GLES/DisplayListInterpreter.h
+12
View File
@@ -85,6 +85,7 @@ set(SRCS
PSPMixer.cpp
System.cpp
Core.cpp
../git-version.cpp
)
if(ARM)
@@ -115,6 +116,17 @@ add_library(core STATIC ${SRCS})
target_link_libraries(core general common)
target_link_libraries(core general base)
# Generate git-version.cpp at build time.
add_custom_target(GitVersion ALL
DEPENDS something_that_never_exists)
add_custom_command(OUTPUT something_that_never_exists
COMMAND ${CMAKE_COMMAND} -DSOURCE_DIR=${CMAKE_CURRENT_SOURCE_DIR}/..
-P ${CMAKE_CURRENT_SOURCE_DIR}/../git-version.cmake)
set_source_files_properties(${CMAKE_CURRENT_SOURCE_DIR}/../git-version.cpp
PROPERTIES GENERATED TRUE)
add_dependencies(core GitVersion)
if(UNIX)
add_definitions(-fPIC)
add_definitions(-std=gnu++0x)
+1 -2
View File
@@ -20,8 +20,7 @@
#include <string>
#include <map>
#define PPSSPP_VERSION_STR "0.6.1"
extern const char *PPSSPP_GIT_VERSION;
struct SState
{
+18
View File
@@ -74,6 +74,10 @@
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
<PreBuildEvent>
<Command>../Windows/git-version-gen.cmd</Command>
<Message>Updating git-version.cpp</Message>
</PreBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
@@ -87,6 +91,10 @@
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
<PreBuildEvent>
<Command>../Windows/git-version-gen.cmd</Command>
<Message>Updating git-version.cpp</Message>
</PreBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
@@ -104,6 +112,11 @@
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
</Link>
<CustomBuildStep />
<PreBuildEvent>
<Command>../Windows/git-version-gen.cmd</Command>
<Message>Updating git-version.cpp</Message>
</PreBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
@@ -120,11 +133,16 @@
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
</Link>
<PreBuildEvent>
<Command>../Windows/git-version-gen.cmd</Command>
<Message>Updating git-version.cpp</Message>
</PreBuildEvent>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="..\ext\disarm.cpp" />
<ClCompile Include="..\ext\snappy\snappy-c.cpp" />
<ClCompile Include="..\ext\snappy\snappy.cpp" />
<ClCompile Include="..\git-version.cpp" />
<ClCompile Include="Config.cpp" />
<ClCompile Include="Core.cpp" />
<ClCompile Include="CoreTiming.cpp" />
+1
View File
@@ -382,6 +382,7 @@
<ClCompile Include="Font\PGF.cpp">
<Filter>Font</Filter>
</ClCompile>
<ClCompile Include="..\git-version.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="ELF\ElfReader.h">
+2
View File
@@ -358,6 +358,8 @@ u32 sceKernelStopVTimer(u32 uid) {
__stopVTimer(vt);
return 1;
}
return error;
}
u32 sceKernelSetVTimerHandler(u32 uid, u32 scheduleAddr, u32 handlerFuncAddr, u32 commonAddr) {
+2 -2
View File
@@ -120,7 +120,7 @@ namespace MIPSComp
}
void Jit::GetVectorRegsPrefixD(u8 *regs, VectorSize sz, int vectorReg) {
_assert_(js.prefixDFlag & JitState::PREFIX_KNOWN);
_assert_(js.prefixDFlag & ArmJitState::PREFIX_KNOWN);
GetVectorRegs(regs, sz, vectorReg);
if (js.prefixD == 0)
@@ -136,7 +136,7 @@ namespace MIPSComp
}
void Jit::ApplyPrefixD(const u8 *vregs, VectorSize sz) {
_assert_(js.prefixDFlag & JitState::PREFIX_KNOWN);
_assert_(js.prefixDFlag & ArmJitState::PREFIX_KNOWN);
if (!js.prefixD) return;
int n = GetNumVectorElements(sz);
+4 -4
View File
@@ -107,11 +107,11 @@ struct ArmJitState
}
}
u8 VfpuWriteMask() const {
_assert_(prefixDFlag & JitState::PREFIX_KNOWN);
_assert_(prefixDFlag & PREFIX_KNOWN);
return (prefixD >> 8) & 0xF;
}
bool VfpuWriteMask(int i) const {
_assert_(prefixDFlag & JitState::PREFIX_KNOWN);
_assert_(prefixDFlag & PREFIX_KNOWN);
return (prefixD >> (8 + i)) & 1;
}
};
@@ -224,12 +224,12 @@ private:
void ApplyPrefixST(u8 *vregs, u32 prefix, VectorSize sz);
void ApplyPrefixD(const u8 *vregs, VectorSize sz);
void GetVectorRegsPrefixS(u8 *regs, VectorSize sz, int vectorReg) {
_assert_(js.prefixSFlag & JitState::PREFIX_KNOWN);
_assert_(js.prefixSFlag & ArmJitState::PREFIX_KNOWN);
GetVectorRegs(regs, sz, vectorReg);
ApplyPrefixST(regs, js.prefixS, sz);
}
void GetVectorRegsPrefixT(u8 *regs, VectorSize sz, int vectorReg) {
_assert_(js.prefixTFlag & JitState::PREFIX_KNOWN);
_assert_(js.prefixTFlag & ArmJitState::PREFIX_KNOWN);
GetVectorRegs(regs, sz, vectorReg);
ApplyPrefixST(regs, js.prefixT, sz);
}
+3
View File
@@ -32,6 +32,7 @@
#include "HLE/sceKernel.h"
#include "HLE/sceKernelMemory.h"
#include "HLE/sceAudio.h"
#include "Config.h"
#include "Core.h"
#include "CoreTiming.h"
#include "CoreParameter.h"
@@ -47,6 +48,8 @@ static PSPMixer *mixer;
bool PSP_Init(const CoreParameter &coreParam, std::string *error_string)
{
INFO_LOG(HLE, "PPSSPP %s", PPSSPP_GIT_VERSION);
coreParameter = coreParam;
currentCPU = &mipsr4k;
numCPUs = 1;
+8
View File
@@ -4,6 +4,14 @@ TARGET = Core
TEMPLATE = lib
CONFIG += staticlib
version.target = ../git-version.cpp
version.commands = $$PWD/git-version-gen.sh
version.depends = ../.git
QMAKE_EXTRA_TARGETS += version
PRE_TARGETDEPS += ../git-version.cpp
SOURCES += ../git-version.cpp
include(Settings.pri)
INCLUDEPATH += ../native ../Core/MIPS ../
+1 -1
View File
@@ -43,7 +43,7 @@ void QtHost::ShutdownGL()
void QtHost::SetWindowTitle(const char *message)
{
QString title = "PPSSPP " + QString(PPSSPP_VERSION_STR) + " - " + QString::fromUtf8(message);
QString title = "PPSSPP " + QString(PPSSPP_GIT_VERSION) + " - " + QString::fromUtf8(message);
mainWindow->setWindowTitle(title);
}
+52
View File
@@ -0,0 +1,52 @@
#!/bin/bash
## Copyright (c) 2012- PPSSPP Project.
## This program is free software: you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
## the Free Software Foundation, version 2.0 or later versions.
## This program is distributed in the hope that it will be useful,
## but WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
## GNU General Public License 2.0 for more details.
## A copy of the GPL 2.0 should have been included with the program.
## If not, see http://www.gnu.org/licenses/
## Official git repository and contact information can be found at
## https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/.
GIT_VERSION_FILE=$(dirname $0)/../git-version.cpp
if [ -e "$GIT_VERSION_FILE" ]; then
# Skip updating the file if PPSSPP_GIT_VERSION_NO_UPDATE is 1.
results=$(grep '^#define PPSSPP_GIT_VERSION_NO_UPDATE 1' "$GIT_VERSION_FILE")
if [ "$results" != "" ]; then
exit 0
fi
fi
GIT_VERSION=$(git describe --always)
if [ "$GIT_VERSION" == "" ]; then
echo "Unable to update git-version.cpp, git not on path." 1>&2
echo "// This is a generated file." > "$GIT_VERSION_FILE"
echo >> "$GIT_VERSION_FILE"
echo 'const char *PPSSPP_GIT_VERSION = "unknown";' >> "$GIT_VERSION_FILE"
exit 0
fi
# Don't modify the file if it already has the current version.
if [ -e "$GIT_VERSION_FILE" ]; then
results=$(grep "$GIT_VERSION" "$GIT_VERSION_FILE")
if [ "$results" != "" ]; then
exit 0
fi
fi
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"
+1 -1
View File
@@ -884,7 +884,7 @@ void MainWindow::SetZoom(float zoom) {
void MainWindow::SetGameTitle(QString text)
{
QString title = "PPSSPP " + QString(PPSSPP_VERSION_STR);
QString title = "PPSSPP " + QString(PPSSPP_GIT_VERSION);
if (text != "")
title += QString(" - %1").arg(text);
+1 -3
View File
@@ -38,9 +38,7 @@ void WindowsHost::ShutdownGL()
void WindowsHost::SetWindowTitle(const char *message)
{
// Really need a better way to deal with versions.
std::string title = "PPSSPP " PPSSPP_VERSION_STR " - ";
title += message;
std::string title = std::string("PPSSPP ") + PPSSPP_GIT_VERSION + " - " + message;
int size = MultiByteToWideChar(CP_UTF8, 0, message, (int) title.size(), NULL, 0);
if (size > 0)
+5 -6
View File
@@ -844,14 +844,13 @@ namespace MainWindow
void SetPlaying(const char *text)
{
char temp[256];
if (text == 0)
SetWindowText(hwndMain, "PPSSPP " PPSSPP_VERSION_STR);
snprintf(temp, 256, "PPSSPP %s", PPSSPP_GIT_VERSION);
else
{
char temp[256];
sprintf(temp, "%s - %s", text, "PPSSPP " PPSSPP_VERSION_STR);
SetWindowText(hwndMain,temp);
}
snprintf(temp, 256, "%s - PPSSPP %s", text, PPSSPP_GIT_VERSION);
temp[255] = '\0';
SetWindowText(hwndMain, temp);
}
void SaveStateActionFinished(bool result, void *userdata)
+61
View File
@@ -0,0 +1,61 @@
@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/.
setlocal
set GIT_VERSION_FILE=%~p0..\git-version.cpp
if "%GIT%" == "" (
set GIT=git
)
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
)
)
"%GIT%" describe --always > NUL 2> NUL
if errorlevel 1 (
echo Unable to update git-version.cpp, %GIT% not on path.
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
)
for /F %%I IN ('"%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 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
+8 -3
View File
@@ -168,7 +168,7 @@ void MenuScreen::render() {
ui_draw2d.DrawTextShadow(UBUNTU48, "PPSSPP", dp_xres + xoff - w/2, 80, 0xFFFFFFFF, ALIGN_HCENTER | ALIGN_BOTTOM);
ui_draw2d.SetFontScale(0.7f, 0.7f);
ui_draw2d.DrawTextShadow(UBUNTU24, PPSSPP_VERSION_STR, dp_xres + xoff, 80, 0xFFFFFFFF, ALIGN_RIGHT | ALIGN_BOTTOM);
ui_draw2d.DrawTextShadow(UBUNTU24, PPSSPP_GIT_VERSION, dp_xres + xoff, 80, 0xFFFFFFFF, ALIGN_RIGHT | ALIGN_BOTTOM);
ui_draw2d.SetFontScale(1.0f, 1.0f);
VLinear vlinear(dp_xres + xoff, 95, 20);
@@ -444,9 +444,9 @@ void CreditsScreen::update(InputState &input_state) {
frames_++;
}
static const char *credits[] =
static char *credits[] =
{
"PPSSPP " PPSSPP_VERSION_STR,
"PPSSPP",
"",
"",
"A fast and portable PSP emulator",
@@ -506,6 +506,11 @@ static const char *credits[] =
};
void CreditsScreen::render() {
// TODO: This is kinda ugly, done on every frame...
char temp[256];
snprinf(temp, 256, "PPSSPP %s", PPSSPP_GIT_VERSION);
credits[0] = temp;
UIShader_Prepare();
UIBegin();
DrawBackground(1.0f);
+42
View File
@@ -0,0 +1,42 @@
set(GIT_VERSION_FILE "${SOURCE_DIR}/git-version.cpp")
set(GIT_VERSION "unknown")
set(GIT_VERSION_UPDATE "1")
find_package(Git)
if(GIT_FOUND)
execute_process(COMMAND ${GIT_EXECUTABLE} describe --always
RESULT_VARIABLE exit_code
OUTPUT_VARIABLE GIT_VERSION)
if(NOT ${exit_code} EQUAL 0)
message(WARNING "git describe failed, unable to include version.")
endif()
string(STRIP ${GIT_VERSION} GIT_VERSION)
else()
message(WARNING "git not found, unable to include version.")
endif()
if(EXISTS ${GIT_VERSION_FILE})
# Don't update if marked not to update.
file(STRINGS ${GIT_VERSION_FILE} match
REGEX "PPSSPP_GIT_VERSION_NO_UPDATE = 1")
if(NOT $[match} EQUAL "")
set(GIT_VERSION_UPDATE "0")
endif()
# Don't update if it's already the same.
file(STRINGS ${GIT_VERSION_FILE} match
REGEX "${GIT_VERSION}")
if(NOT $[match} EQUAL "")
set(GIT_VERSION_UPDATE "0")
endif()
endif()
set(code_string "// This is a generated file.\n\n"
"const char *PPSSPP_GIT_VERSION = \"${GIT_VERSION}\"\;\n\n"
"// If you don't want this file to update/recompile, change to 1.\n"
"#define PPSSPP_GIT_VERSION_NO_UPDATE 0\n")
message(WARNING "UPDATE: ${GIT_VERSION_FILE}")
if ("${GIT_VERSION_UPDATE}" EQUAL "1")
file(WRITE ${GIT_VERSION_FILE} ${code_string})
endif()