diff options
Diffstat (limited to 'Source/cmGeneratorTarget.cxx')
-rw-r--r-- | Source/cmGeneratorTarget.cxx | 97 |
1 files changed, 53 insertions, 44 deletions
diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index e84bf4e..32e2b00 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -2,9 +2,9 @@ file Copyright.txt or https://cmake.org/licensing for details. */ #include "cmGeneratorTarget.h" +#include "cmsys/RegularExpression.hxx" #include <algorithm> #include <assert.h> -#include <cmsys/RegularExpression.hxx> #include <errno.h> #include <iterator> #include <queue> @@ -547,12 +547,6 @@ void cmGeneratorTarget::GetModuleDefinitionSources( IMPLEMENT_VISIT(SourceKindModuleDefinition); } -void cmGeneratorTarget::GetIDLSources(std::vector<cmSourceFile const*>& data, - const std::string& config) const -{ - IMPLEMENT_VISIT(SourceKindIDL); -} - void cmGeneratorTarget::GetHeaderSources( std::vector<cmSourceFile const*>& data, const std::string& config) const { @@ -975,6 +969,19 @@ void cmGeneratorTarget::GetSourceFiles(std::vector<cmSourceFile*>& files, } } +void cmGeneratorTarget::GetSourceFilesWithoutObjectLibraries( + std::vector<cmSourceFile*>& files, const std::string& config) const +{ + KindedSources const& kinded = this->GetKindedSources(config); + files.reserve(kinded.Sources.size()); + for (std::vector<SourceAndKind>::const_iterator si = kinded.Sources.begin(); + si != kinded.Sources.end(); ++si) { + if (si->Source->GetObjectLibrary().empty()) { + files.push_back(si->Source); + } + } +} + cmGeneratorTarget::KindedSources const& cmGeneratorTarget::GetKindedSources( std::string const& config) const { @@ -1095,6 +1102,43 @@ void cmGeneratorTarget::ComputeKindedSources(KindedSources& files, } } +std::vector<cmGeneratorTarget::AllConfigSource> const& +cmGeneratorTarget::GetAllConfigSources() const +{ + if (this->AllConfigSources.empty()) { + this->ComputeAllConfigSources(); + } + return this->AllConfigSources; +} + +void cmGeneratorTarget::ComputeAllConfigSources() const +{ + std::vector<std::string> configs; + this->Makefile->GetConfigurations(configs); + + std::map<cmSourceFile const*, size_t> index; + + for (size_t ci = 0; ci < configs.size(); ++ci) { + KindedSources const& sources = this->GetKindedSources(configs[ci]); + for (std::vector<cmGeneratorTarget::SourceAndKind>::const_iterator si = + sources.Sources.begin(); + si != sources.Sources.end(); ++si) { + std::map<cmSourceFile const*, size_t>::iterator mi = + index.find(si->Source); + if (mi == index.end()) { + AllConfigSource acs; + acs.Source = si->Source; + acs.Kind = si->Kind; + this->AllConfigSources.push_back(acs); + std::map<cmSourceFile const*, size_t>::value_type entry( + si->Source, this->AllConfigSources.size() - 1); + mi = index.insert(entry).first; + } + this->AllConfigSources[mi->second].Configs.push_back(ci); + } + } +} + std::string cmGeneratorTarget::GetCompilePDBName( const std::string& config) const { @@ -1963,41 +2007,6 @@ bool cmGeneratorTarget::IsDLLPlatform() const return this->DLLPlatform; } -void cmGeneratorTarget::UseObjectLibraries(std::vector<std::string>& objs, - const std::string& config) const -{ - std::vector<cmSourceFile const*> objectFiles; - this->GetExternalObjects(objectFiles, config); - std::vector<cmGeneratorTarget*> objectLibraries; - for (std::vector<cmSourceFile const*>::const_iterator it = - objectFiles.begin(); - it != objectFiles.end(); ++it) { - std::string objLib = (*it)->GetObjectLibrary(); - if (cmGeneratorTarget* tgt = - this->LocalGenerator->FindGeneratorTargetToUse(objLib)) { - objectLibraries.push_back(tgt); - } - } - - std::vector<cmGeneratorTarget*>::const_iterator end = - cmRemoveDuplicates(objectLibraries); - - for (std::vector<cmGeneratorTarget*>::const_iterator ti = - objectLibraries.begin(); - ti != end; ++ti) { - cmGeneratorTarget* ogt = *ti; - std::vector<cmSourceFile const*> objectSources; - ogt->GetObjectSources(objectSources, config); - for (std::vector<cmSourceFile const*>::const_iterator si = - objectSources.begin(); - si != objectSources.end(); ++si) { - std::string obj = ogt->ObjectDirectory; - obj += ogt->Objects[*si]; - objs.push_back(obj); - } - } -} - void cmGeneratorTarget::GetAutoUicOptions(std::vector<std::string>& result, const std::string& config) const { @@ -4961,11 +4970,11 @@ bool cmGeneratorTarget::GetConfigCommonSourceFiles( std::vector<std::string>::const_iterator it = configs.begin(); const std::string& firstConfig = *it; - this->GetSourceFiles(files, firstConfig); + this->GetSourceFilesWithoutObjectLibraries(files, firstConfig); for (; it != configs.end(); ++it) { std::vector<cmSourceFile*> configFiles; - this->GetSourceFiles(configFiles, *it); + this->GetSourceFilesWithoutObjectLibraries(configFiles, *it); if (configFiles != files) { std::string firstConfigFiles; const char* sep = ""; |