summaryrefslogtreecommitdiffstats
path: root/Source/cmNinjaTargetGenerator.cxx
diff options
context:
space:
mode:
authorBen Boeckel <mathstuf@gmail.com>2014-03-11 01:07:31 (GMT)
committerBen Boeckel <ben.boeckel@kitware.com>2014-05-07 18:30:31 (GMT)
commit2583eff6fe34f219a017c973c9e3bf12eb503178 (patch)
tree9ddb520f8372a45ca28fc5d88b0e3354da74a7c7 /Source/cmNinjaTargetGenerator.cxx
parent18e478a860ce480f47ca2fdf583f3c5d65f93ccf (diff)
downloadCMake-2583eff6fe34f219a017c973c9e3bf12eb503178.zip
CMake-2583eff6fe34f219a017c973c9e3bf12eb503178.tar.gz
CMake-2583eff6fe34f219a017c973c9e3bf12eb503178.tar.bz2
ninja: Factor out custom command order-only depends
This makes WebKitGTK's CMake build.ninja file go from 165M to 11M and configure/generate in 5 seconds.
Diffstat (limited to 'Source/cmNinjaTargetGenerator.cxx')
-rw-r--r--Source/cmNinjaTargetGenerator.cxx29
1 files changed, 15 insertions, 14 deletions
diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx
index 0b379bd..292a22f 100644
--- a/Source/cmNinjaTargetGenerator.cxx
+++ b/Source/cmNinjaTargetGenerator.cxx
@@ -502,7 +502,7 @@ cmNinjaTargetGenerator
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());
+ this->CustomCommands.push_back(cc);
}
std::vector<cmSourceFile const*> headerSources;
this->GeneratorTarget->GetHeaderSources(headerSources, config);
@@ -525,6 +525,20 @@ cmNinjaTargetGenerator
cmNinjaDeps orderOnlyDeps;
this->GetLocalGenerator()->AppendTargetDepends(this->Target, orderOnlyDeps);
+
+ // Add order-only dependencies on custom command outputs.
+ for(std::vector<cmCustomCommand const*>::const_iterator
+ cci = this->CustomCommands.begin();
+ cci != this->CustomCommands.end(); ++cci)
+ {
+ cmCustomCommand const* cc = *cci;
+ cmCustomCommandGenerator ccg(*cc, this->GetConfigName(),
+ this->GetMakefile());
+ const std::vector<std::string>& ccoutputs = ccg.GetOutputs();
+ std::transform(ccoutputs.begin(), ccoutputs.end(),
+ std::back_inserter(orderOnlyDeps), MapToNinjaPath());
+ }
+
cmNinjaDeps orderOnlyTarget;
orderOnlyTarget.push_back(this->OrderDependsTargetForTarget());
this->GetGlobalGenerator()->WritePhonyBuild(this->GetBuildFileStream(),
@@ -584,19 +598,6 @@ cmNinjaTargetGenerator
cmNinjaDeps orderOnlyDeps;
orderOnlyDeps.push_back(this->OrderDependsTargetForTarget());
- // Add order-only dependencies on custom command outputs.
- for(std::vector<cmCustomCommand const*>::const_iterator
- cci = this->CustomCommands.begin();
- cci != this->CustomCommands.end(); ++cci)
- {
- cmCustomCommand const* cc = *cci;
- cmCustomCommandGenerator ccg(*cc, this->GetConfigName(),
- this->GetMakefile());
- const std::vector<std::string>& ccoutputs = ccg.GetOutputs();
- std::transform(ccoutputs.begin(), ccoutputs.end(),
- std::back_inserter(orderOnlyDeps), MapToNinjaPath());
- }
-
// If the source file is GENERATED and does not have a custom command
// (either attached to this source file or another one), assume that one of
// the target dependencies, OBJECT_DEPENDS or header file custom commands