diff --git a/rpcs3/CMakeLists.txt b/rpcs3/CMakeLists.txt index 9245ac9125..c5e6ebe4a0 100644 --- a/rpcs3/CMakeLists.txt +++ b/rpcs3/CMakeLists.txt @@ -5,6 +5,13 @@ include(cotire) project(rpcs3) +# Generate git-version.h 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.") diff --git a/rpcs3/Gui/AboutDialog.h b/rpcs3/Gui/AboutDialog.h index bee94e9b1a..78584d6d3d 100644 --- a/rpcs3/Gui/AboutDialog.h +++ b/rpcs3/Gui/AboutDialog.h @@ -36,11 +36,7 @@ AboutDialog::AboutDialog(wxWindow *parent) t_descr->SetForegroundColour(wxColor(255,255,255)); t_descr->SetPosition(wxPoint(12,50)); -#ifdef _DEBUG - wxStaticText* t_version = new wxStaticText(this, wxID_ANY, wxString::Format("Version: " _PRGNAME_ " git-" RPCS3_GIT_VERSION)); -#else - wxStaticText* t_version = new wxStaticText(this, wxID_ANY, wxString::Format("Version: " _PRGNAME_ " " _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)); diff --git a/rpcs3/Gui/MainFrame.cpp b/rpcs3/Gui/MainFrame.cpp index 45c1a24f68..975af52f18 100644 --- a/rpcs3/Gui/MainFrame.cpp +++ b/rpcs3/Gui/MainFrame.cpp @@ -70,11 +70,7 @@ MainFrame::MainFrame() , m_sys_menu_opened(false) { -#ifdef _DEBUG - SetLabel(wxString::Format(_PRGNAME_ " git-" RPCS3_GIT_VERSION)); -#else - SetLabel(wxString::Format(_PRGNAME_ " " _PRGVER_)); -#endif + SetLabel(wxString::Format(_PRGNAME_ " " RPCS3_GIT_VERSION)); wxMenuBar* menubar = new wxMenuBar(); diff --git a/rpcs3/emucore.vcxproj b/rpcs3/emucore.vcxproj index b3694d79b4..9f569766f2 100644 --- a/rpcs3/emucore.vcxproj +++ b/rpcs3/emucore.vcxproj @@ -1,10 +1,6 @@  - - Debug - LLVM - Win32 - Debug - LLVM x64 @@ -17,26 +13,14 @@ Debug - MemLeak x64 - - Debug - Win32 - Debug x64 - - Release - LLVM - Win32 - Release - LLVM x64 - - Release - Win32 - Release x64 @@ -57,14 +41,9 @@ - NotUsing NotUsing - NotUsing - NotUsing NotUsing NotUsing - NotUsing - NotUsing NotUsing NotUsing @@ -253,14 +232,9 @@ true - Create Create - Create - Create Create Create - Create - Create Create Create @@ -477,24 +451,6 @@ emucore - - StaticLibrary - true - v120 - Unicode - - - StaticLibrary - true - v120 - Unicode - - - StaticLibrary - true - v120 - Unicode - StaticLibrary true @@ -513,20 +469,6 @@ v120 Unicode - - StaticLibrary - false - v120 - false - Unicode - - - StaticLibrary - false - v120 - false - Unicode - StaticLibrary false @@ -544,15 +486,6 @@ - - - - - - - - - @@ -562,12 +495,6 @@ - - - - - - @@ -575,31 +502,6 @@ - - $(SolutionDir)$(Platform)\$(Configuration)\ - $(Platform)\$(Configuration)\ - .\;..\;..\asmjit\src\asmjit;..\wxWidgets\include\msvc;..\wxWidgets\include;.\OpenAL\include;..\ffmpeg\WindowsInclude;..\ffmpeg\Windows\x86\Include;$(VC_IncludePath);$(WindowsSDK_IncludePath); - - - $(SolutionDir)$(Platform)\$(Configuration)\ - $(Platform)\$(Configuration)\ - .\;..\;..\asmjit\src\asmjit;..\wxWidgets\include\msvc;..\wxWidgets\include;.\OpenAL\include;..\ffmpeg\WindowsInclude;..\ffmpeg\Windows\x86\Include;$(VC_IncludePath);$(WindowsSDK_IncludePath); - - - $(SolutionDir)$(Platform)\$(Configuration)\ - $(Platform)\$(Configuration)\ - .\;..\;..\asmjit\src\asmjit;..\wxWidgets\include\msvc;..\wxWidgets\include;.\OpenAL\include;..\ffmpeg\WindowsInclude;..\ffmpeg\Windows\x86\Include;$(VC_IncludePath);$(WindowsSDK_IncludePath); - - - $(SolutionDir)$(Platform)\$(Configuration)\ - $(Platform)\$(Configuration)\ - .\;..\;..\asmjit\src\asmjit;..\wxWidgets\include\msvc;..\wxWidgets\include;.\OpenAL\include;..\ffmpeg\WindowsInclude;..\ffmpeg\Windows\x86\Include;$(VC_IncludePath);$(WindowsSDK_IncludePath); - - - $(SolutionDir)$(Platform)\$(Configuration)\ - $(Platform)\$(Configuration)\ - .\;..\;..\asmjit\src\asmjit;..\wxWidgets\include\msvc;..\wxWidgets\include;.\OpenAL\include;..\ffmpeg\WindowsInclude;..\ffmpeg\Windows\x86\Include;$(VC_IncludePath);$(WindowsSDK_IncludePath); - .\;..\;..\minidx9\Include;..\asmjit\src\asmjit;..\wxWidgets\include\msvc;..\wxWidgets\include;.\OpenAL\include;..\ffmpeg\WindowsInclude;..\ffmpeg\Windows\x86_64\Include;$(VC_IncludePath);$(WindowsSDK_IncludePath);..\llvm\include;..\llvm_build\include $(Platform)\$(Configuration)\emucore\ @@ -630,43 +532,6 @@ $(LibraryPath) $(ExcludePath) - - - Level3 - Disabled - false - Use - stdafx.h - - - true - - - - - Level3 - Disabled - false - Use - stdafx.h - - - true - - - - - Level3 - Disabled - false - Use - _UNICODE;UNICODE;MSVC_CRT_MEMLEAK_DETECTION;%(PreprocessorDefinitions) - stdafx.h - - - true - - Level3 @@ -720,38 +585,6 @@ true - - - Level3 - MaxSpeed - true - true - false - Use - stdafx.h - - - true - true - true - - - - - Level3 - MaxSpeed - true - true - false - Use - stdafx.h - - - true - true - true - - Level3 diff --git a/rpcs3/git-version.cmake b/rpcs3/git-version.cmake new file mode 100644 index 0000000000..3a764c50a4 --- /dev/null +++ b/rpcs3/git-version.cmake @@ -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() diff --git a/rpcs3/git-version.h b/rpcs3/git-version.h deleted file mode 100644 index f770897486..0000000000 --- a/rpcs3/git-version.h +++ /dev/null @@ -1,6 +0,0 @@ -// This is a generated file. - -#define RPCS3_GIT_VERSION "unknown" - -// If you don't want this file to update/recompile, change to 1. -#define RPCS3_GIT_VERSION_NO_UPDATE 1 diff --git a/rpcs3/rpcs3.vcxproj b/rpcs3/rpcs3.vcxproj index 44c219a587..ade3c6121a 100644 --- a/rpcs3/rpcs3.vcxproj +++ b/rpcs3/rpcs3.vcxproj @@ -94,6 +94,7 @@ "$(SolutionDir)\Utilities\git-version-gen.cmd" + Updating git-version.h false @@ -120,6 +121,7 @@ "$(SolutionDir)\Utilities\git-version-gen.cmd" + Updating git-version.h false @@ -156,8 +158,8 @@ ..\wxWidgets\lib\vc_x64_lib;..\ffmpeg\Windows\x86_64\lib;..\OpenAL\Win64 - - + "$(SolutionDir)\Utilities\git-version-gen.cmd" + Updating git-version.h diff --git a/rpcs3/rpcs3.vcxproj.filters b/rpcs3/rpcs3.vcxproj.filters index 71062a8296..e55464ae48 100644 --- a/rpcs3/rpcs3.vcxproj.filters +++ b/rpcs3/rpcs3.vcxproj.filters @@ -194,5 +194,8 @@ Gui + + Gui + \ No newline at end of file