VS: Compare VS instance versions as strings
This makes the values more readable.
This commit is contained in:
parent
c92595be1d
commit
3fd65f5ca6
@ -1361,10 +1361,10 @@ static unsigned int cmLoadFlagTableSpecial(Json::Value entry,
|
|||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
unsigned long long const vsVer16_10_0 = 4503644629696790;
|
std::string const vsVer16_10_0 = "16.10.31321.278";
|
||||||
|
|
||||||
cmIDEFlagTable const* cmLoadFlagTableJson(
|
cmIDEFlagTable const* cmLoadFlagTableJson(std::string const& flagJsonPath,
|
||||||
std::string const& flagJsonPath, cm::optional<unsigned long long> vsver)
|
cm::optional<std::string> vsVer)
|
||||||
{
|
{
|
||||||
cmIDEFlagTable* ret = nullptr;
|
cmIDEFlagTable* ret = nullptr;
|
||||||
auto savedFlagIterator = loadedFlagJsonFiles.find(flagJsonPath);
|
auto savedFlagIterator = loadedFlagJsonFiles.find(flagJsonPath);
|
||||||
@ -1387,7 +1387,8 @@ cmIDEFlagTable const* cmLoadFlagTableJson(
|
|||||||
flagEntry.value = cmLoadFlagTableString(flag, "value");
|
flagEntry.value = cmLoadFlagTableString(flag, "value");
|
||||||
flagEntry.special = cmLoadFlagTableSpecial(flag, "flags");
|
flagEntry.special = cmLoadFlagTableSpecial(flag, "flags");
|
||||||
// FIXME: Port this version check to a Json field.
|
// FIXME: Port this version check to a Json field.
|
||||||
if (vsver && *vsver < vsVer16_10_0 &&
|
if (vsVer &&
|
||||||
|
!cmSystemTools::VersionCompareGreaterEq(*vsVer, vsVer16_10_0) &&
|
||||||
flagEntry.IDEName == "ExternalWarningLevel") {
|
flagEntry.IDEName == "ExternalWarningLevel") {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -1466,8 +1467,8 @@ cmIDEFlagTable const* cmGlobalVisualStudio10Generator::LoadFlagTable(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
cm::optional<unsigned long long> vsver = this->GetVSInstanceVersion();
|
cm::optional<std::string> vsVer = this->GetVSInstanceVersion();
|
||||||
if (cmIDEFlagTable const* ret = cmLoadFlagTableJson(filename, vsver)) {
|
if (cmIDEFlagTable const* ret = cmLoadFlagTableJson(filename, vsVer)) {
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -128,10 +128,7 @@ public:
|
|||||||
std::string Encoding() override;
|
std::string Encoding() override;
|
||||||
const char* GetToolsVersion() const;
|
const char* GetToolsVersion() const;
|
||||||
|
|
||||||
virtual cm::optional<unsigned long long> GetVSInstanceVersion() const
|
virtual cm::optional<std::string> GetVSInstanceVersion() const { return {}; }
|
||||||
{
|
|
||||||
return {};
|
|
||||||
}
|
|
||||||
|
|
||||||
bool GetSupportsUnityBuilds() const { return this->SupportsUnityBuilds; }
|
bool GetSupportsUnityBuilds() const { return this->SupportsUnityBuilds; }
|
||||||
|
|
||||||
|
@ -391,11 +391,11 @@ bool cmGlobalVisualStudioVersionedGenerator::GetVSInstance(
|
|||||||
return vsSetupAPIHelper.GetVSInstanceInfo(dir);
|
return vsSetupAPIHelper.GetVSInstanceInfo(dir);
|
||||||
}
|
}
|
||||||
|
|
||||||
cm::optional<unsigned long long>
|
cm::optional<std::string>
|
||||||
cmGlobalVisualStudioVersionedGenerator::GetVSInstanceVersion() const
|
cmGlobalVisualStudioVersionedGenerator::GetVSInstanceVersion() const
|
||||||
{
|
{
|
||||||
cm::optional<unsigned long long> result;
|
cm::optional<std::string> result;
|
||||||
unsigned long long vsInstanceVersion;
|
std::string vsInstanceVersion;
|
||||||
if (vsSetupAPIHelper.GetVSInstanceVersion(vsInstanceVersion)) {
|
if (vsSetupAPIHelper.GetVSInstanceVersion(vsInstanceVersion)) {
|
||||||
result = vsInstanceVersion;
|
result = vsInstanceVersion;
|
||||||
}
|
}
|
||||||
@ -411,10 +411,10 @@ bool cmGlobalVisualStudioVersionedGenerator::IsStdOutEncodingSupported() const
|
|||||||
if (this->Version < cmGlobalVisualStudioGenerator::VSVersion::VS16) {
|
if (this->Version < cmGlobalVisualStudioGenerator::VSVersion::VS16) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
unsigned long long const vsInstanceVersion16_7_P2 = 4503631666610212;
|
static std::string const vsVer16_7_P2 = "16.7.30128.36";
|
||||||
cm::optional<unsigned long long> vsInstanceVersion =
|
cm::optional<std::string> vsVer = this->GetVSInstanceVersion();
|
||||||
this->GetVSInstanceVersion();
|
return (vsVer &&
|
||||||
return (vsInstanceVersion && *vsInstanceVersion > vsInstanceVersion16_7_P2);
|
cmSystemTools::VersionCompareGreaterEq(*vsVer, vsVer16_7_P2));
|
||||||
}
|
}
|
||||||
|
|
||||||
const char*
|
const char*
|
||||||
|
@ -28,7 +28,7 @@ public:
|
|||||||
|
|
||||||
bool GetVSInstance(std::string& dir) const;
|
bool GetVSInstance(std::string& dir) const;
|
||||||
|
|
||||||
cm::optional<unsigned long long> GetVSInstanceVersion() const override;
|
cm::optional<std::string> GetVSInstanceVersion() const override;
|
||||||
|
|
||||||
AuxToolset FindAuxToolset(std::string& version,
|
AuxToolset FindAuxToolset(std::string& version,
|
||||||
std::string& props) const override;
|
std::string& props) const override;
|
||||||
|
@ -258,15 +258,13 @@ bool cmVSSetupAPIHelper::GetVSInstanceInfo(std::string& vsInstallLocation)
|
|||||||
return isInstalled;
|
return isInstalled;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool cmVSSetupAPIHelper::GetVSInstanceVersion(
|
bool cmVSSetupAPIHelper::GetVSInstanceVersion(std::string& vsInstanceVersion)
|
||||||
unsigned long long& vsInstanceVersion)
|
|
||||||
{
|
{
|
||||||
vsInstanceVersion = 0;
|
vsInstanceVersion.clear();
|
||||||
bool isInstalled = this->EnumerateAndChooseVSInstance();
|
bool isInstalled = this->EnumerateAndChooseVSInstance();
|
||||||
|
|
||||||
if (isInstalled) {
|
if (isInstalled) {
|
||||||
vsInstanceVersion =
|
vsInstanceVersion = cmsys::Encoding::ToNarrow(chosenInstanceInfo.Version);
|
||||||
static_cast<unsigned long long>(chosenInstanceInfo.ullVersion);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return isInstalled;
|
return isInstalled;
|
||||||
|
@ -88,7 +88,7 @@ struct VSInstanceInfo
|
|||||||
std::wstring VSInstallLocation;
|
std::wstring VSInstallLocation;
|
||||||
std::wstring Version;
|
std::wstring Version;
|
||||||
std::string VCToolsetVersion;
|
std::string VCToolsetVersion;
|
||||||
ULONGLONG ullVersion = 0;
|
ULONGLONG ullVersion = 0; // A.B.C.D = (A<<48)|(B<<32)|(C<<16)|D
|
||||||
bool IsWin10SDKInstalled = false;
|
bool IsWin10SDKInstalled = false;
|
||||||
bool IsWin81SDKInstalled = false;
|
bool IsWin81SDKInstalled = false;
|
||||||
|
|
||||||
@ -105,7 +105,7 @@ public:
|
|||||||
|
|
||||||
bool IsVSInstalled();
|
bool IsVSInstalled();
|
||||||
bool GetVSInstanceInfo(std::string& vsInstallLocation);
|
bool GetVSInstanceInfo(std::string& vsInstallLocation);
|
||||||
bool GetVSInstanceVersion(unsigned long long& vsInstanceVersion);
|
bool GetVSInstanceVersion(std::string& vsInstanceVersion);
|
||||||
bool GetVCToolsetVersion(std::string& vsToolsetVersion);
|
bool GetVCToolsetVersion(std::string& vsToolsetVersion);
|
||||||
bool IsWin10SDKInstalled();
|
bool IsWin10SDKInstalled();
|
||||||
bool IsWin81SDKInstalled();
|
bool IsWin81SDKInstalled();
|
||||||
|
Loading…
Reference in New Issue
Block a user