diff --git a/desktop_version/.gitignore b/desktop_version/.gitignore index 241f712d..04039b60 100644 --- a/desktop_version/.gitignore +++ b/desktop_version/.gitignore @@ -10,6 +10,7 @@ VVVVVV *.a *.gch src/Version.h.out +src/InterimVersion.out.c # Game data data.zip diff --git a/desktop_version/CMakeLists.txt b/desktop_version/CMakeLists.txt index 29211a75..b9f0b627 100644 --- a/desktop_version/CMakeLists.txt +++ b/desktop_version/CMakeLists.txt @@ -201,8 +201,8 @@ if(NOT OFFICIAL_BUILD) if(GIT_FOUND) # These filenames have to be qualified, because when we run # the CMake script, its work dir gets set to the build folder - set(VERSION_INPUT_FILE ${CMAKE_CURRENT_SOURCE_DIR}/src/Version.h.in) - set(VERSION_OUTPUT_FILE ${CMAKE_CURRENT_SOURCE_DIR}/src/Version.h.out) + set(VERSION_INPUT_FILE ${CMAKE_CURRENT_SOURCE_DIR}/src/InterimVersion.in.c) + set(VERSION_OUTPUT_FILE ${CMAKE_CURRENT_SOURCE_DIR}/src/InterimVersion.out.c) add_custom_target( GenerateVersion ALL @@ -219,8 +219,10 @@ if(NOT OFFICIAL_BUILD) add_dependencies(VVVVVV GenerateVersion) - # This lets Version.h know that Version.h.out exists - target_compile_definitions(VVVVVV PRIVATE -DVERSION_H_OUT_EXISTS) + target_compile_definitions(VVVVVV PRIVATE -DINTERIM_VERSION_EXISTS) + + add_library(InterimVersion STATIC src/InterimVersion.out.c) + list(APPEND STATIC_LIBRARIES InterimVersion) endif() endif() @@ -299,9 +301,9 @@ target_compile_definitions(lodepng-static PRIVATE ) if(BUNDLE_DEPENDENCIES) - set(STATIC_LIBRARIES physfs-static tinyxml2-static lodepng-static faudio-static) + list(APPEND STATIC_LIBRARIES physfs-static tinyxml2-static lodepng-static faudio-static) else() - set(STATIC_LIBRARIES lodepng-static) + list(APPEND STATIC_LIBRARIES lodepng-static) endif() if(BUNDLE_DEPENDENCIES) diff --git a/desktop_version/src/InterimVersion.h b/desktop_version/src/InterimVersion.h new file mode 100644 index 00000000..109c8014 --- /dev/null +++ b/desktop_version/src/InterimVersion.h @@ -0,0 +1,22 @@ +#ifndef INTERIMVERSION_H +#define INTERIMVERSION_H + +#ifdef INTERIM_VERSION_EXISTS + +#ifdef __cplusplus +extern "C" +{ +#endif + +extern const char* INTERIM_COMMIT; +extern const int LEN_INTERIM_COMMIT; + +extern const char* COMMIT_DATE; + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* INTERIM_VERSION_EXISTS */ + +#endif /* INTERIMVERSION_H */ diff --git a/desktop_version/src/InterimVersion.in.c b/desktop_version/src/InterimVersion.in.c new file mode 100644 index 00000000..24f72d00 --- /dev/null +++ b/desktop_version/src/InterimVersion.in.c @@ -0,0 +1,4 @@ +const char* INTERIM_COMMIT = "@INTERIM_COMMIT@"; +const int LEN_INTERIM_COMMIT = sizeof("@INTERIM_COMMIT@") - 1; + +const char* COMMIT_DATE = "@COMMIT_DATE@"; diff --git a/desktop_version/src/Render.cpp b/desktop_version/src/Render.cpp index 54e56426..bce5901b 100644 --- a/desktop_version/src/Render.cpp +++ b/desktop_version/src/Render.cpp @@ -9,6 +9,7 @@ #include "GlitchrunnerMode.h" #include "Graphics.h" #include "GraphicsUtil.h" +#include "InterimVersion.h" #include "KeyPoll.h" #include "MakeAndPlay.h" #include "Map.h" @@ -17,7 +18,6 @@ #include "Screen.h" #include "Script.h" #include "UtilityClass.h" -#include "Version.h" static int tr; static int tg; @@ -144,11 +144,9 @@ static void menurender(void) #if defined(MAKEANDPLAY) graphics.Print(-1,temp+35," MAKE AND PLAY EDITION",tr, tg, tb, true); #endif -#ifdef COMMIT_DATE +#ifdef INTERIM_VERSION_EXISTS graphics.Print( 310 - (10*8), 210, COMMIT_DATE, tr/2, tg/2, tb/2); -#endif -#ifdef INTERIM_COMMIT - graphics.Print( 310 - (SDL_arraysize(INTERIM_COMMIT) - 1) * 8, 220, INTERIM_COMMIT, tr/2, tg/2, tb/2); + graphics.Print( 310 - LEN_INTERIM_COMMIT * 8, 220, INTERIM_COMMIT, tr/2, tg/2, tb/2); #endif graphics.Print( 310 - (4*8), 230, "v2.4", tr/2, tg/2, tb/2); diff --git a/desktop_version/src/Version.h b/desktop_version/src/Version.h deleted file mode 100644 index e1bf0cbc..00000000 --- a/desktop_version/src/Version.h +++ /dev/null @@ -1,8 +0,0 @@ -#ifndef VERSION_H -#define VERSION_H - -#ifdef VERSION_H_OUT_EXISTS -#include "Version.h.out" -#endif - -#endif /* VERSION_H */ diff --git a/desktop_version/src/Version.h.in b/desktop_version/src/Version.h.in deleted file mode 100644 index 0837b9cb..00000000 --- a/desktop_version/src/Version.h.in +++ /dev/null @@ -1,7 +0,0 @@ -#ifndef VERSION_H_OUT -#define VERSION_H_OUT - -#define INTERIM_COMMIT "@INTERIM_COMMIT@" -#define COMMIT_DATE "@COMMIT_DATE@" - -#endif /* VERSION_H_OUT */ diff --git a/desktop_version/src/main.cpp b/desktop_version/src/main.cpp index c9dea47b..33988be3 100644 --- a/desktop_version/src/main.cpp +++ b/desktop_version/src/main.cpp @@ -14,6 +14,7 @@ #include "Game.h" #include "Graphics.h" #include "Input.h" +#include "InterimVersion.h" #include "KeyPoll.h" #include "Logic.h" #include "Map.h"