cmCommonTargetGenerator: Adopt basic target generator members
De-duplicate the GeneratorTarget, Target, and Makefile members from the local Makefile and Ninja generators.
This commit is contained in:
parent
001f9b3617
commit
e7dcdd1011
@ -11,7 +11,18 @@
|
|||||||
============================================================================*/
|
============================================================================*/
|
||||||
#include "cmCommonTargetGenerator.h"
|
#include "cmCommonTargetGenerator.h"
|
||||||
|
|
||||||
cmCommonTargetGenerator::cmCommonTargetGenerator()
|
#include "cmGeneratorTarget.h"
|
||||||
|
#include "cmGlobalCommonGenerator.h"
|
||||||
|
#include "cmLocalCommonGenerator.h"
|
||||||
|
#include "cmTarget.h"
|
||||||
|
|
||||||
|
cmCommonTargetGenerator::cmCommonTargetGenerator(cmGeneratorTarget* gt)
|
||||||
|
: GeneratorTarget(gt)
|
||||||
|
, Target(gt->Target)
|
||||||
|
, Makefile(gt->Makefile)
|
||||||
|
, LocalGenerator(static_cast<cmLocalCommonGenerator*>(gt->LocalGenerator))
|
||||||
|
, GlobalGenerator(static_cast<cmGlobalCommonGenerator*>(
|
||||||
|
gt->LocalGenerator->GetGlobalGenerator()))
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -14,14 +14,27 @@
|
|||||||
|
|
||||||
#include "cmStandardIncludes.h"
|
#include "cmStandardIncludes.h"
|
||||||
|
|
||||||
|
class cmGeneratorTarget;
|
||||||
|
class cmGlobalCommonGenerator;
|
||||||
|
class cmLocalCommonGenerator;
|
||||||
|
class cmMakefile;
|
||||||
|
class cmTarget;
|
||||||
|
|
||||||
/** \class cmCommonTargetGenerator
|
/** \class cmCommonTargetGenerator
|
||||||
* \brief Common infrastructure for Makefile and Ninja per-target generators
|
* \brief Common infrastructure for Makefile and Ninja per-target generators
|
||||||
*/
|
*/
|
||||||
class cmCommonTargetGenerator
|
class cmCommonTargetGenerator
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
cmCommonTargetGenerator();
|
cmCommonTargetGenerator(cmGeneratorTarget* gt);
|
||||||
virtual ~cmCommonTargetGenerator();
|
virtual ~cmCommonTargetGenerator();
|
||||||
|
|
||||||
|
protected:
|
||||||
|
cmGeneratorTarget* GeneratorTarget;
|
||||||
|
cmTarget* Target;
|
||||||
|
cmMakefile* Makefile;
|
||||||
|
cmLocalCommonGenerator* LocalGenerator;
|
||||||
|
cmGlobalCommonGenerator* GlobalGenerator;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -33,7 +33,7 @@
|
|||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
|
|
||||||
cmMakefileTargetGenerator::cmMakefileTargetGenerator(cmGeneratorTarget* target)
|
cmMakefileTargetGenerator::cmMakefileTargetGenerator(cmGeneratorTarget* target)
|
||||||
: cmCommonTargetGenerator()
|
: cmCommonTargetGenerator(target)
|
||||||
, OSXBundleGenerator(0)
|
, OSXBundleGenerator(0)
|
||||||
, MacOSXContentGenerator(0)
|
, MacOSXContentGenerator(0)
|
||||||
{
|
{
|
||||||
@ -42,15 +42,12 @@ cmMakefileTargetGenerator::cmMakefileTargetGenerator(cmGeneratorTarget* target)
|
|||||||
this->FlagFileStream = 0;
|
this->FlagFileStream = 0;
|
||||||
this->CustomCommandDriver = OnBuild;
|
this->CustomCommandDriver = OnBuild;
|
||||||
this->FortranModuleDirectoryComputed = false;
|
this->FortranModuleDirectoryComputed = false;
|
||||||
this->Target = target->Target;
|
|
||||||
this->Makefile = this->Target->GetMakefile();
|
|
||||||
this->LocalGenerator =
|
this->LocalGenerator =
|
||||||
static_cast<cmLocalUnixMakefileGenerator3*>(target->GetLocalGenerator());
|
static_cast<cmLocalUnixMakefileGenerator3*>(target->GetLocalGenerator());
|
||||||
this->ConfigName = this->LocalGenerator->ConfigurationName.c_str();
|
this->ConfigName = this->LocalGenerator->ConfigurationName.c_str();
|
||||||
this->GlobalGenerator =
|
this->GlobalGenerator =
|
||||||
static_cast<cmGlobalUnixMakefileGenerator3*>(
|
static_cast<cmGlobalUnixMakefileGenerator3*>(
|
||||||
this->LocalGenerator->GetGlobalGenerator());
|
this->LocalGenerator->GetGlobalGenerator());
|
||||||
this->GeneratorTarget = target;
|
|
||||||
cmake* cm = this->GlobalGenerator->GetCMakeInstance();
|
cmake* cm = this->GlobalGenerator->GetCMakeInstance();
|
||||||
this->NoRuleMessages = false;
|
this->NoRuleMessages = false;
|
||||||
if(const char* ruleStatus = cm->GetState()
|
if(const char* ruleStatus = cm->GetState()
|
||||||
|
@ -175,11 +175,8 @@ protected:
|
|||||||
virtual void CloseFileStreams();
|
virtual void CloseFileStreams();
|
||||||
void RemoveForbiddenFlags(const char* flagVar, const std::string& linkLang,
|
void RemoveForbiddenFlags(const char* flagVar, const std::string& linkLang,
|
||||||
std::string& linkFlags);
|
std::string& linkFlags);
|
||||||
cmTarget *Target;
|
|
||||||
cmGeneratorTarget* GeneratorTarget;
|
|
||||||
cmLocalUnixMakefileGenerator3 *LocalGenerator;
|
cmLocalUnixMakefileGenerator3 *LocalGenerator;
|
||||||
cmGlobalUnixMakefileGenerator3 *GlobalGenerator;
|
cmGlobalUnixMakefileGenerator3 *GlobalGenerator;
|
||||||
cmMakefile *Makefile;
|
|
||||||
std::string ConfigName;
|
std::string ConfigName;
|
||||||
|
|
||||||
enum CustomCommandDriveType { OnBuild, OnDepends, OnUtility };
|
enum CustomCommandDriveType { OnBuild, OnDepends, OnUtility };
|
||||||
|
@ -58,17 +58,14 @@ cmNinjaTargetGenerator::New(cmGeneratorTarget* target)
|
|||||||
}
|
}
|
||||||
|
|
||||||
cmNinjaTargetGenerator::cmNinjaTargetGenerator(cmGeneratorTarget* target)
|
cmNinjaTargetGenerator::cmNinjaTargetGenerator(cmGeneratorTarget* target)
|
||||||
: cmCommonTargetGenerator(),
|
: cmCommonTargetGenerator(target),
|
||||||
MacOSXContentGenerator(0),
|
MacOSXContentGenerator(0),
|
||||||
OSXBundleGenerator(0),
|
OSXBundleGenerator(0),
|
||||||
MacContentFolders(),
|
MacContentFolders(),
|
||||||
Target(target->Target),
|
|
||||||
Makefile(target->Makefile),
|
|
||||||
LocalGenerator(
|
LocalGenerator(
|
||||||
static_cast<cmLocalNinjaGenerator*>(target->GetLocalGenerator())),
|
static_cast<cmLocalNinjaGenerator*>(target->GetLocalGenerator())),
|
||||||
Objects()
|
Objects()
|
||||||
{
|
{
|
||||||
this->GeneratorTarget = target;
|
|
||||||
MacOSXContentGenerator = new MacOSXContentGeneratorType(this);
|
MacOSXContentGenerator = new MacOSXContentGeneratorType(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -152,9 +152,6 @@ protected:
|
|||||||
cmNinjaVars& vars);
|
cmNinjaVars& vars);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
cmTarget* Target;
|
|
||||||
cmGeneratorTarget* GeneratorTarget;
|
|
||||||
cmMakefile* Makefile;
|
|
||||||
cmLocalNinjaGenerator* LocalGenerator;
|
cmLocalNinjaGenerator* LocalGenerator;
|
||||||
/// List of object files for this target.
|
/// List of object files for this target.
|
||||||
cmNinjaDeps Objects;
|
cmNinjaDeps Objects;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user