Merge topic 'generate-time-generators'

2b9a25d7 cmGlobalGenerator: Create global targets directly after Configure.
3e08b4df cmMakefile: Skip Global targets for CMP0019 evaluation.
357bf469 cmGlobalGenerator: Fill the project map at compute time.
ebf8d0a9 cmGlobalGenerator: Rename method.
bd096d30 cmGlobalGenerator: Avoid cmLocalGenerator until after Configure.
ff8ac8ee cmLocalGenerator: Create from already-constructed cmMakefile.
0bd7279f Ninja: Remove some incorrect comments adding no value.
2f2d4da9 cmCTestScriptHandler: Simplify deletes.
7fdc9a8b QtAutogen: Use a smart pointer.
92041eec cmGlobalGenerator: Remove MakeLocalGenerator method.
acb00622 cmGlobalGenerator: Require a snapshot to create a local generator.
83b8a927 cmMakefile: Remove cmLocalGenerator member.
9b6a743b cmLocalGenerator: Remove Parent pointer.
This commit is contained in:
Brad King 2015-08-31 09:48:28 -04:00 committed by CMake Topic Stage
commit 352e8e95b6
50 changed files with 176 additions and 247 deletions

View File

@ -716,8 +716,10 @@ int cmCPackGenerator::InstallProjectViaInstallCMakeProjects(
cm.AddCMakePaths();
cm.SetProgressCallback(cmCPackGeneratorProgress, this);
cmGlobalGenerator gg(&cm);
cmsys::auto_ptr<cmLocalGenerator> lg(gg.MakeLocalGenerator());
cmMakefile *mf = lg->GetMakefile();
cmsys::auto_ptr<cmMakefile> mf(
new cmMakefile(&gg, cm.GetCurrentSnapshot()));
cmsys::auto_ptr<cmLocalGenerator> lg(
gg.CreateLocalGenerator(mf.get()));
std::string realInstallDirectory = tempInstallDirectory;
if ( !installSubDirectory.empty() && installSubDirectory != "/" )
{

View File

@ -202,8 +202,10 @@ int main (int argc, char const* const* argv)
cminst.SetHomeOutputDirectory("");
cminst.GetState()->RemoveUnscriptableCommands();
cmGlobalGenerator cmgg(&cminst);
cmsys::auto_ptr<cmLocalGenerator> cmlg(cmgg.MakeLocalGenerator());
cmMakefile* globalMF = cmlg->GetMakefile();
cmsys::auto_ptr<cmMakefile> globalMF(
new cmMakefile(&cmgg, cminst.GetCurrentSnapshot()));
cmsys::auto_ptr<cmLocalGenerator> cmlg(
cmgg.CreateLocalGenerator(globalMF.get()));
#if defined(__CYGWIN__)
globalMF->AddDefinition("CMAKE_LEGACY_CYGWIN_WIN32", "0");
#endif
@ -357,8 +359,8 @@ int main (int argc, char const* const* argv)
++it )
{
const char* gen = it->c_str();
cmMakefile::ScopePushPop raii(globalMF);
cmMakefile* mf = globalMF;
cmMakefile::ScopePushPop raii(globalMF.get());
cmMakefile* mf = globalMF.get();
cmCPack_Log(&log, cmCPackLog::LOG_VERBOSE,
"Specified generator: " << gen << std::endl);
if ( parsed && !mf->GetDefinition("CPACK_PACKAGE_NAME") )

View File

@ -738,8 +738,9 @@ void cmCTestLaunch::LoadConfig()
cm.SetHomeDirectory("");
cm.SetHomeOutputDirectory("");
cmGlobalGenerator gg(&cm);
cmsys::auto_ptr<cmLocalGenerator> lg(gg.MakeLocalGenerator());
cmMakefile* mf = lg->GetMakefile();
cmsys::auto_ptr<cmMakefile> mf(new cmMakefile(&gg, cm.GetCurrentSnapshot()));
cmsys::auto_ptr<cmLocalGenerator> lg(
gg.CreateLocalGenerator(mf.get()));
std::string fname = this->LogDir;
fname += "CTestLaunchConfig.cmake";
if(cmSystemTools::FileExists(fname.c_str()) &&

View File

@ -125,42 +125,25 @@ void cmCTestScriptHandler::Initialize()
// what time in seconds did this script start running
this->ScriptStartTime = 0;
delete this->Makefile;
this->Makefile = 0;
if (this->LocalGenerator)
{
delete this->LocalGenerator;
}
delete this->LocalGenerator;
this->LocalGenerator = 0;
if (this->GlobalGenerator)
{
delete this->GlobalGenerator;
}
delete this->GlobalGenerator;
this->GlobalGenerator = 0;
if (this->CMake)
{
delete this->CMake;
}
delete this->CMake;
}
//----------------------------------------------------------------------
cmCTestScriptHandler::~cmCTestScriptHandler()
{
// local generator owns the makefile
this->Makefile = 0;
if (this->LocalGenerator)
{
delete this->LocalGenerator;
}
this->LocalGenerator = 0;
if (this->GlobalGenerator)
{
delete this->GlobalGenerator;
}
this->GlobalGenerator = 0;
if (this->CMake)
{
delete this->CMake;
}
delete this->Makefile;
delete this->LocalGenerator;
delete this->GlobalGenerator;
delete this->CMake;
}
@ -334,6 +317,7 @@ void cmCTestScriptHandler::CreateCMake()
delete this->CMake;
delete this->GlobalGenerator;
delete this->LocalGenerator;
delete this->Makefile;
}
this->CMake = new cmake;
this->CMake->SetHomeDirectory("");
@ -341,8 +325,10 @@ void cmCTestScriptHandler::CreateCMake()
this->CMake->AddCMakePaths();
this->GlobalGenerator = new cmGlobalGenerator(this->CMake);
this->LocalGenerator = this->GlobalGenerator->MakeLocalGenerator();
this->Makefile = this->LocalGenerator->GetMakefile();
cmState::Snapshot snapshot = this->CMake->GetCurrentSnapshot();
this->Makefile = new cmMakefile(this->GlobalGenerator, snapshot);
this->LocalGenerator =
this->GlobalGenerator->CreateLocalGenerator(this->Makefile);
this->CMake->SetProgressCallback(ctestScriptProgressCallback, this->CTest);

View File

@ -1592,8 +1592,9 @@ void cmCTestTestHandler::GetListOfTests()
cm.SetHomeDirectory("");
cm.SetHomeOutputDirectory("");
cmGlobalGenerator gg(&cm);
cmsys::auto_ptr<cmLocalGenerator> lg(gg.MakeLocalGenerator());
cmMakefile *mf = lg->GetMakefile();
cmsys::auto_ptr<cmMakefile> mf(new cmMakefile(&gg, cm.GetCurrentSnapshot()));
cmsys::auto_ptr<cmLocalGenerator> lg(
gg.CreateLocalGenerator(mf.get()));
mf->AddDefinition("CTEST_CONFIGURATION_TYPE",
this->CTest->GetConfigType().c_str());

View File

@ -520,9 +520,10 @@ int cmCTest::Initialize(const char* binary_dir, cmCTestStartCommand* command)
cm.SetHomeDirectory("");
cm.SetHomeOutputDirectory("");
cmGlobalGenerator gg(&cm);
cmsys::auto_ptr<cmLocalGenerator> lg(gg.MakeLocalGenerator());
cmMakefile *mf = lg->GetMakefile();
if ( !this->ReadCustomConfigurationFileTree(this->BinaryDir.c_str(), mf) )
cmsys::auto_ptr<cmMakefile> mf(new cmMakefile(&gg, cm.GetCurrentSnapshot()));
cmsys::auto_ptr<cmLocalGenerator> lg(gg.CreateLocalGenerator(mf.get()));
if ( !this->ReadCustomConfigurationFileTree(this->BinaryDir.c_str(),
mf.get()) )
{
cmCTestOptionalLog(this, DEBUG,
"Cannot find custom configuration file tree" << std::endl, quiet);

View File

@ -44,10 +44,10 @@ void cmGlobalBorlandMakefileGenerator
///! Create a local generator appropriate to this Global Generator
cmLocalGenerator *cmGlobalBorlandMakefileGenerator::CreateLocalGenerator(
cmLocalGenerator* parent, cmState::Snapshot snapshot)
cmMakefile *mf)
{
cmLocalUnixMakefileGenerator3* lg =
new cmLocalUnixMakefileGenerator3(this, parent, snapshot);
new cmLocalUnixMakefileGenerator3(this, mf);
lg->SetMakefileVariableSize(32);
lg->SetMakeCommandEscapeTargetTwice(true);
lg->SetBorlandMakeCurlyHack(true);

View File

@ -36,8 +36,7 @@ public:
static void GetDocumentation(cmDocumentationEntry& entry);
///! Create a local generator appropriate to this Global Generator
virtual cmLocalGenerator *CreateLocalGenerator(cmLocalGenerator* parent,
cmState::Snapshot snapshot);
virtual cmLocalGenerator *CreateLocalGenerator(cmMakefile* mf);
/**
* Try to determine system information such as shared library

View File

@ -1127,23 +1127,40 @@ void cmGlobalGenerator::Configure()
this->FirstTimeProgress = 0.0f;
this->ClearGeneratorMembers();
// start with this directory
cmLocalGenerator *lg = this->MakeLocalGenerator();
this->Makefiles.push_back(lg->GetMakefile());
cmMakefile* dirMf =
new cmMakefile(this, this->GetCMakeInstance()->GetCurrentSnapshot());
this->Makefiles.push_back(dirMf);
cmLocalGenerator *lg = this->CreateLocalGenerator(dirMf);
this->LocalGenerators.push_back(lg);
// set the Start directories
lg->GetMakefile()->SetCurrentSourceDirectory
dirMf->SetCurrentSourceDirectory
(this->CMakeInstance->GetHomeDirectory());
lg->GetMakefile()->SetCurrentBinaryDirectory
dirMf->SetCurrentBinaryDirectory
(this->CMakeInstance->GetHomeOutputDirectory());
this->BinaryDirectories.insert(
this->CMakeInstance->GetHomeOutputDirectory());
// now do it
lg->GetMakefile()->Configure();
lg->GetMakefile()->EnforceDirectoryLevelRules();
dirMf->Configure();
dirMf->EnforceDirectoryLevelRules();
// Put a copy of each global target in every directory.
cmTargets globalTargets;
this->CreateDefaultGlobalTargets(&globalTargets);
for (unsigned int i = 0; i < this->Makefiles.size(); ++i)
{
cmMakefile* mf = this->Makefiles[i];
cmTargets* targets = &(mf->GetTargets());
cmTargets::iterator tit;
for ( tit = globalTargets.begin(); tit != globalTargets.end(); ++ tit )
{
(*targets)[tit->first] = tit->second;
(*targets)[tit->first].SetMakefile(mf);
}
}
// update the cache entry for the number of local generators, this is used
// for progress
@ -1155,11 +1172,7 @@ void cmGlobalGenerator::Configure()
// check for link libraries and include directories containing "NOTFOUND"
// and for infinite loops
this->CheckLocalGenerators();
// at this point this->LocalGenerators has been filled,
// so create the map from project name to vector of local generators
this->FillProjectMap();
this->CheckTargetProperties();
if ( this->CMakeInstance->GetWorkingMode() == cmake::NORMAL_MODE)
{
@ -1186,25 +1199,6 @@ void cmGlobalGenerator::Configure()
}
this->CMakeInstance->UpdateProgress(msg.str().c_str(), -1);
}
unsigned int i;
// Put a copy of each global target in every directory.
cmTargets globalTargets;
this->CreateDefaultGlobalTargets(&globalTargets);
for (i = 0; i < this->Makefiles.size(); ++i)
{
cmMakefile* mf = this->Makefiles[i];
cmTargets* targets = &(mf->GetTargets());
cmTargets::iterator tit;
for ( tit = globalTargets.begin(); tit != globalTargets.end(); ++ tit )
{
(*targets)[tit->first] = tit->second;
(*targets)[tit->first].SetMakefile(mf);
}
}
}
void cmGlobalGenerator::CreateGenerationObjects(TargetTypes targetTypes)
@ -1267,6 +1261,10 @@ bool cmGlobalGenerator::Compute()
this->CreateGenerationObjects();
// at this point this->LocalGenerators has been filled,
// so create the map from project name to vector of local generators
this->FillProjectMap();
#ifdef CMAKE_BUILD_WITH_CMAKE
// Iterate through all targets and set up automoc for those which have
// the AUTOMOC, AUTOUIC or AUTORCC property set
@ -1600,6 +1598,7 @@ void cmGlobalGenerator::ClearGeneratorMembers()
cmDeleteAll(this->BuildExportSets);
this->BuildExportSets.clear();
cmDeleteAll(this->Makefiles);
this->Makefiles.clear();
cmDeleteAll(this->LocalGenerators);
@ -1634,7 +1633,7 @@ void cmGlobalGenerator::ComputeTargetObjectDirectory(cmGeneratorTarget*) const
{
}
void cmGlobalGenerator::CheckLocalGenerators()
void cmGlobalGenerator::CheckTargetProperties()
{
std::map<std::string, std::string> notFoundMap;
// std::set<std::string> notFoundMap;
@ -1985,23 +1984,10 @@ void cmGlobalGenerator::EnableInstallTarget()
this->InstallTargetEnabled = true;
}
cmLocalGenerator *
cmGlobalGenerator::MakeLocalGenerator(cmState::Snapshot snapshot,
cmLocalGenerator *parent)
{
if (!snapshot.IsValid())
{
snapshot = this->CMakeInstance->GetCurrentSnapshot();
}
return this->CreateLocalGenerator(parent, snapshot);
}
cmLocalGenerator*
cmGlobalGenerator::CreateLocalGenerator(cmLocalGenerator* parent,
cmState::Snapshot snapshot)
cmGlobalGenerator::CreateLocalGenerator(cmMakefile* mf)
{
return new cmLocalGenerator(this, parent, snapshot);
return new cmLocalGenerator(this, mf);
}
void cmGlobalGenerator::EnableLanguagesFromGenerator(cmGlobalGenerator *gen,

View File

@ -56,9 +56,8 @@ public:
cmGlobalGenerator(cmake* cm);
virtual ~cmGlobalGenerator();
cmLocalGenerator* MakeLocalGenerator(
cmState::Snapshot snapshot = cmState::Snapshot(),
cmLocalGenerator* parent = 0);
virtual cmLocalGenerator*
CreateLocalGenerator(cmMakefile* mf);
///! Get the name for this generator
virtual std::string GetName() const { return "Generic"; }
@ -395,7 +394,7 @@ protected:
// Fill the ProjectMap, this must be called after LocalGenerators
// has been populated.
void FillProjectMap();
void CheckLocalGenerators();
void CheckTargetProperties();
bool IsExcluded(cmState::Snapshot const& root,
cmState::Snapshot const& snp) const;
bool IsExcluded(cmLocalGenerator* root, cmLocalGenerator* gen) const;
@ -441,10 +440,6 @@ protected:
virtual bool UseFolderProperty();
private:
///! Create a local generator appropriate to this Global Generator
virtual cmLocalGenerator *CreateLocalGenerator(cmLocalGenerator* parent,
cmState::Snapshot snapshot);
cmMakefile* TryCompileOuterMakefile;
// If you add a new map here, make sure it is copied
// in EnableLanguagesFromGenerator

View File

@ -33,10 +33,9 @@ cmGlobalGhsMultiGenerator::~cmGlobalGhsMultiGenerator()
}
cmLocalGenerator *
cmGlobalGhsMultiGenerator::CreateLocalGenerator(cmLocalGenerator* parent,
cmState::Snapshot snapshot)
cmGlobalGhsMultiGenerator::CreateLocalGenerator(cmMakefile* mf)
{
return new cmLocalGhsMultiGenerator(this, parent, snapshot);
return new cmLocalGhsMultiGenerator(this, mf);
}
void cmGlobalGhsMultiGenerator::GetDocumentation(cmDocumentationEntry &entry)

View File

@ -31,8 +31,7 @@ public:
{ return new cmGlobalGeneratorSimpleFactory<cmGlobalGhsMultiGenerator>(); }
///! create the correct local generator
virtual cmLocalGenerator *CreateLocalGenerator(cmLocalGenerator* parent,
cmState::Snapshot snapshot);
virtual cmLocalGenerator *CreateLocalGenerator(cmMakefile* mf);
/// @return the name of this generator.
static std::string GetActualName() { return "Green Hills MULTI"; }

View File

@ -528,10 +528,9 @@ cmGlobalNinjaGenerator::cmGlobalNinjaGenerator(cmake* cm)
// Virtual public methods.
cmLocalGenerator*
cmGlobalNinjaGenerator::CreateLocalGenerator(cmLocalGenerator* parent,
cmState::Snapshot snapshot)
cmGlobalNinjaGenerator::CreateLocalGenerator(cmMakefile* mf)
{
return new cmLocalNinjaGenerator(this, parent, snapshot);
return new cmLocalNinjaGenerator(this, mf);
}
void cmGlobalNinjaGenerator

View File

@ -162,33 +162,24 @@ public:
public:
cmGlobalNinjaGenerator(cmake* cm);
/// Convenience method for creating an instance of this class.
static cmGlobalGeneratorFactory* NewFactory() {
return new cmGlobalGeneratorSimpleFactory<cmGlobalNinjaGenerator>(); }
/// Destructor.
virtual ~cmGlobalNinjaGenerator() { }
/// Overloaded methods. @see cmGlobalGenerator::CreateLocalGenerator()
virtual cmLocalGenerator* CreateLocalGenerator(cmLocalGenerator* parent,
cmState::Snapshot snapshot);
virtual cmLocalGenerator* CreateLocalGenerator(cmMakefile* mf);
/// Overloaded methods. @see cmGlobalGenerator::GetName().
virtual std::string GetName() const {
return cmGlobalNinjaGenerator::GetActualName(); }
/// @return the name of this generator.
static std::string GetActualName() { return "Ninja"; }
/// Overloaded methods. @see cmGlobalGenerator::GetDocumentation()
static void GetDocumentation(cmDocumentationEntry& entry);
/// Overloaded methods. @see cmGlobalGenerator::EnableLanguage()
virtual void EnableLanguage(std::vector<std::string>const& languages,
cmMakefile* mf,
bool optional);
/// Overloaded methods. @see cmGlobalGenerator::GenerateBuildCommand()
virtual void GenerateBuildCommand(
std::vector<std::string>& makeCommand,
const std::string& makeProgram,
@ -307,11 +298,8 @@ public:
protected:
/// Overloaded methods. @see cmGlobalGenerator::Generate()
virtual void Generate();
/// Overloaded methods.
/// @see cmGlobalGenerator::CheckALLOW_DUPLICATE_CUSTOM_TARGETS()
virtual bool CheckALLOW_DUPLICATE_CUSTOM_TARGETS() const { return true; }

View File

@ -59,11 +59,10 @@ void cmGlobalUnixMakefileGenerator3
}
///! Create a local generator appropriate to this Global Generator
cmLocalGenerator *
cmGlobalUnixMakefileGenerator3::CreateLocalGenerator(cmLocalGenerator* parent,
cmState::Snapshot snapshot)
cmLocalGenerator* cmGlobalUnixMakefileGenerator3::CreateLocalGenerator(
cmMakefile* mf)
{
return new cmLocalUnixMakefileGenerator3(this, parent, snapshot);
return new cmLocalUnixMakefileGenerator3(this, mf);
}
//----------------------------------------------------------------------------
@ -578,16 +577,20 @@ void cmGlobalUnixMakefileGenerator3
makeOptions.begin(), makeOptions.end());
if (!targetName.empty())
{
cmMakefile* mf;
cmLocalUnixMakefileGenerator3 *lg;
if (!this->LocalGenerators.empty())
{
lg = static_cast<cmLocalUnixMakefileGenerator3 *>
(this->LocalGenerators[0]);
mf = lg->GetMakefile();
}
else
{
cmState::Snapshot snapshot = this->CMakeInstance->GetCurrentSnapshot();
mf = new cmMakefile(this, snapshot);
lg = static_cast<cmLocalUnixMakefileGenerator3 *>
(this->MakeLocalGenerator());
(this->CreateLocalGenerator(mf));
// set the Start directories
lg->GetMakefile()->SetCurrentSourceDirectory
(this->CMakeInstance->GetHomeDirectory());
@ -606,6 +609,7 @@ void cmGlobalUnixMakefileGenerator3
if (this->LocalGenerators.empty())
{
delete lg;
delete mf;
}
}
}

View File

@ -67,9 +67,7 @@ public:
/** Get the documentation entry for this generator. */
static void GetDocumentation(cmDocumentationEntry& entry);
///! Create a local generator appropriate to this Global Generator3
virtual cmLocalGenerator *CreateLocalGenerator(cmLocalGenerator* parent,
cmState::Snapshot snapshot);
virtual cmLocalGenerator *CreateLocalGenerator(cmMakefile* mf);
/**
* Try to determine system information such as shared library

View File

@ -306,11 +306,10 @@ void cmGlobalVisualStudio10Generator::WriteSLNHeader(std::ostream& fout)
}
///! Create a local generator appropriate to this Global Generator
cmLocalGenerator *
cmGlobalVisualStudio10Generator::CreateLocalGenerator(cmLocalGenerator* parent,
cmState::Snapshot snapshot)
cmLocalGenerator* cmGlobalVisualStudio10Generator::CreateLocalGenerator(
cmMakefile* mf)
{
return new cmLocalVisualStudio10Generator(this, parent, snapshot);
return new cmLocalVisualStudio10Generator(this, mf);
}
//----------------------------------------------------------------------------

View File

@ -48,8 +48,7 @@ public:
virtual bool Compute();
///! create the correct local generator
virtual cmLocalGenerator *CreateLocalGenerator(cmLocalGenerator* parent,
cmState::Snapshot snapshot);
virtual cmLocalGenerator *CreateLocalGenerator(cmMakefile* mf);
/**
* Try to determine system information such as shared library

View File

@ -173,10 +173,9 @@ cmGlobalVisualStudio6Generator::GenerateBuildCommand(
///! Create a local generator appropriate to this Global Generator
cmLocalGenerator *
cmGlobalVisualStudio6Generator::CreateLocalGenerator(cmLocalGenerator* parent,
cmState::Snapshot snapshot)
cmGlobalVisualStudio6Generator::CreateLocalGenerator(cmMakefile* mf)
{
return new cmLocalVisualStudio6Generator(this, parent, snapshot);
return new cmLocalVisualStudio6Generator(this, mf);
}

View File

@ -39,8 +39,7 @@ public:
static void GetDocumentation(cmDocumentationEntry& entry);
///! Create a local generator appropriate to this Global Generator
virtual cmLocalGenerator *CreateLocalGenerator(cmLocalGenerator* parent,
cmState::Snapshot snapshot);
virtual cmLocalGenerator *CreateLocalGenerator(cmMakefile* mf);
/**
* Try to determine system information such as shared library

View File

@ -279,12 +279,11 @@ void cmGlobalVisualStudio7Generator::GenerateBuildCommand(
}
///! Create a local generator appropriate to this Global Generator
cmLocalGenerator *
cmGlobalVisualStudio7Generator::CreateLocalGenerator(cmLocalGenerator* parent,
cmState::Snapshot snapshot)
cmLocalGenerator *cmGlobalVisualStudio7Generator::CreateLocalGenerator(
cmMakefile* mf)
{
cmLocalVisualStudio7Generator *lg =
new cmLocalVisualStudio7Generator(this, parent, snapshot);
new cmLocalVisualStudio7Generator(this, mf);
return lg;
}

View File

@ -43,8 +43,7 @@ public:
std::string const& GetPlatformName() const;
///! Create a local generator appropriate to this Global Generator
virtual cmLocalGenerator *CreateLocalGenerator(cmLocalGenerator* parent,
cmState::Snapshot snapshot);
virtual cmLocalGenerator *CreateLocalGenerator(cmMakefile* mf);
virtual bool SetSystemName(std::string const& s, cmMakefile* mf);

View File

@ -371,10 +371,9 @@ cmGlobalXCodeGenerator::GenerateBuildCommand(
//----------------------------------------------------------------------------
///! Create a local generator appropriate to this Global Generator
cmLocalGenerator *
cmGlobalXCodeGenerator::CreateLocalGenerator(cmLocalGenerator* parent,
cmState::Snapshot snapshot)
cmGlobalXCodeGenerator::CreateLocalGenerator(cmMakefile* mf)
{
return new cmLocalXCodeGenerator(this, parent, snapshot);
return new cmLocalXCodeGenerator(this, mf);
}
//----------------------------------------------------------------------------

View File

@ -41,8 +41,7 @@ public:
static void GetDocumentation(cmDocumentationEntry& entry);
///! Create a local generator appropriate to this Global Generator
virtual cmLocalGenerator *CreateLocalGenerator(cmLocalGenerator* parent,
cmState::Snapshot snapshot);
virtual cmLocalGenerator *CreateLocalGenerator(cmMakefile *mf);
/**
* Try to determine system information such as shared library

View File

@ -68,8 +68,9 @@ void cmGraphVizWriter::ReadSettings(const char* settingsFileName,
cm.SetHomeDirectory("");
cm.SetHomeOutputDirectory("");
cmGlobalGenerator ggi(&cm);
cmsys::auto_ptr<cmLocalGenerator> lg(ggi.MakeLocalGenerator());
cmMakefile *mf = lg->GetMakefile();
cmsys::auto_ptr<cmMakefile> mf(
new cmMakefile(&ggi, cm.GetCurrentSnapshot()));
cmsys::auto_ptr<cmLocalGenerator> lg(ggi.CreateLocalGenerator(mf.get()));
const char* inFileName = settingsFileName;

View File

@ -14,9 +14,8 @@
#include "cmMakefile.h"
cmLocalCommonGenerator::cmLocalCommonGenerator(cmGlobalGenerator* gg,
cmLocalGenerator* parent,
cmState::Snapshot snapshot):
cmLocalGenerator(gg, parent, snapshot)
cmMakefile* mf):
cmLocalGenerator(gg, mf)
{
}

View File

@ -22,9 +22,7 @@ class cmCommonTargetGenerator;
class cmLocalCommonGenerator: public cmLocalGenerator
{
public:
cmLocalCommonGenerator(cmGlobalGenerator* gg,
cmLocalGenerator* parent,
cmState::Snapshot snapshot);
cmLocalCommonGenerator(cmGlobalGenerator* gg, cmMakefile* mf);
~cmLocalCommonGenerator();
std::string const& GetConfigName() { return this->ConfigName; }

View File

@ -43,15 +43,13 @@
#endif
cmLocalGenerator::cmLocalGenerator(cmGlobalGenerator* gg,
cmLocalGenerator* parent,
cmState::Snapshot snapshot)
: cmOutputConverter(snapshot), StateSnapshot(snapshot)
cmMakefile* makefile)
: cmOutputConverter(makefile->GetStateSnapshot()),
StateSnapshot(makefile->GetStateSnapshot())
{
assert(snapshot.IsValid());
this->GlobalGenerator = gg;
this->Parent = parent;
this->Makefile = new cmMakefile(this);
this->Makefile = makefile;
this->EmitUniversalBinaryFlags = true;
this->BackwardsCompatibility = 0;
@ -60,7 +58,6 @@ cmLocalGenerator::cmLocalGenerator(cmGlobalGenerator* gg,
cmLocalGenerator::~cmLocalGenerator()
{
delete this->Makefile;
}
void cmLocalGenerator::IssueMessage(cmake::MessageType t,

View File

@ -36,8 +36,7 @@ class cmCustomCommandGenerator;
class cmLocalGenerator : public cmOutputConverter
{
public:
cmLocalGenerator(cmGlobalGenerator* gg, cmLocalGenerator* parent,
cmState::Snapshot snapshot);
cmLocalGenerator(cmGlobalGenerator* gg, cmMakefile* makefile);
virtual ~cmLocalGenerator();
/**
@ -86,9 +85,6 @@ public:
cmState* GetState() const;
cmState::Snapshot GetStateSnapshot() const;
///! set/get the parent generator
cmLocalGenerator* GetParent() const {return this->Parent;}
void AddArchitectureFlags(std::string& flags,
cmGeneratorTarget const* target,
const std::string&lang, const std::string& config);
@ -343,7 +339,6 @@ protected:
cmMakefile *Makefile;
cmState::Snapshot StateSnapshot;
cmGlobalGenerator *GlobalGenerator;
cmLocalGenerator* Parent;
std::map<std::string, std::string> UniqueObjectNamesMap;
std::string::size_type ObjectPathMax;
std::set<std::string> ObjectMaxPathViolations;

View File

@ -17,9 +17,8 @@
#include "cmGeneratedFileStream.h"
cmLocalGhsMultiGenerator::cmLocalGhsMultiGenerator(cmGlobalGenerator* gg,
cmLocalGenerator* parent,
cmState::Snapshot snapshot)
: cmLocalGenerator(gg, parent, snapshot)
cmMakefile* mf)
: cmLocalGenerator(gg, mf)
{
}

View File

@ -25,8 +25,7 @@ class cmGeneratedFileStream;
class cmLocalGhsMultiGenerator : public cmLocalGenerator
{
public:
cmLocalGhsMultiGenerator(cmGlobalGenerator* gg, cmLocalGenerator* parent,
cmState::Snapshot snapshot);
cmLocalGhsMultiGenerator(cmGlobalGenerator* gg, cmMakefile* mf);
virtual ~cmLocalGhsMultiGenerator();

View File

@ -23,9 +23,8 @@
#include <assert.h>
cmLocalNinjaGenerator::cmLocalNinjaGenerator(cmGlobalGenerator* gg,
cmLocalGenerator* parent,
cmState::Snapshot snapshot)
: cmLocalCommonGenerator(gg, parent, snapshot)
cmMakefile* mf)
: cmLocalCommonGenerator(gg, mf)
, HomeRelativeOutputPath("")
{
this->TargetImplib = "$TARGET_IMPLIB";

View File

@ -31,8 +31,7 @@ class cmake;
class cmLocalNinjaGenerator : public cmLocalCommonGenerator
{
public:
cmLocalNinjaGenerator(cmGlobalGenerator* gg, cmLocalGenerator* parent,
cmState::Snapshot snapshot);
cmLocalNinjaGenerator(cmGlobalGenerator* gg, cmMakefile* mf);
virtual ~cmLocalNinjaGenerator();

View File

@ -80,9 +80,8 @@ static std::string cmSplitExtension(std::string const& in, std::string& base)
//----------------------------------------------------------------------------
cmLocalUnixMakefileGenerator3::
cmLocalUnixMakefileGenerator3(cmGlobalGenerator* gg, cmLocalGenerator* parent,
cmState::Snapshot snapshot)
: cmLocalCommonGenerator(gg, parent, snapshot)
cmLocalUnixMakefileGenerator3(cmGlobalGenerator* gg, cmMakefile* mf)
: cmLocalCommonGenerator(gg, mf)
{
this->MakefileVariableSize = 0;
this->ColorMakefile = false;

View File

@ -34,9 +34,7 @@ class cmSourceFile;
class cmLocalUnixMakefileGenerator3 : public cmLocalCommonGenerator
{
public:
cmLocalUnixMakefileGenerator3(cmGlobalGenerator* gg,
cmLocalGenerator* parent,
cmState::Snapshot snapshot);
cmLocalUnixMakefileGenerator3(cmGlobalGenerator* gg, cmMakefile* mf);
virtual ~cmLocalUnixMakefileGenerator3();
virtual void ComputeHomeRelativeOutputPath();

View File

@ -62,10 +62,8 @@ class cmVS10XMLParser : public cmXMLParser
//----------------------------------------------------------------------------
cmLocalVisualStudio10Generator
::cmLocalVisualStudio10Generator(cmGlobalGenerator* gg,
cmLocalGenerator* parent,
cmState::Snapshot snapshot):
cmLocalVisualStudio7Generator(gg, parent, snapshot)
::cmLocalVisualStudio10Generator(cmGlobalGenerator* gg, cmMakefile* mf):
cmLocalVisualStudio7Generator(gg, mf)
{
}

View File

@ -25,9 +25,7 @@ class cmLocalVisualStudio10Generator : public cmLocalVisualStudio7Generator
{
public:
///! Set cache only and recurse to false by default.
cmLocalVisualStudio10Generator(cmGlobalGenerator* gg,
cmLocalGenerator* parent,
cmState::Snapshot snapshot);
cmLocalVisualStudio10Generator(cmGlobalGenerator* gg, cmMakefile* mf);
virtual ~cmLocalVisualStudio10Generator();

View File

@ -24,10 +24,8 @@
#include <cmsys/FStream.hxx>
cmLocalVisualStudio6Generator
::cmLocalVisualStudio6Generator(cmGlobalGenerator* gg,
cmLocalGenerator* parent,
cmState::Snapshot snapshot):
cmLocalVisualStudioGenerator(gg, parent, snapshot)
::cmLocalVisualStudio6Generator(cmGlobalGenerator* gg, cmMakefile* mf):
cmLocalVisualStudioGenerator(gg, mf)
{
}

View File

@ -29,9 +29,7 @@ class cmLocalVisualStudio6Generator : public cmLocalVisualStudioGenerator
{
public:
///! Set cache only and recurse to false by default.
cmLocalVisualStudio6Generator(cmGlobalGenerator* gg,
cmLocalGenerator* parent,
cmState::Snapshot snapshot);
cmLocalVisualStudio6Generator(cmGlobalGenerator* gg, cmMakefile* mf);
virtual ~cmLocalVisualStudio6Generator();

View File

@ -53,10 +53,8 @@ static void cmConvertToWindowsSlash(std::string& s)
//----------------------------------------------------------------------------
cmLocalVisualStudio7Generator
::cmLocalVisualStudio7Generator(cmGlobalGenerator* gg,
cmLocalGenerator* parent,
cmState::Snapshot snapshot):
cmLocalVisualStudioGenerator(gg, parent, snapshot)
::cmLocalVisualStudio7Generator(cmGlobalGenerator* gg, cmMakefile* mf):
cmLocalVisualStudioGenerator(gg, mf)
{
this->Internal = new cmLocalVisualStudio7GeneratorInternals(this);
}

View File

@ -35,9 +35,7 @@ class cmLocalVisualStudio7Generator : public cmLocalVisualStudioGenerator
{
public:
///! Set cache only and recurse to false by default.
cmLocalVisualStudio7Generator(cmGlobalGenerator* gg,
cmLocalGenerator* parent,
cmState::Snapshot snapshot);
cmLocalVisualStudio7Generator(cmGlobalGenerator* gg, cmMakefile* mf);
virtual ~cmLocalVisualStudio7Generator();

View File

@ -19,10 +19,8 @@
//----------------------------------------------------------------------------
cmLocalVisualStudioGenerator
::cmLocalVisualStudioGenerator(cmGlobalGenerator* gg,
cmLocalGenerator* parent,
cmState::Snapshot snapshot)
: cmLocalGenerator(gg, parent, snapshot)
::cmLocalVisualStudioGenerator(cmGlobalGenerator* gg, cmMakefile* mf)
: cmLocalGenerator(gg, mf)
{
}

View File

@ -31,9 +31,7 @@ class cmCustomCommandGenerator;
class cmLocalVisualStudioGenerator : public cmLocalGenerator
{
public:
cmLocalVisualStudioGenerator(cmGlobalGenerator* gg,
cmLocalGenerator* parent,
cmState::Snapshot snapshot);
cmLocalVisualStudioGenerator(cmGlobalGenerator* gg, cmMakefile* mf);
virtual ~cmLocalVisualStudioGenerator();
/** Construct a script from the given list of command lines. */

View File

@ -16,9 +16,8 @@
//----------------------------------------------------------------------------
cmLocalXCodeGenerator::cmLocalXCodeGenerator(cmGlobalGenerator* gg,
cmLocalGenerator* parent,
cmState::Snapshot snapshot)
: cmLocalGenerator(gg, parent, snapshot)
cmMakefile* mf)
: cmLocalGenerator(gg, mf)
{
// the global generator does this, so do not
// put these flags into the language flags

View File

@ -24,8 +24,8 @@ class cmLocalXCodeGenerator : public cmLocalGenerator
{
public:
///! Set cache only and recurse to false by default.
cmLocalXCodeGenerator(cmGlobalGenerator* gg, cmLocalGenerator* parent,
cmState::Snapshot snapshot);
cmLocalXCodeGenerator(cmGlobalGenerator* gg,
cmMakefile* mf);
virtual ~cmLocalXCodeGenerator();
virtual std::string GetTargetDirectory(cmTarget const& target) const;

View File

@ -16,7 +16,6 @@
#include "cmSourceFileLocation.h"
#include "cmSystemTools.h"
#include "cmGlobalGenerator.h"
#include "cmLocalGenerator.h"
#include "cmCommands.h"
#include "cmState.h"
#include "cmOutputConverter.h"
@ -44,9 +43,10 @@
#include <assert.h>
// default is not to be building executables
cmMakefile::cmMakefile(cmLocalGenerator* localGenerator)
: LocalGenerator(localGenerator),
StateSnapshot(localGenerator->GetStateSnapshot())
cmMakefile::cmMakefile(cmGlobalGenerator* globalGenerator,
cmState::Snapshot const& snapshot)
: GlobalGenerator(globalGenerator),
StateSnapshot(snapshot)
{
this->IsSourceFileTryCompile = false;
@ -1753,14 +1753,14 @@ void cmMakefile::AddSubDirectory(const std::string& srcPath,
this->ContextStack.back()->Name,
this->ContextStack.back()->Line);
cmMakefile* subMf = new cmMakefile(this->GlobalGenerator, newSnapshot);
this->GetGlobalGenerator()->AddMakefile(subMf);
// create a new local generator and set its parent
cmLocalGenerator *lg2 = this->GetGlobalGenerator()
->MakeLocalGenerator(newSnapshot, this->LocalGenerator);
this->GetGlobalGenerator()->AddMakefile(lg2->GetMakefile());
->CreateLocalGenerator(subMf);
this->GetGlobalGenerator()->AddLocalGenerator(lg2);
cmMakefile* subMf = lg2->GetMakefile();
// set the subdirs start dirs
subMf->SetCurrentSourceDirectory(srcPath);
subMf->SetCurrentBinaryDirectory(binPath);
@ -2334,7 +2334,8 @@ void cmMakefile::ExpandVariablesCMP0019()
l != this->Targets.end(); ++l)
{
cmTarget &t = l->second;
if (t.GetType() == cmTarget::INTERFACE_LIBRARY)
if (t.GetType() == cmTarget::INTERFACE_LIBRARY
|| t.GetType() == cmTarget::GLOBAL_TARGET)
{
continue;
}
@ -3744,12 +3745,12 @@ bool cmMakefile::GetIsSourceFileTryCompile() const
cmake *cmMakefile::GetCMakeInstance() const
{
return this->GetGlobalGenerator()->GetCMakeInstance();
return this->GlobalGenerator->GetCMakeInstance();
}
cmGlobalGenerator* cmMakefile::GetGlobalGenerator() const
{
return this->LocalGenerator->GetGlobalGenerator();
return this->GlobalGenerator;
}
#ifdef CMAKE_BUILD_WITH_CMAKE

View File

@ -42,7 +42,6 @@
class cmFunctionBlocker;
class cmCommand;
class cmInstallGenerator;
class cmLocalGenerator;
class cmMakeDepend;
class cmSourceFile;
class cmTest;
@ -71,7 +70,8 @@ public:
/**
* Construct an empty makefile.
*/
cmMakefile(cmLocalGenerator* localGenerator);
cmMakefile(cmGlobalGenerator* globalGenerator,
const cmState::Snapshot& snapshot);
/**
* Destructor.
@ -856,7 +856,7 @@ protected:
#endif
std::vector<cmCommand*> FinalPassCommands;
cmLocalGenerator* LocalGenerator;
cmGlobalGenerator* GlobalGenerator;
bool IsFunctionBlocked(const cmListFileFunction& lff,
cmExecutionStatus &status);

View File

@ -1217,7 +1217,9 @@ bool cmQtAutoGenerators::Run(const std::string& targetDirectory,
cm.SetHomeDirectory(targetDirectory);
cmGlobalGenerator gg(&cm);
cmLocalGenerator* lg = gg.MakeLocalGenerator();
cmState::Snapshot snapshot = cm.GetCurrentSnapshot();
cmsys::auto_ptr<cmMakefile> mf(new cmMakefile(&gg, snapshot));
cmsys::auto_ptr<cmLocalGenerator> lg(gg.CreateLocalGenerator(mf.get()));
lg->GetMakefile()->SetCurrentBinaryDirectory(targetDirectory);
lg->GetMakefile()->SetCurrentSourceDirectory(targetDirectory);
gg.SetCurrentMakefile(lg->GetMakefile());
@ -1234,7 +1236,6 @@ bool cmQtAutoGenerators::Run(const std::string& targetDirectory,
this->WriteOldMocDefinitionsFile(targetDirectory);
delete lg;
return success;
}

View File

@ -429,7 +429,9 @@ void cmake::ReadListFile(const std::vector<std::string>& args,
std::string homeOutputDir = this->GetHomeOutputDirectory();
this->SetHomeDirectory(cmSystemTools::GetCurrentWorkingDirectory());
this->SetHomeOutputDirectory(cmSystemTools::GetCurrentWorkingDirectory());
cmsys::auto_ptr<cmLocalGenerator> lg(gg->MakeLocalGenerator());
cmState::Snapshot snapshot = this->GetCurrentSnapshot();
cmsys::auto_ptr<cmMakefile> mf(new cmMakefile(gg, snapshot));
cmsys::auto_ptr<cmLocalGenerator> lg(gg->CreateLocalGenerator(mf.get()));
lg->GetMakefile()->SetCurrentBinaryDirectory
(cmSystemTools::GetCurrentWorkingDirectory());
lg->GetMakefile()->SetCurrentSourceDirectory
@ -469,9 +471,10 @@ bool cmake::FindPackage(const std::vector<std::string>& args)
cmGlobalGenerator *gg = new cmGlobalGenerator(this);
this->SetGlobalGenerator(gg);
cmState::Snapshot snapshot = this->GetCurrentSnapshot();
// read in the list file to fill the cache
cmsys::auto_ptr<cmLocalGenerator> lg(gg->MakeLocalGenerator());
cmMakefile* mf = lg->GetMakefile();
cmsys::auto_ptr<cmMakefile> mf(new cmMakefile(gg, snapshot));
cmsys::auto_ptr<cmLocalGenerator> lg(gg->CreateLocalGenerator(mf.get()));
mf->SetCurrentBinaryDirectory
(cmSystemTools::GetCurrentWorkingDirectory());
mf->SetCurrentSourceDirectory
@ -2059,8 +2062,8 @@ int cmake::CheckBuildSystem()
cm.SetHomeDirectory("");
cm.SetHomeOutputDirectory("");
cmGlobalGenerator gg(&cm);
cmsys::auto_ptr<cmLocalGenerator> lg(gg.MakeLocalGenerator());
cmMakefile* mf = lg->GetMakefile();
cmsys::auto_ptr<cmMakefile> mf(new cmMakefile(&gg, cm.GetCurrentSnapshot()));
cmsys::auto_ptr<cmLocalGenerator> lg(gg.CreateLocalGenerator(mf.get()));
if(!mf->ReadListFile(this->CheckBuildSystemArgument.c_str()) ||
cmSystemTools::GetErrorOccuredFlag())
{
@ -2089,8 +2092,11 @@ int cmake::CheckBuildSystem()
ggd(this->CreateGlobalGenerator(genName));
if(ggd.get())
{
cmsys::auto_ptr<cmLocalGenerator> lgd(ggd->MakeLocalGenerator());
lgd->ClearDependencies(mf, verbose);
cmsys::auto_ptr<cmMakefile> mfd(new cmMakefile(ggd.get(),
cm.GetCurrentSnapshot()));
cmsys::auto_ptr<cmLocalGenerator> lgd(
ggd->CreateLocalGenerator(mfd.get()));
lgd->ClearDependencies(mfd.get(), verbose);
}
}

View File

@ -768,7 +768,10 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args)
if(cmGlobalGenerator* ggd = cm.CreateGlobalGenerator(gen))
{
cm.SetGlobalGenerator(ggd);
cmsys::auto_ptr<cmLocalGenerator> lgd(ggd->MakeLocalGenerator());
cmState::Snapshot snapshot = cm.GetCurrentSnapshot();
cmsys::auto_ptr<cmMakefile> mf(new cmMakefile(ggd, snapshot));
cmsys::auto_ptr<cmLocalGenerator> lgd(
ggd->CreateLocalGenerator(mf.get()));
lgd->GetMakefile()->SetCurrentSourceDirectory(startDir);
lgd->GetMakefile()->SetCurrentBinaryDirectory(startOutDir);