Merge topic 'vs-check-phone-store-tools'

689cd0d4 VS: Do not produce WinMD file for OBJECT libraries (#15228)
b20a32ac VS: Improve error messages when compiler is not detected (#15228)
This commit is contained in:
Brad King 2014-11-18 09:12:34 -05:00 committed by CMake Topic Stage
commit d526ebc603
7 changed files with 242 additions and 35 deletions

View File

@ -261,6 +261,24 @@ bool cmGlobalVisualStudio10Generator::InitializeWindowsStore(cmMakefile* mf)
return false; return false;
} }
//----------------------------------------------------------------------------
bool
cmGlobalVisualStudio10Generator::SelectWindowsPhoneToolset(
std::string& toolset) const
{
toolset = "";
return false;
}
//----------------------------------------------------------------------------
bool
cmGlobalVisualStudio10Generator::SelectWindowsStoreToolset(
std::string& toolset) const
{
toolset = "";
return false;
}
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
std::string cmGlobalVisualStudio10Generator::SelectWindowsCEToolset() const std::string cmGlobalVisualStudio10Generator::SelectWindowsCEToolset() const
{ {

View File

@ -118,9 +118,10 @@ protected:
virtual bool InitializeWindowsCE(cmMakefile* mf); virtual bool InitializeWindowsCE(cmMakefile* mf);
virtual bool InitializeWindowsPhone(cmMakefile* mf); virtual bool InitializeWindowsPhone(cmMakefile* mf);
virtual bool InitializeWindowsStore(cmMakefile* mf); virtual bool InitializeWindowsStore(cmMakefile* mf);
virtual std::string SelectWindowsCEToolset() const; virtual std::string SelectWindowsCEToolset() const;
virtual std::string SelectWindowsPhoneToolset() const { return ""; } virtual bool SelectWindowsPhoneToolset(std::string& toolset) const;
virtual std::string SelectWindowsStoreToolset() const { return ""; } virtual bool SelectWindowsStoreToolset(std::string& toolset) const;
virtual const char* GetIDEVersion() { return "10.0"; } virtual const char* GetIDEVersion() { return "10.0"; }

View File

@ -131,12 +131,20 @@ cmGlobalVisualStudio11Generator::MatchesGeneratorName(
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
bool cmGlobalVisualStudio11Generator::InitializeWindowsPhone(cmMakefile* mf) bool cmGlobalVisualStudio11Generator::InitializeWindowsPhone(cmMakefile* mf)
{ {
this->DefaultPlatformToolset = this->SelectWindowsPhoneToolset(); if(!this->SelectWindowsPhoneToolset(this->DefaultPlatformToolset))
if(this->DefaultPlatformToolset.empty())
{ {
cmOStringStream e; cmOStringStream e;
if(this->DefaultPlatformToolset.empty())
{
e << this->GetName() << " supports Windows Phone '8.0', but not '" e << this->GetName() << " supports Windows Phone '8.0', but not '"
<< this->SystemVersion << "'. Check CMAKE_SYSTEM_VERSION."; << this->SystemVersion << "'. Check CMAKE_SYSTEM_VERSION.";
}
else
{
e << "A Windows Phone component with CMake requires both the Windows "
<< "Desktop SDK as well as the Windows Phone '" << this->SystemVersion
<< "' SDK. Please make sure that you have both installed";
}
mf->IssueMessage(cmake::FATAL_ERROR, e.str()); mf->IssueMessage(cmake::FATAL_ERROR, e.str());
return false; return false;
} }
@ -146,12 +154,20 @@ bool cmGlobalVisualStudio11Generator::InitializeWindowsPhone(cmMakefile* mf)
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
bool cmGlobalVisualStudio11Generator::InitializeWindowsStore(cmMakefile* mf) bool cmGlobalVisualStudio11Generator::InitializeWindowsStore(cmMakefile* mf)
{ {
this->DefaultPlatformToolset = this->SelectWindowsStoreToolset(); if(!this->SelectWindowsStoreToolset(this->DefaultPlatformToolset))
if(this->DefaultPlatformToolset.empty())
{ {
cmOStringStream e; cmOStringStream e;
if(this->DefaultPlatformToolset.empty())
{
e << this->GetName() << " supports Windows Store '8.0', but not '" e << this->GetName() << " supports Windows Store '8.0', but not '"
<< this->SystemVersion << "'. Check CMAKE_SYSTEM_VERSION."; << this->SystemVersion << "'. Check CMAKE_SYSTEM_VERSION.";
}
else
{
e << "A Windows Store component with CMake requires both the Windows "
<< "Desktop SDK as well as the Windows Store '" << this->SystemVersion
<< "' SDK. Please make sure that you have both installed";
}
mf->IssueMessage(cmake::FATAL_ERROR, e.str()); mf->IssueMessage(cmake::FATAL_ERROR, e.str());
return false; return false;
} }
@ -159,23 +175,47 @@ bool cmGlobalVisualStudio11Generator::InitializeWindowsStore(cmMakefile* mf)
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
std::string cmGlobalVisualStudio11Generator::SelectWindowsPhoneToolset() const bool
cmGlobalVisualStudio11Generator::SelectWindowsPhoneToolset(
std::string& toolset) const
{ {
if(this->SystemVersion == "8.0") if(this->SystemVersion == "8.0")
{ {
return "v110_wp80"; if (this->IsWindowsPhoneToolsetInstalled() &&
this->IsWindowsDesktopToolsetInstalled())
{
toolset = "v110_wp80";
return true;
} }
return this->cmGlobalVisualStudio10Generator::SelectWindowsPhoneToolset(); else
{
return false;
}
}
return
this->cmGlobalVisualStudio10Generator::SelectWindowsPhoneToolset(toolset);
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
std::string cmGlobalVisualStudio11Generator::SelectWindowsStoreToolset() const bool
cmGlobalVisualStudio11Generator::SelectWindowsStoreToolset(
std::string& toolset) const
{ {
if(this->SystemVersion == "8.0") if(this->SystemVersion == "8.0")
{ {
return "v110"; if(this->IsWindowsStoreToolsetInstalled() &&
this->IsWindowsDesktopToolsetInstalled())
{
toolset = "v110";
return true;
} }
return this->cmGlobalVisualStudio10Generator::SelectWindowsStoreToolset(); else
{
return false;
}
}
return
this->cmGlobalVisualStudio10Generator::SelectWindowsStoreToolset(toolset);
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
@ -256,3 +296,54 @@ cmGlobalVisualStudio11Generator::NeedsDeploy(cmTarget::TargetType type) const
} }
return cmGlobalVisualStudio10Generator::NeedsDeploy(type); return cmGlobalVisualStudio10Generator::NeedsDeploy(type);
} }
//----------------------------------------------------------------------------
bool
cmGlobalVisualStudio11Generator::IsWindowsDesktopToolsetInstalled() const
{
const char desktop80Key[] =
"HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\"
"VisualStudio\\11.0\\VC\\Libraries\\Extended";
const char VS2012DesktopExpressKey[] =
"HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\"
"WDExpress\\11.0;InstallDir";
std::vector<std::string> subkeys;
std::string path;
return cmSystemTools::ReadRegistryValue(VS2012DesktopExpressKey,
path,
cmSystemTools::KeyWOW64_32) ||
cmSystemTools::GetRegistrySubKeys(desktop80Key,
subkeys,
cmSystemTools::KeyWOW64_32);
}
//----------------------------------------------------------------------------
bool
cmGlobalVisualStudio11Generator::IsWindowsPhoneToolsetInstalled() const
{
const char wp80Key[] =
"HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\"
"Microsoft SDKs\\WindowsPhone\\v8.0\\"
"Install Path;Install Path";
std::string path;
cmSystemTools::ReadRegistryValue(wp80Key,
path,
cmSystemTools::KeyWOW64_32);
return !path.empty();
}
//----------------------------------------------------------------------------
bool
cmGlobalVisualStudio11Generator::IsWindowsStoreToolsetInstalled() const
{
const char win80Key[] =
"HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\"
"VisualStudio\\11.0\\VC\\Libraries\\Core\\Arm";
std::vector<std::string> subkeys;
return cmSystemTools::GetRegistrySubKeys(win80Key,
subkeys,
cmSystemTools::KeyWOW64_32);
}

View File

@ -36,8 +36,15 @@ public:
protected: protected:
virtual bool InitializeWindowsPhone(cmMakefile* mf); virtual bool InitializeWindowsPhone(cmMakefile* mf);
virtual bool InitializeWindowsStore(cmMakefile* mf); virtual bool InitializeWindowsStore(cmMakefile* mf);
virtual std::string SelectWindowsPhoneToolset() const; virtual bool SelectWindowsPhoneToolset(std::string& toolset) const;
virtual std::string SelectWindowsStoreToolset() const; virtual bool SelectWindowsStoreToolset(std::string& toolset) const;
// These aren't virtual because we need to check if the selected version
// of the toolset is installed
bool IsWindowsDesktopToolsetInstalled() const;
bool IsWindowsPhoneToolsetInstalled() const;
bool IsWindowsStoreToolsetInstalled() const;
virtual const char* GetIDEVersion() { return "11.0"; } virtual const char* GetIDEVersion() { return "11.0"; }
bool UseFolderProperty(); bool UseFolderProperty();
static std::set<std::string> GetInstalledWindowsCESDKs(); static std::set<std::string> GetInstalledWindowsCESDKs();

View File

@ -111,12 +111,20 @@ cmGlobalVisualStudio12Generator::MatchesGeneratorName(
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
bool cmGlobalVisualStudio12Generator::InitializeWindowsPhone(cmMakefile* mf) bool cmGlobalVisualStudio12Generator::InitializeWindowsPhone(cmMakefile* mf)
{ {
this->DefaultPlatformToolset = this->SelectWindowsPhoneToolset(); if(!this->SelectWindowsPhoneToolset(this->DefaultPlatformToolset))
if(this->DefaultPlatformToolset.empty())
{ {
cmOStringStream e; cmOStringStream e;
e << this->GetName() << " supports Windows Phone '8.0' and '8.1', " if(this->DefaultPlatformToolset.empty())
"but not '" << this->SystemVersion << "'. Check CMAKE_SYSTEM_VERSION."; {
e << this->GetName() << " supports Windows Phone '8.0' and '8.1', but "
"not '" << this->SystemVersion << "'. Check CMAKE_SYSTEM_VERSION.";
}
else
{
e << "A Windows Phone component with CMake requires both the Windows "
<< "Desktop SDK as well as the Windows Phone '" << this->SystemVersion
<< "' SDK. Please make sure that you have both installed";
}
mf->IssueMessage(cmake::FATAL_ERROR, e.str()); mf->IssueMessage(cmake::FATAL_ERROR, e.str());
return false; return false;
} }
@ -126,12 +134,20 @@ bool cmGlobalVisualStudio12Generator::InitializeWindowsPhone(cmMakefile* mf)
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
bool cmGlobalVisualStudio12Generator::InitializeWindowsStore(cmMakefile* mf) bool cmGlobalVisualStudio12Generator::InitializeWindowsStore(cmMakefile* mf)
{ {
this->DefaultPlatformToolset = this->SelectWindowsStoreToolset(); if(!this->SelectWindowsStoreToolset(this->DefaultPlatformToolset))
if(this->DefaultPlatformToolset.empty())
{ {
cmOStringStream e; cmOStringStream e;
e << this->GetName() << " supports Windows Store '8.0' and '8.1', " if(this->DefaultPlatformToolset.empty())
"but not '" << this->SystemVersion << "'. Check CMAKE_SYSTEM_VERSION."; {
e << this->GetName() << " supports Windows Store '8.0' and '8.1', but "
"not '" << this->SystemVersion << "'. Check CMAKE_SYSTEM_VERSION.";
}
else
{
e << "A Windows Store component with CMake requires both the Windows "
<< "Desktop SDK as well as the Windows Store '" << this->SystemVersion
<< "' SDK. Please make sure that you have both installed";
}
mf->IssueMessage(cmake::FATAL_ERROR, e.str()); mf->IssueMessage(cmake::FATAL_ERROR, e.str());
return false; return false;
} }
@ -139,23 +155,47 @@ bool cmGlobalVisualStudio12Generator::InitializeWindowsStore(cmMakefile* mf)
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
std::string cmGlobalVisualStudio12Generator::SelectWindowsPhoneToolset() const bool
cmGlobalVisualStudio12Generator::SelectWindowsPhoneToolset(
std::string& toolset) const
{ {
if(this->SystemVersion == "8.1") if(this->SystemVersion == "8.1")
{ {
return "v120_wp81"; if (this->IsWindowsPhoneToolsetInstalled() &&
this->IsWindowsDesktopToolsetInstalled())
{
toolset = "v120_wp81";
return true;
} }
return this->cmGlobalVisualStudio11Generator::SelectWindowsPhoneToolset(); else
{
return false;
}
}
return
this->cmGlobalVisualStudio11Generator::SelectWindowsPhoneToolset(toolset);
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
std::string cmGlobalVisualStudio12Generator::SelectWindowsStoreToolset() const bool
cmGlobalVisualStudio12Generator::SelectWindowsStoreToolset(
std::string& toolset) const
{ {
if(this->SystemVersion == "8.1") if(this->SystemVersion == "8.1")
{ {
return "v120"; if(this->IsWindowsStoreToolsetInstalled() &&
this->IsWindowsDesktopToolsetInstalled())
{
toolset = "v120";
return true;
} }
return this->cmGlobalVisualStudio11Generator::SelectWindowsStoreToolset(); else
{
return false;
}
}
return
this->cmGlobalVisualStudio11Generator::SelectWindowsStoreToolset(toolset);
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
@ -180,3 +220,46 @@ cmLocalGenerator *cmGlobalVisualStudio12Generator::CreateLocalGenerator()
lg->SetGlobalGenerator(this); lg->SetGlobalGenerator(this);
return lg; return lg;
} }
//----------------------------------------------------------------------------
bool
cmGlobalVisualStudio12Generator::IsWindowsDesktopToolsetInstalled() const
{
const char desktop81Key[] =
"HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\"
"VisualStudio\\12.0\\VC\\LibraryDesktop";
std::vector<std::string> subkeys;
return cmSystemTools::GetRegistrySubKeys(desktop81Key,
subkeys,
cmSystemTools::KeyWOW64_32);
}
//----------------------------------------------------------------------------
bool
cmGlobalVisualStudio12Generator::IsWindowsPhoneToolsetInstalled() const
{
const char wp81Key[] =
"HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\"
"Microsoft SDKs\\WindowsPhone\\v8.1\\Install Path;Install Path";
std::string path;
cmSystemTools::ReadRegistryValue(wp81Key,
path,
cmSystemTools::KeyWOW64_32);
return !path.empty();
}
//----------------------------------------------------------------------------
bool
cmGlobalVisualStudio12Generator::IsWindowsStoreToolsetInstalled() const
{
const char win81Key[] =
"HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\"
"VisualStudio\\12.0\\VC\\Libraries\\Core\\Arm";
std::vector<std::string> subkeys;
return cmSystemTools::GetRegistrySubKeys(win81Key,
subkeys,
cmSystemTools::KeyWOW64_32);
}

View File

@ -41,8 +41,14 @@ public:
protected: protected:
virtual bool InitializeWindowsPhone(cmMakefile* mf); virtual bool InitializeWindowsPhone(cmMakefile* mf);
virtual bool InitializeWindowsStore(cmMakefile* mf); virtual bool InitializeWindowsStore(cmMakefile* mf);
virtual std::string SelectWindowsPhoneToolset() const; virtual bool SelectWindowsPhoneToolset(std::string& toolset) const;
virtual std::string SelectWindowsStoreToolset() const; virtual bool SelectWindowsStoreToolset(std::string& toolset) const;
// These aren't virtual because we need to check if the selected version
// of the toolset is installed
bool IsWindowsDesktopToolsetInstalled() const;
bool IsWindowsPhoneToolsetInstalled() const;
bool IsWindowsStoreToolsetInstalled() const;
virtual const char* GetIDEVersion() { return "12.0"; } virtual const char* GetIDEVersion() { return "12.0"; }
private: private:
class Factory; class Factory;

View File

@ -2036,7 +2036,8 @@ WriteMasmOptions(std::string const& configName,
void void
cmVisualStudio10TargetGenerator::WriteLibOptions(std::string const& config) cmVisualStudio10TargetGenerator::WriteLibOptions(std::string const& config)
{ {
if(this->Target->GetType() != cmTarget::STATIC_LIBRARY) if(this->Target->GetType() != cmTarget::STATIC_LIBRARY &&
this->Target->GetType() != cmTarget::OBJECT_LIBRARY)
{ {
return; return;
} }