|
|
@ -6,6 +6,7 @@
|
|
|
|
#include <sstream>
|
|
|
|
#include <sstream>
|
|
|
|
|
|
|
|
|
|
|
|
#include <cm/vector>
|
|
|
|
#include <cm/vector>
|
|
|
|
|
|
|
|
#include <cmext/string_view>
|
|
|
|
|
|
|
|
|
|
|
|
#include "cmGlobalGenerator.h"
|
|
|
|
#include "cmGlobalGenerator.h"
|
|
|
|
#include "cmGlobalGeneratorFactory.h"
|
|
|
|
#include "cmGlobalGeneratorFactory.h"
|
|
|
@ -140,14 +141,103 @@ bool cmGlobalVisualStudio14Generator::MatchesGeneratorName(
|
|
|
|
|
|
|
|
|
|
|
|
bool cmGlobalVisualStudio14Generator::InitializePlatformWindows(cmMakefile* mf)
|
|
|
|
bool cmGlobalVisualStudio14Generator::InitializePlatformWindows(cmMakefile* mf)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (cmHasLiteralPrefix(this->SystemVersion, "10.0")) {
|
|
|
|
// If a Windows SDK version is explicitly requested, search for it.
|
|
|
|
|
|
|
|
if (this->GeneratorPlatformVersion) {
|
|
|
|
|
|
|
|
std::string const& version = *this->GeneratorPlatformVersion;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// VS 2019 and above support specifying plain "10.0".
|
|
|
|
|
|
|
|
if (version == "10.0"_s) {
|
|
|
|
|
|
|
|
if (this->Version >= VSVersion::VS16) {
|
|
|
|
|
|
|
|
this->SetWindowsTargetPlatformVersion("10.0", mf);
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
/* clang-format off */
|
|
|
|
|
|
|
|
mf->IssueMessage(MessageType::FATAL_ERROR, cmStrCat(
|
|
|
|
|
|
|
|
"Generator\n"
|
|
|
|
|
|
|
|
" ", this->GetName(), "\n"
|
|
|
|
|
|
|
|
"given platform specification containing a\n"
|
|
|
|
|
|
|
|
" version=10.0\n"
|
|
|
|
|
|
|
|
"field. The value 10.0 is only supported by VS 2019 and above.\n"
|
|
|
|
|
|
|
|
));
|
|
|
|
|
|
|
|
/* clang-format on */
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (cmHasLiteralPrefix(version, "10.0.")) {
|
|
|
|
return this->SelectWindows10SDK(mf);
|
|
|
|
return this->SelectWindows10SDK(mf);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return this->VerifyNoGeneratorPlatformVersion(mf);
|
|
|
|
|
|
|
|
|
|
|
|
if (version == "8.1"_s) {
|
|
|
|
|
|
|
|
if (this->IsWin81SDKInstalled()) {
|
|
|
|
|
|
|
|
this->SetWindowsTargetPlatformVersion("8.1", mf);
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
/* clang-format off */
|
|
|
|
|
|
|
|
mf->IssueMessage(MessageType::FATAL_ERROR, cmStrCat(
|
|
|
|
|
|
|
|
"Generator\n"
|
|
|
|
|
|
|
|
" ", this->GetName(), "\n"
|
|
|
|
|
|
|
|
"given platform specification containing a\n"
|
|
|
|
|
|
|
|
" version=8.1\n"
|
|
|
|
|
|
|
|
"field, but the Windows 8.1 SDK is not installed.\n"
|
|
|
|
|
|
|
|
));
|
|
|
|
|
|
|
|
/* clang-format on */
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (version.empty()) {
|
|
|
|
|
|
|
|
/* clang-format off */
|
|
|
|
|
|
|
|
mf->IssueMessage(MessageType::FATAL_ERROR, cmStrCat(
|
|
|
|
|
|
|
|
"Generator\n"
|
|
|
|
|
|
|
|
" ", this->GetName(), "\n"
|
|
|
|
|
|
|
|
"given platform specification with empty\n"
|
|
|
|
|
|
|
|
" version=\n"
|
|
|
|
|
|
|
|
"field.\n"
|
|
|
|
|
|
|
|
));
|
|
|
|
|
|
|
|
/* clang-format on */
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* clang-format off */
|
|
|
|
|
|
|
|
mf->IssueMessage(MessageType::FATAL_ERROR, cmStrCat(
|
|
|
|
|
|
|
|
"Generator\n"
|
|
|
|
|
|
|
|
" ", this->GetName(), "\n"
|
|
|
|
|
|
|
|
"given platform specification containing a\n"
|
|
|
|
|
|
|
|
" version=", version, "\n"
|
|
|
|
|
|
|
|
"field with unsupported value.\n"
|
|
|
|
|
|
|
|
));
|
|
|
|
|
|
|
|
/* clang-format on */
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// If we are targeting Windows 10+, we select a Windows 10 SDK.
|
|
|
|
|
|
|
|
// If no Windows 8.1 SDK is installed, which is possible with VS 2017 and
|
|
|
|
|
|
|
|
// higher, then we must choose a Windows 10 SDK anyway.
|
|
|
|
|
|
|
|
if (cmHasLiteralPrefix(this->SystemVersion, "10.0") ||
|
|
|
|
|
|
|
|
!this->IsWin81SDKInstalled()) {
|
|
|
|
|
|
|
|
return this->SelectWindows10SDK(mf);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Under CMP0149 NEW behavior, we search for a Windows 10 SDK even
|
|
|
|
|
|
|
|
// when targeting older Windows versions, but it is not required.
|
|
|
|
|
|
|
|
if (mf->GetPolicyStatus(cmPolicies::CMP0149) == cmPolicies::NEW) {
|
|
|
|
|
|
|
|
std::string const version = this->GetWindows10SDKVersion(mf);
|
|
|
|
|
|
|
|
if (!version.empty()) {
|
|
|
|
|
|
|
|
this->SetWindowsTargetPlatformVersion(version, mf);
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// We are not targeting Windows 10+, so fall back to the Windows 8.1 SDK.
|
|
|
|
|
|
|
|
// For VS 2019 and above we must explicitly specify it.
|
|
|
|
|
|
|
|
if (this->Version >= cmGlobalVisualStudioGenerator::VSVersion::VS16 &&
|
|
|
|
|
|
|
|
!cmSystemTools::VersionCompareGreater(this->SystemVersion, "8.1")) {
|
|
|
|
|
|
|
|
this->SetWindowsTargetPlatformVersion("8.1", mf);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool cmGlobalVisualStudio14Generator::VerifyNoGeneratorPlatformVersion(
|
|
|
|
bool cmGlobalVisualStudio14Generator::VerifyNoGeneratorPlatformVersion(
|
|
|
|
cmMakefile* mf, cm::optional<std::string> reason) const
|
|
|
|
cmMakefile* mf) const
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (!this->GeneratorPlatformVersion) {
|
|
|
|
if (!this->GeneratorPlatformVersion) {
|
|
|
|
return true;
|
|
|
|
return true;
|
|
|
@ -163,9 +253,6 @@ bool cmGlobalVisualStudio14Generator::VerifyNoGeneratorPlatformVersion(
|
|
|
|
" " << this->SystemName << " " << this->SystemVersion << "\n"
|
|
|
|
" " << this->SystemName << " " << this->SystemVersion << "\n"
|
|
|
|
;
|
|
|
|
;
|
|
|
|
/* clang-format on */
|
|
|
|
/* clang-format on */
|
|
|
|
if (reason) {
|
|
|
|
|
|
|
|
e << *reason << ".";
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
mf->IssueMessage(MessageType::FATAL_ERROR, e.str());
|
|
|
|
mf->IssueMessage(MessageType::FATAL_ERROR, e.str());
|
|
|
|
return false;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -207,16 +294,6 @@ bool cmGlobalVisualStudio14Generator::ProcessGeneratorPlatformField(
|
|
|
|
|
|
|
|
|
|
|
|
bool cmGlobalVisualStudio14Generator::SelectWindows10SDK(cmMakefile* mf)
|
|
|
|
bool cmGlobalVisualStudio14Generator::SelectWindows10SDK(cmMakefile* mf)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (this->GeneratorPlatformVersion &&
|
|
|
|
|
|
|
|
this->GeneratorPlatformVersion->empty()) {
|
|
|
|
|
|
|
|
mf->IssueMessage(
|
|
|
|
|
|
|
|
MessageType::FATAL_ERROR,
|
|
|
|
|
|
|
|
cmStrCat("Generator\n ", this->GetName(),
|
|
|
|
|
|
|
|
"\ngiven platform specification with empty\n version=\n"
|
|
|
|
|
|
|
|
"field."));
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Find the default version of the Windows 10 SDK.
|
|
|
|
// Find the default version of the Windows 10 SDK.
|
|
|
|
std::string const version = this->GetWindows10SDKVersion(mf);
|
|
|
|
std::string const version = this->GetWindows10SDKVersion(mf);
|
|
|
|
|
|
|
|
|
|
|
@ -248,7 +325,8 @@ void cmGlobalVisualStudio14Generator::SetWindowsTargetPlatformVersion(
|
|
|
|
std::string const& version, cmMakefile* mf)
|
|
|
|
std::string const& version, cmMakefile* mf)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
this->WindowsTargetPlatformVersion = version;
|
|
|
|
this->WindowsTargetPlatformVersion = version;
|
|
|
|
if (!cmSystemTools::VersionCompareEqual(this->WindowsTargetPlatformVersion,
|
|
|
|
if (!this->WindowsTargetPlatformVersion.empty() &&
|
|
|
|
|
|
|
|
!cmSystemTools::VersionCompareEqual(this->WindowsTargetPlatformVersion,
|
|
|
|
this->SystemVersion)) {
|
|
|
|
this->SystemVersion)) {
|
|
|
|
std::ostringstream e;
|
|
|
|
std::ostringstream e;
|
|
|
|
e << "Selecting Windows SDK version " << this->WindowsTargetPlatformVersion
|
|
|
|
e << "Selecting Windows SDK version " << this->WindowsTargetPlatformVersion
|
|
|
@ -295,6 +373,11 @@ bool cmGlobalVisualStudio14Generator::IsWindowsStoreToolsetInstalled() const
|
|
|
|
cmSystemTools::KeyWOW64_32);
|
|
|
|
cmSystemTools::KeyWOW64_32);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bool cmGlobalVisualStudio14Generator::IsWin81SDKInstalled() const
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
std::string cmGlobalVisualStudio14Generator::GetWindows10SDKMaxVersion(
|
|
|
|
std::string cmGlobalVisualStudio14Generator::GetWindows10SDKMaxVersion(
|
|
|
|
cmMakefile* mf) const
|
|
|
|
cmMakefile* mf) const
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -356,16 +439,6 @@ std::string cmGlobalVisualStudio14Generator::GetWindows10SDKVersion(
|
|
|
|
cmMakefile* mf)
|
|
|
|
cmMakefile* mf)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
#if defined(_WIN32) && !defined(__CYGWIN__)
|
|
|
|
#if defined(_WIN32) && !defined(__CYGWIN__)
|
|
|
|
// Accept specific version requests as-is.
|
|
|
|
|
|
|
|
if (this->GeneratorPlatformVersion) {
|
|
|
|
|
|
|
|
std::string const& ver = *this->GeneratorPlatformVersion;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// VS 2019 and above support specifying plain "10.0".
|
|
|
|
|
|
|
|
if (this->Version >= VSVersion::VS16 && ver == "10.0") {
|
|
|
|
|
|
|
|
return ver;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
std::vector<std::string> win10Roots;
|
|
|
|
std::vector<std::string> win10Roots;
|
|
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
{
|
|
|
|