Port some of the generator API to cmGeneratorTarget.

Just enough to reach the BuildMacContentDirectory method and the
NeedRelinkBeforeInstall methods.

In the future, those methods can be moved to cmGeneratorTarget.
This commit is contained in:
Stephen Kelly 2012-10-10 21:32:37 +02:00
parent abb13ea565
commit c34968a9aa
19 changed files with 155 additions and 118 deletions

View File

@ -471,23 +471,29 @@ cmGlobalUnixMakefileGenerator3
// The directory-level rule should depend on the target-level rules // The directory-level rule should depend on the target-level rules
// for all targets in the directory. // for all targets in the directory.
std::vector<std::string> depends; std::vector<std::string> depends;
for(cmTargets::iterator l = lg->GetMakefile()->GetTargets().begin(); cmGeneratorTargetsType targets = lg->GetMakefile()->GetGeneratorTargets();
l != lg->GetMakefile()->GetTargets().end(); ++l) for(cmGeneratorTargetsType::iterator l = targets.begin();
l != targets.end(); ++l)
{ {
if((l->second.GetType() == cmTarget::EXECUTABLE) || if((l->second->GetType() == cmTarget::EXECUTABLE) ||
(l->second.GetType() == cmTarget::STATIC_LIBRARY) || (l->second->GetType() == cmTarget::STATIC_LIBRARY) ||
(l->second.GetType() == cmTarget::SHARED_LIBRARY) || (l->second->GetType() == cmTarget::SHARED_LIBRARY) ||
(l->second.GetType() == cmTarget::MODULE_LIBRARY) || (l->second->GetType() == cmTarget::MODULE_LIBRARY) ||
(l->second.GetType() == cmTarget::OBJECT_LIBRARY) || (l->second->GetType() == cmTarget::OBJECT_LIBRARY) ||
(l->second.GetType() == cmTarget::INTERFACE_LIBRARY) || (l->second->GetType() == cmTarget::INTERFACE_LIBRARY) ||
(l->second.GetType() == cmTarget::UTILITY)) (l->second->GetType() == cmTarget::UTILITY))
{ {
// Add this to the list of depends rules in this directory. if(l->second->Target->IsImported())
if((!check_all || !l->second.GetPropertyAsBool("EXCLUDE_FROM_ALL")) &&
(!check_relink ||
l->second.NeedRelinkBeforeInstall(lg->ConfigurationName.c_str())))
{ {
std::string tname = lg->GetRelativeTargetDirectory(l->second); continue;
}
// Add this to the list of depends rules in this directory.
if((!check_all || !l->second->GetPropertyAsBool("EXCLUDE_FROM_ALL")) &&
(!check_relink ||
l->second->Target
->NeedRelinkBeforeInstall(lg->ConfigurationName.c_str())))
{
std::string tname = lg->GetRelativeTargetDirectory(*l->second->Target);
tname += "/"; tname += "/";
tname += pass; tname += pass;
depends.push_back(tname); depends.push_back(tname);
@ -632,49 +638,55 @@ cmGlobalUnixMakefileGenerator3
lg = static_cast<cmLocalUnixMakefileGenerator3 *> lg = static_cast<cmLocalUnixMakefileGenerator3 *>
(this->LocalGenerators[i]); (this->LocalGenerators[i]);
// for each target Generate the rule files for each target. // for each target Generate the rule files for each target.
cmTargets& targets = lg->GetMakefile()->GetTargets(); cmGeneratorTargetsType targets = lg->GetMakefile()->GetGeneratorTargets();
for(cmTargets::iterator t = targets.begin(); t != targets.end(); ++t) for(cmGeneratorTargetsType::iterator t = targets.begin();
t != targets.end(); ++t)
{ {
if(t->second->Target->IsImported())
{
continue;
}
// Don't emit the same rule twice (e.g. two targets with the same // Don't emit the same rule twice (e.g. two targets with the same
// simple name) // simple name)
if(t->second.GetName() && if(t->second->GetName() &&
strlen(t->second.GetName()) && strlen(t->second->GetName()) &&
emitted.insert(t->second.GetName()).second && emitted.insert(t->second->GetName()).second &&
// Handle user targets here. Global targets are handled in // Handle user targets here. Global targets are handled in
// the local generator on a per-directory basis. // the local generator on a per-directory basis.
((t->second.GetType() == cmTarget::EXECUTABLE) || ((t->second->GetType() == cmTarget::EXECUTABLE) ||
(t->second.GetType() == cmTarget::STATIC_LIBRARY) || (t->second->GetType() == cmTarget::STATIC_LIBRARY) ||
(t->second.GetType() == cmTarget::SHARED_LIBRARY) || (t->second->GetType() == cmTarget::SHARED_LIBRARY) ||
(t->second.GetType() == cmTarget::MODULE_LIBRARY) || (t->second->GetType() == cmTarget::MODULE_LIBRARY) ||
(t->second.GetType() == cmTarget::OBJECT_LIBRARY) || (t->second->GetType() == cmTarget::OBJECT_LIBRARY) ||
(t->second.GetType() == cmTarget::INTERFACE_LIBRARY) || (t->second->GetType() == cmTarget::INTERFACE_LIBRARY) ||
(t->second.GetType() == cmTarget::UTILITY))) (t->second->GetType() == cmTarget::UTILITY)))
{ {
// Add a rule to build the target by name. // Add a rule to build the target by name.
lg->WriteDivider(ruleFileStream); lg->WriteDivider(ruleFileStream);
ruleFileStream ruleFileStream
<< "# Target rules for targets named " << "# Target rules for targets named "
<< t->second.GetName() << "\n\n"; << t->second->GetName() << "\n\n";
// Write the rule. // Write the rule.
commands.clear(); commands.clear();
std::string tmp = cmake::GetCMakeFilesDirectoryPostSlash(); std::string tmp = cmake::GetCMakeFilesDirectoryPostSlash();
tmp += "Makefile2"; tmp += "Makefile2";
commands.push_back(lg->GetRecursiveMakeCall commands.push_back(lg->GetRecursiveMakeCall
(tmp.c_str(),t->second.GetName())); (tmp.c_str(),t->second->GetName()));
depends.clear(); depends.clear();
depends.push_back("cmake_check_build_system"); depends.push_back("cmake_check_build_system");
lg->WriteMakeRule(ruleFileStream, lg->WriteMakeRule(ruleFileStream,
"Build rule for target.", "Build rule for target.",
t->second.GetName(), depends, commands, t->second->GetName(), depends, commands,
true); true);
if (t->second.GetType() == cmTarget::INTERFACE_LIBRARY) if (t->second->GetType() == cmTarget::INTERFACE_LIBRARY)
{ {
continue; continue;
} }
// Add a fast rule to build the target // Add a fast rule to build the target
std::string localName = lg->GetRelativeTargetDirectory(t->second); std::string localName =
lg->GetRelativeTargetDirectory(*t->second->Target);
std::string makefileName; std::string makefileName;
makefileName = localName; makefileName = localName;
makefileName += "/build.make"; makefileName += "/build.make";
@ -682,7 +694,7 @@ cmGlobalUnixMakefileGenerator3
commands.clear(); commands.clear();
std::string makeTargetName = localName; std::string makeTargetName = localName;
makeTargetName += "/build"; makeTargetName += "/build";
localName = t->second.GetName(); localName = t->second->GetName();
localName += "/fast"; localName += "/fast";
commands.push_back(lg->GetRecursiveMakeCall commands.push_back(lg->GetRecursiveMakeCall
(makefileName.c_str(), makeTargetName.c_str())); (makefileName.c_str(), makeTargetName.c_str()));
@ -691,11 +703,12 @@ cmGlobalUnixMakefileGenerator3
// Add a local name for the rule to relink the target before // Add a local name for the rule to relink the target before
// installation. // installation.
if(t->second.NeedRelinkBeforeInstall(lg->ConfigurationName.c_str())) if(t->second->Target
->NeedRelinkBeforeInstall(lg->ConfigurationName.c_str()))
{ {
makeTargetName = lg->GetRelativeTargetDirectory(t->second); makeTargetName = lg->GetRelativeTargetDirectory(*t->second->Target);
makeTargetName += "/preinstall"; makeTargetName += "/preinstall";
localName = t->second.GetName(); localName = t->second->GetName();
localName += "/preinstall"; localName += "/preinstall";
depends.clear(); depends.clear();
commands.clear(); commands.clear();
@ -729,26 +742,31 @@ cmGlobalUnixMakefileGenerator3
depends.push_back("cmake_check_build_system"); depends.push_back("cmake_check_build_system");
// for each target Generate the rule files for each target. // for each target Generate the rule files for each target.
cmTargets& targets = lg->GetMakefile()->GetTargets(); cmGeneratorTargetsType targets = lg->GetMakefile()->GetGeneratorTargets();
for(cmTargets::iterator t = targets.begin(); t != targets.end(); ++t) for(cmGeneratorTargetsType::iterator t = targets.begin();
t != targets.end(); ++t)
{ {
if (t->second.GetName() if(t->second->Target->IsImported())
&& strlen(t->second.GetName()) {
&& ((t->second.GetType() == cmTarget::EXECUTABLE) continue;
|| (t->second.GetType() == cmTarget::STATIC_LIBRARY) }
|| (t->second.GetType() == cmTarget::SHARED_LIBRARY) if (t->second->GetName()
|| (t->second.GetType() == cmTarget::MODULE_LIBRARY) && strlen(t->second->GetName())
|| (t->second.GetType() == cmTarget::OBJECT_LIBRARY) && ((t->second->GetType() == cmTarget::EXECUTABLE)
|| (t->second.GetType() == cmTarget::INTERFACE_LIBRARY) || (t->second->GetType() == cmTarget::STATIC_LIBRARY)
|| (t->second.GetType() == cmTarget::UTILITY))) || (t->second->GetType() == cmTarget::SHARED_LIBRARY)
|| (t->second->GetType() == cmTarget::MODULE_LIBRARY)
|| (t->second->GetType() == cmTarget::OBJECT_LIBRARY)
|| (t->second->GetType() == cmTarget::INTERFACE_LIBRARY)
|| (t->second->GetType() == cmTarget::UTILITY)))
{ {
std::string makefileName; std::string makefileName;
// Add a rule to build the target by name. // Add a rule to build the target by name.
localName = lg->GetRelativeTargetDirectory(t->second); localName = lg->GetRelativeTargetDirectory(*t->second->Target);
makefileName = localName; makefileName = localName;
makefileName += "/build.make"; makefileName += "/build.make";
bool needRequiresStep = this->NeedRequiresStep(t->second); bool needRequiresStep = this->NeedRequiresStep(*t->second->Target);
lg->WriteDivider(ruleFileStream); lg->WriteDivider(ruleFileStream);
ruleFileStream ruleFileStream
@ -757,7 +775,7 @@ cmGlobalUnixMakefileGenerator3
commands.clear(); commands.clear();
if(t->second.GetType() != cmTarget::INTERFACE_LIBRARY) if(t->second->GetType() != cmTarget::INTERFACE_LIBRARY)
{ {
makeTargetName = localName; makeTargetName = localName;
makeTargetName += "/depend"; makeTargetName += "/depend";
@ -793,7 +811,7 @@ cmGlobalUnixMakefileGenerator3
cmLocalGenerator::SHELL); cmLocalGenerator::SHELL);
progCmd << " "; progCmd << " ";
std::vector<unsigned long>& progFiles = std::vector<unsigned long>& progFiles =
this->ProgressMap[&t->second].Marks; this->ProgressMap[t->second->Target].Marks;
for (std::vector<unsigned long>::iterator i = progFiles.begin(); for (std::vector<unsigned long>::iterator i = progFiles.begin();
i != progFiles.end(); ++i) i != progFiles.end(); ++i)
{ {
@ -802,14 +820,14 @@ cmGlobalUnixMakefileGenerator3
commands.push_back(progCmd.str()); commands.push_back(progCmd.str());
} }
progressDir = "Built target "; progressDir = "Built target ";
progressDir += t->first; progressDir += t->second->GetName();
lg->AppendEcho(commands,progressDir.c_str()); lg->AppendEcho(commands,progressDir.c_str());
} }
else else
{ {
depends.clear(); depends.clear();
} }
this->AppendGlobalTargetDepends(depends,t->second); this->AppendGlobalTargetDepends(depends,*t->second->Target);
if(depends.empty() && this->EmptyRuleHackDepends != "") if(depends.empty() && this->EmptyRuleHackDepends != "")
{ {
depends.push_back(this->EmptyRuleHackDepends); depends.push_back(this->EmptyRuleHackDepends);
@ -818,7 +836,7 @@ cmGlobalUnixMakefileGenerator3
localName.c_str(), depends, commands, true); localName.c_str(), depends, commands, true);
// add the all/all dependency // add the all/all dependency
if(!this->IsExcluded(this->LocalGenerators[0], t->second)) if(!this->IsExcluded(this->LocalGenerators[0], *t->second->Target))
{ {
depends.clear(); depends.clear();
depends.push_back(localName); depends.push_back(localName);
@ -843,7 +861,7 @@ cmGlobalUnixMakefileGenerator3
// //
std::set<cmTarget *> emitted; std::set<cmTarget *> emitted;
progCmd << " " progCmd << " "
<< this->CountProgressMarksInTarget(&t->second, emitted); << this->CountProgressMarksInTarget(t->second->Target, emitted);
commands.push_back(progCmd.str()); commands.push_back(progCmd.str());
} }
std::string tmp = cmake::GetCMakeFilesDirectoryPostSlash(); std::string tmp = cmake::GetCMakeFilesDirectoryPostSlash();
@ -861,7 +879,7 @@ cmGlobalUnixMakefileGenerator3
} }
depends.clear(); depends.clear();
depends.push_back("cmake_check_build_system"); depends.push_back("cmake_check_build_system");
localName = lg->GetRelativeTargetDirectory(t->second); localName = lg->GetRelativeTargetDirectory(*t->second->Target);
localName += "/rule"; localName += "/rule";
lg->WriteMakeRule(ruleFileStream, lg->WriteMakeRule(ruleFileStream,
"Build rule for subdir invocation for target.", "Build rule for subdir invocation for target.",
@ -872,12 +890,13 @@ cmGlobalUnixMakefileGenerator3
depends.clear(); depends.clear();
depends.push_back(localName); depends.push_back(localName);
lg->WriteMakeRule(ruleFileStream, "Convenience name for target.", lg->WriteMakeRule(ruleFileStream, "Convenience name for target.",
t->second.GetName(), depends, commands, true); t->second->GetName(), depends, commands, true);
// Add rules to prepare the target for installation. // Add rules to prepare the target for installation.
if(t->second.NeedRelinkBeforeInstall(lg->ConfigurationName.c_str())) if(t->second->Target
->NeedRelinkBeforeInstall(lg->ConfigurationName.c_str()))
{ {
localName = lg->GetRelativeTargetDirectory(t->second); localName = lg->GetRelativeTargetDirectory(*t->second->Target);
localName += "/preinstall"; localName += "/preinstall";
depends.clear(); depends.clear();
commands.clear(); commands.clear();
@ -887,7 +906,7 @@ cmGlobalUnixMakefileGenerator3
"Pre-install relink rule for target.", "Pre-install relink rule for target.",
localName.c_str(), depends, commands, true); localName.c_str(), depends, commands, true);
if(!this->IsExcluded(this->LocalGenerators[0], t->second)) if(!this->IsExcluded(this->LocalGenerators[0], *t->second->Target))
{ {
depends.clear(); depends.clear();
depends.push_back(localName); depends.push_back(localName);
@ -898,7 +917,7 @@ cmGlobalUnixMakefileGenerator3
} }
// add the clean rule // add the clean rule
localName = lg->GetRelativeTargetDirectory(t->second); localName = lg->GetRelativeTargetDirectory(*t->second->Target);
makeTargetName = localName; makeTargetName = localName;
makeTargetName += "/clean"; makeTargetName += "/clean";
depends.clear(); depends.clear();

View File

@ -64,18 +64,23 @@ void cmLocalNinjaGenerator::Generate()
} }
} }
cmTargets& targets = this->GetMakefile()->GetTargets(); cmGeneratorTargetsType targets = this->GetMakefile()->GetGeneratorTargets();
for(cmTargets::iterator t = targets.begin(); t != targets.end(); ++t) for(cmGeneratorTargetsType::iterator t = targets.begin();
t != targets.end(); ++t)
{ {
cmNinjaTargetGenerator* tg = cmNinjaTargetGenerator::New(&t->second); if (t->second->Target->IsImported())
{
continue;
}
cmNinjaTargetGenerator* tg = cmNinjaTargetGenerator::New(t->second);
if(tg) if(tg)
{ {
tg->Generate(); tg->Generate();
// Add the target to "all" if required. // Add the target to "all" if required.
if (!this->GetGlobalNinjaGenerator()->IsExcluded( if (!this->GetGlobalNinjaGenerator()->IsExcluded(
this->GetGlobalNinjaGenerator()->GetLocalGenerators()[0], this->GetGlobalNinjaGenerator()->GetLocalGenerators()[0],
t->second)) *t->second->Target))
this->GetGlobalNinjaGenerator()->AddDependencyToAll(&t->second); this->GetGlobalNinjaGenerator()->AddDependencyToAll(t->second->Target);
delete tg; delete tg;
} }
} }

View File

@ -145,13 +145,18 @@ void cmLocalUnixMakefileGenerator3::Generate()
this->Makefile->IsOn("CMAKE_SKIP_ASSEMBLY_SOURCE_RULES"); this->Makefile->IsOn("CMAKE_SKIP_ASSEMBLY_SOURCE_RULES");
// Generate the rule files for each target. // Generate the rule files for each target.
cmTargets& targets = this->Makefile->GetTargets(); cmGeneratorTargetsType targets = this->Makefile->GetGeneratorTargets();
cmGlobalUnixMakefileGenerator3* gg = cmGlobalUnixMakefileGenerator3* gg =
static_cast<cmGlobalUnixMakefileGenerator3*>(this->GlobalGenerator); static_cast<cmGlobalUnixMakefileGenerator3*>(this->GlobalGenerator);
for(cmTargets::iterator t = targets.begin(); t != targets.end(); ++t) for(cmGeneratorTargetsType::iterator t = targets.begin();
t != targets.end(); ++t)
{ {
if (t->second->Target->IsImported())
{
continue;
}
cmsys::auto_ptr<cmMakefileTargetGenerator> tg( cmsys::auto_ptr<cmMakefileTargetGenerator> tg(
cmMakefileTargetGenerator::New(&(t->second))); cmMakefileTargetGenerator::New(t->second));
if (tg.get()) if (tg.get())
{ {
tg->WriteRuleFiles(); tg->WriteRuleFiles();
@ -372,22 +377,23 @@ void cmLocalUnixMakefileGenerator3
// for each target we just provide a rule to cd up to the top and do a make // for each target we just provide a rule to cd up to the top and do a make
// on the target // on the target
cmTargets& targets = this->Makefile->GetTargets(); cmGeneratorTargetsType targets = this->Makefile->GetGeneratorTargets();
std::string localName; std::string localName;
for(cmTargets::iterator t = targets.begin(); t != targets.end(); ++t) for(cmGeneratorTargetsType::iterator t = targets.begin();
t != targets.end(); ++t)
{ {
if((t->second.GetType() == cmTarget::EXECUTABLE) || if((t->second->GetType() == cmTarget::EXECUTABLE) ||
(t->second.GetType() == cmTarget::STATIC_LIBRARY) || (t->second->GetType() == cmTarget::STATIC_LIBRARY) ||
(t->second.GetType() == cmTarget::SHARED_LIBRARY) || (t->second->GetType() == cmTarget::SHARED_LIBRARY) ||
(t->second.GetType() == cmTarget::MODULE_LIBRARY) || (t->second->GetType() == cmTarget::MODULE_LIBRARY) ||
(t->second.GetType() == cmTarget::OBJECT_LIBRARY) || (t->second->GetType() == cmTarget::OBJECT_LIBRARY) ||
(t->second.GetType() == cmTarget::INTERFACE_LIBRARY) || (t->second->GetType() == cmTarget::INTERFACE_LIBRARY) ||
(t->second.GetType() == cmTarget::UTILITY)) (t->second->GetType() == cmTarget::UTILITY))
{ {
emitted.insert(t->second.GetName()); emitted.insert(t->second->GetName());
// for subdirs add a rule to build this specific target by name. // for subdirs add a rule to build this specific target by name.
localName = this->GetRelativeTargetDirectory(t->second); localName = this->GetRelativeTargetDirectory(*t->second->Target);
localName += "/rule"; localName += "/rule";
commands.clear(); commands.clear();
depends.clear(); depends.clear();
@ -404,22 +410,23 @@ void cmLocalUnixMakefileGenerator3
localName.c_str(), depends, commands, true); localName.c_str(), depends, commands, true);
// Add a target with the canonical name (no prefix, suffix or path). // Add a target with the canonical name (no prefix, suffix or path).
if(localName != t->second.GetName()) if(localName != t->second->GetName())
{ {
commands.clear(); commands.clear();
depends.push_back(localName); depends.push_back(localName);
this->WriteMakeRule(ruleFileStream, "Convenience name for target.", this->WriteMakeRule(ruleFileStream, "Convenience name for target.",
t->second.GetName(), depends, commands, true); t->second->GetName(), depends, commands, true);
} }
// Add a fast rule to build the target // Add a fast rule to build the target
std::string makefileName = this->GetRelativeTargetDirectory(t->second); std::string makefileName =
this->GetRelativeTargetDirectory(*t->second->Target);
makefileName += "/build.make"; makefileName += "/build.make";
// make sure the makefile name is suitable for a makefile // make sure the makefile name is suitable for a makefile
std::string makeTargetName = std::string makeTargetName =
this->GetRelativeTargetDirectory(t->second); this->GetRelativeTargetDirectory(*t->second->Target);
makeTargetName += "/build"; makeTargetName += "/build";
localName = t->second.GetName(); localName = t->second->GetName();
localName += "/fast"; localName += "/fast";
depends.clear(); depends.clear();
commands.clear(); commands.clear();
@ -433,11 +440,12 @@ void cmLocalUnixMakefileGenerator3
// Add a local name for the rule to relink the target before // Add a local name for the rule to relink the target before
// installation. // installation.
if(t->second.NeedRelinkBeforeInstall(this->ConfigurationName.c_str())) if(t->second->Target
->NeedRelinkBeforeInstall(this->ConfigurationName.c_str()))
{ {
makeTargetName = this->GetRelativeTargetDirectory(t->second); makeTargetName = this->GetRelativeTargetDirectory(*t->second->Target);
makeTargetName += "/preinstall"; makeTargetName += "/preinstall";
localName = t->second.GetName(); localName = t->second->GetName();
localName += "/preinstall"; localName += "/preinstall";
depends.clear(); depends.clear();
commands.clear(); commands.clear();

View File

@ -21,15 +21,15 @@
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
cmMakefileExecutableTargetGenerator cmMakefileExecutableTargetGenerator
::cmMakefileExecutableTargetGenerator(cmTarget* target): ::cmMakefileExecutableTargetGenerator(cmGeneratorTarget* target):
cmMakefileTargetGenerator(target) cmMakefileTargetGenerator(target->Target)
{ {
this->CustomCommandDriver = OnDepends; this->CustomCommandDriver = OnDepends;
this->Target->GetExecutableNames( this->Target->GetExecutableNames(
this->TargetNameOut, this->TargetNameReal, this->TargetNameImport, this->TargetNameOut, this->TargetNameReal, this->TargetNameImport,
this->TargetNamePDB, this->ConfigName); this->TargetNamePDB, this->ConfigName);
this->OSXBundleGenerator = new cmOSXBundleGenerator(this->Target, this->OSXBundleGenerator = new cmOSXBundleGenerator(target,
this->ConfigName); this->ConfigName);
this->OSXBundleGenerator->SetMacContentFolders(&this->MacContentFolders); this->OSXBundleGenerator->SetMacContentFolders(&this->MacContentFolders);
} }

View File

@ -17,7 +17,7 @@
class cmMakefileExecutableTargetGenerator: public cmMakefileTargetGenerator class cmMakefileExecutableTargetGenerator: public cmMakefileTargetGenerator
{ {
public: public:
cmMakefileExecutableTargetGenerator(cmTarget* target); cmMakefileExecutableTargetGenerator(cmGeneratorTarget* target);
virtual ~cmMakefileExecutableTargetGenerator(); virtual ~cmMakefileExecutableTargetGenerator();
/* the main entry point for this class. Writes the Makefiles associated /* the main entry point for this class. Writes the Makefiles associated

View File

@ -21,15 +21,15 @@
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
cmMakefileLibraryTargetGenerator cmMakefileLibraryTargetGenerator
::cmMakefileLibraryTargetGenerator(cmTarget* target): ::cmMakefileLibraryTargetGenerator(cmGeneratorTarget* target):
cmMakefileTargetGenerator(target) cmMakefileTargetGenerator(target->Target)
{ {
this->CustomCommandDriver = OnDepends; this->CustomCommandDriver = OnDepends;
this->Target->GetLibraryNames( this->Target->GetLibraryNames(
this->TargetNameOut, this->TargetNameSO, this->TargetNameReal, this->TargetNameOut, this->TargetNameSO, this->TargetNameReal,
this->TargetNameImport, this->TargetNamePDB, this->ConfigName); this->TargetNameImport, this->TargetNamePDB, this->ConfigName);
this->OSXBundleGenerator = new cmOSXBundleGenerator(this->Target, this->OSXBundleGenerator = new cmOSXBundleGenerator(target,
this->ConfigName); this->ConfigName);
this->OSXBundleGenerator->SetMacContentFolders(&this->MacContentFolders); this->OSXBundleGenerator->SetMacContentFolders(&this->MacContentFolders);
} }

View File

@ -18,7 +18,7 @@ class cmMakefileLibraryTargetGenerator:
public cmMakefileTargetGenerator public cmMakefileTargetGenerator
{ {
public: public:
cmMakefileLibraryTargetGenerator(cmTarget* target); cmMakefileLibraryTargetGenerator(cmGeneratorTarget* target);
virtual ~cmMakefileLibraryTargetGenerator(); virtual ~cmMakefileLibraryTargetGenerator();
/* the main entry point for this class. Writes the Makefiles associated /* the main entry point for this class. Writes the Makefiles associated

View File

@ -63,7 +63,7 @@ cmMakefileTargetGenerator::~cmMakefileTargetGenerator()
} }
cmMakefileTargetGenerator * cmMakefileTargetGenerator *
cmMakefileTargetGenerator::New(cmTarget *tgt) cmMakefileTargetGenerator::New(cmGeneratorTarget *tgt)
{ {
cmMakefileTargetGenerator *result = 0; cmMakefileTargetGenerator *result = 0;

View File

@ -38,7 +38,7 @@ public:
virtual ~cmMakefileTargetGenerator(); virtual ~cmMakefileTargetGenerator();
// construct using this factory call // construct using this factory call
static cmMakefileTargetGenerator *New(cmTarget *tgt); static cmMakefileTargetGenerator *New(cmGeneratorTarget *tgt);
/* the main entry point for this class. Writes the Makefiles associated /* the main entry point for this class. Writes the Makefiles associated
with this target */ with this target */

View File

@ -20,11 +20,11 @@
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
cmMakefileUtilityTargetGenerator cmMakefileUtilityTargetGenerator
::cmMakefileUtilityTargetGenerator(cmTarget* target): ::cmMakefileUtilityTargetGenerator(cmGeneratorTarget* target):
cmMakefileTargetGenerator(target) cmMakefileTargetGenerator(target->Target)
{ {
this->CustomCommandDriver = OnUtility; this->CustomCommandDriver = OnUtility;
this->OSXBundleGenerator = new cmOSXBundleGenerator(this->Target, this->OSXBundleGenerator = new cmOSXBundleGenerator(target,
this->ConfigName); this->ConfigName);
this->OSXBundleGenerator->SetMacContentFolders(&this->MacContentFolders); this->OSXBundleGenerator->SetMacContentFolders(&this->MacContentFolders);
} }

View File

@ -18,7 +18,7 @@ class cmMakefileUtilityTargetGenerator:
public cmMakefileTargetGenerator public cmMakefileTargetGenerator
{ {
public: public:
cmMakefileUtilityTargetGenerator(cmTarget* target); cmMakefileUtilityTargetGenerator(cmGeneratorTarget* target);
virtual ~cmMakefileUtilityTargetGenerator(); virtual ~cmMakefileUtilityTargetGenerator();
/* the main entry point for this class. Writes the Makefiles associated /* the main entry point for this class. Writes the Makefiles associated

View File

@ -17,6 +17,7 @@
#include "cmGeneratedFileStream.h" #include "cmGeneratedFileStream.h"
#include "cmMakefile.h" #include "cmMakefile.h"
#include "cmOSXBundleGenerator.h" #include "cmOSXBundleGenerator.h"
#include "cmGeneratorTarget.h"
#include <assert.h> #include <assert.h>
#include <algorithm> #include <algorithm>
@ -27,8 +28,8 @@
cmNinjaNormalTargetGenerator:: cmNinjaNormalTargetGenerator::
cmNinjaNormalTargetGenerator(cmTarget* target) cmNinjaNormalTargetGenerator(cmGeneratorTarget* target)
: cmNinjaTargetGenerator(target) : cmNinjaTargetGenerator(target->Target)
, TargetNameOut() , TargetNameOut()
, TargetNameSO() , TargetNameSO()
, TargetNameReal() , TargetNameReal()
@ -36,15 +37,16 @@ cmNinjaNormalTargetGenerator(cmTarget* target)
, TargetNamePDB() , TargetNamePDB()
, TargetLinkLanguage(0) , TargetLinkLanguage(0)
{ {
this->TargetLinkLanguage = target->GetLinkerLanguage(this->GetConfigName()); this->TargetLinkLanguage = target->Target
->GetLinkerLanguage(this->GetConfigName());
if (target->GetType() == cmTarget::EXECUTABLE) if (target->GetType() == cmTarget::EXECUTABLE)
target->GetExecutableNames(this->TargetNameOut, target->Target->GetExecutableNames(this->TargetNameOut,
this->TargetNameReal, this->TargetNameReal,
this->TargetNameImport, this->TargetNameImport,
this->TargetNamePDB, this->TargetNamePDB,
GetLocalGenerator()->GetConfigName()); GetLocalGenerator()->GetConfigName());
else else
target->GetLibraryNames(this->TargetNameOut, target->Target->GetLibraryNames(this->TargetNameOut,
this->TargetNameSO, this->TargetNameSO,
this->TargetNameReal, this->TargetNameReal,
this->TargetNameImport, this->TargetNameImport,
@ -55,7 +57,7 @@ cmNinjaNormalTargetGenerator(cmTarget* target)
{ {
// on Windows the output dir is already needed at compile time // on Windows the output dir is already needed at compile time
// ensure the directory exists (OutDir test) // ensure the directory exists (OutDir test)
EnsureDirectoryExists(target->GetDirectory(this->GetConfigName())); EnsureDirectoryExists(target->Target->GetDirectory(this->GetConfigName()));
} }
this->OSXBundleGenerator = new cmOSXBundleGenerator(target, this->OSXBundleGenerator = new cmOSXBundleGenerator(target,

View File

@ -21,11 +21,12 @@
class cmSourceFile; class cmSourceFile;
class cmOSXBundleGenerator; class cmOSXBundleGenerator;
class cmGeneratorTarget;
class cmNinjaNormalTargetGenerator : public cmNinjaTargetGenerator class cmNinjaNormalTargetGenerator : public cmNinjaTargetGenerator
{ {
public: public:
cmNinjaNormalTargetGenerator(cmTarget* target); cmNinjaNormalTargetGenerator(cmGeneratorTarget* target);
~cmNinjaNormalTargetGenerator(); ~cmNinjaNormalTargetGenerator();
void Generate(); void Generate();

View File

@ -26,7 +26,7 @@
#include <algorithm> #include <algorithm>
cmNinjaTargetGenerator * cmNinjaTargetGenerator *
cmNinjaTargetGenerator::New(cmTarget* target) cmNinjaTargetGenerator::New(cmGeneratorTarget* target)
{ {
switch (target->GetType()) switch (target->GetType())
{ {
@ -44,7 +44,7 @@ cmNinjaTargetGenerator::New(cmTarget* target)
// We only want to process global targets that live in the home // We only want to process global targets that live in the home
// (i.e. top-level) directory. CMake creates copies of these targets // (i.e. top-level) directory. CMake creates copies of these targets
// in every directory, which we don't need. // in every directory, which we don't need.
cmMakefile *mf = target->GetMakefile(); cmMakefile *mf = target->Target->GetMakefile();
if (strcmp(mf->GetStartDirectory(), mf->GetHomeDirectory()) == 0) if (strcmp(mf->GetStartDirectory(), mf->GetHomeDirectory()) == 0)
return new cmNinjaUtilityTargetGenerator(target); return new cmNinjaUtilityTargetGenerator(target);
// else fallthrough // else fallthrough

View File

@ -30,7 +30,7 @@ class cmNinjaTargetGenerator
{ {
public: public:
/// Create a cmNinjaTargetGenerator according to the @a target's type. /// Create a cmNinjaTargetGenerator according to the @a target's type.
static cmNinjaTargetGenerator* New(cmTarget* target); static cmNinjaTargetGenerator* New(cmGeneratorTarget* target);
/// Build a NinjaTargetGenerator. /// Build a NinjaTargetGenerator.
cmNinjaTargetGenerator(cmTarget* target); cmNinjaTargetGenerator(cmTarget* target);

View File

@ -18,8 +18,9 @@
#include "cmSourceFile.h" #include "cmSourceFile.h"
#include "cmTarget.h" #include "cmTarget.h"
cmNinjaUtilityTargetGenerator::cmNinjaUtilityTargetGenerator(cmTarget *target) cmNinjaUtilityTargetGenerator::cmNinjaUtilityTargetGenerator(
: cmNinjaTargetGenerator(target) {} cmGeneratorTarget *target)
: cmNinjaTargetGenerator(target->Target) {}
cmNinjaUtilityTargetGenerator::~cmNinjaUtilityTargetGenerator() {} cmNinjaUtilityTargetGenerator::~cmNinjaUtilityTargetGenerator() {}

View File

@ -21,7 +21,7 @@ class cmSourceFile;
class cmNinjaUtilityTargetGenerator : public cmNinjaTargetGenerator class cmNinjaUtilityTargetGenerator : public cmNinjaTargetGenerator
{ {
public: public:
cmNinjaUtilityTargetGenerator(cmTarget* target); cmNinjaUtilityTargetGenerator(cmGeneratorTarget* target);
~cmNinjaUtilityTargetGenerator(); ~cmNinjaUtilityTargetGenerator();
void Generate(); void Generate();

View File

@ -18,10 +18,10 @@
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
cmOSXBundleGenerator:: cmOSXBundleGenerator::
cmOSXBundleGenerator(cmTarget* target, cmOSXBundleGenerator(cmGeneratorTarget* target,
const char* configName) const char* configName)
: Target(target) : Target(target->Target)
, Makefile(target->GetMakefile()) , Makefile(target->Target->GetMakefile())
, LocalGenerator(Makefile->GetLocalGenerator()) , LocalGenerator(Makefile->GetLocalGenerator())
, ConfigName(configName) , ConfigName(configName)
, MacContentFolders(0) , MacContentFolders(0)

View File

@ -21,11 +21,12 @@
class cmTarget; class cmTarget;
class cmMakefile; class cmMakefile;
class cmLocalGenerator; class cmLocalGenerator;
class cmGeneratorTarget;
class cmOSXBundleGenerator class cmOSXBundleGenerator
{ {
public: public:
cmOSXBundleGenerator(cmTarget* target, cmOSXBundleGenerator(cmGeneratorTarget* target,
const char* configName); const char* configName);
// create an app bundle at a given root, and return // create an app bundle at a given root, and return