VS: Teach VS >= 10 generator about Windows CE
When CMAKE_SYSTEM_NAME is 'WindowsCE': * Set the Subsystem and EntryPointSymbol accordingly. * When CMAKE_SYSTEM_VERSION is 8.0 (Windows CE 2013), select the CE800 toolset by default.
This commit is contained in:
parent
0f2defba7d
commit
a3298f7790
|
@ -97,6 +97,7 @@ cmGlobalVisualStudio10Generator::cmGlobalVisualStudio10Generator(
|
||||||
this->ExpressEdition = cmSystemTools::ReadRegistryValue(
|
this->ExpressEdition = cmSystemTools::ReadRegistryValue(
|
||||||
"HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VCExpress\\10.0\\Setup\\VC;"
|
"HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VCExpress\\10.0\\Setup\\VC;"
|
||||||
"ProductDir", vc10Express, cmSystemTools::KeyWOW64_32);
|
"ProductDir", vc10Express, cmSystemTools::KeyWOW64_32);
|
||||||
|
this->SystemIsWindowsCE = false;
|
||||||
this->SystemIsWindowsPhone = false;
|
this->SystemIsWindowsPhone = false;
|
||||||
this->SystemIsWindowsStore = false;
|
this->SystemIsWindowsStore = false;
|
||||||
this->MSBuildCommandInitialized = false;
|
this->MSBuildCommandInitialized = false;
|
||||||
|
@ -152,6 +153,16 @@ bool
|
||||||
cmGlobalVisualStudio10Generator::SetGeneratorToolset(std::string const& ts,
|
cmGlobalVisualStudio10Generator::SetGeneratorToolset(std::string const& ts,
|
||||||
cmMakefile* mf)
|
cmMakefile* mf)
|
||||||
{
|
{
|
||||||
|
if (this->SystemIsWindowsCE && ts.empty() &&
|
||||||
|
this->DefaultPlatformToolset.empty())
|
||||||
|
{
|
||||||
|
cmOStringStream e;
|
||||||
|
e << this->GetName() << " Windows CE version '" << this->SystemVersion
|
||||||
|
<< "' requires CMAKE_GENERATOR_TOOLSET to be set.";
|
||||||
|
mf->IssueMessage(cmake::FATAL_ERROR, e.str());
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
this->GeneratorToolset = ts;
|
this->GeneratorToolset = ts;
|
||||||
if(const char* toolset = this->GetPlatformToolset())
|
if(const char* toolset = this->GetPlatformToolset())
|
||||||
{
|
{
|
||||||
|
@ -163,7 +174,15 @@ cmGlobalVisualStudio10Generator::SetGeneratorToolset(std::string const& ts,
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
bool cmGlobalVisualStudio10Generator::InitializeSystem(cmMakefile* mf)
|
bool cmGlobalVisualStudio10Generator::InitializeSystem(cmMakefile* mf)
|
||||||
{
|
{
|
||||||
if(this->SystemName == "WindowsPhone")
|
if (this->SystemName == "WindowsCE")
|
||||||
|
{
|
||||||
|
this->SystemIsWindowsCE = true;
|
||||||
|
if (!this->InitializeWindowsCE(mf))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if(this->SystemName == "WindowsPhone")
|
||||||
{
|
{
|
||||||
this->SystemIsWindowsPhone = true;
|
this->SystemIsWindowsPhone = true;
|
||||||
if(!this->InitializeWindowsPhone(mf))
|
if(!this->InitializeWindowsPhone(mf))
|
||||||
|
@ -182,6 +201,23 @@ bool cmGlobalVisualStudio10Generator::InitializeSystem(cmMakefile* mf)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
bool cmGlobalVisualStudio10Generator::InitializeWindowsCE(cmMakefile* mf)
|
||||||
|
{
|
||||||
|
if (this->DefaultPlatformName != "Win32")
|
||||||
|
{
|
||||||
|
cmOStringStream e;
|
||||||
|
e << "CMAKE_SYSTEM_NAME is 'WindowsCE' but CMAKE_GENERATOR "
|
||||||
|
<< "specifies a platform too: '" << this->GetName() << "'";
|
||||||
|
mf->IssueMessage(cmake::FATAL_ERROR, e.str());
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
this->DefaultPlatformToolset = this->SelectWindowsCEToolset();
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
bool cmGlobalVisualStudio10Generator::InitializeWindowsPhone(cmMakefile* mf)
|
bool cmGlobalVisualStudio10Generator::InitializeWindowsPhone(cmMakefile* mf)
|
||||||
{
|
{
|
||||||
|
@ -200,6 +236,16 @@ bool cmGlobalVisualStudio10Generator::InitializeWindowsStore(cmMakefile* mf)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
std::string cmGlobalVisualStudio10Generator::SelectWindowsCEToolset() const
|
||||||
|
{
|
||||||
|
if (this->SystemVersion == "8.0")
|
||||||
|
{
|
||||||
|
return "CE800";
|
||||||
|
}
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
void cmGlobalVisualStudio10Generator::WriteSLNHeader(std::ostream& fout)
|
void cmGlobalVisualStudio10Generator::WriteSLNHeader(std::ostream& fout)
|
||||||
{
|
{
|
||||||
|
|
|
@ -68,6 +68,10 @@ public:
|
||||||
/** Return the CMAKE_SYSTEM_VERSION. */
|
/** Return the CMAKE_SYSTEM_VERSION. */
|
||||||
std::string const& GetSystemVersion() const { return this->SystemVersion; }
|
std::string const& GetSystemVersion() const { return this->SystemVersion; }
|
||||||
|
|
||||||
|
/** Return true if building for WindowsCE */
|
||||||
|
bool TargetsWindowsCE() const
|
||||||
|
{ return this->SystemIsWindowsCE; }
|
||||||
|
|
||||||
/** Return true if building for WindowsPhone */
|
/** Return true if building for WindowsPhone */
|
||||||
bool TargetsWindowsPhone() const
|
bool TargetsWindowsPhone() const
|
||||||
{ return this->SystemIsWindowsPhone; }
|
{ return this->SystemIsWindowsPhone; }
|
||||||
|
@ -105,8 +109,10 @@ public:
|
||||||
protected:
|
protected:
|
||||||
virtual void Generate();
|
virtual void Generate();
|
||||||
virtual bool InitializeSystem(cmMakefile* mf);
|
virtual bool InitializeSystem(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 SelectWindowsPhoneToolset() const { return ""; }
|
virtual std::string SelectWindowsPhoneToolset() const { return ""; }
|
||||||
virtual std::string SelectWindowsStoreToolset() const { return ""; }
|
virtual std::string SelectWindowsStoreToolset() const { return ""; }
|
||||||
|
|
||||||
|
@ -118,6 +124,7 @@ protected:
|
||||||
std::string DefaultPlatformToolset;
|
std::string DefaultPlatformToolset;
|
||||||
std::string SystemName;
|
std::string SystemName;
|
||||||
std::string SystemVersion;
|
std::string SystemVersion;
|
||||||
|
bool SystemIsWindowsCE;
|
||||||
bool SystemIsWindowsPhone;
|
bool SystemIsWindowsPhone;
|
||||||
bool SystemIsWindowsStore;
|
bool SystemIsWindowsStore;
|
||||||
bool ExpressEdition;
|
bool ExpressEdition;
|
||||||
|
|
|
@ -2114,12 +2114,28 @@ cmVisualStudio10TargetGenerator::ComputeLinkOptions(std::string const& config)
|
||||||
linkOptions.AddFlag("Version", "");
|
linkOptions.AddFlag("Version", "");
|
||||||
|
|
||||||
if ( this->Target->GetPropertyAsBool("WIN32_EXECUTABLE") )
|
if ( this->Target->GetPropertyAsBool("WIN32_EXECUTABLE") )
|
||||||
|
{
|
||||||
|
if (this->GlobalGenerator->TargetsWindowsCE())
|
||||||
|
{
|
||||||
|
linkOptions.AddFlag("SubSystem", "WindowsCE");
|
||||||
|
linkOptions.AddFlag("EntryPointSymbol", "WinMainCRTStartup");
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
linkOptions.AddFlag("SubSystem", "Windows");
|
linkOptions.AddFlag("SubSystem", "Windows");
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (this->GlobalGenerator->TargetsWindowsCE())
|
||||||
|
{
|
||||||
|
linkOptions.AddFlag("SubSystem", "WindowsCE");
|
||||||
|
linkOptions.AddFlag("EntryPointSymbol", "mainACRTStartup");
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
linkOptions.AddFlag("SubSystem", "Console");
|
linkOptions.AddFlag("SubSystem", "Console");
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
if(const char* stackVal =
|
if(const char* stackVal =
|
||||||
|
|
Loading…
Reference in New Issue