Merge pull request #2 from Bigpet/master

don't distinguish between windows and unix for no reason
This commit is contained in:
Zangetsu38 2015-01-15 03:47:22 +01:00
commit e69f76de87
4 changed files with 50 additions and 11 deletions

View File

@ -5,6 +5,13 @@ include(cotire)
project(rpcs3)
# 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)
if (CMAKE_COMPILER_IS_GNUCXX)
if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.7.0)
message(FATAL_ERROR "GCC ${CMAKE_CXX_COMPILER_VERSION} is too old.")

View File

@ -36,11 +36,7 @@ AboutDialog::AboutDialog(wxWindow *parent)
t_descr->SetForegroundColour(wxColor(255,255,255));
t_descr->SetPosition(wxPoint(12,50));
#ifdef _WIN32
wxStaticText* t_version = new wxStaticText(this, wxID_ANY, wxString::Format(_PRGNAME_" Version : " "git-" RPCS3_GIT_VERSION));
#else
wxStaticText* t_version = new wxStaticText(this, wxID_ANY, wxString::Format(_PRGNAME_" Version : " _PRGVER_));
#endif
wxStaticText* t_version = new wxStaticText(this, wxID_ANY, wxString::Format(_PRGNAME_" Version : " RPCS3_GIT_VERSION));
t_version->SetBackgroundColour(wxColor(100,100,100));
t_version->SetForegroundColour(wxColor(200,200,200));
t_version->SetPosition(wxPoint(12,66));

View File

@ -5,9 +5,7 @@
#include "rpcs3.h"
#include "MainFrame.h"
#ifdef _WIN32
#include "git-version.h"
#endif
#include "Ini.h"
#include "Emu/SysCalls/Modules/cellSysutil.h"
#include "Emu/RSX/sysutil_video.h"
@ -72,11 +70,7 @@ MainFrame::MainFrame()
, m_sys_menu_opened(false)
{
#ifdef _WIN32
SetLabel(wxString::Format(_PRGNAME_ " " RPCS3_GIT_VERSION));
#else
SetLabel(wxString::Format(_PRGNAME_ " " _PRGVER_));
#endif
wxMenuBar* menubar = new wxMenuBar();

42
rpcs3/git-version.cmake Normal file
View File

@ -0,0 +1,42 @@
set(GIT_VERSION_FILE "${SOURCE_DIR}/git-version.h")
set(GIT_VERSION "unknown")
set(GIT_VERSION_UPDATE "1")
find_package(Git)
if(GIT_FOUND)
execute_process(COMMAND ${GIT_EXECUTABLE} describe --always
WORKING_DIRECTORY ${SOURCE_DIR}
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 "RPCS3_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"
"#define RPCS3_GIT_VERSION \"${GIT_VERSION}\"\;\n\n"
"// If you don't want this file to update/recompile, change to 1.\n"
"#define RPCS3_GIT_VERSION_NO_UPDATE 0\n")
if ("${GIT_VERSION_UPDATE}" EQUAL "1")
file(WRITE ${GIT_VERSION_FILE} ${code_string})
endif()