This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake".
The branch, next has been updated via e4891140bb3e9947f28c09668c69432b018586b7 (commit) via 46019f89e555341c2b42d824e947c8a9e1d32751 (commit) via 32a6fdb59e1beb36c567a7fcfa83c7eebdef03e7 (commit) via f94cf6285b2317441753c8e425b465d86c8987e6 (commit) via a91e614b5bbac304ae3083660dcc33fccb4e1e9b (commit) via c12b6a608b4217bb96e8831473edf82951137ac1 (commit) from 1f8814428337d3a946fe84e5185067a4ac2a3ad2 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=e4891140bb3e9947f28c09668c69432b018586b7 commit e4891140bb3e9947f28c09668c69432b018586b7 Merge: 1f88144 46019f8 Author: Stephen Kelly <steve...@gmail.com> AuthorDate: Wed Mar 12 14:23:15 2014 -0400 Commit: CMake Topic Stage <kwro...@kitware.com> CommitDate: Wed Mar 12 14:23:15 2014 -0400 Merge topic 'target-objects-refactor' into next 46019f89 cmGeneratorTarget: Compute target objects in LookupObjectLibraries. 32a6fdb5 cmGeneratorTarget: Remove GetObjectName method. f94cf628 cmLocalGenerator: Add ComputeObjectFilename method. a91e614b cmLocalGenerator: Add ComputeObjectFilenames method. c12b6a60 cmGeneratorTarget: Move ExplicitTargetName to VS local generator http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=46019f89e555341c2b42d824e947c8a9e1d32751 commit 46019f89e555341c2b42d824e947c8a9e1d32751 Author: Stephen Kelly <steve...@gmail.com> AuthorDate: Tue Mar 11 20:39:01 2014 +0100 Commit: Stephen Kelly <steve...@gmail.com> CommitDate: Wed Mar 12 19:22:43 2014 +0100 cmGeneratorTarget: Compute target objects in LookupObjectLibraries. Remove the old method from the generators which are now all functionally identical. Remove the supporting cmGeneratorTarget::AddObject method. In a follow-up, the LookupObjectLibraries may be replaced by a true generator expression evaluator for TARGET_OBJECTS. That will require generators to use cmGeneratorTarget::GetExternalObjects which is not currently the case for Xcode and VS generators. diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index 8804fac..6a1f734 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -316,12 +316,6 @@ cmGeneratorTarget::GetObjectSources(std::vector<cmSourceFile*> &data) const } //---------------------------------------------------------------------------- -void cmGeneratorTarget::AddObject(cmSourceFile *sf, std::string const&name) -{ - this->Objects[sf] = name; -} - -//---------------------------------------------------------------------------- void cmGeneratorTarget::GetIDLSources(std::vector<cmSourceFile*>& data) const { IMPLEMENT_VISIT(IDLSources); @@ -529,6 +523,29 @@ void cmGeneratorTarget::LookupObjectLibraries() return; } } + + // Compute full path to object file directory for this target. + std::string obj_dir; + this->LocalGenerator->GetObjectDirectory(this->Target, obj_dir); + this->ObjectDirectory = obj_dir; + + std::string dir_max; + this->LocalGenerator->GetDirectoryForObjects(this->Target, dir_max); + + std::vector<cmSourceFile*> objectSources; + this->GetObjectSources(objectSources); + std::vector<std::string> objects; + this->LocalGenerator->ComputeObjectFilenames(objectSources, + objects, dir_max); + assert(objects.size() == objectSources.size()); + // Compute the name of each object file. + std::vector<cmSourceFile*>::const_iterator srcIt = objectSources.begin(); + std::vector<std::string>::const_iterator objIt = objects.begin(); + for( ; srcIt != objectSources.end(), objIt != objects.end(); + ++srcIt, ++objIt) + { + this->Objects[*srcIt] = *objIt; + } } //---------------------------------------------------------------------------- diff --git a/Source/cmGeneratorTarget.h b/Source/cmGeneratorTarget.h index ceb38d5..5788abe 100644 --- a/Source/cmGeneratorTarget.h +++ b/Source/cmGeneratorTarget.h @@ -34,8 +34,6 @@ public: void GetObjectSources(std::vector<cmSourceFile*> &) const; - void AddObject(cmSourceFile *sf, std::string const&name); - void GetResxSources(std::vector<cmSourceFile*>&) const; void GetIDLSources(std::vector<cmSourceFile*>&) const; void GetExternalObjects(std::vector<cmSourceFile*>&) const; diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index b95ff81..d0b7b69 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -1450,7 +1450,6 @@ void cmGlobalGenerator::ComputeGeneratorTargetObjects() } cmGeneratorTarget* gt = ti->second; gt->LookupObjectLibraries(); - this->ComputeTargetObjects(gt); } } } @@ -1514,12 +1513,6 @@ cmGlobalGenerator::GetGeneratorTarget(cmTarget const* t) const return ti->second; } -//---------------------------------------------------------------------------- -void cmGlobalGenerator::ComputeTargetObjects(cmGeneratorTarget*) const -{ - // Implemented in generator subclasses that need this. -} - void cmGlobalGenerator::CheckLocalGenerators() { std::map<std::string, std::string> notFoundMap; diff --git a/Source/cmGlobalGenerator.h b/Source/cmGlobalGenerator.h index 91e71a8..762b536 100644 --- a/Source/cmGlobalGenerator.h +++ b/Source/cmGlobalGenerator.h @@ -441,7 +441,6 @@ private: void CreateGeneratorTargets(cmMakefile* mf); void CreateGeneratorTargets(); void ComputeGeneratorTargetObjects(); - virtual void ComputeTargetObjects(cmGeneratorTarget* gt) const; void ClearGeneratorMembers(); diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx index 89d81de..6af4ef0 100644 --- a/Source/cmGlobalNinjaGenerator.cxx +++ b/Source/cmGlobalNinjaGenerator.cxx @@ -631,33 +631,6 @@ std::string cmGlobalNinjaGenerator::GetEditCacheCommand() const return cmSystemTools::GetCMakeGUICommand(); } -// TODO: Refactor to combine with cmGlobalUnixMakefileGenerator3 impl. -void cmGlobalNinjaGenerator::ComputeTargetObjects(cmGeneratorTarget* gt) const -{ - cmTarget* target = gt->Target; - - // Compute full path to object file directory for this target. - std::string obj_dir; - gt->LocalGenerator->GetObjectDirectory(target, obj_dir); - gt->ObjectDirectory = obj_dir; - - std::string dir_max; - gt->LocalGenerator->GetDirectoryForObjects(target, dir_max); - - std::vector<cmSourceFile*> objectSources; - gt->GetObjectSources(objectSources); - std::vector<std::string> objects; - gt->LocalGenerator->ComputeObjectFilenames(objectSources, - objects, dir_max); - std::vector<cmSourceFile*>::const_iterator srcIt = objectSources.begin(); - std::vector<std::string>::const_iterator objIt = objects.begin(); - for( ; srcIt != objectSources.end(), objIt != objects.end(); - ++srcIt, ++objIt) - { - gt->AddObject(*srcIt, *objIt); - } -} - //---------------------------------------------------------------------------- // Private methods diff --git a/Source/cmGlobalNinjaGenerator.h b/Source/cmGlobalNinjaGenerator.h index 7725cf3..787e3f4 100644 --- a/Source/cmGlobalNinjaGenerator.h +++ b/Source/cmGlobalNinjaGenerator.h @@ -310,9 +310,6 @@ protected: private: virtual std::string GetEditCacheCommand() const; - /// @see cmGlobalGenerator::ComputeTargetObjects - virtual void ComputeTargetObjects(cmGeneratorTarget* gt) const; - void OpenBuildFileStream(); void CloseBuildFileStream(); diff --git a/Source/cmGlobalUnixMakefileGenerator3.cxx b/Source/cmGlobalUnixMakefileGenerator3.cxx index ea65669..ee08ec8 100644 --- a/Source/cmGlobalUnixMakefileGenerator3.cxx +++ b/Source/cmGlobalUnixMakefileGenerator3.cxx @@ -103,34 +103,6 @@ std::string cmGlobalUnixMakefileGenerator3::GetEditCacheCommand() const return edit_cmd? edit_cmd : ""; } -//---------------------------------------------------------------------------- -void -cmGlobalUnixMakefileGenerator3 -::ComputeTargetObjects(cmGeneratorTarget* gt) const -{ - cmTarget* target = gt->Target; - // Compute full path to object file directory for this target. - std::string obj_dir; - gt->LocalGenerator->GetObjectDirectory(target, obj_dir); - gt->ObjectDirectory = obj_dir; - - std::string dir_max; - gt->LocalGenerator->GetDirectoryForObjects(target, dir_max); - - std::vector<cmSourceFile*> objectSources; - gt->GetObjectSources(objectSources); - std::vector<std::string> objects; - gt->LocalGenerator->ComputeObjectFilenames(objectSources, - objects, dir_max); - std::vector<cmSourceFile*>::const_iterator srcIt = objectSources.begin(); - std::vector<std::string>::const_iterator objIt = objects.begin(); - for( ; srcIt != objectSources.end(), objIt != objects.end(); - ++srcIt, ++objIt) - { - gt->AddObject(*srcIt, *objIt); - } -} - void cmGlobalUnixMakefileGenerator3::Configure() { // Initialize CMAKE_EDIT_COMMAND cache entry. diff --git a/Source/cmGlobalUnixMakefileGenerator3.h b/Source/cmGlobalUnixMakefileGenerator3.h index 8115176..b078651 100644 --- a/Source/cmGlobalUnixMakefileGenerator3.h +++ b/Source/cmGlobalUnixMakefileGenerator3.h @@ -198,7 +198,6 @@ protected: private: virtual const char* GetBuildIgnoreErrorsFlag() const { return "-i"; } virtual std::string GetEditCacheCommand() const; - virtual void ComputeTargetObjects(cmGeneratorTarget* gt) const; }; #endif diff --git a/Source/cmGlobalVisualStudioGenerator.cxx b/Source/cmGlobalVisualStudioGenerator.cxx index 3cee9e2..587024d 100644 --- a/Source/cmGlobalVisualStudioGenerator.cxx +++ b/Source/cmGlobalVisualStudioGenerator.cxx @@ -118,32 +118,6 @@ void cmGlobalVisualStudioGenerator::Generate() } //---------------------------------------------------------------------------- -void -cmGlobalVisualStudioGenerator -::ComputeTargetObjects(cmGeneratorTarget* gt) const -{ - std::string dir_max; - gt->LocalGenerator->GetDirectoryForObjects(gt->Target, dir_max); - - std::vector<cmSourceFile*> objectSources; - gt->GetObjectSources(objectSources); - std::vector<std::string> objects; - gt->LocalGenerator->ComputeObjectFilenames(objectSources, - objects, dir_max); - std::vector<cmSourceFile*>::const_iterator srcIt = objectSources.begin(); - std::vector<std::string>::const_iterator objIt = objects.begin(); - for( ; srcIt != objectSources.end(), objIt != objects.end(); - ++srcIt, ++objIt) - { - gt->AddObject(*srcIt, *objIt); - } - - std::string dir; - gt->LocalGenerator->GetObjectDirectory(gt->Target, dir); - gt->ObjectDirectory = dir; -} - -//---------------------------------------------------------------------------- bool IsVisualStudioMacrosFileRegistered(const std::string& macrosFile, const std::string& regKeyBase, std::string& nextAvailableSubKeyName); diff --git a/Source/cmGlobalVisualStudioGenerator.h b/Source/cmGlobalVisualStudioGenerator.h index 7e8dcf8..e587f4f 100644 --- a/Source/cmGlobalVisualStudioGenerator.h +++ b/Source/cmGlobalVisualStudioGenerator.h @@ -116,7 +116,6 @@ private: virtual std::string GetVSMakeProgram() = 0; void PrintCompilerAdvice(std::ostream&, std::string const&, const char*) const {} - void ComputeTargetObjects(cmGeneratorTarget* gt) const; void FollowLinkDepends(cmTarget const* target, std::set<cmTarget const*>& linked); diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index 2eef69d..1923b05 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -3946,26 +3946,3 @@ bool cmGlobalXCodeGenerator::IsMultiConfig() // Newer Xcode versions are multi config: return true; } - - //---------------------------------------------------------------------------- -void -cmGlobalXCodeGenerator -::ComputeTargetObjects(cmGeneratorTarget* gt) const -{ - std::vector<cmSourceFile*> objectSources; - gt->GetObjectSources(objectSources); - std::vector<std::string> objects; - gt->LocalGenerator->ComputeObjectFilenames(objectSources, - objects, ""); - std::vector<cmSourceFile*>::const_iterator srcIt = objectSources.begin(); - std::vector<std::string>::const_iterator objIt = objects.begin(); - for( ; srcIt != objectSources.end(), objIt != objects.end(); - ++srcIt, ++objIt) - { - gt->AddObject(*srcIt, *objIt); - } - - std::string dir; - gt->LocalGenerator->GetObjectDirectory(*gt->Target, dir); - gt->ObjectDirectory = dir; -} diff --git a/Source/cmGlobalXCodeGenerator.h b/Source/cmGlobalXCodeGenerator.h index 655fb23..ee85117 100644 --- a/Source/cmGlobalXCodeGenerator.h +++ b/Source/cmGlobalXCodeGenerator.h @@ -226,7 +226,6 @@ protected: private: void PrintCompilerAdvice(std::ostream&, std::string const&, const char*) const {} - void ComputeTargetObjects(cmGeneratorTarget* gt) const; void addObject(cmXCodeObject *obj); std::string PostBuildMakeTarget(std::string const& tName, http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=32a6fdb59e1beb36c567a7fcfa83c7eebdef03e7 commit 32a6fdb59e1beb36c567a7fcfa83c7eebdef03e7 Author: Stephen Kelly <steve...@gmail.com> AuthorDate: Wed Mar 12 00:11:18 2014 +0100 Commit: Stephen Kelly <steve...@gmail.com> CommitDate: Wed Mar 12 19:22:43 2014 +0100 cmGeneratorTarget: Remove GetObjectName method. It is no longer used. diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index 83ba343..8804fac 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -316,11 +316,6 @@ cmGeneratorTarget::GetObjectSources(std::vector<cmSourceFile*> &data) const } //---------------------------------------------------------------------------- -const std::string& cmGeneratorTarget::GetObjectName(cmSourceFile const* file) -{ - return this->Objects[file]; -} - void cmGeneratorTarget::AddObject(cmSourceFile *sf, std::string const&name) { this->Objects[sf] = name; diff --git a/Source/cmGeneratorTarget.h b/Source/cmGeneratorTarget.h index 8b6d7e5..ceb38d5 100644 --- a/Source/cmGeneratorTarget.h +++ b/Source/cmGeneratorTarget.h @@ -33,7 +33,6 @@ public: void GetSourceFiles(std::vector<cmSourceFile*>& files) const; void GetObjectSources(std::vector<cmSourceFile*> &) const; - const std::string& GetObjectName(cmSourceFile const* file); void AddObject(cmSourceFile *sf, std::string const&name); http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=f94cf6285b2317441753c8e425b465d86c8987e6 commit f94cf6285b2317441753c8e425b465d86c8987e6 Author: Stephen Kelly <steve...@gmail.com> AuthorDate: Wed Mar 12 00:04:38 2014 +0100 Commit: Stephen Kelly <steve...@gmail.com> CommitDate: Wed Mar 12 19:22:43 2014 +0100 cmLocalGenerator: Add ComputeObjectFilename method. The generators need to be able to get the ObjectName for a single source file. diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index edbaf92..87cf0bb 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -3107,6 +3107,21 @@ void cmLocalGenerator::ComputeObjectFilenames( } //---------------------------------------------------------------------------- +void cmLocalGenerator::ComputeObjectFilename( + cmSourceFile* src, + std::string& name, + const std::string& dir) +{ + std::vector<cmSourceFile*> srcs; + srcs.push_back(src); + std::vector<std::string> names; + + this->ComputeObjectFilenames(srcs, names, dir); + assert(names.size() == 1); + name = names.front(); +} + +//---------------------------------------------------------------------------- void cmLocalGenerator::GetDirectoryForObjects(cmTarget* tgt, std::string& dir) { this->GetObjectDirectory(tgt, dir); diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h index 38e303a..db1df0d 100644 --- a/Source/cmLocalGenerator.h +++ b/Source/cmLocalGenerator.h @@ -378,6 +378,9 @@ public: const std::vector<cmSourceFile*>& objectSources, std::vector<std::string>& objectFiles, const std::string& dir); + void ComputeObjectFilename(cmSourceFile* objectSource, + std::string& objectFile, + const std::string& dir); protected: ///! put all the libraries for a target on into the given stream diff --git a/Source/cmLocalVisualStudio6Generator.cxx b/Source/cmLocalVisualStudio6Generator.cxx index ce55068..78df95d 100644 --- a/Source/cmLocalVisualStudio6Generator.cxx +++ b/Source/cmLocalVisualStudio6Generator.cxx @@ -404,7 +404,13 @@ void cmLocalVisualStudio6Generator std::string objectNameDir; if(this->HasExplicitObjectName(*sf)) { - objectNameDir = cmSystemTools::GetFilenamePath(gt->GetObjectName(*sf)); + std::string dir_max; + this->GetDirectoryForObjects(&target, dir_max); + + std::string objectName; + this->ComputeObjectFilename(const_cast<cmSourceFile*>(*sf), + objectName, dir_max); + objectNameDir = cmSystemTools::GetFilenamePath(objectName); } // Add per-source file flags. diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx index 8819361..88085fa 100644 --- a/Source/cmLocalVisualStudio7Generator.cxx +++ b/Source/cmLocalVisualStudio7Generator.cxx @@ -1484,7 +1484,11 @@ cmLocalVisualStudio7GeneratorFCInfo std::string objectName; if(lg->HasExplicitObjectName(&sf)) { - objectName = gt->GetObjectName(&sf); + std::string dir_max; + lg->GetDirectoryForObjects(&target, dir_max); + + lg->ComputeObjectFilename(const_cast<cmSourceFile*>(&sf), + objectName, dir_max); } // Compute per-source, per-config information. diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx index 983fd99..1634269 100644 --- a/Source/cmMakefileTargetGenerator.cxx +++ b/Source/cmMakefileTargetGenerator.cxx @@ -431,9 +431,12 @@ void cmMakefileTargetGenerator::WriteObjectRuleFiles(cmSourceFile& source) return; } - // Get the full path name of the object file. - std::string const& objectName = this->GeneratorTarget - ->GetObjectName(&source); + std::string dir_max; + this->LocalGenerator->GetDirectoryForObjects(this->Target, dir_max); + + std::string objectName; + this->LocalGenerator->ComputeObjectFilename(&source, objectName, dir_max); + std::string obj = this->LocalGenerator->GetTargetDirectory(*this->Target); obj += "/"; obj += objectName; diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx index d652018..e84065c 100644 --- a/Source/cmNinjaTargetGenerator.cxx +++ b/Source/cmNinjaTargetGenerator.cxx @@ -281,8 +281,11 @@ cmNinjaTargetGenerator std::string path = this->LocalGenerator->GetHomeRelativeOutputPath(); if(!path.empty()) path += "/"; - std::string const& objectName = this->GeneratorTarget - ->GetObjectName(source); + std::string dir_max; + this->LocalGenerator->GetDirectoryForObjects(this->Target, dir_max); + + std::string objectName; + this->LocalGenerator->ComputeObjectFilename(source, objectName, dir_max); path += this->LocalGenerator->GetTargetDirectory(*this->Target); path += "/"; path += objectName; diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index 5bb3b36..aefd310 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -1096,7 +1096,9 @@ bool cmVisualStudio10TargetGenerator::OutputSourceSpecificFlags( std::string objectName; if(this->LocalGenerator->HasExplicitObjectName(&sf)) { - objectName = this->GeneratorTarget->GetObjectName(&sf); + std::string dir_max; + this->LocalGenerator->GetDirectoryForObjects(this->Target, dir_max); + this->LocalGenerator->ComputeObjectFilename(&sf, objectName, dir_max); } std::string flags; std::string defines; http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=a91e614b5bbac304ae3083660dcc33fccb4e1e9b commit a91e614b5bbac304ae3083660dcc33fccb4e1e9b Author: Stephen Kelly <steve...@gmail.com> AuthorDate: Tue Mar 11 17:37:26 2014 +0100 Commit: Stephen Kelly <steve...@gmail.com> CommitDate: Wed Mar 12 19:22:43 2014 +0100 cmLocalGenerator: Add ComputeObjectFilenames method. diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx index 36bdd4c..89d81de 100644 --- a/Source/cmGlobalNinjaGenerator.cxx +++ b/Source/cmGlobalNinjaGenerator.cxx @@ -646,15 +646,15 @@ void cmGlobalNinjaGenerator::ComputeTargetObjects(cmGeneratorTarget* gt) const std::vector<cmSourceFile*> objectSources; gt->GetObjectSources(objectSources); - // Compute the name of each object file. - for(std::vector<cmSourceFile*>::iterator - si = objectSources.begin(); - si != objectSources.end(); ++si) + std::vector<std::string> objects; + gt->LocalGenerator->ComputeObjectFilenames(objectSources, + objects, dir_max); + std::vector<cmSourceFile*>::const_iterator srcIt = objectSources.begin(); + std::vector<std::string>::const_iterator objIt = objects.begin(); + for( ; srcIt != objectSources.end(), objIt != objects.end(); + ++srcIt, ++objIt) { - cmSourceFile* sf = *si; - std::string objectName = gt->LocalGenerator - ->GetObjectFileNameWithoutTarget(*sf, dir_max); - gt->AddObject(sf, objectName); + gt->AddObject(*srcIt, *objIt); } } diff --git a/Source/cmGlobalUnixMakefileGenerator3.cxx b/Source/cmGlobalUnixMakefileGenerator3.cxx index 220ca47..ea65669 100644 --- a/Source/cmGlobalUnixMakefileGenerator3.cxx +++ b/Source/cmGlobalUnixMakefileGenerator3.cxx @@ -119,15 +119,15 @@ cmGlobalUnixMakefileGenerator3 std::vector<cmSourceFile*> objectSources; gt->GetObjectSources(objectSources); - // Compute the name of each object file. - for(std::vector<cmSourceFile*>::iterator - si = objectSources.begin(); - si != objectSources.end(); ++si) + std::vector<std::string> objects; + gt->LocalGenerator->ComputeObjectFilenames(objectSources, + objects, dir_max); + std::vector<cmSourceFile*>::const_iterator srcIt = objectSources.begin(); + std::vector<std::string>::const_iterator objIt = objects.begin(); + for( ; srcIt != objectSources.end(), objIt != objects.end(); + ++srcIt, ++objIt) { - cmSourceFile* sf = *si; - std::string objectName = gt->LocalGenerator - ->GetObjectFileNameWithoutTarget(*sf, dir_max); - gt->AddObject(sf, objectName); + gt->AddObject(*srcIt, *objIt); } } diff --git a/Source/cmGlobalVisualStudioGenerator.cxx b/Source/cmGlobalVisualStudioGenerator.cxx index d33620a..3cee9e2 100644 --- a/Source/cmGlobalVisualStudioGenerator.cxx +++ b/Source/cmGlobalVisualStudioGenerator.cxx @@ -122,44 +122,20 @@ void cmGlobalVisualStudioGenerator ::ComputeTargetObjects(cmGeneratorTarget* gt) const { - cmLocalVisualStudioGenerator* lg = - static_cast<cmLocalVisualStudioGenerator*>(gt->LocalGenerator); - std::string dir_max; gt->LocalGenerator->GetDirectoryForObjects(gt->Target, dir_max); - // Count the number of object files with each name. Note that - // windows file names are not case sensitive. - std::map<std::string, int> counts; std::vector<cmSourceFile*> objectSources; gt->GetObjectSources(objectSources); - for(std::vector<cmSourceFile*>::const_iterator - si = objectSources.begin(); - si != objectSources.end(); ++si) - { - cmSourceFile* sf = *si; - std::string objectNameLower = cmSystemTools::LowerCase( - cmSystemTools::GetFilenameWithoutLastExtension(sf->GetFullPath())); - objectNameLower += ".obj"; - counts[objectNameLower] += 1; - } - - // For all source files producing duplicate names we need unique - // object name computation. - for(std::vector<cmSourceFile*>::const_iterator - si = objectSources.begin(); - si != objectSources.end(); ++si) - { - cmSourceFile* sf = *si; - std::string objectName = - cmSystemTools::GetFilenameWithoutLastExtension(sf->GetFullPath()); - objectName += ".obj"; - if(counts[cmSystemTools::LowerCase(objectName)] > 1) - { - lg->AddExplicitObjectName(sf); - objectName = lg->GetObjectFileNameWithoutTarget(*sf, dir_max); - } - gt->AddObject(sf, objectName); + std::vector<std::string> objects; + gt->LocalGenerator->ComputeObjectFilenames(objectSources, + objects, dir_max); + std::vector<cmSourceFile*>::const_iterator srcIt = objectSources.begin(); + std::vector<std::string>::const_iterator objIt = objects.begin(); + for( ; srcIt != objectSources.end(), objIt != objects.end(); + ++srcIt, ++objIt) + { + gt->AddObject(*srcIt, *objIt); } std::string dir; diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index b97b133..2eef69d 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -3952,30 +3952,17 @@ void cmGlobalXCodeGenerator ::ComputeTargetObjects(cmGeneratorTarget* gt) const { - // Count the number of object files with each name. Warn about duplicate - // names since Xcode names them uniquely automatically with a numeric suffix - // to avoid exact duplicate file names. Note that Mac file names are not - // typically case sensitive, hence the LowerCase. - std::map<std::string, int> counts; std::vector<cmSourceFile*> objectSources; gt->GetObjectSources(objectSources); - for(std::vector<cmSourceFile*>::const_iterator - si = objectSources.begin(); - si != objectSources.end(); ++si) - { - cmSourceFile* sf = *si; - std::string objectName = - cmSystemTools::GetFilenameWithoutLastExtension(sf->GetFullPath()); - objectName += ".o"; - - std::string objectNameLower = cmSystemTools::LowerCase(objectName); - counts[objectNameLower] += 1; - if (2 == counts[objectNameLower]) - { - // TODO: emit warning about duplicate name? - } - - gt->AddObject(sf, objectName); + std::vector<std::string> objects; + gt->LocalGenerator->ComputeObjectFilenames(objectSources, + objects, ""); + std::vector<cmSourceFile*>::const_iterator srcIt = objectSources.begin(); + std::vector<std::string>::const_iterator objIt = objects.begin(); + for( ; srcIt != objectSources.end(), objIt != objects.end(); + ++srcIt, ++objIt) + { + gt->AddObject(*srcIt, *objIt); } std::string dir; diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index 0d52a31..edbaf92 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -3098,6 +3098,15 @@ void cmLocalGenerator::ComputeObjectDirectory(cmTarget*, std::string&) } //---------------------------------------------------------------------------- +void cmLocalGenerator::ComputeObjectFilenames( + const std::vector<cmSourceFile*>&, + std::vector<std::string>&, + const std::string&) +{ + +} + +//---------------------------------------------------------------------------- void cmLocalGenerator::GetDirectoryForObjects(cmTarget* tgt, std::string& dir) { this->GetObjectDirectory(tgt, dir); diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h index 5a70bf7..38e303a 100644 --- a/Source/cmLocalGenerator.h +++ b/Source/cmLocalGenerator.h @@ -374,6 +374,11 @@ public: void GetObjectDirectory(cmTarget* tgt, std::string& dir); virtual void GetDirectoryForObjects(cmTarget* tgt, std::string& dir); + virtual void ComputeObjectFilenames( + const std::vector<cmSourceFile*>& objectSources, + std::vector<std::string>& objectFiles, + const std::string& dir); + protected: ///! put all the libraries for a target on into the given stream virtual void OutputLinkLibraries(std::string& linkLibraries, diff --git a/Source/cmLocalNinjaGenerator.cxx b/Source/cmLocalNinjaGenerator.cxx index abb156c..3261900 100644 --- a/Source/cmLocalNinjaGenerator.cxx +++ b/Source/cmLocalNinjaGenerator.cxx @@ -277,6 +277,22 @@ void cmLocalNinjaGenerator::ComputeObjectDirectory(cmTarget* tgt, dir += "/"; } +//---------------------------------------------------------------------------- +void cmLocalNinjaGenerator::ComputeObjectFilenames( + const std::vector<cmSourceFile*> &objectSources, + std::vector<std::string>& objectFiles, + const std::string& dir) +{ + // Compute the name of each object file. + for(std::vector<cmSourceFile*>::const_iterator + si = objectSources.begin(); + si != objectSources.end(); ++si) + { + cmSourceFile* sf = *si; + objectFiles.push_back(this->GetObjectFileNameWithoutTarget(*sf, dir)); + } +} + void cmLocalNinjaGenerator::WriteProcessedMakefile(std::ostream& os) { cmGlobalNinjaGenerator::WriteDivider(os); diff --git a/Source/cmLocalNinjaGenerator.h b/Source/cmLocalNinjaGenerator.h index 17365e7..fe8929a 100644 --- a/Source/cmLocalNinjaGenerator.h +++ b/Source/cmLocalNinjaGenerator.h @@ -100,6 +100,11 @@ public: virtual std::string ConvertToLinkReference(std::string const& lib, OutputFormat format = SHELL); + virtual void ComputeObjectFilenames( + const std::vector<cmSourceFile*>& objectSources, + std::vector<std::string>& objectFiles, + const std::string& dir); + private: virtual void ComputeObjectDirectory(cmTarget*, std::string&); diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx index 5d22392..b3c823e 100644 --- a/Source/cmLocalUnixMakefileGenerator3.cxx +++ b/Source/cmLocalUnixMakefileGenerator3.cxx @@ -182,6 +182,22 @@ void cmLocalUnixMakefileGenerator3::ComputeObjectDirectory(cmTarget* tgt, } //---------------------------------------------------------------------------- +void cmLocalUnixMakefileGenerator3::ComputeObjectFilenames( + const std::vector<cmSourceFile*> &objectSources, + std::vector<std::string>& objectFiles, + const std::string& dir) +{ + // Compute the name of each object file. + for(std::vector<cmSourceFile*>::const_iterator + si = objectSources.begin(); + si != objectSources.end(); ++si) + { + cmSourceFile* sf = *si; + objectFiles.push_back(this->GetObjectFileNameWithoutTarget(*sf, dir)); + } +} + +//---------------------------------------------------------------------------- void cmLocalUnixMakefileGenerator3:: GetLocalObjectFiles(std::map<std::string, LocalObjectInfo> &localObjectFiles) { diff --git a/Source/cmLocalUnixMakefileGenerator3.h b/Source/cmLocalUnixMakefileGenerator3.h index 85ce69a..e2f8058 100644 --- a/Source/cmLocalUnixMakefileGenerator3.h +++ b/Source/cmLocalUnixMakefileGenerator3.h @@ -242,6 +242,11 @@ public: // Eclipse generator. void GetIndividualFileTargets(std::vector<std::string>& targets); + virtual void ComputeObjectFilenames( + const std::vector<cmSourceFile*>& objectSources, + std::vector<std::string>& objectFiles, + const std::string& dir); + private: virtual void ComputeObjectDirectory(cmTarget*, std::string&); diff --git a/Source/cmLocalVisualStudioGenerator.cxx b/Source/cmLocalVisualStudioGenerator.cxx index 339e85c..88d793e 100644 --- a/Source/cmLocalVisualStudioGenerator.cxx +++ b/Source/cmLocalVisualStudioGenerator.cxx @@ -51,6 +51,45 @@ void cmLocalVisualStudioGenerator::ComputeObjectDirectory(cmTarget* tgt, } //---------------------------------------------------------------------------- +void cmLocalVisualStudioGenerator::ComputeObjectFilenames( + const std::vector<cmSourceFile*> &objectSources, + std::vector<std::string>& objectFiles, + const std::string& dir) +{ + // Count the number of object files with each name. Note that + // windows file names are not case sensitive. + std::map<std::string, int> counts; + for(std::vector<cmSourceFile*>::const_iterator + si = objectSources.begin(); + si != objectSources.end(); ++si) + { + cmSourceFile* sf = *si; + std::string objectNameLower = cmSystemTools::LowerCase( + cmSystemTools::GetFilenameWithoutLastExtension(sf->GetFullPath())); + objectNameLower += ".obj"; + counts[objectNameLower] += 1; + } + + // For all source files producing duplicate names we need unique + // object name computation. + for(std::vector<cmSourceFile*>::const_iterator + si = objectSources.begin(); + si != objectSources.end(); ++si) + { + cmSourceFile* sf = *si; + std::string objectName = + cmSystemTools::GetFilenameWithoutLastExtension(sf->GetFullPath()); + objectName += ".obj"; + if(counts[cmSystemTools::LowerCase(objectName)] > 1) + { + this->ExplicitObjectName.insert(sf); + objectName = this->GetObjectFileNameWithoutTarget(*sf, dir); + } + objectFiles.push_back(objectName); + } +} + +//---------------------------------------------------------------------------- cmsys::auto_ptr<cmCustomCommand> cmLocalVisualStudioGenerator::MaybeCreateImplibDir(cmTarget& target, const std::string& config, @@ -107,13 +146,6 @@ bool cmLocalVisualStudioGenerator //---------------------------------------------------------------------------- void cmLocalVisualStudioGenerator -::AddExplicitObjectName(cmSourceFile* sf) -{ - this->ExplicitObjectName.insert(sf); -} - -//---------------------------------------------------------------------------- -void cmLocalVisualStudioGenerator ::GetDirectoryForObjects(cmTarget* tgt, std::string& dir) { dir = this->ComputeLongestObjectDirectory(*tgt); diff --git a/Source/cmLocalVisualStudioGenerator.h b/Source/cmLocalVisualStudioGenerator.h index c1b89cd..ba39bf4 100644 --- a/Source/cmLocalVisualStudioGenerator.h +++ b/Source/cmLocalVisualStudioGenerator.h @@ -64,7 +64,11 @@ public: void GetDirectoryForObjects(cmTarget* tgt, std::string& dir); bool HasExplicitObjectName(cmSourceFile const* file) const; - void AddExplicitObjectName(cmSourceFile* sf); + + virtual void ComputeObjectFilenames( + const std::vector<cmSourceFile*>& objectSources, + std::vector<std::string>& objectFiles, + const std::string& dir); protected: virtual const char* ReportErrorLabel() const; diff --git a/Source/cmLocalXCodeGenerator.cxx b/Source/cmLocalXCodeGenerator.cxx index c32469e..05aed0c 100644 --- a/Source/cmLocalXCodeGenerator.cxx +++ b/Source/cmLocalXCodeGenerator.cxx @@ -100,3 +100,33 @@ void cmLocalXCodeGenerator::ComputeObjectDirectory(cmTarget* tgt, #endif } } + +//---------------------------------------------------------------------------- +void cmLocalXCodeGenerator::ComputeObjectFilenames( + const std::vector<cmSourceFile*> &objectSources, + std::vector<std::string>& objectFiles, + const std::string&) +{ + // Count the number of object files with each name. Warn about duplicate + // names since Xcode names them uniquely automatically with a numeric suffix + // to avoid exact duplicate file names. Note that Mac file names are not + // typically case sensitive, hence the LowerCase. + std::map<std::string, int> counts; + for(std::vector<cmSourceFile*>::const_iterator + si = objectSources.begin(); + si != objectSources.end(); ++si) + { + cmSourceFile* sf = *si; + std::string objectName = + cmSystemTools::GetFilenameWithoutLastExtension(sf->GetFullPath()); + objectName += ".o"; + + std::string objectNameLower = cmSystemTools::LowerCase(objectName); + counts[objectNameLower] += 1; + if (2 == counts[objectNameLower]) + { + // TODO: emit warning about duplicate name? + } + objectFiles.push_back(objectName); + } +} diff --git a/Source/cmLocalXCodeGenerator.h b/Source/cmLocalXCodeGenerator.h index 8526d18..5cd8654 100644 --- a/Source/cmLocalXCodeGenerator.h +++ b/Source/cmLocalXCodeGenerator.h @@ -33,6 +33,10 @@ public: virtual void Generate(); virtual void GenerateInstallRules(); void GetDirectoryForObjects(cmTarget*,std::string&); + virtual void ComputeObjectFilenames( + const std::vector<cmSourceFile*>& objectSources, + std::vector<std::string>& objectFiles, + const std::string& dir); private: virtual void ComputeObjectDirectory(cmTarget* tgt, std::string& dir); http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=c12b6a608b4217bb96e8831473edf82951137ac1 commit c12b6a608b4217bb96e8831473edf82951137ac1 Author: Stephen Kelly <steve...@gmail.com> AuthorDate: Tue Mar 11 18:04:51 2014 +0100 Commit: Stephen Kelly <steve...@gmail.com> CommitDate: Wed Mar 12 19:22:43 2014 +0100 cmGeneratorTarget: Move ExplicitTargetName to VS local generator diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index db88749..83ba343 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -327,20 +327,6 @@ void cmGeneratorTarget::AddObject(cmSourceFile *sf, std::string const&name) } //---------------------------------------------------------------------------- -void cmGeneratorTarget::AddExplicitObjectName(cmSourceFile* sf) -{ - this->ExplicitObjectName.insert(sf); -} - -//---------------------------------------------------------------------------- -bool cmGeneratorTarget::HasExplicitObjectName(cmSourceFile const* file) const -{ - std::set<cmSourceFile const*>::const_iterator it - = this->ExplicitObjectName.find(file); - return it != this->ExplicitObjectName.end(); -} - -//---------------------------------------------------------------------------- void cmGeneratorTarget::GetIDLSources(std::vector<cmSourceFile*>& data) const { IMPLEMENT_VISIT(IDLSources); diff --git a/Source/cmGeneratorTarget.h b/Source/cmGeneratorTarget.h index 81a447f..8b6d7e5 100644 --- a/Source/cmGeneratorTarget.h +++ b/Source/cmGeneratorTarget.h @@ -36,8 +36,6 @@ public: const std::string& GetObjectName(cmSourceFile const* file); void AddObject(cmSourceFile *sf, std::string const&name); - bool HasExplicitObjectName(cmSourceFile const* file) const; - void AddExplicitObjectName(cmSourceFile* sf); void GetResxSources(std::vector<cmSourceFile*>&) const; void GetIDLSources(std::vector<cmSourceFile*>&) const; @@ -125,7 +123,6 @@ private: SourceEntriesType SourceEntries; std::map<cmSourceFile const*, std::string> Objects; - std::set<cmSourceFile const*> ExplicitObjectName; mutable std::vector<cmSourceFile*> ObjectSources; std::vector<cmTarget*> ObjectLibraries; mutable std::map<std::string, std::vector<std::string> > SystemIncludesCache; diff --git a/Source/cmGlobalVisualStudioGenerator.cxx b/Source/cmGlobalVisualStudioGenerator.cxx index 6c280f1..d33620a 100644 --- a/Source/cmGlobalVisualStudioGenerator.cxx +++ b/Source/cmGlobalVisualStudioGenerator.cxx @@ -156,7 +156,7 @@ cmGlobalVisualStudioGenerator objectName += ".obj"; if(counts[cmSystemTools::LowerCase(objectName)] > 1) { - gt->AddExplicitObjectName(sf); + lg->AddExplicitObjectName(sf); objectName = lg->GetObjectFileNameWithoutTarget(*sf, dir_max); } gt->AddObject(sf, objectName); diff --git a/Source/cmLocalVisualStudio6Generator.cxx b/Source/cmLocalVisualStudio6Generator.cxx index f1fd994..ce55068 100644 --- a/Source/cmLocalVisualStudio6Generator.cxx +++ b/Source/cmLocalVisualStudio6Generator.cxx @@ -402,7 +402,7 @@ void cmLocalVisualStudio6Generator std::string compileFlags; std::vector<std::string> depends; std::string objectNameDir; - if(gt->HasExplicitObjectName(*sf)) + if(this->HasExplicitObjectName(*sf)) { objectNameDir = cmSystemTools::GetFilenamePath(gt->GetObjectName(*sf)); } diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx index 4491140..8819361 100644 --- a/Source/cmLocalVisualStudio7Generator.cxx +++ b/Source/cmLocalVisualStudio7Generator.cxx @@ -1482,7 +1482,7 @@ cmLocalVisualStudio7GeneratorFCInfo cmGeneratorTarget* gt = lg->GetGlobalGenerator()->GetGeneratorTarget(&target); std::string objectName; - if(gt->HasExplicitObjectName(&sf)) + if(lg->HasExplicitObjectName(&sf)) { objectName = gt->GetObjectName(&sf); } diff --git a/Source/cmLocalVisualStudioGenerator.cxx b/Source/cmLocalVisualStudioGenerator.cxx index aa66145..339e85c 100644 --- a/Source/cmLocalVisualStudioGenerator.cxx +++ b/Source/cmLocalVisualStudioGenerator.cxx @@ -97,6 +97,22 @@ const char* cmLocalVisualStudioGenerator::GetReportErrorLabel() const } //---------------------------------------------------------------------------- +bool cmLocalVisualStudioGenerator +::HasExplicitObjectName(cmSourceFile const* file) const +{ + std::set<cmSourceFile const*>::const_iterator it + = this->ExplicitObjectName.find(file); + return it != this->ExplicitObjectName.end(); +} + +//---------------------------------------------------------------------------- +void cmLocalVisualStudioGenerator +::AddExplicitObjectName(cmSourceFile* sf) +{ + this->ExplicitObjectName.insert(sf); +} + +//---------------------------------------------------------------------------- void cmLocalVisualStudioGenerator ::GetDirectoryForObjects(cmTarget* tgt, std::string& dir) { diff --git a/Source/cmLocalVisualStudioGenerator.h b/Source/cmLocalVisualStudioGenerator.h index 168fc02..c1b89cd 100644 --- a/Source/cmLocalVisualStudioGenerator.h +++ b/Source/cmLocalVisualStudioGenerator.h @@ -63,6 +63,9 @@ public: void GetDirectoryForObjects(cmTarget* tgt, std::string& dir); + bool HasExplicitObjectName(cmSourceFile const* file) const; + void AddExplicitObjectName(cmSourceFile* sf); + protected: virtual const char* ReportErrorLabel() const; virtual bool CustomCommandUseLocal() const { return false; } @@ -75,6 +78,8 @@ protected: VSVersion Version; private: virtual void ComputeObjectDirectory(cmTarget* tgt, std::string& dir); + + std::set<cmSourceFile const*> ExplicitObjectName; }; #endif diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index 90155b4..5bb3b36 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -1094,7 +1094,7 @@ bool cmVisualStudio10TargetGenerator::OutputSourceSpecificFlags( cmSourceFile& sf = *source; std::string objectName; - if(this->GeneratorTarget->HasExplicitObjectName(&sf)) + if(this->LocalGenerator->HasExplicitObjectName(&sf)) { objectName = this->GeneratorTarget->GetObjectName(&sf); } ----------------------------------------------------------------------- Summary of changes: hooks/post-receive -- CMake _______________________________________________ Cmake-commits mailing list Cmake-commits@cmake.org http://public.kitware.com/cgi-bin/mailman/listinfo/cmake-commits