Browse Source

Adjust version header to resolve linker conflict with two definitions of love::VERSION in android builds

NOTE: Sadly, on some platforms, like linux, the linker is "smart" enough to have the previous code be completely ineffective, the checking will only work with versions of love >= 0.9.2
Bart van Strien 10 years ago
parent
commit
33d2331255
3 changed files with 7 additions and 4 deletions
  1. 2 1
      src/common/version.h
  2. 2 2
      src/love.cpp
  3. 3 1
      src/modules/love/love.cpp

+ 2 - 1
src/common/version.h

@@ -25,10 +25,11 @@ namespace love
 {
 {
 
 
 // Version stuff.
 // Version stuff.
+#define LOVE_VERSION_STRING "0.9.2"
 const int VERSION_MAJOR = 0;
 const int VERSION_MAJOR = 0;
 const int VERSION_MINOR = 9;
 const int VERSION_MINOR = 9;
 const int VERSION_REV = 2;
 const int VERSION_REV = 2;
-const char *VERSION = "0.9.2";
+const char *VERSION = LOVE_VERSION_STRING;
 const char *VERSION_COMPATIBILITY[] =  { VERSION, "0.9.1", "0.9.0", 0 };
 const char *VERSION_COMPATIBILITY[] =  { VERSION, "0.9.1", "0.9.0", 0 };
 const char *VERSION_CODENAME = "Baby Inspector";
 const char *VERSION_CODENAME = "Baby Inspector";
 
 

+ 2 - 2
src/love.cpp

@@ -151,10 +151,10 @@ int main(int argc, char **argv)
 	argv = hack_argv;
 	argv = hack_argv;
 #endif // LOVE_LEGENDARY_APP_ARGV_HACK
 #endif // LOVE_LEGENDARY_APP_ARGV_HACK
 
 
-	if (strcmp(love::VERSION, love_version()) != 0)
+	if (strcmp(LOVE_VERSION_STRING, love_version()) != 0)
 	{
 	{
 		printf("Version mismatch detected!\nLOVE binary is version %s\n"
 		printf("Version mismatch detected!\nLOVE binary is version %s\n"
-				"LOVE library is version %s\n", love::VERSION, love_version());
+				"LOVE library is version %s\n", LOVE_VERSION_STRING, love_version());
 		return 1;
 		return 1;
 	}
 	}
 
 

+ 3 - 1
src/modules/love/love.cpp

@@ -165,7 +165,9 @@ int w__openConsole(lua_State *L);
 
 
 const char *love_version()
 const char *love_version()
 {
 {
-	return love::VERSION;
+	// Do not refer to love::VERSION here, the linker
+	// will patch it back up to the executable's one..
+	return LOVE_VERSION_STRING;
 }
 }
 
 
 const char *love_codename()
 const char *love_codename()