cmLocalGenerator: Require a global generator in the constructor.

Port generator factory methods to pass it.
This commit is contained in:
Stephen Kelly 2015-05-03 16:50:34 +02:00
parent 3837c48334
commit 34c9ee2ed7
38 changed files with 66 additions and 94 deletions

View File

@ -41,13 +41,12 @@ cmLocalGenerator *cmGlobalBorlandMakefileGenerator::CreateLocalGenerator(
cmLocalGenerator* parent)
{
cmLocalUnixMakefileGenerator3* lg =
new cmLocalUnixMakefileGenerator3(parent);
new cmLocalUnixMakefileGenerator3(this, parent);
lg->SetIncludeDirective("!include");
lg->SetWindowsShell(true);
lg->SetDefineWindowsNULL(true);
lg->SetMakefileVariableSize(32);
lg->SetPassMakeflags(true);
lg->SetGlobalGenerator(this);
lg->SetUnixCD(false);
lg->SetMakeCommandEscapeTargetTwice(true);
lg->SetBorlandMakeCurlyHack(true);

View File

@ -1877,9 +1877,7 @@ void cmGlobalGenerator::EnableInstallTarget()
cmLocalGenerator *
cmGlobalGenerator::CreateLocalGenerator(cmLocalGenerator *parent)
{
cmLocalGenerator *lg = new cmLocalGenerator(parent);
lg->SetGlobalGenerator(this);
return lg;
return new cmLocalGenerator(this, parent);
}
void cmGlobalGenerator::EnableLanguagesFromGenerator(cmGlobalGenerator *gen,

View File

@ -35,8 +35,7 @@ cmGlobalGhsMultiGenerator::~cmGlobalGhsMultiGenerator()
cmLocalGenerator *
cmGlobalGhsMultiGenerator::CreateLocalGenerator(cmLocalGenerator* parent)
{
cmLocalGenerator *lg = new cmLocalGhsMultiGenerator(parent);
lg->SetGlobalGenerator(this);
cmLocalGenerator *lg = new cmLocalGhsMultiGenerator(this, parent);
this->SetCurrentLocalGenerator(lg);
return lg;
}

View File

@ -49,11 +49,10 @@ cmLocalGenerator *
cmGlobalJOMMakefileGenerator::CreateLocalGenerator(cmLocalGenerator* parent)
{
cmLocalUnixMakefileGenerator3* lg
= new cmLocalUnixMakefileGenerator3(parent);
= new cmLocalUnixMakefileGenerator3(this, parent);
lg->SetDefineWindowsNULL(true);
lg->SetWindowsShell(true);
lg->SetMakeSilentFlag("/nologo");
lg->SetGlobalGenerator(this);
lg->SetIgnoreLibPrefix(true);
lg->SetPassMakeflags(true);
lg->SetNMake(true);

View File

@ -97,10 +97,9 @@ cmLocalGenerator *
cmGlobalMSYSMakefileGenerator::CreateLocalGenerator(cmLocalGenerator* parent)
{
cmLocalUnixMakefileGenerator3* lg =
new cmLocalUnixMakefileGenerator3(parent);
new cmLocalUnixMakefileGenerator3(this, parent);
lg->SetWindowsShell(false);
lg->SetMSYSShell(true);
lg->SetGlobalGenerator(this);
lg->SetIgnoreLibPrefix(true);
lg->SetPassMakeflags(false);
lg->SetUnixCD(true);

View File

@ -61,9 +61,8 @@ cmLocalGenerator *
cmGlobalMinGWMakefileGenerator::CreateLocalGenerator(cmLocalGenerator* parent)
{
cmLocalUnixMakefileGenerator3* lg =
new cmLocalUnixMakefileGenerator3(parent);
new cmLocalUnixMakefileGenerator3(this, parent);
lg->SetWindowsShell(true);
lg->SetGlobalGenerator(this);
lg->SetIgnoreLibPrefix(true);
lg->SetPassMakeflags(false);
lg->SetUnixCD(true);

View File

@ -49,11 +49,10 @@ cmLocalGenerator *
cmGlobalNMakeMakefileGenerator::CreateLocalGenerator(cmLocalGenerator* parent)
{
cmLocalUnixMakefileGenerator3* lg =
new cmLocalUnixMakefileGenerator3(parent);
new cmLocalUnixMakefileGenerator3(this, parent);
lg->SetDefineWindowsNULL(true);
lg->SetWindowsShell(true);
lg->SetMakeSilentFlag("/nologo");
lg->SetGlobalGenerator(this);
lg->SetIgnoreLibPrefix(true);
lg->SetPassMakeflags(true);
lg->SetNMake(true);

View File

@ -500,9 +500,7 @@ cmGlobalNinjaGenerator::cmGlobalNinjaGenerator()
cmLocalGenerator*
cmGlobalNinjaGenerator::CreateLocalGenerator(cmLocalGenerator* parent)
{
cmLocalGenerator* lg = new cmLocalNinjaGenerator(parent);
lg->SetGlobalGenerator(this);
return lg;
return new cmLocalNinjaGenerator(this, parent);
}
void cmGlobalNinjaGenerator

View File

@ -56,9 +56,7 @@ void cmGlobalUnixMakefileGenerator3
cmLocalGenerator *
cmGlobalUnixMakefileGenerator3::CreateLocalGenerator(cmLocalGenerator* parent)
{
cmLocalGenerator* lg = new cmLocalUnixMakefileGenerator3(parent);
lg->SetGlobalGenerator(this);
return lg;
return new cmLocalUnixMakefileGenerator3(this, parent);
}
//----------------------------------------------------------------------------

View File

@ -311,11 +311,8 @@ void cmGlobalVisualStudio10Generator::WriteSLNHeader(std::ostream& fout)
cmLocalGenerator *
cmGlobalVisualStudio10Generator::CreateLocalGenerator(cmLocalGenerator* parent)
{
cmLocalVisualStudio10Generator* lg =
new cmLocalVisualStudio10Generator(cmLocalVisualStudioGenerator::VS10,
parent);
lg->SetGlobalGenerator(this);
return lg;
return new cmLocalVisualStudio10Generator(
cmLocalVisualStudioGenerator::VS10, this, parent);
}
//----------------------------------------------------------------------------

View File

@ -240,11 +240,8 @@ void cmGlobalVisualStudio11Generator::WriteSLNHeader(std::ostream& fout)
cmLocalGenerator *
cmGlobalVisualStudio11Generator::CreateLocalGenerator(cmLocalGenerator* parent)
{
cmLocalVisualStudio10Generator* lg =
new cmLocalVisualStudio10Generator(cmLocalVisualStudioGenerator::VS11,
parent);
lg->SetGlobalGenerator(this);
return lg;
return new cmLocalVisualStudio10Generator(
cmLocalVisualStudioGenerator::VS11, this, parent);
}
//----------------------------------------------------------------------------

View File

@ -220,11 +220,8 @@ void cmGlobalVisualStudio12Generator::WriteSLNHeader(std::ostream& fout)
cmLocalGenerator *
cmGlobalVisualStudio12Generator::CreateLocalGenerator(cmLocalGenerator* parent)
{
cmLocalVisualStudio10Generator* lg =
new cmLocalVisualStudio10Generator(cmLocalVisualStudioGenerator::VS12,
parent);
lg->SetGlobalGenerator(this);
return lg;
return new cmLocalVisualStudio10Generator(
cmLocalVisualStudioGenerator::VS12, this, parent);
}
//----------------------------------------------------------------------------

View File

@ -131,9 +131,6 @@ void cmGlobalVisualStudio14Generator::WriteSLNHeader(std::ostream& fout)
cmLocalGenerator *
cmGlobalVisualStudio14Generator::CreateLocalGenerator(cmLocalGenerator* parent)
{
cmLocalVisualStudio10Generator* lg =
new cmLocalVisualStudio10Generator(cmLocalVisualStudioGenerator::VS14,
parent);
lg->SetGlobalGenerator(this);
return lg;
return new cmLocalVisualStudio10Generator(
cmLocalVisualStudioGenerator::VS14, this, parent);
}

View File

@ -173,9 +173,7 @@ cmGlobalVisualStudio6Generator::GenerateBuildCommand(
cmLocalGenerator *
cmGlobalVisualStudio6Generator::CreateLocalGenerator(cmLocalGenerator* parent)
{
cmLocalGenerator *lg = new cmLocalVisualStudio6Generator(parent);
lg->SetGlobalGenerator(this);
return lg;
return new cmLocalVisualStudio6Generator(this, parent);
}

View File

@ -30,9 +30,8 @@ cmGlobalVisualStudio71Generator::CreateLocalGenerator(cmLocalGenerator* parent)
{
cmLocalVisualStudio7Generator *lg =
new cmLocalVisualStudio7Generator(cmLocalVisualStudioGenerator::VS71,
parent);
this, parent);
lg->SetExtraFlagTable(this->GetExtraFlagTableVS7());
lg->SetGlobalGenerator(this);
return lg;
}

View File

@ -255,9 +255,8 @@ cmGlobalVisualStudio7Generator::CreateLocalGenerator(cmLocalGenerator* parent)
{
cmLocalVisualStudio7Generator *lg =
new cmLocalVisualStudio7Generator(cmLocalVisualStudioGenerator::VS7,
parent);
this, parent);
lg->SetExtraFlagTable(this->GetExtraFlagTableVS7());
lg->SetGlobalGenerator(this);
return lg;
}

View File

@ -130,9 +130,8 @@ cmGlobalVisualStudio8Generator::CreateLocalGenerator(cmLocalGenerator* parent)
{
cmLocalVisualStudio7Generator *lg =
new cmLocalVisualStudio7Generator(cmLocalVisualStudioGenerator::VS8,
parent);
this, parent);
lg->SetExtraFlagTable(this->GetExtraFlagTableVS8());
lg->SetGlobalGenerator(this);
return lg;
}

View File

@ -119,9 +119,8 @@ cmGlobalVisualStudio9Generator::CreateLocalGenerator(cmLocalGenerator* parent)
{
cmLocalVisualStudio7Generator *lg
= new cmLocalVisualStudio7Generator(cmLocalVisualStudioGenerator::VS9,
parent);
this, parent);
lg->SetExtraFlagTable(this->GetExtraFlagTableVS8());
lg->SetGlobalGenerator(this);
return lg;
}

View File

@ -45,14 +45,13 @@ cmLocalGenerator *
cmGlobalWatcomWMakeGenerator::CreateLocalGenerator(cmLocalGenerator* parent)
{
cmLocalUnixMakefileGenerator3* lg
= new cmLocalUnixMakefileGenerator3(parent);
= new cmLocalUnixMakefileGenerator3(this, parent);
lg->SetDefineWindowsNULL(true);
#ifdef _WIN32
lg->SetWindowsShell(true);
#endif
lg->SetWatcomWMake(true);
lg->SetMakeSilentFlag("-h");
lg->SetGlobalGenerator(this);
lg->SetIgnoreLibPrefix(true);
lg->SetPassMakeflags(false);
lg->SetUnixCD(false);

View File

@ -371,9 +371,7 @@ cmGlobalXCodeGenerator::GenerateBuildCommand(
cmLocalGenerator *
cmGlobalXCodeGenerator::CreateLocalGenerator(cmLocalGenerator* parent)
{
cmLocalGenerator *lg = new cmLocalXCodeGenerator(parent);
lg->SetGlobalGenerator(this);
return lg;
return new cmLocalXCodeGenerator(this, parent);
}
//----------------------------------------------------------------------------

View File

@ -43,14 +43,17 @@
#include <StorageDefs.h>
#endif
cmLocalGenerator::cmLocalGenerator(cmLocalGenerator* parent)
cmLocalGenerator::cmLocalGenerator(cmGlobalGenerator* gg,
cmLocalGenerator* parent)
{
this->Makefile = 0; // moved to after set on global
this->GlobalGenerator = gg;
this->Parent = parent;
if (parent)
{
parent->AddChild(this);
}
this->Makefile = new cmMakefile(this);
this->WindowsShell = false;
this->WindowsVSIDE = false;
this->WatcomWMake = false;
@ -249,13 +252,6 @@ void cmLocalGenerator::SetupPathConversions()
this->StartOutputDirectoryComponents);
}
void cmLocalGenerator::SetGlobalGenerator(cmGlobalGenerator *gg)
{
this->GlobalGenerator = gg;
this->Makefile = new cmMakefile(this);
}
void cmLocalGenerator::ConfigureFinalPass()
{
this->Makefile->ConfigureFinalPass();

View File

@ -33,7 +33,7 @@ class cmCustomCommandGenerator;
class cmLocalGenerator
{
public:
cmLocalGenerator(cmLocalGenerator* parent);
cmLocalGenerator(cmGlobalGenerator* gg, cmLocalGenerator* parent);
virtual ~cmLocalGenerator();
/**
@ -88,9 +88,6 @@ public:
const cmGlobalGenerator *GetGlobalGenerator() const {
return this->GlobalGenerator; }
///! Set the Global Generator, done on creation by the GlobalGenerator
void SetGlobalGenerator(cmGlobalGenerator *gg);
/**
* Convert something to something else. This is a centralized conversion
* routine used by the generators to handle relative paths and the like.

View File

@ -16,8 +16,9 @@
#include "cmGhsMultiTargetGenerator.h"
#include "cmGeneratedFileStream.h"
cmLocalGhsMultiGenerator::cmLocalGhsMultiGenerator(cmLocalGenerator* parent)
: cmLocalGenerator(parent)
cmLocalGhsMultiGenerator::cmLocalGhsMultiGenerator(cmGlobalGenerator* gg,
cmLocalGenerator* parent)
: cmLocalGenerator(gg, parent)
{
}

View File

@ -25,7 +25,7 @@ class cmGeneratedFileStream;
class cmLocalGhsMultiGenerator : public cmLocalGenerator
{
public:
cmLocalGhsMultiGenerator(cmLocalGenerator* parent);
cmLocalGhsMultiGenerator(cmGlobalGenerator* gg, cmLocalGenerator* parent);
virtual ~cmLocalGhsMultiGenerator();

View File

@ -22,8 +22,9 @@
#include <assert.h>
cmLocalNinjaGenerator::cmLocalNinjaGenerator(cmLocalGenerator* parent)
: cmLocalGenerator(parent)
cmLocalNinjaGenerator::cmLocalNinjaGenerator(cmGlobalGenerator* gg,
cmLocalGenerator* parent)
: cmLocalGenerator(gg, parent)
, ConfigName("")
, HomeRelativeOutputPath("")
{

View File

@ -32,7 +32,7 @@ class cmLocalNinjaGenerator : public cmLocalGenerator
{
public:
/// Default constructor.
cmLocalNinjaGenerator(cmLocalGenerator* parent);
cmLocalNinjaGenerator(cmGlobalGenerator* gg, cmLocalGenerator* parent);
/// Destructor.
virtual ~cmLocalNinjaGenerator();

View File

@ -80,8 +80,8 @@ static std::string cmSplitExtension(std::string const& in, std::string& base)
//----------------------------------------------------------------------------
cmLocalUnixMakefileGenerator3::
cmLocalUnixMakefileGenerator3(cmLocalGenerator* parent)
: cmLocalGenerator(parent)
cmLocalUnixMakefileGenerator3(cmGlobalGenerator* gg, cmLocalGenerator* parent)
: cmLocalGenerator(gg, parent)
{
this->WindowsShell = false;
this->IncludeDirective = "include";

View File

@ -34,7 +34,8 @@ class cmSourceFile;
class cmLocalUnixMakefileGenerator3 : public cmLocalGenerator
{
public:
cmLocalUnixMakefileGenerator3(cmLocalGenerator* parent);
cmLocalUnixMakefileGenerator3(cmGlobalGenerator* gg,
cmLocalGenerator* parent);
virtual ~cmLocalUnixMakefileGenerator3();
/**

View File

@ -62,8 +62,9 @@ class cmVS10XMLParser : public cmXMLParser
//----------------------------------------------------------------------------
cmLocalVisualStudio10Generator
::cmLocalVisualStudio10Generator(VSVersion v, cmLocalGenerator* parent):
cmLocalVisualStudio7Generator(v, parent)
::cmLocalVisualStudio10Generator(VSVersion v, cmGlobalGenerator* gg,
cmLocalGenerator* parent):
cmLocalVisualStudio7Generator(v, gg, parent)
{
}

View File

@ -25,7 +25,8 @@ class cmLocalVisualStudio10Generator : public cmLocalVisualStudio7Generator
{
public:
///! Set cache only and recurse to false by default.
cmLocalVisualStudio10Generator(VSVersion v, cmLocalGenerator* parent);
cmLocalVisualStudio10Generator(VSVersion v, cmGlobalGenerator* gg,
cmLocalGenerator* parent);
virtual ~cmLocalVisualStudio10Generator();

View File

@ -24,8 +24,9 @@
#include <cmsys/FStream.hxx>
cmLocalVisualStudio6Generator
::cmLocalVisualStudio6Generator(cmLocalGenerator* parent):
cmLocalVisualStudioGenerator(VS6, parent)
::cmLocalVisualStudio6Generator(cmGlobalGenerator* gg,
cmLocalGenerator* parent):
cmLocalVisualStudioGenerator(VS6, gg, parent)
{
}

View File

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

View File

@ -55,8 +55,9 @@ static void cmConvertToWindowsSlash(std::string& s)
//----------------------------------------------------------------------------
cmLocalVisualStudio7Generator
::cmLocalVisualStudio7Generator(VSVersion v, cmLocalGenerator* parent):
cmLocalVisualStudioGenerator(v, parent)
::cmLocalVisualStudio7Generator(VSVersion v, cmGlobalGenerator* gg,
cmLocalGenerator* parent):
cmLocalVisualStudioGenerator(v, gg, parent)
{
this->ExtraFlagTable = 0;
this->Internal = new cmLocalVisualStudio7GeneratorInternals(this);

View File

@ -35,7 +35,8 @@ class cmLocalVisualStudio7Generator : public cmLocalVisualStudioGenerator
{
public:
///! Set cache only and recurse to false by default.
cmLocalVisualStudio7Generator(VSVersion v, cmLocalGenerator* parent);
cmLocalVisualStudio7Generator(VSVersion v, cmGlobalGenerator* gg,
cmLocalGenerator* parent);
virtual ~cmLocalVisualStudio7Generator();

View File

@ -19,8 +19,9 @@
//----------------------------------------------------------------------------
cmLocalVisualStudioGenerator
::cmLocalVisualStudioGenerator(VSVersion v, cmLocalGenerator* parent)
: cmLocalGenerator(parent)
::cmLocalVisualStudioGenerator(VSVersion v, cmGlobalGenerator* gg,
cmLocalGenerator* parent)
: cmLocalGenerator(gg, parent)
{
this->WindowsShell = true;
this->WindowsVSIDE = true;

View File

@ -45,7 +45,8 @@ public:
VS14 = 140
};
cmLocalVisualStudioGenerator(VSVersion v, cmLocalGenerator* parent);
cmLocalVisualStudioGenerator(VSVersion v, cmGlobalGenerator* gg,
cmLocalGenerator* parent);
virtual ~cmLocalVisualStudioGenerator();
/** Construct a script from the given list of command lines. */

View File

@ -15,8 +15,9 @@
#include "cmMakefile.h"
//----------------------------------------------------------------------------
cmLocalXCodeGenerator::cmLocalXCodeGenerator(cmLocalGenerator* parent)
: cmLocalGenerator(parent)
cmLocalXCodeGenerator::cmLocalXCodeGenerator(cmGlobalGenerator* gg,
cmLocalGenerator* parent)
: cmLocalGenerator(gg, parent)
{
// the global generator does this, so do not
// put these flags into the language flags

View File

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