Ninja: Implement USES_TERMINAL using the console pool if available

This commit is contained in:
Peter Collingbourne 2014-11-05 21:42:18 +01:00 committed by Brad King
parent f281ae01a2
commit f42d86f0b8
4 changed files with 13 additions and 0 deletions

View File

@ -250,6 +250,7 @@ void
cmGlobalNinjaGenerator::WriteCustomCommandBuild(const std::string& command,
const std::string& description,
const std::string& comment,
bool uses_terminal,
const cmNinjaDeps& outputs,
const cmNinjaDeps& deps,
const cmNinjaDeps& orderOnly)
@ -266,6 +267,10 @@ cmGlobalNinjaGenerator::WriteCustomCommandBuild(const std::string& command,
cmNinjaVars vars;
vars["COMMAND"] = cmd;
vars["DESC"] = EncodeLiteral(description);
if (uses_terminal && SupportsConsolePool())
{
vars["pool"] = "console";
}
this->WriteBuild(*this->BuildFileStream,
comment,
@ -826,6 +831,7 @@ void cmGlobalNinjaGenerator::WriteAssumedSourceDependencies()
std::copy(i->second.begin(), i->second.end(), std::back_inserter(deps));
WriteCustomCommandBuild(/*command=*/"", /*description=*/"",
"Assume dependencies for generated source file.",
/*uses_terminal*/false,
cmNinjaDeps(1, i->first), deps);
}
}

View File

@ -103,6 +103,7 @@ public:
void WriteCustomCommandBuild(const std::string& command,
const std::string& description,
const std::string& comment,
bool uses_terminal,
const cmNinjaDeps& outputs,
const cmNinjaDeps& deps = cmNinjaDeps(),
const cmNinjaDeps& orderOnly = cmNinjaDeps());

View File

@ -468,6 +468,7 @@ cmLocalNinjaGenerator::WriteCustomCommandBuildStatement(
this->BuildCommandLine(cmdLines),
this->ConstructComment(ccg),
"Custom command for " + ninjaOutputs[0],
cc->GetUsesTerminal(),
ninjaOutputs,
ninjaDeps,
orderOnlyDeps);

View File

@ -35,6 +35,8 @@ void cmNinjaUtilityTargetGenerator::Generate()
&this->GetTarget()->GetPostBuildCommands()
};
bool uses_terminal = false;
for (unsigned i = 0; i != 2; ++i) {
for (std::vector<cmCustomCommand>::const_iterator
ci = cmdLists[i]->begin(); ci != cmdLists[i]->end(); ++ci) {
@ -42,6 +44,8 @@ void cmNinjaUtilityTargetGenerator::Generate()
this->GetMakefile());
this->GetLocalGenerator()->AppendCustomCommandDeps(ccg, deps);
this->GetLocalGenerator()->AppendCustomCommandLines(ccg, commands);
if (ci->GetUsesTerminal())
uses_terminal = true;
}
}
@ -110,6 +114,7 @@ void cmNinjaUtilityTargetGenerator::Generate()
command,
desc,
"Utility command for " + this->GetTargetName(),
uses_terminal,
cmNinjaDeps(1, utilCommandName),
deps);