diff options
author | Stephen Kelly <steveire@gmail.com> | 2014-04-04 15:09:56 (GMT) |
---|---|---|
committer | Stephen Kelly <steveire@gmail.com> | 2014-04-05 12:22:48 (GMT) |
commit | 19b7c22d020a3b1bf26065beb33b0f2f499cd1ad (patch) | |
tree | 3bf35421a3deebac491be956bcafad23a0c5a72c /Source/cmNinjaTargetGenerator.cxx | |
parent | a02c30c29407f30bce654be60da91cf84e2cb4f1 (diff) | |
download | CMake-19b7c22d020a3b1bf26065beb33b0f2f499cd1ad.zip CMake-19b7c22d020a3b1bf26065beb33b0f2f499cd1ad.tar.gz CMake-19b7c22d020a3b1bf26065beb33b0f2f499cd1ad.tar.bz2 |
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.
Diffstat (limited to 'Source/cmNinjaTargetGenerator.cxx')
-rw-r--r-- | Source/cmNinjaTargetGenerator.cxx | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx index 56155ef..cb6eb90 100644 --- a/Source/cmNinjaTargetGenerator.cxx +++ b/Source/cmNinjaTargetGenerator.cxx @@ -494,6 +494,9 @@ cmNinjaTargetGenerator { cmCustomCommand const* cc = (*si)->GetCustomCommand(); 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; this->GeneratorTarget->GetHeaderSources(headerSources, config); @@ -565,14 +568,11 @@ cmNinjaTargetGenerator } // Add order-only dependencies on custom command outputs. - std::vector<cmSourceFile const*> customCommands; - std::string config = this->Makefile->GetSafeDefinition("CMAKE_BUILD_TYPE"); - this->GeneratorTarget->GetCustomCommands(customCommands, config); - for(std::vector<cmSourceFile const*>::const_iterator - si = customCommands.begin(); - si != customCommands.end(); ++si) + for(std::vector<cmCustomCommand const*>::const_iterator + cci = this->CustomCommands.begin(); + cci != this->CustomCommands.end(); ++cci) { - cmCustomCommand const* cc = (*si)->GetCustomCommand(); + cmCustomCommand const* cc = *cci; cmCustomCommandGenerator ccg(*cc, this->GetConfigName(), this->GetMakefile()); const std::vector<std::string>& ccoutputs = ccg.GetOutputs(); |