diff --git a/CMakeLists.txt b/CMakeLists.txt index aa827cff..1f69c780 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -809,6 +809,7 @@ set( src/sdl/expr.cpp src/sdl/exprNode.cpp src/sdl/expr-lex.cpp + src/common/version.c ) set( @@ -818,6 +819,7 @@ set( src/sdl/inputSDL.h src/sdl/expr.cpp.h src/sdl/exprNode.h + src/common/version_c.h ) set( diff --git a/src/common/version.c b/src/common/version.c new file mode 100644 index 00000000..f0fe8e37 --- /dev/null +++ b/src/common/version.c @@ -0,0 +1,6 @@ +#include "version_c.h" +#include "version.h" + +const char* vba_name_and_subversion = VBA_NAME_AND_SUBVERSION; + +const char* vbam_version = VERSION; diff --git a/src/common/version_c.h b/src/common/version_c.h new file mode 100644 index 00000000..d3b26a98 --- /dev/null +++ b/src/common/version_c.h @@ -0,0 +1,8 @@ +#ifndef VBAM_VERSION_C_H +#define VBAM_VERSION_C_H + +extern const char* vba_name_and_subversion; + +extern const char* vbam_version; + +#endif /* VBAM_VERSION_C_H */ diff --git a/src/sdl/SDL.cpp b/src/sdl/SDL.cpp index 44f00cfc..e175e041 100644 --- a/src/sdl/SDL.cpp +++ b/src/sdl/SDL.cpp @@ -41,7 +41,7 @@ #include -#include "version.h" +#include "../common/version_c.h" #include "SDL.h" @@ -1521,7 +1521,7 @@ void SetHomeDataDir() int main(int argc, char** argv) { - fprintf(stdout, "%s\n", VBA_NAME_AND_SUBVERSION); + fprintf(stdout, "%s\n", vba_name_and_subversion); home = argv[0]; SetHome(home); diff --git a/src/version.h.in b/src/version.h.in index 055e526f..cf63766c 100644 --- a/src/version.h.in +++ b/src/version.h.in @@ -17,6 +17,9 @@ // along with this program; if not, write to the Free Software Foundation, // Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +#ifndef VBAM_VERSION_H +#define VBAM_VERSION_H + #define VBA_NAME "VisualBoyAdvance-M" #define VBA_CURRENT_VERSION "@VERSION@" @@ -46,3 +49,5 @@ #define VER_FILEVERSION_STR VERSION #define VER_FILEVERSION @WIN_VERSION@ + +#endif /* VBAM_VERSION_H */ diff --git a/src/wx/CMakeLists.txt b/src/wx/CMakeLists.txt index 8426017b..d14802b4 100644 --- a/src/wx/CMakeLists.txt +++ b/src/wx/CMakeLists.txt @@ -668,6 +668,7 @@ set( cmd-evtable.h # icon File xrc/vbam.xpm + ../common/version.c ) if(APPLE) @@ -693,6 +694,7 @@ set( ../sdl/text.h # from external source with minor modifications widgets/wx/checkedlistctrl.h + ../common/version_c.h ) set( diff --git a/src/wx/cmdevents.cpp b/src/wx/cmdevents.cpp index 1014392f..156925ec 100644 --- a/src/wx/cmdevents.cpp +++ b/src/wx/cmdevents.cpp @@ -10,7 +10,7 @@ #include #include -#include "version.h" +#include "../common/version_c.h" #include "../common/ConfigManager.h" #include "../gb/gbPrinter.h" #include "../gba/agbprint.h" @@ -2723,22 +2723,14 @@ EVT_HANDLER(Translate, "Translations") wxLaunchDefaultBrowser(wxT("http://www.transifex.com/projects/p/vba-m")); } +#include "../common/version_c.h" + // was About EVT_HANDLER(wxID_ABOUT, "About...") { wxAboutDialogInfo ai; ai.SetName(wxT("VisualBoyAdvance-M")); - wxString version = wxT(""); -#ifndef FINAL_BUILD -#ifndef VERSION -# define VERSION "git" -#endif - - if (!version.IsEmpty()) - version = version + wxT("-"); - - version = version + wxT(VERSION); -#endif + wxString version(vbam_version); ai.SetVersion(version); // setting website, icon, license uses custom aboutbox on win32 & macosx // but at least win32 standard about is nothing special diff --git a/src/wx/panel.cpp b/src/wx/panel.cpp index 5e5b6791..ce214b24 100644 --- a/src/wx/panel.cpp +++ b/src/wx/panel.cpp @@ -5,7 +5,7 @@ #include #include -#include "version.h" +#include "../common/version_c.h" #include "../common/ConfigManager.h" #include "../common/Patch.h" #include "../gb/gbPrinter.h" @@ -424,9 +424,8 @@ void GameArea::SetFrameTitle() } tit.append(wxT("VisualBoyAdvance-M ")); -#ifndef FINAL_BUILD - tit.append(_(VERSION)); -#endif + tit.append(vbam_version); + #ifndef NO_LINK int playerId = GetLinkPlayerId();