1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-11-24 08:32:34 +02:00

Merge pull request #1055 from kambala-decapitator/version-from-cmakelists

define app version only in CMakeLists
This commit is contained in:
Andrii Danylchenko 2022-10-08 09:55:59 +03:00 committed by GitHub
commit 238dabe060
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 13 additions and 19 deletions

View File

@ -49,9 +49,14 @@ if(NOT CMAKE_BUILD_TYPE)
endif()
set(VCMI_VERSION_MAJOR 1)
set(VCMI_VERSION_MINOR 0)
set(VCMI_VERSION_MINOR 1)
set(VCMI_VERSION_PATCH 0)
add_definitions(
-DVCMI_VERSION_MAJOR=${VCMI_VERSION_MAJOR}
-DVCMI_VERSION_MINOR=${VCMI_VERSION_MINOR}
-DVCMI_VERSION_PATCH=${VCMI_VERSION_PATCH}
-DVCMI_VERSION_STRING="${VCMI_VERSION_MAJOR}.${VCMI_VERSION_MINOR}.${VCMI_VERSION_PATCH}"
)
set(APP_SHORT_VERSION "${VCMI_VERSION_MAJOR}.${VCMI_VERSION_MINOR}")
if(NOT VCMI_VERSION_PATCH EQUAL 0)
string(APPEND APP_SHORT_VERSION ".${VCMI_VERSION_PATCH}")

View File

@ -19,9 +19,9 @@ namespace
bool isCompatible(const QString & verMin, const QString & verMax)
{
const int maxSections = 3; // versions consist from up to 3 sections, major.minor.patch
QVersionNumber vcmiVersion(GameConstants::VCMI_VERSION_MAJOR,
GameConstants::VCMI_VERSION_MINOR,
GameConstants::VCMI_VERSION_PATCH);
QVersionNumber vcmiVersion(VCMI_VERSION_MAJOR,
VCMI_VERSION_MINOR,
VCMI_VERSION_PATCH);
auto versionMin = QVersionNumber::fromString(verMin);
auto versionMax = QVersionNumber::fromString(verMax);

View File

@ -538,7 +538,7 @@ JsonNode addMeta(JsonNode config, std::string meta)
CModInfo::Version CModInfo::Version::GameVersion()
{
return Version(GameConstants::VCMI_VERSION_MAJOR, GameConstants::VCMI_VERSION_MINOR, GameConstants::VCMI_VERSION_PATCH);
return Version(VCMI_VERSION_MAJOR, VCMI_VERSION_MINOR, VCMI_VERSION_PATCH);
}
CModInfo::Version CModInfo::Version::fromString(std::string from)

View File

@ -53,18 +53,10 @@ const TeamID TeamID::NO_TEAM = TeamID(255);
namespace GameConstants
{
const int VCMI_VERSION_MAJOR = 1;
const int VCMI_VERSION_MINOR = 1;
const int VCMI_VERSION_PATCH = 0;
const std::string VCMI_VERSION_STRING = std::to_string(VCMI_VERSION_MAJOR) + "." +
std::to_string(VCMI_VERSION_MINOR) + "." +
std::to_string(VCMI_VERSION_PATCH);
#ifdef VCMI_NO_EXTRA_VERSION
const std::string VCMI_VERSION = std::string("VCMI ") + VCMI_VERSION_STRING;
const std::string VCMI_VERSION = "VCMI " VCMI_VERSION_STRING;
#else
const std::string VCMI_VERSION = std::string("VCMI ") + VCMI_VERSION_STRING + "." + GIT_SHA1;
const std::string VCMI_VERSION = "VCMI " VCMI_VERSION_STRING "." + std::string{GIT_SHA1};
#endif
}

View File

@ -38,9 +38,6 @@ struct IdTag
namespace GameConstants
{
DLL_LINKAGE extern const int VCMI_VERSION_MAJOR;
DLL_LINKAGE extern const int VCMI_VERSION_MINOR;
DLL_LINKAGE extern const int VCMI_VERSION_PATCH;
DLL_LINKAGE extern const std::string VCMI_VERSION;
const int PUZZLE_MAP_PIECES = 48;