Ninja: Query custom commands once per target, not once per file.
Computing the source files is now more expensive, so the Ninja generator became very slow with a large number of files.
This commit is contained in:
parent
a02c30c294
commit
19b7c22d02
|
@ -494,6 +494,9 @@ cmNinjaTargetGenerator
|
||||||
{
|
{
|
||||||
cmCustomCommand const* cc = (*si)->GetCustomCommand();
|
cmCustomCommand const* cc = (*si)->GetCustomCommand();
|
||||||
this->GetLocalGenerator()->AddCustomCommandTarget(cc, this->GetTarget());
|
this->GetLocalGenerator()->AddCustomCommandTarget(cc, this->GetTarget());
|
||||||
|
// Record the custom commands for this target. The container is used
|
||||||
|
// in WriteObjectBuildStatement when called in a loop below.
|
||||||
|
this->CustomCommands.push_back((*si)->GetCustomCommand());
|
||||||
}
|
}
|
||||||
std::vector<cmSourceFile const*> headerSources;
|
std::vector<cmSourceFile const*> headerSources;
|
||||||
this->GeneratorTarget->GetHeaderSources(headerSources, config);
|
this->GeneratorTarget->GetHeaderSources(headerSources, config);
|
||||||
|
@ -565,14 +568,11 @@ cmNinjaTargetGenerator
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add order-only dependencies on custom command outputs.
|
// Add order-only dependencies on custom command outputs.
|
||||||
std::vector<cmSourceFile const*> customCommands;
|
for(std::vector<cmCustomCommand const*>::const_iterator
|
||||||
std::string config = this->Makefile->GetSafeDefinition("CMAKE_BUILD_TYPE");
|
cci = this->CustomCommands.begin();
|
||||||
this->GeneratorTarget->GetCustomCommands(customCommands, config);
|
cci != this->CustomCommands.end(); ++cci)
|
||||||
for(std::vector<cmSourceFile const*>::const_iterator
|
|
||||||
si = customCommands.begin();
|
|
||||||
si != customCommands.end(); ++si)
|
|
||||||
{
|
{
|
||||||
cmCustomCommand const* cc = (*si)->GetCustomCommand();
|
cmCustomCommand const* cc = *cci;
|
||||||
cmCustomCommandGenerator ccg(*cc, this->GetConfigName(),
|
cmCustomCommandGenerator ccg(*cc, this->GetConfigName(),
|
||||||
this->GetMakefile());
|
this->GetMakefile());
|
||||||
const std::vector<std::string>& ccoutputs = ccg.GetOutputs();
|
const std::vector<std::string>& ccoutputs = ccg.GetOutputs();
|
||||||
|
|
|
@ -153,6 +153,7 @@ private:
|
||||||
cmLocalNinjaGenerator* LocalGenerator;
|
cmLocalNinjaGenerator* LocalGenerator;
|
||||||
/// List of object files for this target.
|
/// List of object files for this target.
|
||||||
cmNinjaDeps Objects;
|
cmNinjaDeps Objects;
|
||||||
|
std::vector<cmCustomCommand const*> CustomCommands;
|
||||||
|
|
||||||
typedef std::map<std::string, std::string> LanguageFlagMap;
|
typedef std::map<std::string, std::string> LanguageFlagMap;
|
||||||
LanguageFlagMap LanguageFlags;
|
LanguageFlagMap LanguageFlags;
|
||||||
|
|
Loading…
Reference in New Issue