diff options
author | Sebastian Holtermann <sebholt@xwmw.org> | 2019-01-17 10:19:42 (GMT) |
---|---|---|
committer | Sebastian Holtermann <sebholt@xwmw.org> | 2019-01-18 12:47:23 (GMT) |
commit | 1ed4d48dcf71df4e8a352bc476262a79d75e299a (patch) | |
tree | 6fa8ea9ab297775adbaa307349e0a86a80a95f1d /Source/cmQtAutoGenInitializer.cxx | |
parent | a42b700cc254e284892821dea06ac265744a0939 (diff) | |
download | CMake-1ed4d48dcf71df4e8a352bc476262a79d75e299a.zip CMake-1ed4d48dcf71df4e8a352bc476262a79d75e299a.tar.gz CMake-1ed4d48dcf71df4e8a352bc476262a79d75e299a.tar.bz2 |
Autogen: Prepend instead of append `mocs_compilation.cpp` to the sources list
`mocs_compilation.cpp` easily takes a long time to compile when it
contains multiple `moc` files. When it was appended like before
we ran into the situation that all smaller sources were already compiled when
`mocs_compilation.cpp` got compiled at last. In that case a single core was
busy but all remaining cores stayed idle.
To optimize CPU core utilization we now prepend `mocs_compilation.cpp`
to the sources list instead of appending it. This allows smaller source files
to get compiled *while* the long lasting `mocs_compilation.cpp` gets compiled.
Closes #18793
Diffstat (limited to 'Source/cmQtAutoGenInitializer.cxx')
-rw-r--r-- | Source/cmQtAutoGenInitializer.cxx | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/Source/cmQtAutoGenInitializer.cxx b/Source/cmQtAutoGenInitializer.cxx index 9fa8a89..3ae6d9a 100644 --- a/Source/cmQtAutoGenInitializer.cxx +++ b/Source/cmQtAutoGenInitializer.cxx @@ -963,7 +963,7 @@ bool cmQtAutoGenInitializer::InitAutogenTarget() // Files provided by the autogen target std::vector<std::string> autogenProvides; if (this->Moc.Enabled) { - this->AddGeneratedSource(this->Moc.MocsCompilation, GeneratorT::MOC); + this->AddGeneratedSource(this->Moc.MocsCompilation, GeneratorT::MOC, true); autogenProvides.push_back(this->Moc.MocsCompilation); } @@ -1356,7 +1356,8 @@ bool cmQtAutoGenInitializer::SetupWriteRccInfo() } void cmQtAutoGenInitializer::AddGeneratedSource(std::string const& filename, - GeneratorT genType) + GeneratorT genType, + bool prepend) { // Register source file in makefile cmMakefile* makefile = this->Target->Target->GetMakefile(); @@ -1370,7 +1371,7 @@ void cmQtAutoGenInitializer::AddGeneratedSource(std::string const& filename, AddToSourceGroup(makefile, filename, genType); // Add source file to target - this->Target->AddSource(filename); + this->Target->AddSource(filename, prepend); } static unsigned int CharPtrToInt(const char* const input) |