Merge topic 'delay-generator-platform'

7a526c35 VS: Delay getting platform name in local generator
e7fdb44b VS: Delay detection of VS 10 Express 64-bit tools
6e176e6d VS: Delay platform definitions until system name is known
d3d9218a VS: Remove unused method from VS 9 generator
eeb60102 VS: Refactor CMAKE_FORCE_*64 platform definitions
ecb34faa Tell generators about CMAKE_SYSTEM_NAME as soon as it is known
This commit is contained in:
Brad King 2014-07-18 10:57:02 -04:00 committed by CMake Topic Stage
commit e27b2c3fa5
21 changed files with 99 additions and 118 deletions

View File

@ -448,6 +448,14 @@ cmGlobalGenerator::EnableLanguage(std::vector<std::string>const& languages,
mf->ReadListFile(0,fpath.c_str()); mf->ReadListFile(0,fpath.c_str());
} }
// Tell the generator about the target system.
std::string system = mf->GetSafeDefinition("CMAKE_SYSTEM_NAME");
if(!this->SetSystemName(system, mf))
{
cmSystemTools::SetFatalErrorOccured();
return;
}
// Tell the generator about the toolset, if any. // Tell the generator about the toolset, if any.
std::string toolset = mf->GetSafeDefinition("CMAKE_GENERATOR_TOOLSET"); std::string toolset = mf->GetSafeDefinition("CMAKE_GENERATOR_TOOLSET");
if(!toolset.empty() && if(!toolset.empty() &&

View File

@ -61,6 +61,10 @@ public:
virtual bool MatchesGeneratorName(const std::string& name) const virtual bool MatchesGeneratorName(const std::string& name) const
{ return this->GetName() == name; } { return this->GetName() == name; }
/** Tell the generator about the target system. */
virtual bool SetSystemName(std::string const&, cmMakefile*)
{ return true; }
/** Set the generator-specific toolset name. Returns true if toolset /** Set the generator-specific toolset name. Returns true if toolset
is supported and false otherwise. */ is supported and false otherwise. */
virtual bool SetGeneratorToolset(std::string const& ts, cmMakefile* mf); virtual bool SetGeneratorToolset(std::string const& ts, cmMakefile* mf);

View File

@ -51,19 +51,19 @@ public:
if(!*p) if(!*p)
{ {
return new cmGlobalVisualStudio10Generator( return new cmGlobalVisualStudio10Generator(
genName, "", ""); genName, "");
} }
if(*p++ != ' ') if(*p++ != ' ')
{ return 0; } { return 0; }
if(strcmp(p, "Win64") == 0) if(strcmp(p, "Win64") == 0)
{ {
return new cmGlobalVisualStudio10Generator( return new cmGlobalVisualStudio10Generator(
genName, "x64", "CMAKE_FORCE_WIN64"); genName, "x64");
} }
if(strcmp(p, "IA64") == 0) if(strcmp(p, "IA64") == 0)
{ {
return new cmGlobalVisualStudio10Generator( return new cmGlobalVisualStudio10Generator(
genName, "Itanium", "CMAKE_FORCE_IA64"); genName, "Itanium");
} }
return 0; return 0;
} }
@ -90,10 +90,8 @@ cmGlobalGeneratorFactory* cmGlobalVisualStudio10Generator::NewFactory()
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
cmGlobalVisualStudio10Generator::cmGlobalVisualStudio10Generator( cmGlobalVisualStudio10Generator::cmGlobalVisualStudio10Generator(
const std::string& name, const std::string& platformName, const std::string& name, const std::string& platformName)
const std::string& additionalPlatformDefinition) : cmGlobalVisualStudio8Generator(name, platformName)
: cmGlobalVisualStudio8Generator(name, platformName,
additionalPlatformDefinition)
{ {
std::string vc10Express; std::string vc10Express;
this->ExpressEdition = cmSystemTools::ReadRegistryValue( this->ExpressEdition = cmSystemTools::ReadRegistryValue(
@ -127,10 +125,18 @@ cmGlobalVisualStudio10Generator::SetGeneratorToolset(std::string const& ts,
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void cmGlobalVisualStudio10Generator::AddPlatformDefinitions(cmMakefile* mf) bool cmGlobalVisualStudio10Generator::SetSystemName(std::string const& s,
cmMakefile* mf)
{ {
cmGlobalVisualStudio8Generator::AddPlatformDefinitions(mf); if(this->PlatformName == "Itanium" || this->PlatformName == "x64")
{
if(this->IsExpressEdition() && !this->Find64BitTools(mf))
{
return false;
}
}
this->AddVSPlatformToolsetDefinition(mf); this->AddVSPlatformToolsetDefinition(mf);
return this->cmGlobalVisualStudio8Generator::SetSystemName(s, mf);
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
@ -162,7 +168,6 @@ cmLocalGenerator *cmGlobalVisualStudio10Generator::CreateLocalGenerator()
{ {
cmLocalVisualStudio10Generator* lg = cmLocalVisualStudio10Generator* lg =
new cmLocalVisualStudio10Generator(cmLocalVisualStudioGenerator::VS10); new cmLocalVisualStudio10Generator(cmLocalVisualStudioGenerator::VS10);
lg->SetPlatformName(this->GetPlatformName());
lg->SetGlobalGenerator(this); lg->SetGlobalGenerator(this);
return lg; return lg;
} }
@ -204,14 +209,6 @@ void cmGlobalVisualStudio10Generator
::EnableLanguage(std::vector<std::string>const & lang, ::EnableLanguage(std::vector<std::string>const & lang,
cmMakefile *mf, bool optional) cmMakefile *mf, bool optional)
{ {
if(this->PlatformName == "Itanium" || this->PlatformName == "x64")
{
if(this->IsExpressEdition() && !this->Find64BitTools(mf))
{
return;
}
}
for(std::vector<std::string>::const_iterator it = lang.begin(); for(std::vector<std::string>::const_iterator it = lang.begin();
it != lang.end(); ++it) it != lang.end(); ++it)
{ {

View File

@ -25,13 +25,13 @@ class cmGlobalVisualStudio10Generator :
{ {
public: public:
cmGlobalVisualStudio10Generator(const std::string& name, cmGlobalVisualStudio10Generator(const std::string& name,
const std::string& platformName, const std::string& platformName);
const std::string& additionalPlatformDefinition);
static cmGlobalGeneratorFactory* NewFactory(); static cmGlobalGeneratorFactory* NewFactory();
virtual bool MatchesGeneratorName(const std::string& name) const; virtual bool MatchesGeneratorName(const std::string& name) const;
virtual bool SetGeneratorToolset(std::string const& ts, cmMakefile* mf); virtual bool SetGeneratorToolset(std::string const& ts, cmMakefile* mf);
virtual bool SetSystemName(std::string const& s, cmMakefile* mf);
virtual void GenerateBuildCommand( virtual void GenerateBuildCommand(
std::vector<std::string>& makeCommand, std::vector<std::string>& makeCommand,
@ -44,8 +44,6 @@ public:
std::vector<std::string> const& makeOptions = std::vector<std::string>() std::vector<std::string> const& makeOptions = std::vector<std::string>()
); );
virtual void AddPlatformDefinitions(cmMakefile* mf);
///! create the correct local generator ///! create the correct local generator
virtual cmLocalGenerator *CreateLocalGenerator(); virtual cmLocalGenerator *CreateLocalGenerator();

View File

@ -46,19 +46,19 @@ public:
if(!*p) if(!*p)
{ {
return new cmGlobalVisualStudio11Generator( return new cmGlobalVisualStudio11Generator(
genName, "", ""); genName, "");
} }
if(*p++ != ' ') if(*p++ != ' ')
{ return 0; } { return 0; }
if(strcmp(p, "Win64") == 0) if(strcmp(p, "Win64") == 0)
{ {
return new cmGlobalVisualStudio11Generator( return new cmGlobalVisualStudio11Generator(
genName, "x64", "CMAKE_FORCE_WIN64"); genName, "x64");
} }
if(strcmp(p, "ARM") == 0) if(strcmp(p, "ARM") == 0)
{ {
return new cmGlobalVisualStudio11Generator( return new cmGlobalVisualStudio11Generator(
genName, "ARM", ""); genName, "ARM");
} }
std::set<std::string> installedSDKs = std::set<std::string> installedSDKs =
@ -70,7 +70,7 @@ public:
} }
cmGlobalVisualStudio11Generator* ret = cmGlobalVisualStudio11Generator* ret =
new cmGlobalVisualStudio11Generator(name, p, NULL); new cmGlobalVisualStudio11Generator(name, p);
ret->WindowsCEVersion = "8.00"; ret->WindowsCEVersion = "8.00";
return ret; return ret;
} }
@ -105,10 +105,8 @@ cmGlobalGeneratorFactory* cmGlobalVisualStudio11Generator::NewFactory()
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
cmGlobalVisualStudio11Generator::cmGlobalVisualStudio11Generator( cmGlobalVisualStudio11Generator::cmGlobalVisualStudio11Generator(
const std::string& name, const std::string& platformName, const std::string& name, const std::string& platformName)
const std::string& additionalPlatformDefinition) : cmGlobalVisualStudio10Generator(name, platformName)
: cmGlobalVisualStudio10Generator(name, platformName,
additionalPlatformDefinition)
{ {
std::string vc11Express; std::string vc11Express;
this->ExpressEdition = cmSystemTools::ReadRegistryValue( this->ExpressEdition = cmSystemTools::ReadRegistryValue(
@ -149,7 +147,6 @@ cmLocalGenerator *cmGlobalVisualStudio11Generator::CreateLocalGenerator()
{ {
cmLocalVisualStudio10Generator* lg = cmLocalVisualStudio10Generator* lg =
new cmLocalVisualStudio10Generator(cmLocalVisualStudioGenerator::VS11); new cmLocalVisualStudio10Generator(cmLocalVisualStudioGenerator::VS11);
lg->SetPlatformName(this->GetPlatformName());
lg->SetGlobalGenerator(this); lg->SetGlobalGenerator(this);
return lg; return lg;
} }

View File

@ -21,8 +21,7 @@ class cmGlobalVisualStudio11Generator:
{ {
public: public:
cmGlobalVisualStudio11Generator(const std::string& name, cmGlobalVisualStudio11Generator(const std::string& name,
const std::string& platformName, const std::string& platformName);
const std::string& additionalPlatformDefinition);
static cmGlobalGeneratorFactory* NewFactory(); static cmGlobalGeneratorFactory* NewFactory();
virtual bool MatchesGeneratorName(const std::string& name) const; virtual bool MatchesGeneratorName(const std::string& name) const;

View File

@ -46,19 +46,19 @@ public:
if(!*p) if(!*p)
{ {
return new cmGlobalVisualStudio12Generator( return new cmGlobalVisualStudio12Generator(
genName, "", ""); genName, "");
} }
if(*p++ != ' ') if(*p++ != ' ')
{ return 0; } { return 0; }
if(strcmp(p, "Win64") == 0) if(strcmp(p, "Win64") == 0)
{ {
return new cmGlobalVisualStudio12Generator( return new cmGlobalVisualStudio12Generator(
genName, "x64", "CMAKE_FORCE_WIN64"); genName, "x64");
} }
if(strcmp(p, "ARM") == 0) if(strcmp(p, "ARM") == 0)
{ {
return new cmGlobalVisualStudio12Generator( return new cmGlobalVisualStudio12Generator(
genName, "ARM", ""); genName, "ARM");
} }
return 0; return 0;
} }
@ -85,10 +85,8 @@ cmGlobalGeneratorFactory* cmGlobalVisualStudio12Generator::NewFactory()
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
cmGlobalVisualStudio12Generator::cmGlobalVisualStudio12Generator( cmGlobalVisualStudio12Generator::cmGlobalVisualStudio12Generator(
const std::string& name, const std::string& platformName, const std::string& name, const std::string& platformName)
const std::string& additionalPlatformDefinition) : cmGlobalVisualStudio11Generator(name, platformName)
: cmGlobalVisualStudio11Generator(name, platformName,
additionalPlatformDefinition)
{ {
std::string vc12Express; std::string vc12Express;
this->ExpressEdition = cmSystemTools::ReadRegistryValue( this->ExpressEdition = cmSystemTools::ReadRegistryValue(
@ -129,7 +127,6 @@ cmLocalGenerator *cmGlobalVisualStudio12Generator::CreateLocalGenerator()
{ {
cmLocalVisualStudio10Generator* lg = cmLocalVisualStudio10Generator* lg =
new cmLocalVisualStudio10Generator(cmLocalVisualStudioGenerator::VS12); new cmLocalVisualStudio10Generator(cmLocalVisualStudioGenerator::VS12);
lg->SetPlatformName(this->GetPlatformName());
lg->SetGlobalGenerator(this); lg->SetGlobalGenerator(this);
return lg; return lg;
} }

View File

@ -21,8 +21,7 @@ class cmGlobalVisualStudio12Generator:
{ {
public: public:
cmGlobalVisualStudio12Generator(const std::string& name, cmGlobalVisualStudio12Generator(const std::string& name,
const std::string& platformName, const std::string& platformName);
const std::string& additionalPlatformDefinition);
static cmGlobalGeneratorFactory* NewFactory(); static cmGlobalGeneratorFactory* NewFactory();
virtual bool MatchesGeneratorName(const std::string& name) const; virtual bool MatchesGeneratorName(const std::string& name) const;

View File

@ -31,19 +31,19 @@ public:
if(!*p) if(!*p)
{ {
return new cmGlobalVisualStudio14Generator( return new cmGlobalVisualStudio14Generator(
genName, "", ""); genName, "");
} }
if(*p++ != ' ') if(*p++ != ' ')
{ return 0; } { return 0; }
if(strcmp(p, "Win64") == 0) if(strcmp(p, "Win64") == 0)
{ {
return new cmGlobalVisualStudio14Generator( return new cmGlobalVisualStudio14Generator(
genName, "x64", "CMAKE_FORCE_WIN64"); genName, "x64");
} }
if(strcmp(p, "ARM") == 0) if(strcmp(p, "ARM") == 0)
{ {
return new cmGlobalVisualStudio14Generator( return new cmGlobalVisualStudio14Generator(
genName, "ARM", ""); genName, "ARM");
} }
return 0; return 0;
} }
@ -70,10 +70,8 @@ cmGlobalGeneratorFactory* cmGlobalVisualStudio14Generator::NewFactory()
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
cmGlobalVisualStudio14Generator::cmGlobalVisualStudio14Generator( cmGlobalVisualStudio14Generator::cmGlobalVisualStudio14Generator(
const std::string& name, const std::string& platformName, const std::string& name, const std::string& platformName)
const std::string& additionalPlatformDefinition) : cmGlobalVisualStudio12Generator(name, platformName)
: cmGlobalVisualStudio12Generator(name, platformName,
additionalPlatformDefinition)
{ {
std::string vc14Express; std::string vc14Express;
this->ExpressEdition = cmSystemTools::ReadRegistryValue( this->ExpressEdition = cmSystemTools::ReadRegistryValue(
@ -110,7 +108,6 @@ cmLocalGenerator *cmGlobalVisualStudio14Generator::CreateLocalGenerator()
{ {
cmLocalVisualStudio10Generator* lg = cmLocalVisualStudio10Generator* lg =
new cmLocalVisualStudio10Generator(cmLocalVisualStudioGenerator::VS14); new cmLocalVisualStudio10Generator(cmLocalVisualStudioGenerator::VS14);
lg->SetPlatformName(this->GetPlatformName());
lg->SetGlobalGenerator(this); lg->SetGlobalGenerator(this);
return lg; return lg;
} }

View File

@ -21,8 +21,7 @@ class cmGlobalVisualStudio14Generator:
{ {
public: public:
cmGlobalVisualStudio14Generator(const std::string& name, cmGlobalVisualStudio14Generator(const std::string& name,
const std::string& platformName, const std::string& platformName);
const std::string& additionalPlatformDefinition);
static cmGlobalGeneratorFactory* NewFactory(); static cmGlobalGeneratorFactory* NewFactory();
virtual bool MatchesGeneratorName(const std::string& name) const; virtual bool MatchesGeneratorName(const std::string& name) const;

View File

@ -41,7 +41,6 @@ void cmGlobalVisualStudio6Generator
cmMakefile *mf, cmMakefile *mf,
bool optional) bool optional)
{ {
cmGlobalVisualStudioGenerator::AddPlatformDefinitions(mf);
mf->AddDefinition("CMAKE_GENERATOR_RC", "rc"); mf->AddDefinition("CMAKE_GENERATOR_RC", "rc");
mf->AddDefinition("CMAKE_GENERATOR_NO_COMPILER_ENV", "1"); mf->AddDefinition("CMAKE_GENERATOR_NO_COMPILER_ENV", "1");
this->GenerateConfigurations(mf); this->GenerateConfigurations(mf);

View File

@ -80,7 +80,6 @@ void cmGlobalVisualStudio7Generator
{ {
mf->AddDefinition("CMAKE_GENERATOR_RC", "rc"); mf->AddDefinition("CMAKE_GENERATOR_RC", "rc");
mf->AddDefinition("CMAKE_GENERATOR_NO_COMPILER_ENV", "1"); mf->AddDefinition("CMAKE_GENERATOR_NO_COMPILER_ENV", "1");
this->AddPlatformDefinitions(mf);
if(!mf->GetDefinition("CMAKE_CONFIGURATION_TYPES")) if(!mf->GetDefinition("CMAKE_CONFIGURATION_TYPES"))
{ {
mf->AddCacheDefinition( mf->AddCacheDefinition(
@ -260,12 +259,21 @@ cmLocalGenerator *cmGlobalVisualStudio7Generator::CreateLocalGenerator()
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void cmGlobalVisualStudio7Generator::AddPlatformDefinitions(cmMakefile* mf) bool cmGlobalVisualStudio7Generator::SetSystemName(std::string const& s,
cmMakefile* mf)
{ {
cmGlobalVisualStudioGenerator::AddPlatformDefinitions(mf); if(this->PlatformName == "x64")
{
mf->AddDefinition("CMAKE_FORCE_WIN64", "TRUE");
}
else if(this->PlatformName == "Itanium")
{
mf->AddDefinition("CMAKE_FORCE_IA64", "TRUE");
}
mf->AddDefinition("CMAKE_VS_PLATFORM_NAME", this->GetPlatformName().c_str()); mf->AddDefinition("CMAKE_VS_PLATFORM_NAME", this->GetPlatformName().c_str());
mf->AddDefinition("CMAKE_VS_INTEL_Fortran_PROJECT_VERSION", mf->AddDefinition("CMAKE_VS_INTEL_Fortran_PROJECT_VERSION",
this->GetIntelProjectVersion()); this->GetIntelProjectVersion());
return this->cmGlobalVisualStudioGenerator::SetSystemName(s, mf);
} }
void cmGlobalVisualStudio7Generator::GenerateConfigurations(cmMakefile* mf) void cmGlobalVisualStudio7Generator::GenerateConfigurations(cmMakefile* mf)

View File

@ -44,7 +44,7 @@ public:
///! Create a local generator appropriate to this Global Generator ///! Create a local generator appropriate to this Global Generator
virtual cmLocalGenerator *CreateLocalGenerator(); virtual cmLocalGenerator *CreateLocalGenerator();
virtual void AddPlatformDefinitions(cmMakefile* mf); virtual bool SetSystemName(std::string const& s, cmMakefile* mf);
/** Get the documentation entry for this generator. */ /** Get the documentation entry for this generator. */
static void GetDocumentation(cmDocumentationEntry& entry); static void GetDocumentation(cmDocumentationEntry& entry);

View File

@ -36,7 +36,7 @@ public:
if(p[0] == '\0') if(p[0] == '\0')
{ {
return new cmGlobalVisualStudio8Generator( return new cmGlobalVisualStudio8Generator(
name, "", ""); name, "");
} }
if(p[0] != ' ') if(p[0] != ' ')
@ -49,7 +49,7 @@ public:
if(!strcmp(p, "Win64")) if(!strcmp(p, "Win64"))
{ {
return new cmGlobalVisualStudio8Generator( return new cmGlobalVisualStudio8Generator(
name, "x64", "CMAKE_FORCE_WIN64"); name, "x64");
} }
cmVisualStudioWCEPlatformParser parser(p); cmVisualStudioWCEPlatformParser parser(p);
@ -60,7 +60,7 @@ public:
} }
cmGlobalVisualStudio8Generator* ret = new cmGlobalVisualStudio8Generator( cmGlobalVisualStudio8Generator* ret = new cmGlobalVisualStudio8Generator(
name, p, ""); name, p);
ret->WindowsCEVersion = parser.GetOSVersion(); ret->WindowsCEVersion = parser.GetOSVersion();
return ret; return ret;
} }
@ -93,17 +93,11 @@ cmGlobalGeneratorFactory* cmGlobalVisualStudio8Generator::NewFactory()
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
cmGlobalVisualStudio8Generator::cmGlobalVisualStudio8Generator( cmGlobalVisualStudio8Generator::cmGlobalVisualStudio8Generator(
const std::string& name, const std::string& platformName, const std::string& name, const std::string& platformName)
const std::string& additionalPlatformDefinition)
: cmGlobalVisualStudio71Generator(platformName) : cmGlobalVisualStudio71Generator(platformName)
{ {
this->ProjectConfigurationSectionName = "ProjectConfigurationPlatforms"; this->ProjectConfigurationSectionName = "ProjectConfigurationPlatforms";
this->Name = name; this->Name = name;
if (!additionalPlatformDefinition.empty())
{
this->AdditionalPlatformDefinition = additionalPlatformDefinition;
}
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
@ -132,17 +126,23 @@ cmLocalGenerator *cmGlobalVisualStudio8Generator::CreateLocalGenerator()
{ {
cmLocalVisualStudio7Generator *lg = cmLocalVisualStudio7Generator *lg =
new cmLocalVisualStudio7Generator(cmLocalVisualStudioGenerator::VS8); new cmLocalVisualStudio7Generator(cmLocalVisualStudioGenerator::VS8);
lg->SetPlatformName(this->GetPlatformName());
lg->SetExtraFlagTable(this->GetExtraFlagTableVS8()); lg->SetExtraFlagTable(this->GetExtraFlagTableVS8());
lg->SetGlobalGenerator(this); lg->SetGlobalGenerator(this);
return lg; return lg;
} }
//----------------------------------------------------------------------------
void cmGlobalVisualStudio8Generator
::EnableLanguage(std::vector<std::string>const & lang,
cmMakefile *mf, bool optional)
{
this->AddPlatformDefinitions(mf);
cmGlobalVisualStudio7Generator::EnableLanguage(lang, mf, optional);
}
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void cmGlobalVisualStudio8Generator::AddPlatformDefinitions(cmMakefile* mf) void cmGlobalVisualStudio8Generator::AddPlatformDefinitions(cmMakefile* mf)
{ {
cmGlobalVisualStudio71Generator::AddPlatformDefinitions(mf);
if(this->TargetsWindowsCE()) if(this->TargetsWindowsCE())
{ {
mf->AddDefinition("CMAKE_VS_WINCE_VERSION", mf->AddDefinition("CMAKE_VS_WINCE_VERSION",

View File

@ -24,8 +24,7 @@ class cmGlobalVisualStudio8Generator : public cmGlobalVisualStudio71Generator
{ {
public: public:
cmGlobalVisualStudio8Generator(const std::string& name, cmGlobalVisualStudio8Generator(const std::string& name,
const std::string& platformName, const std::string& platformName);
const std::string& additionalPlatformDefinition);
static cmGlobalGeneratorFactory* NewFactory(); static cmGlobalGeneratorFactory* NewFactory();
///! Get the name for the generator. ///! Get the name for the generator.
@ -37,6 +36,8 @@ public:
///! Create a local generator appropriate to this Global Generator ///! Create a local generator appropriate to this Global Generator
virtual cmLocalGenerator *CreateLocalGenerator(); virtual cmLocalGenerator *CreateLocalGenerator();
virtual void EnableLanguage(std::vector<std::string>const& languages,
cmMakefile *, bool optional);
virtual void AddPlatformDefinitions(cmMakefile* mf); virtual void AddPlatformDefinitions(cmMakefile* mf);
/** /**

View File

@ -34,7 +34,7 @@ public:
if(p[0] == '\0') if(p[0] == '\0')
{ {
return new cmGlobalVisualStudio9Generator( return new cmGlobalVisualStudio9Generator(
name, "", ""); name, "");
} }
if(p[0] != ' ') if(p[0] != ' ')
@ -47,13 +47,13 @@ public:
if(!strcmp(p, "IA64")) if(!strcmp(p, "IA64"))
{ {
return new cmGlobalVisualStudio9Generator( return new cmGlobalVisualStudio9Generator(
name, "Itanium", "CMAKE_FORCE_IA64"); name, "Itanium");
} }
if(!strcmp(p, "Win64")) if(!strcmp(p, "Win64"))
{ {
return new cmGlobalVisualStudio9Generator( return new cmGlobalVisualStudio9Generator(
name, "x64", "CMAKE_FORCE_WIN64"); name, "x64");
} }
cmVisualStudioWCEPlatformParser parser(p); cmVisualStudioWCEPlatformParser parser(p);
@ -64,7 +64,7 @@ public:
} }
cmGlobalVisualStudio9Generator* ret = new cmGlobalVisualStudio9Generator( cmGlobalVisualStudio9Generator* ret = new cmGlobalVisualStudio9Generator(
name, p, NULL); name, p);
ret->WindowsCEVersion = parser.GetOSVersion(); ret->WindowsCEVersion = parser.GetOSVersion();
return ret; return ret;
} }
@ -98,10 +98,8 @@ cmGlobalGeneratorFactory* cmGlobalVisualStudio9Generator::NewFactory()
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
cmGlobalVisualStudio9Generator::cmGlobalVisualStudio9Generator( cmGlobalVisualStudio9Generator::cmGlobalVisualStudio9Generator(
const std::string& name, const std::string& platformName, const std::string& name, const std::string& platformName)
const std::string& additionalPlatformDefinition) : cmGlobalVisualStudio8Generator(name, platformName)
: cmGlobalVisualStudio8Generator(name, platformName,
additionalPlatformDefinition)
{ {
} }
@ -117,20 +115,11 @@ cmLocalGenerator *cmGlobalVisualStudio9Generator::CreateLocalGenerator()
{ {
cmLocalVisualStudio7Generator *lg cmLocalVisualStudio7Generator *lg
= new cmLocalVisualStudio7Generator(cmLocalVisualStudioGenerator::VS9); = new cmLocalVisualStudio7Generator(cmLocalVisualStudioGenerator::VS9);
lg->SetPlatformName(this->GetPlatformName());
lg->SetExtraFlagTable(this->GetExtraFlagTableVS8()); lg->SetExtraFlagTable(this->GetExtraFlagTableVS8());
lg->SetGlobalGenerator(this); lg->SetGlobalGenerator(this);
return lg; return lg;
} }
//----------------------------------------------------------------------------
void cmGlobalVisualStudio9Generator
::EnableLanguage(std::vector<std::string>const & lang,
cmMakefile *mf, bool optional)
{
cmGlobalVisualStudio8Generator::EnableLanguage(lang, mf, optional);
}
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
std::string cmGlobalVisualStudio9Generator::GetUserMacrosDirectory() std::string cmGlobalVisualStudio9Generator::GetUserMacrosDirectory()
{ {

View File

@ -25,8 +25,7 @@ class cmGlobalVisualStudio9Generator :
{ {
public: public:
cmGlobalVisualStudio9Generator(const std::string& name, cmGlobalVisualStudio9Generator(const std::string& name,
const std::string& platformName, const std::string& platformName);
const std::string& additionalPlatformDefinition);
static cmGlobalGeneratorFactory* NewFactory(); static cmGlobalGeneratorFactory* NewFactory();
///! create the correct local generator ///! create the correct local generator
@ -36,8 +35,6 @@ public:
* Try to determine system infomation such as shared library * Try to determine system infomation such as shared library
* extension, pthreads, byte order etc. * extension, pthreads, byte order etc.
*/ */
virtual void EnableLanguage(std::vector<std::string>const& languages,
cmMakefile *, bool optional);
virtual void WriteSLNHeader(std::ostream& fout); virtual void WriteSLNHeader(std::ostream& fout);
/** /**

View File

@ -23,7 +23,6 @@
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
cmGlobalVisualStudioGenerator::cmGlobalVisualStudioGenerator() cmGlobalVisualStudioGenerator::cmGlobalVisualStudioGenerator()
{ {
this->AdditionalPlatformDefinition = "";
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
@ -477,15 +476,6 @@ void cmGlobalVisualStudioGenerator::FindMakeProgram(cmMakefile* mf)
} }
} }
//----------------------------------------------------------------------------
void cmGlobalVisualStudioGenerator::AddPlatformDefinitions(cmMakefile* mf)
{
if(!this->AdditionalPlatformDefinition.empty())
{
mf->AddDefinition(this->AdditionalPlatformDefinition, "TRUE");
}
}
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
std::string std::string
cmGlobalVisualStudioGenerator::GetUtilityDepend(cmTarget const* target) cmGlobalVisualStudioGenerator::GetUtilityDepend(cmTarget const* target)

View File

@ -97,8 +97,6 @@ protected:
virtual const char* GetIDEVersion() = 0; virtual const char* GetIDEVersion() = 0;
virtual void AddPlatformDefinitions(cmMakefile* mf);
virtual bool ComputeTargetDepends(); virtual bool ComputeTargetDepends();
class VSDependSet: public std::set<std::string> {}; class VSDependSet: public std::set<std::string> {};
class VSDependMap: public std::map<cmTarget const*, VSDependSet> {}; class VSDependMap: public std::map<cmTarget const*, VSDependSet> {};
@ -111,7 +109,6 @@ protected:
std::string GetUtilityDepend(cmTarget const* target); std::string GetUtilityDepend(cmTarget const* target);
typedef std::map<cmTarget const*, std::string> UtilityDependsMap; typedef std::map<cmTarget const*, std::string> UtilityDependsMap;
UtilityDependsMap UtilityDepends; UtilityDependsMap UtilityDepends;
std::string AdditionalPlatformDefinition;
private: private:
virtual std::string GetVSMakeProgram() = 0; virtual std::string GetVSMakeProgram() = 0;

View File

@ -48,7 +48,6 @@ extern cmVS7FlagTable cmLocalVisualStudio7GeneratorFlagTable[];
cmLocalVisualStudio7Generator::cmLocalVisualStudio7Generator(VSVersion v): cmLocalVisualStudio7Generator::cmLocalVisualStudio7Generator(VSVersion v):
cmLocalVisualStudioGenerator(v) cmLocalVisualStudioGenerator(v)
{ {
this->PlatformName = "Win32";
this->ExtraFlagTable = 0; this->ExtraFlagTable = 0;
this->Internal = new cmLocalVisualStudio7GeneratorInternals(this); this->Internal = new cmLocalVisualStudio7GeneratorInternals(this);
} }
@ -647,8 +646,11 @@ void cmLocalVisualStudio7Generator::WriteConfiguration(std::ostream& fout,
{ {
mfcFlag = "0"; mfcFlag = "0";
} }
cmGlobalVisualStudio7Generator* gg =
static_cast<cmGlobalVisualStudio7Generator*>(this->GlobalGenerator);
fout << "\t\t<Configuration\n" fout << "\t\t<Configuration\n"
<< "\t\t\tName=\"" << configName << "|" << this->PlatformName << "\"\n" << "\t\t\tName=\"" << configName
<< "|" << gg->GetPlatformName() << "\"\n"
<< "\t\t\tOutputDirectory=\"" << configName << "\"\n"; << "\t\t\tOutputDirectory=\"" << configName << "\"\n";
// This is an internal type to Visual Studio, it seems that: // This is an internal type to Visual Studio, it seems that:
// 4 == static library // 4 == static library
@ -896,11 +898,11 @@ void cmLocalVisualStudio7Generator::WriteConfiguration(std::ostream& fout,
} }
fout << "\"\n"; fout << "\"\n";
fout << "\t\t\t\tMkTypLibCompatible=\"false\"\n"; fout << "\t\t\t\tMkTypLibCompatible=\"false\"\n";
if( this->PlatformName == "x64" ) if( gg->GetPlatformName() == "x64" )
{ {
fout << "\t\t\t\tTargetEnvironment=\"3\"\n"; fout << "\t\t\t\tTargetEnvironment=\"3\"\n";
} }
else if( this->PlatformName == "ia64" ) else if( gg->GetPlatformName() == "ia64" )
{ {
fout << "\t\t\t\tTargetEnvironment=\"2\"\n"; fout << "\t\t\t\tTargetEnvironment=\"2\"\n";
} }
@ -1640,6 +1642,8 @@ bool cmLocalVisualStudio7Generator
std::ostream &fout, const std::string& libName, std::ostream &fout, const std::string& libName,
std::vector<std::string> *configs) std::vector<std::string> *configs)
{ {
cmGlobalVisualStudio7Generator* gg =
static_cast<cmGlobalVisualStudio7Generator *>(this->GlobalGenerator);
const std::vector<const cmSourceFile *> &sourceFiles = const std::vector<const cmSourceFile *> &sourceFiles =
sg->GetSourceFiles(); sg->GetSourceFiles();
std::vector<cmSourceGroup> const& children = sg->GetGroupChildren(); std::vector<cmSourceGroup> const& children = sg->GetGroupChildren();
@ -1730,7 +1734,7 @@ bool cmLocalVisualStudio7Generator
cmLVS7GFileConfig const& fc = fci->second; cmLVS7GFileConfig const& fc = fci->second;
fout << "\t\t\t\t<FileConfiguration\n" fout << "\t\t\t\t<FileConfiguration\n"
<< "\t\t\t\t\tName=\"" << fci->first << "\t\t\t\t\tName=\"" << fci->first
<< "|" << this->PlatformName << "\""; << "|" << gg->GetPlatformName() << "\"";
if(fc.ExcludedFromBuild) if(fc.ExcludedFromBuild)
{ {
fout << " ExcludedFromBuild=\"true\""; fout << " ExcludedFromBuild=\"true\"";
@ -1800,6 +1804,9 @@ WriteCustomRule(std::ostream& fout,
const cmCustomCommand& command, const cmCustomCommand& command,
FCInfo& fcinfo) FCInfo& fcinfo)
{ {
cmGlobalVisualStudio7Generator* gg =
static_cast<cmGlobalVisualStudio7Generator *>(this->GlobalGenerator);
// Write the rule for each configuration. // Write the rule for each configuration.
std::vector<std::string>::iterator i; std::vector<std::string>::iterator i;
std::vector<std::string> *configs = std::vector<std::string> *configs =
@ -1820,7 +1827,8 @@ WriteCustomRule(std::ostream& fout,
cmCustomCommandGenerator ccg(command, *i, this->Makefile); cmCustomCommandGenerator ccg(command, *i, this->Makefile);
cmLVS7GFileConfig const& fc = fcinfo.FileConfigMap[*i]; cmLVS7GFileConfig const& fc = fcinfo.FileConfigMap[*i];
fout << "\t\t\t\t<FileConfiguration\n"; fout << "\t\t\t\t<FileConfiguration\n";
fout << "\t\t\t\t\tName=\"" << *i << "|" << this->PlatformName << "\">\n"; fout << "\t\t\t\t\tName=\"" << *i << "|"
<< gg->GetPlatformName() << "\">\n";
if(!fc.CompileFlags.empty()) if(!fc.CompileFlags.empty())
{ {
fout << "\t\t\t\t\t<Tool\n" fout << "\t\t\t\t\t<Tool\n"
@ -2030,7 +2038,7 @@ cmLocalVisualStudio7Generator
fout<< "\tKeyword=\"" << keyword << "\">\n" fout<< "\tKeyword=\"" << keyword << "\">\n"
<< "\tProjectGUID=\"{" << gg->GetGUID(libName.c_str()) << "}\">\n" << "\tProjectGUID=\"{" << gg->GetGUID(libName.c_str()) << "}\">\n"
<< "\t<Platforms>\n" << "\t<Platforms>\n"
<< "\t\t<Platform\n\t\t\tName=\"" << this->PlatformName << "\"/>\n" << "\t\t<Platform\n\t\t\tName=\"" << gg->GetPlatformName() << "\"/>\n"
<< "\t</Platforms>\n"; << "\t</Platforms>\n";
} }
@ -2085,7 +2093,7 @@ cmLocalVisualStudio7Generator::WriteProjectStart(std::ostream& fout,
} }
fout << "\tKeyword=\"" << keyword << "\">\n" fout << "\tKeyword=\"" << keyword << "\">\n"
<< "\t<Platforms>\n" << "\t<Platforms>\n"
<< "\t\t<Platform\n\t\t\tName=\"" << this->PlatformName << "\"/>\n" << "\t\t<Platform\n\t\t\tName=\"" << gg->GetPlatformName() << "\"/>\n"
<< "\t</Platforms>\n"; << "\t</Platforms>\n";
} }

View File

@ -53,8 +53,6 @@ public:
*/ */
void SetBuildType(BuildType,const std::string& name); void SetBuildType(BuildType,const std::string& name);
void SetPlatformName(const std::string& n) { this->PlatformName = n;}
void SetExtraFlagTable(cmVS7FlagTable const* table) void SetExtraFlagTable(cmVS7FlagTable const* table)
{ this->ExtraFlagTable = table; } { this->ExtraFlagTable = table; }
virtual std::string GetTargetDirectory(cmTarget const&) const; virtual std::string GetTargetDirectory(cmTarget const&) const;
@ -124,7 +122,6 @@ private:
std::string ModuleDefinitionFile; std::string ModuleDefinitionFile;
bool FortranProject; bool FortranProject;
bool WindowsCEProject; bool WindowsCEProject;
std::string PlatformName; // Win32 or x64
cmLocalVisualStudio7GeneratorInternals* Internal; cmLocalVisualStudio7GeneratorInternals* Internal;
}; };