Relax base-package and SimGear version checks.
As discussed on the devel list, only require the major+minor versions of FG+SG+data to match by default. If we encounter a situation on a release branch where stronger checks are needed, it’s easy to restore.
This commit is contained in:
parent
ea827f5677
commit
4a3ee6a74a
2 changed files with 20 additions and 6 deletions
|
@ -314,8 +314,17 @@ endif (ENABLE_QT)
|
||||||
|
|
||||||
find_package(PLIB REQUIRED puaux pu js fnt)
|
find_package(PLIB REQUIRED puaux pu js fnt)
|
||||||
|
|
||||||
# FlightGear and SimGear versions need to match
|
# FlightGear and SimGear versions need to match major + minor
|
||||||
find_package(SimGear ${FLIGHTGEAR_VERSION} CONFIG REQUIRED)
|
# split version string into components, note CMAKE_MATCH_0 is the entire regexp match
|
||||||
|
string(REGEX MATCH "([0-9]+)\\.([0-9]+)\\.([0-9]+)" VERSION_REGEX ${FLIGHTGEAR_VERSION} )
|
||||||
|
set(FG_VERSION_MAJOR ${CMAKE_MATCH_1})
|
||||||
|
set(FG_VERSION_MINOR ${CMAKE_MATCH_2})
|
||||||
|
set(FG_VERSION_PATCH ${CMAKE_MATCH_3})
|
||||||
|
|
||||||
|
set(MIN_SIMGEAR_VERSION "${FG_VERSION_MAJOR}.${FG_VERSION_MINOR}.0")
|
||||||
|
message(STATUS "Min Simgear version is ${MIN_SIMGEAR_VERSION}")
|
||||||
|
|
||||||
|
find_package(SimGear ${MIN_SIMGEAR_VERSION} CONFIG REQUIRED)
|
||||||
|
|
||||||
##############################################################################
|
##############################################################################
|
||||||
|
|
||||||
|
|
|
@ -2711,15 +2711,18 @@ void Options::setupRoot(int argc, char **argv)
|
||||||
}
|
}
|
||||||
|
|
||||||
globals->set_fg_root(root);
|
globals->set_fg_root(root);
|
||||||
static char required_version[] = FLIGHTGEAR_VERSION;
|
|
||||||
string base_version = fgBasePackageVersion(root);
|
string base_version = fgBasePackageVersion(root);
|
||||||
|
|
||||||
|
|
||||||
#if defined(HAVE_QT)
|
#if defined(HAVE_QT)
|
||||||
|
// only compare major and minor version, not the patch level.
|
||||||
|
const int versionComp = simgear::strutils::compare_versions(FLIGHTGEAR_VERSION, base_version, 2);
|
||||||
|
|
||||||
// note we never end up here if restoring a user selected root via
|
// note we never end up here if restoring a user selected root via
|
||||||
// the Qt GUI, since that code pre-validates the path. But if we're using
|
// the Qt GUI, since that code pre-validates the path. But if we're using
|
||||||
// a command-line, env-var or default root this check can fail and
|
// a command-line, env-var or default root this check can fail and
|
||||||
// we still want to use the GUI in that case
|
// we still want to use the GUI in that case
|
||||||
if (base_version != required_version) {
|
if (versionComp != 0) {
|
||||||
flightgear::initApp(argc, argv);
|
flightgear::initApp(argc, argv);
|
||||||
SetupRootDialog::runDialog(usingDefaultRoot);
|
SetupRootDialog::runDialog(usingDefaultRoot);
|
||||||
}
|
}
|
||||||
|
@ -2733,12 +2736,14 @@ void Options::setupRoot(int argc, char **argv)
|
||||||
exit(-1);
|
exit(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (base_version != required_version) {
|
// only compare major and minor version, not the patch level.
|
||||||
|
const int versionComp = simgear::strutils::compare_versions(FLIGHTGEAR_VERSION, base_version, 2);
|
||||||
|
if (versionComp != 0) {
|
||||||
flightgear::fatalMessageBox("Base package version mismatch",
|
flightgear::fatalMessageBox("Base package version mismatch",
|
||||||
"Version check failed: please check your installation.",
|
"Version check failed: please check your installation.",
|
||||||
"Found data files for version '" + base_version +
|
"Found data files for version '" + base_version +
|
||||||
"' at '" + globals->get_fg_root().str() + "', version '"
|
"' at '" + globals->get_fg_root().str() + "', version '"
|
||||||
+ required_version + "' is required.");
|
+ std::string(FLIGHTGEAR_VERSION) + "' is required.");
|
||||||
|
|
||||||
exit(-1);
|
exit(-1);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue