Ninja: GlobalNinjaGenerator WriteBuild and WritePhonyBuild non static
To properly track the usage of dependencies that are generated at compile time as the side effect of other build steps we need to make the WriteBuild and WritePhonyBuild commands non static
This commit is contained in:
parent
88d27ad014
commit
874e17120d
|
@ -208,7 +208,7 @@ void cmGlobalNinjaGenerator::WritePhonyBuild(std::ostream& os,
|
|||
const cmNinjaDeps& orderOnlyDeps,
|
||||
const cmNinjaVars& variables)
|
||||
{
|
||||
cmGlobalNinjaGenerator::WriteBuild(os,
|
||||
this->WriteBuild(os,
|
||||
comment,
|
||||
"phony",
|
||||
outputs,
|
||||
|
@ -251,7 +251,7 @@ cmGlobalNinjaGenerator::WriteCustomCommandBuild(const std::string& command,
|
|||
vars["COMMAND"] = cmd;
|
||||
vars["DESC"] = EncodeLiteral(description);
|
||||
|
||||
cmGlobalNinjaGenerator::WriteBuild(*this->BuildFileStream,
|
||||
this->WriteBuild(*this->BuildFileStream,
|
||||
comment,
|
||||
"CUSTOM_COMMAND",
|
||||
outputs,
|
||||
|
@ -293,7 +293,7 @@ cmGlobalNinjaGenerator::WriteMacOSXContentBuild(const std::string& input,
|
|||
deps.push_back(input);
|
||||
cmNinjaVars vars;
|
||||
|
||||
cmGlobalNinjaGenerator::WriteBuild(*this->BuildFileStream,
|
||||
this->WriteBuild(*this->BuildFileStream,
|
||||
"",
|
||||
"COPY_OSX_CONTENT",
|
||||
outputs,
|
||||
|
@ -896,7 +896,7 @@ void cmGlobalNinjaGenerator::WriteTargetAliases(std::ostream& os)
|
|||
cmNinjaDeps deps;
|
||||
this->AppendTargetOutputs(i->second, deps);
|
||||
|
||||
cmGlobalNinjaGenerator::WritePhonyBuild(os,
|
||||
this->WritePhonyBuild(os,
|
||||
"",
|
||||
cmNinjaDeps(1, i->first),
|
||||
deps);
|
||||
|
@ -920,7 +920,7 @@ void cmGlobalNinjaGenerator::WriteTargetAll(std::ostream& os)
|
|||
cmNinjaDeps outputs;
|
||||
outputs.push_back("all");
|
||||
|
||||
cmGlobalNinjaGenerator::WritePhonyBuild(os,
|
||||
this->WritePhonyBuild(os,
|
||||
"The main all target.",
|
||||
outputs,
|
||||
this->AllDependencies);
|
||||
|
@ -970,7 +970,7 @@ void cmGlobalNinjaGenerator::WriteTargetRebuildManifest(std::ostream& os)
|
|||
implicitDeps.end());
|
||||
implicitDeps.push_back("CMakeCache.txt");
|
||||
|
||||
WriteBuild(os,
|
||||
this->WriteBuild(os,
|
||||
"Re-run CMake if any of its inputs changed.",
|
||||
"RERUN_CMAKE",
|
||||
/*outputs=*/ cmNinjaDeps(1, NINJA_BUILD_FILE),
|
||||
|
@ -979,7 +979,7 @@ void cmGlobalNinjaGenerator::WriteTargetRebuildManifest(std::ostream& os)
|
|||
/*orderOnlyDeps=*/ cmNinjaDeps(),
|
||||
/*variables=*/ cmNinjaVars());
|
||||
|
||||
WritePhonyBuild(os,
|
||||
this->WritePhonyBuild(os,
|
||||
"A missing CMake input file is not an error.",
|
||||
implicitDeps,
|
||||
cmNinjaDeps());
|
||||
|
|
|
@ -77,7 +77,7 @@ public:
|
|||
* It also writes the variables bound to this build statement.
|
||||
* @warning no escaping of any kind is done here.
|
||||
*/
|
||||
static void WriteBuild(std::ostream& os,
|
||||
void WriteBuild(std::ostream& os,
|
||||
const std::string& comment,
|
||||
const std::string& rule,
|
||||
const cmNinjaDeps& outputs,
|
||||
|
@ -91,7 +91,7 @@ public:
|
|||
/**
|
||||
* Helper to write a build statement with the special 'phony' rule.
|
||||
*/
|
||||
static void WritePhonyBuild(std::ostream& os,
|
||||
void WritePhonyBuild(std::ostream& os,
|
||||
const std::string& comment,
|
||||
const cmNinjaDeps& outputs,
|
||||
const cmNinjaDeps& explicitDeps,
|
||||
|
|
|
@ -340,7 +340,8 @@ cmLocalNinjaGenerator::WriteCustomCommandBuildStatement(
|
|||
this->AppendCustomCommandLines(cc, cmdLines);
|
||||
|
||||
if (cmdLines.empty()) {
|
||||
cmGlobalNinjaGenerator::WritePhonyBuild(this->GetBuildFileStream(),
|
||||
this->GetGlobalNinjaGenerator()->WritePhonyBuild(
|
||||
this->GetBuildFileStream(),
|
||||
"Phony custom command for " +
|
||||
ninjaOutputs[0],
|
||||
ninjaOutputs,
|
||||
|
|
|
@ -598,12 +598,17 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement()
|
|||
#endif
|
||||
}
|
||||
|
||||
//Get the global generator as we are going to be call WriteBuild numerous
|
||||
//times in the following section
|
||||
cmGlobalNinjaGenerator* globalGenerator = this->GetGlobalGenerator();
|
||||
|
||||
|
||||
const std::string rspfile = std::string
|
||||
(cmake::GetCMakeFilesDirectoryPostSlash()) +
|
||||
this->GetTarget()->GetName() + ".rsp";
|
||||
|
||||
// Write the build statement for this target.
|
||||
cmGlobalNinjaGenerator::WriteBuild(this->GetBuildFileStream(),
|
||||
globalGenerator->WriteBuild(this->GetBuildFileStream(),
|
||||
comment.str(),
|
||||
this->LanguageLinkerRule(),
|
||||
outputs,
|
||||
|
@ -616,7 +621,7 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement()
|
|||
|
||||
if (targetOutput != targetOutputReal) {
|
||||
if (targetType == cmTarget::EXECUTABLE) {
|
||||
cmGlobalNinjaGenerator::WriteBuild(this->GetBuildFileStream(),
|
||||
globalGenerator->WriteBuild(this->GetBuildFileStream(),
|
||||
"Create executable symlink " + targetOutput,
|
||||
"CMAKE_SYMLINK_EXECUTABLE",
|
||||
cmNinjaDeps(1, targetOutput),
|
||||
|
@ -635,7 +640,7 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement()
|
|||
symlinks.push_back(soName);
|
||||
}
|
||||
symlinks.push_back(targetOutput);
|
||||
cmGlobalNinjaGenerator::WriteBuild(this->GetBuildFileStream(),
|
||||
globalGenerator->WriteBuild(this->GetBuildFileStream(),
|
||||
"Create library symlink " + targetOutput,
|
||||
"CMAKE_SYMLINK_LIBRARY",
|
||||
symlinks,
|
||||
|
@ -649,16 +654,16 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement()
|
|||
if (!this->TargetNameImport.empty()) {
|
||||
// Since using multiple outputs would mess up the $out variable, use an
|
||||
// alias for the import library.
|
||||
cmGlobalNinjaGenerator::WritePhonyBuild(this->GetBuildFileStream(),
|
||||
globalGenerator->WritePhonyBuild(this->GetBuildFileStream(),
|
||||
"Alias for import library.",
|
||||
cmNinjaDeps(1, targetOutputImplib),
|
||||
cmNinjaDeps(1, targetOutputReal));
|
||||
}
|
||||
|
||||
// Add aliases for the file name and the target name.
|
||||
this->GetGlobalGenerator()->AddTargetAlias(this->TargetNameOut,
|
||||
globalGenerator->AddTargetAlias(this->TargetNameOut,
|
||||
this->GetTarget());
|
||||
this->GetGlobalGenerator()->AddTargetAlias(this->GetTargetName(),
|
||||
globalGenerator->AddTargetAlias(this->GetTargetName(),
|
||||
this->GetTarget());
|
||||
}
|
||||
|
||||
|
@ -669,7 +674,7 @@ void cmNinjaNormalTargetGenerator::WriteObjectLibStatement()
|
|||
cmNinjaDeps outputs;
|
||||
this->GetLocalGenerator()->AppendTargetOutputs(this->GetTarget(), outputs);
|
||||
cmNinjaDeps depends = this->GetObjects();
|
||||
cmGlobalNinjaGenerator::WritePhonyBuild(this->GetBuildFileStream(),
|
||||
this->GetGlobalGenerator()->WritePhonyBuild(this->GetBuildFileStream(),
|
||||
"Object library "
|
||||
+ this->GetTargetName(),
|
||||
outputs,
|
||||
|
|
|
@ -642,7 +642,7 @@ cmNinjaTargetGenerator
|
|||
sourceFileName);
|
||||
}
|
||||
|
||||
cmGlobalNinjaGenerator::WriteBuild(this->GetBuildFileStream(),
|
||||
this->GetGlobalGenerator()->WriteBuild(this->GetBuildFileStream(),
|
||||
comment,
|
||||
rule,
|
||||
outputs,
|
||||
|
@ -656,7 +656,7 @@ cmNinjaTargetGenerator
|
|||
cmSystemTools::ExpandListArgument(objectOutputs, outputList);
|
||||
std::transform(outputList.begin(), outputList.end(), outputList.begin(),
|
||||
MapToNinjaPath());
|
||||
cmGlobalNinjaGenerator::WritePhonyBuild(this->GetBuildFileStream(),
|
||||
this->GetGlobalGenerator()->WritePhonyBuild(this->GetBuildFileStream(),
|
||||
"Additional output files.",
|
||||
outputList,
|
||||
outputs);
|
||||
|
|
|
@ -61,7 +61,7 @@ void cmNinjaUtilityTargetGenerator::Generate()
|
|||
this->GetLocalGenerator()->AppendTargetDepends(this->GetTarget(), deps);
|
||||
|
||||
if (commands.empty()) {
|
||||
cmGlobalNinjaGenerator::WritePhonyBuild(this->GetBuildFileStream(),
|
||||
this->GetGlobalGenerator()->WritePhonyBuild(this->GetBuildFileStream(),
|
||||
"Utility command for "
|
||||
+ this->GetTargetName(),
|
||||
outputs,
|
||||
|
@ -105,10 +105,11 @@ void cmNinjaUtilityTargetGenerator::Generate()
|
|||
cmNinjaDeps(1, utilCommandName),
|
||||
deps);
|
||||
|
||||
cmGlobalNinjaGenerator::WritePhonyBuild(this->GetBuildFileStream(),
|
||||
this->GetGlobalGenerator()->WritePhonyBuild(this->GetBuildFileStream(),
|
||||
"",
|
||||
outputs,
|
||||
cmNinjaDeps(1, utilCommandName));
|
||||
cmNinjaDeps(1, utilCommandName)
|
||||
);
|
||||
}
|
||||
|
||||
this->GetGlobalGenerator()->AddTargetAlias(this->GetTargetName(),
|
||||
|
|
Loading…
Reference in New Issue