Actually use the git version.

Also switch to cpp, duh.
This commit is contained in:
Unknown W. Brackets 2013-03-02 12:31:11 -08:00
parent aadc7db33d
commit 35fe2b4a63
13 changed files with 34 additions and 33 deletions

View File

@ -825,19 +825,19 @@ add_library(${CoreLibName} ${CoreLinkType}
Core/Util/ppge_atlas.h
$<TARGET_OBJECTS:GPU>
Globals.h
git-version.c)
git-version.cpp)
target_link_libraries(${CoreLibName} Common native kirk cityhash
${GLEW_LIBRARIES} ${OPENGL_LIBRARIES})
setup_target_project(${CoreLibName} Core)
# Generate git-version.c at build time.
# 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.c
set_source_files_properties(${CMAKE_CURRENT_SOURCE_DIR}/git-version.cpp
PROPERTIES GENERATED TRUE)
add_dependencies(${CoreLibName} GitVersion)

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
{

View File

@ -76,7 +76,7 @@
</Link>
<PreBuildEvent>
<Command>../Windows/git-version-gen.cmd</Command>
<Message>Updating git-version.c</Message>
<Message>Updating git-version.cpp</Message>
</PreBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
@ -93,7 +93,7 @@
</Link>
<PreBuildEvent>
<Command>../Windows/git-version-gen.cmd</Command>
<Message>Updating git-version.c</Message>
<Message>Updating git-version.cpp</Message>
</PreBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
@ -115,7 +115,7 @@
<CustomBuildStep />
<PreBuildEvent>
<Command>../Windows/git-version-gen.cmd</Command>
<Message>Updating git-version.c</Message>
<Message>Updating git-version.cpp</Message>
</PreBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
@ -135,14 +135,14 @@
</Link>
<PreBuildEvent>
<Command>../Windows/git-version-gen.cmd</Command>
<Message>Updating git-version.c</Message>
<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.c" />
<ClCompile Include="..\git-version.cpp" />
<ClCompile Include="Config.cpp" />
<ClCompile Include="Core.cpp" />
<ClCompile Include="CoreTiming.cpp" />

View File

@ -382,7 +382,7 @@
<ClCompile Include="Font\PGF.cpp">
<Filter>Font</Filter>
</ClCompile>
<ClCompile Include="..\git-version.c" />
<ClCompile Include="..\git-version.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="ELF\ElfReader.h">

View File

@ -4,13 +4,13 @@ TARGET = Core
TEMPLATE = lib
CONFIG += staticlib
version.target = ../git-version.c
version.target = ../git-version.cpp
version.commands = $$PWD/git-version-gen.sh
version.depends = ../.git
QMAKE_EXTRA_TARGETS += version
PRE_TARGETDEPS += ../git-version.c
SOURCES += ../git-version.c
PRE_TARGETDEPS += ../git-version.cpp
SOURCES += ../git-version.cpp
include(Settings.pri)

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);
}

View File

@ -16,7 +16,7 @@
## 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.c
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.
@ -28,7 +28,7 @@ fi
GIT_VERSION=$(git describe --always)
if [ "$GIT_VERSION" == "" ]; then
echo "Unable to update git-version.c, git not on path." 1>&2
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"

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);

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)

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)

View File

@ -18,7 +18,7 @@ rem // https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/.
setlocal
set GIT_VERSION_FILE=%~p0..\git-version.c
set GIT_VERSION_FILE=%~p0..\git-version.cpp
if "%GIT%" == "" (
set GIT=git
)
@ -33,7 +33,7 @@ if exist "%GIT_VERSION_FILE%" (
"%GIT%" describe --always > NUL 2> NUL
if errorlevel 1 (
echo Unable to update git-version.c, %GIT% not on path.
echo Unable to update git-version.cpp, %GIT% not on path.
echo // This is a generated file. > "%GIT_VERSION_FILE%"
echo. >> "%GIT_VERSION_FILE%"

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);

View File

@ -1,4 +1,4 @@
set(GIT_VERSION_FILE "${SOURCE_DIR}/git-version.c")
set(GIT_VERSION_FILE "${SOURCE_DIR}/git-version.cpp")
set(GIT_VERSION "unknown")
set(GIT_VERSION_UPDATE "1")