Ninja: Port to cmGeneratorTarget.
This commit is contained in:
parent
4c41e74da5
commit
80de856bb5
|
@ -886,7 +886,7 @@ void cmGlobalNinjaGenerator::WriteDisclaimer(std::ostream& os)
|
||||||
<< cmVersion::GetMinorVersion() << "\n\n";
|
<< cmVersion::GetMinorVersion() << "\n\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
void cmGlobalNinjaGenerator::AddDependencyToAll(cmTarget* target)
|
void cmGlobalNinjaGenerator::AddDependencyToAll(cmGeneratorTarget* target)
|
||||||
{
|
{
|
||||||
this->AppendTargetOutputs(target, this->AllDependencies);
|
this->AppendTargetOutputs(target, this->AllDependencies);
|
||||||
}
|
}
|
||||||
|
@ -912,18 +912,16 @@ void cmGlobalNinjaGenerator::WriteAssumedSourceDependencies()
|
||||||
|
|
||||||
void
|
void
|
||||||
cmGlobalNinjaGenerator
|
cmGlobalNinjaGenerator
|
||||||
::AppendTargetOutputs(cmTarget const* target, cmNinjaDeps& outputs)
|
::AppendTargetOutputs(cmGeneratorTarget const* target, cmNinjaDeps& outputs)
|
||||||
{
|
{
|
||||||
std::string configName =
|
std::string configName =
|
||||||
target->GetMakefile()->GetSafeDefinition("CMAKE_BUILD_TYPE");
|
target->Target->GetMakefile()->GetSafeDefinition("CMAKE_BUILD_TYPE");
|
||||||
|
|
||||||
cmGeneratorTarget *gtgt = this->GetGeneratorTarget(target);
|
|
||||||
|
|
||||||
// for frameworks, we want the real name, not smple name
|
// for frameworks, we want the real name, not smple name
|
||||||
// frameworks always appear versioned, and the build.ninja
|
// frameworks always appear versioned, and the build.ninja
|
||||||
// will always attempt to manage symbolic links instead
|
// will always attempt to manage symbolic links instead
|
||||||
// of letting cmOSXBundleGenerator do it.
|
// of letting cmOSXBundleGenerator do it.
|
||||||
bool realname = gtgt->IsFrameworkOnApple();
|
bool realname = target->IsFrameworkOnApple();
|
||||||
|
|
||||||
switch (target->GetType()) {
|
switch (target->GetType()) {
|
||||||
case cmState::EXECUTABLE:
|
case cmState::EXECUTABLE:
|
||||||
|
@ -932,7 +930,7 @@ cmGlobalNinjaGenerator
|
||||||
case cmState::MODULE_LIBRARY:
|
case cmState::MODULE_LIBRARY:
|
||||||
{
|
{
|
||||||
outputs.push_back(this->ConvertToNinjaPath(
|
outputs.push_back(this->ConvertToNinjaPath(
|
||||||
gtgt->GetFullPath(configName, false, realname)));
|
target->GetFullPath(configName, false, realname)));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case cmState::OBJECT_LIBRARY:
|
case cmState::OBJECT_LIBRARY:
|
||||||
|
@ -962,16 +960,15 @@ cmGlobalNinjaGenerator
|
||||||
|
|
||||||
void
|
void
|
||||||
cmGlobalNinjaGenerator
|
cmGlobalNinjaGenerator
|
||||||
::AppendTargetDepends(cmTarget const* target, cmNinjaDeps& outputs)
|
::AppendTargetDepends(cmGeneratorTarget const* target, cmNinjaDeps& outputs)
|
||||||
{
|
{
|
||||||
if (target->GetType() == cmState::GLOBAL_TARGET) {
|
if (target->GetType() == cmState::GLOBAL_TARGET) {
|
||||||
// Global targets only depend on other utilities, which may not appear in
|
// Global targets only depend on other utilities, which may not appear in
|
||||||
// the TargetDepends set (e.g. "all").
|
// the TargetDepends set (e.g. "all").
|
||||||
std::set<std::string> const& utils = target->GetUtilities();
|
std::set<std::string> const& utils = target->Target->GetUtilities();
|
||||||
std::copy(utils.begin(), utils.end(), std::back_inserter(outputs));
|
std::copy(utils.begin(), utils.end(), std::back_inserter(outputs));
|
||||||
} else {
|
} else {
|
||||||
cmGeneratorTarget* gt = this->GetGeneratorTarget(target);
|
cmTargetDependSet const& targetDeps = this->GetTargetDirectDepends(target);
|
||||||
cmTargetDependSet const& targetDeps = this->GetTargetDirectDepends(gt);
|
|
||||||
for (cmTargetDependSet::const_iterator i = targetDeps.begin();
|
for (cmTargetDependSet::const_iterator i = targetDeps.begin();
|
||||||
i != targetDeps.end(); ++i)
|
i != targetDeps.end(); ++i)
|
||||||
{
|
{
|
||||||
|
@ -979,13 +976,13 @@ cmGlobalNinjaGenerator
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
this->AppendTargetOutputs((*i)->Target, outputs);
|
this->AppendTargetOutputs(*i, outputs);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void cmGlobalNinjaGenerator::AddTargetAlias(const std::string& alias,
|
void cmGlobalNinjaGenerator::AddTargetAlias(const std::string& alias,
|
||||||
cmTarget* target) {
|
cmGeneratorTarget* target) {
|
||||||
cmNinjaDeps outputs;
|
cmNinjaDeps outputs;
|
||||||
this->AppendTargetOutputs(target, outputs);
|
this->AppendTargetOutputs(target, outputs);
|
||||||
// Mark the target's outputs as ambiguous to ensure that no other target uses
|
// Mark the target's outputs as ambiguous to ensure that no other target uses
|
||||||
|
|
|
@ -285,9 +285,11 @@ public:
|
||||||
ASD.insert(deps.begin(), deps.end());
|
ASD.insert(deps.begin(), deps.end());
|
||||||
}
|
}
|
||||||
|
|
||||||
void AppendTargetOutputs(cmTarget const* target, cmNinjaDeps& outputs);
|
void AppendTargetOutputs(cmGeneratorTarget const* target,
|
||||||
void AppendTargetDepends(cmTarget const* target, cmNinjaDeps& outputs);
|
cmNinjaDeps& outputs);
|
||||||
void AddDependencyToAll(cmTarget* target);
|
void AppendTargetDepends(cmGeneratorTarget const* target,
|
||||||
|
cmNinjaDeps& outputs);
|
||||||
|
void AddDependencyToAll(cmGeneratorTarget* target);
|
||||||
void AddDependencyToAll(const std::string& input);
|
void AddDependencyToAll(const std::string& input);
|
||||||
|
|
||||||
const std::vector<cmLocalGenerator*>& GetLocalGenerators() const {
|
const std::vector<cmLocalGenerator*>& GetLocalGenerators() const {
|
||||||
|
@ -299,7 +301,7 @@ public:
|
||||||
int GetRuleCmdLength(const std::string& name) {
|
int GetRuleCmdLength(const std::string& name) {
|
||||||
return RuleCmdLength[name]; }
|
return RuleCmdLength[name]; }
|
||||||
|
|
||||||
void AddTargetAlias(const std::string& alias, cmTarget* target);
|
void AddTargetAlias(const std::string& alias, cmGeneratorTarget* target);
|
||||||
|
|
||||||
virtual void ComputeTargetObjectDirectory(cmGeneratorTarget* gt) const;
|
virtual void ComputeTargetObjectDirectory(cmGeneratorTarget* gt) const;
|
||||||
|
|
||||||
|
@ -388,7 +390,7 @@ private:
|
||||||
/// The mapping from source file to assumed dependencies.
|
/// The mapping from source file to assumed dependencies.
|
||||||
std::map<std::string, std::set<std::string> > AssumedSourceDependencies;
|
std::map<std::string, std::set<std::string> > AssumedSourceDependencies;
|
||||||
|
|
||||||
typedef std::map<std::string, cmTarget*> TargetAliasMap;
|
typedef std::map<std::string, cmGeneratorTarget*> TargetAliasMap;
|
||||||
TargetAliasMap TargetAliases;
|
TargetAliasMap TargetAliases;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -89,7 +89,7 @@ void cmLocalNinjaGenerator::Generate()
|
||||||
if (!this->GetGlobalNinjaGenerator()->IsExcluded(
|
if (!this->GetGlobalNinjaGenerator()->IsExcluded(
|
||||||
this->GetGlobalNinjaGenerator()->GetLocalGenerators()[0],
|
this->GetGlobalNinjaGenerator()->GetLocalGenerators()[0],
|
||||||
*t))
|
*t))
|
||||||
this->GetGlobalNinjaGenerator()->AddDependencyToAll((*t)->Target);
|
this->GetGlobalNinjaGenerator()->AddDependencyToAll(*t);
|
||||||
delete tg;
|
delete tg;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -285,14 +285,14 @@ void cmLocalNinjaGenerator::WriteProcessedMakefile(std::ostream& os)
|
||||||
|
|
||||||
void
|
void
|
||||||
cmLocalNinjaGenerator
|
cmLocalNinjaGenerator
|
||||||
::AppendTargetOutputs(cmTarget* target, cmNinjaDeps& outputs)
|
::AppendTargetOutputs(cmGeneratorTarget* target, cmNinjaDeps& outputs)
|
||||||
{
|
{
|
||||||
this->GetGlobalNinjaGenerator()->AppendTargetOutputs(target, outputs);
|
this->GetGlobalNinjaGenerator()->AppendTargetOutputs(target, outputs);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
cmLocalNinjaGenerator
|
cmLocalNinjaGenerator
|
||||||
::AppendTargetDepends(cmTarget* target, cmNinjaDeps& outputs)
|
::AppendTargetDepends(cmGeneratorTarget* target, cmNinjaDeps& outputs)
|
||||||
{
|
{
|
||||||
this->GetGlobalNinjaGenerator()->AppendTargetDepends(target, outputs);
|
this->GetGlobalNinjaGenerator()->AppendTargetDepends(target, outputs);
|
||||||
}
|
}
|
||||||
|
@ -441,7 +441,7 @@ cmLocalNinjaGenerator::WriteCustomCommandBuildStatement(
|
||||||
}
|
}
|
||||||
|
|
||||||
void cmLocalNinjaGenerator::AddCustomCommandTarget(cmCustomCommand const* cc,
|
void cmLocalNinjaGenerator::AddCustomCommandTarget(cmCustomCommand const* cc,
|
||||||
cmTarget* target)
|
cmGeneratorTarget* target)
|
||||||
{
|
{
|
||||||
this->CustomCommandTargets[cc].insert(target);
|
this->CustomCommandTargets[cc].insert(target);
|
||||||
}
|
}
|
||||||
|
@ -459,7 +459,7 @@ void cmLocalNinjaGenerator::WriteCustomCommandBuildStatements()
|
||||||
//
|
//
|
||||||
// FIXME: This won't work in certain obscure scenarios involving indirect
|
// FIXME: This won't work in certain obscure scenarios involving indirect
|
||||||
// dependencies.
|
// dependencies.
|
||||||
std::set<cmTarget*>::iterator j = i->second.begin();
|
std::set<cmGeneratorTarget*>::iterator j = i->second.begin();
|
||||||
assert(j != i->second.end());
|
assert(j != i->second.end());
|
||||||
std::vector<std::string> ccTargetDeps;
|
std::vector<std::string> ccTargetDeps;
|
||||||
this->AppendTargetDepends(*j, ccTargetDeps);
|
this->AppendTargetDepends(*j, ccTargetDeps);
|
||||||
|
|
|
@ -58,10 +58,11 @@ public:
|
||||||
|
|
||||||
std::string BuildCommandLine(const std::vector<std::string> &cmdLines);
|
std::string BuildCommandLine(const std::vector<std::string> &cmdLines);
|
||||||
|
|
||||||
void AppendTargetOutputs(cmTarget* target, cmNinjaDeps& outputs);
|
void AppendTargetOutputs(cmGeneratorTarget* target, cmNinjaDeps& outputs);
|
||||||
void AppendTargetDepends(cmTarget* target, cmNinjaDeps& outputs);
|
void AppendTargetDepends(cmGeneratorTarget* target, cmNinjaDeps& outputs);
|
||||||
|
|
||||||
void AddCustomCommandTarget(cmCustomCommand const* cc, cmTarget* target);
|
void AddCustomCommandTarget(cmCustomCommand const* cc,
|
||||||
|
cmGeneratorTarget* target);
|
||||||
void AppendCustomCommandLines(cmCustomCommandGenerator const& ccg,
|
void AppendCustomCommandLines(cmCustomCommandGenerator const& ccg,
|
||||||
std::vector<std::string> &cmdLines);
|
std::vector<std::string> &cmdLines);
|
||||||
void AppendCustomCommandDeps(cmCustomCommandGenerator const& ccg,
|
void AppendCustomCommandDeps(cmCustomCommandGenerator const& ccg,
|
||||||
|
@ -102,7 +103,7 @@ private:
|
||||||
|
|
||||||
std::string HomeRelativeOutputPath;
|
std::string HomeRelativeOutputPath;
|
||||||
|
|
||||||
typedef std::map<cmCustomCommand const*, std::set<cmTarget*> >
|
typedef std::map<cmCustomCommand const*, std::set<cmGeneratorTarget*> >
|
||||||
CustomCommandTargetMap;
|
CustomCommandTargetMap;
|
||||||
CustomCommandTargetMap CustomCommandTargets;
|
CustomCommandTargetMap CustomCommandTargets;
|
||||||
};
|
};
|
||||||
|
|
|
@ -399,7 +399,6 @@ static int calculateCommandLineLengthLimit(int linkRuleLength)
|
||||||
|
|
||||||
void cmNinjaNormalTargetGenerator::WriteLinkStatement()
|
void cmNinjaNormalTargetGenerator::WriteLinkStatement()
|
||||||
{
|
{
|
||||||
cmTarget& target = *this->GetTarget();
|
|
||||||
cmGeneratorTarget& gt = *this->GetGeneratorTarget();
|
cmGeneratorTarget& gt = *this->GetGeneratorTarget();
|
||||||
const std::string cfgName = this->GetConfigName();
|
const std::string cfgName = this->GetConfigName();
|
||||||
std::string targetOutput = ConvertToNinjaPath(
|
std::string targetOutput = ConvertToNinjaPath(
|
||||||
|
@ -443,7 +442,7 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement()
|
||||||
|
|
||||||
// Write comments.
|
// Write comments.
|
||||||
cmGlobalNinjaGenerator::WriteDivider(this->GetBuildFileStream());
|
cmGlobalNinjaGenerator::WriteDivider(this->GetBuildFileStream());
|
||||||
const cmState::TargetType targetType = target.GetType();
|
const cmState::TargetType targetType = gt.GetType();
|
||||||
this->GetBuildFileStream()
|
this->GetBuildFileStream()
|
||||||
<< "# Link build statements for "
|
<< "# Link build statements for "
|
||||||
<< cmState::GetTargetTypeName(targetType)
|
<< cmState::GetTargetTypeName(targetType)
|
||||||
|
@ -490,13 +489,13 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement()
|
||||||
&genTarget,
|
&genTarget,
|
||||||
useWatcomQuote);
|
useWatcomQuote);
|
||||||
if(this->GetMakefile()->IsOn("CMAKE_SUPPORT_WINDOWS_EXPORT_ALL_SYMBOLS")
|
if(this->GetMakefile()->IsOn("CMAKE_SUPPORT_WINDOWS_EXPORT_ALL_SYMBOLS")
|
||||||
&& target.GetType() == cmState::SHARED_LIBRARY)
|
&& gt.GetType() == cmState::SHARED_LIBRARY)
|
||||||
{
|
{
|
||||||
if(target.GetPropertyAsBool("WINDOWS_EXPORT_ALL_SYMBOLS"))
|
if(gt.GetPropertyAsBool("WINDOWS_EXPORT_ALL_SYMBOLS"))
|
||||||
{
|
{
|
||||||
std::string name_of_def_file
|
std::string name_of_def_file
|
||||||
= gt.GetSupportDirectory();
|
= gt.GetSupportDirectory();
|
||||||
name_of_def_file += "/" + target.GetName();
|
name_of_def_file += "/" + gt.GetName();
|
||||||
name_of_def_file += ".def ";
|
name_of_def_file += ".def ";
|
||||||
vars["LINK_FLAGS"] += " /DEF:";
|
vars["LINK_FLAGS"] += " /DEF:";
|
||||||
vars["LINK_FLAGS"] += this->GetLocalGenerator()
|
vars["LINK_FLAGS"] += this->GetLocalGenerator()
|
||||||
|
@ -505,7 +504,7 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
this->addPoolNinjaVariable("JOB_POOL_LINK", &target, vars);
|
this->addPoolNinjaVariable("JOB_POOL_LINK", >, vars);
|
||||||
|
|
||||||
this->AddModuleDefinitionFlag(vars["LINK_FLAGS"]);
|
this->AddModuleDefinitionFlag(vars["LINK_FLAGS"]);
|
||||||
vars["LINK_FLAGS"] = cmGlobalNinjaGenerator
|
vars["LINK_FLAGS"] = cmGlobalNinjaGenerator
|
||||||
|
@ -599,9 +598,9 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement()
|
||||||
}
|
}
|
||||||
|
|
||||||
const std::vector<cmCustomCommand> *cmdLists[3] = {
|
const std::vector<cmCustomCommand> *cmdLists[3] = {
|
||||||
&target.GetPreBuildCommands(),
|
>.Target->GetPreBuildCommands(),
|
||||||
&target.GetPreLinkCommands(),
|
>.Target->GetPreLinkCommands(),
|
||||||
&target.GetPostBuildCommands()
|
>.Target->GetPostBuildCommands()
|
||||||
};
|
};
|
||||||
|
|
||||||
std::vector<std::string> preLinkCmdLines, postBuildCmdLines;
|
std::vector<std::string> preLinkCmdLines, postBuildCmdLines;
|
||||||
|
@ -626,17 +625,17 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement()
|
||||||
}
|
}
|
||||||
|
|
||||||
// maybe create .def file from list of objects
|
// maybe create .def file from list of objects
|
||||||
if (target.GetType() == cmState::SHARED_LIBRARY &&
|
if (gt.GetType() == cmState::SHARED_LIBRARY &&
|
||||||
this->GetMakefile()->IsOn("CMAKE_SUPPORT_WINDOWS_EXPORT_ALL_SYMBOLS"))
|
this->GetMakefile()->IsOn("CMAKE_SUPPORT_WINDOWS_EXPORT_ALL_SYMBOLS"))
|
||||||
{
|
{
|
||||||
if(target.GetPropertyAsBool("WINDOWS_EXPORT_ALL_SYMBOLS"))
|
if(gt.GetPropertyAsBool("WINDOWS_EXPORT_ALL_SYMBOLS"))
|
||||||
{
|
{
|
||||||
std::string cmakeCommand =
|
std::string cmakeCommand =
|
||||||
this->GetLocalGenerator()->ConvertToOutputFormat(
|
this->GetLocalGenerator()->ConvertToOutputFormat(
|
||||||
cmSystemTools::GetCMakeCommand(), cmLocalGenerator::SHELL);
|
cmSystemTools::GetCMakeCommand(), cmLocalGenerator::SHELL);
|
||||||
std::string name_of_def_file
|
std::string name_of_def_file
|
||||||
= gt.GetSupportDirectory();
|
= gt.GetSupportDirectory();
|
||||||
name_of_def_file += "/" + target.GetName();
|
name_of_def_file += "/" + gt.GetName();
|
||||||
name_of_def_file += ".def";
|
name_of_def_file += ".def";
|
||||||
std::string cmd = cmakeCommand;
|
std::string cmd = cmakeCommand;
|
||||||
cmd += " -E __create_def ";
|
cmd += " -E __create_def ";
|
||||||
|
@ -699,11 +698,11 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement()
|
||||||
|
|
||||||
const std::string rspfile =
|
const std::string rspfile =
|
||||||
std::string(cmake::GetCMakeFilesDirectoryPostSlash())
|
std::string(cmake::GetCMakeFilesDirectoryPostSlash())
|
||||||
+ target.GetName() + ".rsp";
|
+ gt.GetName() + ".rsp";
|
||||||
|
|
||||||
// Gather order-only dependencies.
|
// Gather order-only dependencies.
|
||||||
cmNinjaDeps orderOnlyDeps;
|
cmNinjaDeps orderOnlyDeps;
|
||||||
this->GetLocalGenerator()->AppendTargetDepends(this->GetTarget(),
|
this->GetLocalGenerator()->AppendTargetDepends(this->GetGeneratorTarget(),
|
||||||
orderOnlyDeps);
|
orderOnlyDeps);
|
||||||
|
|
||||||
// Ninja should restat after linking if and only if there are byproducts.
|
// Ninja should restat after linking if and only if there are byproducts.
|
||||||
|
@ -772,8 +771,8 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add aliases for the file name and the target name.
|
// Add aliases for the file name and the target name.
|
||||||
globalGen.AddTargetAlias(this->TargetNameOut, &target);
|
globalGen.AddTargetAlias(this->TargetNameOut, >);
|
||||||
globalGen.AddTargetAlias(this->GetTargetName(), &target);
|
globalGen.AddTargetAlias(this->GetTargetName(), >);
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
|
@ -781,7 +780,8 @@ void cmNinjaNormalTargetGenerator::WriteObjectLibStatement()
|
||||||
{
|
{
|
||||||
// Write a phony output that depends on all object files.
|
// Write a phony output that depends on all object files.
|
||||||
cmNinjaDeps outputs;
|
cmNinjaDeps outputs;
|
||||||
this->GetLocalGenerator()->AppendTargetOutputs(this->GetTarget(), outputs);
|
this->GetLocalGenerator()->AppendTargetOutputs(this->GetGeneratorTarget(),
|
||||||
|
outputs);
|
||||||
cmNinjaDeps depends = this->GetObjects();
|
cmNinjaDeps depends = this->GetObjects();
|
||||||
this->GetGlobalGenerator()->WritePhonyBuild(this->GetBuildFileStream(),
|
this->GetGlobalGenerator()->WritePhonyBuild(this->GetBuildFileStream(),
|
||||||
"Object library "
|
"Object library "
|
||||||
|
@ -791,5 +791,5 @@ void cmNinjaNormalTargetGenerator::WriteObjectLibStatement()
|
||||||
|
|
||||||
// Add aliases for the target name.
|
// Add aliases for the target name.
|
||||||
this->GetGlobalGenerator()->AddTargetAlias(this->GetTargetName(),
|
this->GetGlobalGenerator()->AddTargetAlias(this->GetTargetName(),
|
||||||
this->GetTarget());
|
this->GetGeneratorTarget());
|
||||||
}
|
}
|
||||||
|
|
|
@ -486,7 +486,8 @@ cmNinjaTargetGenerator
|
||||||
si != customCommands.end(); ++si)
|
si != customCommands.end(); ++si)
|
||||||
{
|
{
|
||||||
cmCustomCommand const* cc = (*si)->GetCustomCommand();
|
cmCustomCommand const* cc = (*si)->GetCustomCommand();
|
||||||
this->GetLocalGenerator()->AddCustomCommandTarget(cc, this->GetTarget());
|
this->GetLocalGenerator()->AddCustomCommandTarget(cc,
|
||||||
|
this->GetGeneratorTarget());
|
||||||
// Record the custom commands for this target. The container is used
|
// Record the custom commands for this target. The container is used
|
||||||
// in WriteObjectBuildStatement when called in a loop below.
|
// in WriteObjectBuildStatement when called in a loop below.
|
||||||
this->CustomCommands.push_back(cc);
|
this->CustomCommands.push_back(cc);
|
||||||
|
@ -511,7 +512,8 @@ cmNinjaTargetGenerator
|
||||||
}
|
}
|
||||||
|
|
||||||
cmNinjaDeps orderOnlyDeps;
|
cmNinjaDeps orderOnlyDeps;
|
||||||
this->GetLocalGenerator()->AppendTargetDepends(this->Target, orderOnlyDeps);
|
this->GetLocalGenerator()->AppendTargetDepends(this->GeneratorTarget,
|
||||||
|
orderOnlyDeps);
|
||||||
|
|
||||||
// Add order-only dependencies on custom command outputs.
|
// Add order-only dependencies on custom command outputs.
|
||||||
for(std::vector<cmCustomCommand const*>::const_iterator
|
for(std::vector<cmCustomCommand const*>::const_iterator
|
||||||
|
@ -633,7 +635,8 @@ cmNinjaTargetGenerator
|
||||||
ConvertToNinjaPath(objectFileDir),
|
ConvertToNinjaPath(objectFileDir),
|
||||||
cmLocalGenerator::SHELL);
|
cmLocalGenerator::SHELL);
|
||||||
|
|
||||||
this->addPoolNinjaVariable("JOB_POOL_COMPILE", this->GetTarget(), vars);
|
this->addPoolNinjaVariable("JOB_POOL_COMPILE",
|
||||||
|
this->GetGeneratorTarget(), vars);
|
||||||
|
|
||||||
this->SetMsvcTargetPdbVariable(vars);
|
this->SetMsvcTargetPdbVariable(vars);
|
||||||
|
|
||||||
|
@ -782,7 +785,7 @@ cmNinjaTargetGenerator::MacOSXContentGeneratorType::operator()(
|
||||||
|
|
||||||
void cmNinjaTargetGenerator::addPoolNinjaVariable(
|
void cmNinjaTargetGenerator::addPoolNinjaVariable(
|
||||||
const std::string& pool_property,
|
const std::string& pool_property,
|
||||||
cmTarget* target,
|
cmGeneratorTarget* target,
|
||||||
cmNinjaVars& vars)
|
cmNinjaVars& vars)
|
||||||
{
|
{
|
||||||
const char* pool = target->GetProperty(pool_property);
|
const char* pool = target->GetProperty(pool_property);
|
||||||
|
|
|
@ -53,9 +53,6 @@ protected:
|
||||||
cmGeneratedFileStream& GetBuildFileStream() const;
|
cmGeneratedFileStream& GetBuildFileStream() const;
|
||||||
cmGeneratedFileStream& GetRulesFileStream() const;
|
cmGeneratedFileStream& GetRulesFileStream() const;
|
||||||
|
|
||||||
cmTarget* GetTarget() const
|
|
||||||
{ return this->Target; }
|
|
||||||
|
|
||||||
cmGeneratorTarget* GetGeneratorTarget() const
|
cmGeneratorTarget* GetGeneratorTarget() const
|
||||||
{ return this->GeneratorTarget; }
|
{ return this->GeneratorTarget; }
|
||||||
|
|
||||||
|
@ -152,7 +149,7 @@ protected:
|
||||||
std::set<std::string> MacContentFolders;
|
std::set<std::string> MacContentFolders;
|
||||||
|
|
||||||
void addPoolNinjaVariable(const std::string& pool_property,
|
void addPoolNinjaVariable(const std::string& pool_property,
|
||||||
cmTarget* target,
|
cmGeneratorTarget* target,
|
||||||
cmNinjaVars& vars);
|
cmNinjaVars& vars);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -16,7 +16,6 @@
|
||||||
#include "cmGlobalNinjaGenerator.h"
|
#include "cmGlobalNinjaGenerator.h"
|
||||||
#include "cmMakefile.h"
|
#include "cmMakefile.h"
|
||||||
#include "cmSourceFile.h"
|
#include "cmSourceFile.h"
|
||||||
#include "cmTarget.h"
|
|
||||||
#include "cmCustomCommandGenerator.h"
|
#include "cmCustomCommandGenerator.h"
|
||||||
|
|
||||||
cmNinjaUtilityTargetGenerator::cmNinjaUtilityTargetGenerator(
|
cmNinjaUtilityTargetGenerator::cmNinjaUtilityTargetGenerator(
|
||||||
|
@ -34,8 +33,8 @@ void cmNinjaUtilityTargetGenerator::Generate()
|
||||||
cmNinjaDeps deps, outputs, util_outputs(1, utilCommandName);
|
cmNinjaDeps deps, outputs, util_outputs(1, utilCommandName);
|
||||||
|
|
||||||
const std::vector<cmCustomCommand> *cmdLists[2] = {
|
const std::vector<cmCustomCommand> *cmdLists[2] = {
|
||||||
&this->GetTarget()->GetPreBuildCommands(),
|
&this->GetGeneratorTarget()->Target->GetPreBuildCommands(),
|
||||||
&this->GetTarget()->GetPostBuildCommands()
|
&this->GetGeneratorTarget()->Target->GetPostBuildCommands()
|
||||||
};
|
};
|
||||||
|
|
||||||
bool uses_terminal = false;
|
bool uses_terminal = false;
|
||||||
|
@ -66,7 +65,8 @@ void cmNinjaUtilityTargetGenerator::Generate()
|
||||||
{
|
{
|
||||||
cmCustomCommandGenerator ccg(*cc, this->GetConfigName(),
|
cmCustomCommandGenerator ccg(*cc, this->GetConfigName(),
|
||||||
this->GetLocalGenerator());
|
this->GetLocalGenerator());
|
||||||
this->GetLocalGenerator()->AddCustomCommandTarget(cc, this->GetTarget());
|
this->GetLocalGenerator()->AddCustomCommandTarget(cc,
|
||||||
|
this->GetGeneratorTarget());
|
||||||
|
|
||||||
// Depend on all custom command outputs.
|
// Depend on all custom command outputs.
|
||||||
const std::vector<std::string>& ccOutputs = ccg.GetOutputs();
|
const std::vector<std::string>& ccOutputs = ccg.GetOutputs();
|
||||||
|
@ -78,8 +78,10 @@ void cmNinjaUtilityTargetGenerator::Generate()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
this->GetLocalGenerator()->AppendTargetOutputs(this->GetTarget(), outputs);
|
this->GetLocalGenerator()->AppendTargetOutputs(this->GetGeneratorTarget(),
|
||||||
this->GetLocalGenerator()->AppendTargetDepends(this->GetTarget(), deps);
|
outputs);
|
||||||
|
this->GetLocalGenerator()->AppendTargetDepends(this->GetGeneratorTarget(),
|
||||||
|
deps);
|
||||||
|
|
||||||
if (commands.empty()) {
|
if (commands.empty()) {
|
||||||
this->GetGlobalGenerator()->WritePhonyBuild(this->GetBuildFileStream(),
|
this->GetGlobalGenerator()->WritePhonyBuild(this->GetBuildFileStream(),
|
||||||
|
@ -140,5 +142,5 @@ void cmNinjaUtilityTargetGenerator::Generate()
|
||||||
}
|
}
|
||||||
|
|
||||||
this->GetGlobalGenerator()->AddTargetAlias(this->GetTargetName(),
|
this->GetGlobalGenerator()->AddTargetAlias(this->GetTargetName(),
|
||||||
this->GetTarget());
|
this->GetGeneratorTarget());
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue