[Cmake-commits] CMake branch, next, updated. v3.0.0-rc1-934-gf2fe9c2

Stephen Kelly steveire at gmail.com
Wed Mar 12 15:55:13 EDT 2014


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  f2fe9c29893e343aceaa637f2982502b8f1bbb46 (commit)
       via  600f3bcc964d4738178041d9550d2570708a871b (commit)
      from  2ba8a74b1dc3f8481f8b7b72afc12118f6ea35a6 (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=f2fe9c29893e343aceaa637f2982502b8f1bbb46
commit f2fe9c29893e343aceaa637f2982502b8f1bbb46
Merge: 2ba8a74 600f3bc
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Wed Mar 12 15:55:11 2014 -0400
Commit:     CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Wed Mar 12 15:55:11 2014 -0400

    Merge topic 'target-objects-refactor' into next
    
    600f3bcc Revert topic.

diff --cc Source/cmLocalVisualStudioGenerator.cxx
index f4d3653,6e93d22..613ee97
--- a/Source/cmLocalVisualStudioGenerator.cxx
+++ b/Source/cmLocalVisualStudioGenerator.cxx
@@@ -136,25 -77,10 +77,9 @@@ const char* cmLocalVisualStudioGenerato
  }
  
  //----------------------------------------------------------------------------
- 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
- ::GetDirectoryForObjects(cmTarget* tgt, std::string& dir)
- {
-   dir = this->ComputeLongestObjectDirectory(*tgt);
- }
- 
- //----------------------------------------------------------------------------
  std::string
  cmLocalVisualStudioGenerator
 -::ConstructScript(cmCustomCommand const& cc,
 -                  const std::string& configName,
 +::ConstructScript(cmCustomCommandGenerator const& ccg,
                    const std::string& newline_text)
  {
    bool useLocal = this->CustomCommandUseLocal();

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=600f3bcc964d4738178041d9550d2570708a871b
commit 600f3bcc964d4738178041d9550d2570708a871b
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Wed Mar 12 20:52:56 2014 +0100
Commit:     Stephen Kelly <steveire at gmail.com>
CommitDate: Wed Mar 12 20:54:43 2014 +0100

    Revert topic.

diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx
index 83ba343..db88749 100644
--- a/Source/cmGeneratorTarget.cxx
+++ b/Source/cmGeneratorTarget.cxx
@@ -327,6 +327,20 @@ 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 8b6d7e5..81a447f 100644
--- a/Source/cmGeneratorTarget.h
+++ b/Source/cmGeneratorTarget.h
@@ -36,6 +36,8 @@ 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;
@@ -123,6 +125,7 @@ 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/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx
index 89d81de..0a05f5a 100644
--- a/Source/cmGlobalNinjaGenerator.cxx
+++ b/Source/cmGlobalNinjaGenerator.cxx
@@ -637,24 +637,24 @@ 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);
+  dir_max += gt->Makefile->GetCurrentOutputDirectory();
+  dir_max += "/";
+  dir_max += gt->LocalGenerator->GetTargetDirectory(*target);
+  dir_max += "/";
+  gt->ObjectDirectory = 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)
+  // Compute the name of each object file.
+  for(std::vector<cmSourceFile*>::iterator
+        si = objectSources.begin();
+      si != objectSources.end(); ++si)
     {
-    gt->AddObject(*srcIt, *objIt);
+    cmSourceFile* sf = *si;
+    std::string objectName = gt->LocalGenerator
+      ->GetObjectFileNameWithoutTarget(*sf, dir_max);
+    gt->AddObject(sf, objectName);
     }
 }
 
diff --git a/Source/cmGlobalUnixMakefileGenerator3.cxx b/Source/cmGlobalUnixMakefileGenerator3.cxx
index ea65669..f5c56a9 100644
--- a/Source/cmGlobalUnixMakefileGenerator3.cxx
+++ b/Source/cmGlobalUnixMakefileGenerator3.cxx
@@ -109,25 +109,31 @@ 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;
+  cmLocalUnixMakefileGenerator3* lg =
+    static_cast<cmLocalUnixMakefileGenerator3*>(gt->LocalGenerator);
 
+  // Compute full path to object file directory for this target.
   std::string dir_max;
-  gt->LocalGenerator->GetDirectoryForObjects(target, dir_max);
+  dir_max += gt->Makefile->GetCurrentOutputDirectory();
+  dir_max += "/";
+  dir_max += gt->LocalGenerator->GetTargetDirectory(*target);
+  dir_max += "/";
+  gt->ObjectDirectory = 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)
+  // Compute the name of each object file.
+  for(std::vector<cmSourceFile*>::iterator
+        si = objectSources.begin();
+      si != objectSources.end(); ++si)
     {
-    gt->AddObject(*srcIt, *objIt);
+    cmSourceFile* sf = *si;
+    bool hasSourceExtension = true;
+    std::string objectName = gt->LocalGenerator
+      ->GetObjectFileNameWithoutTarget(*sf, dir_max,
+                                       &hasSourceExtension);
+    gt->AddObject(sf, objectName);
+    lg->AddLocalObjectFile(target, sf, objectName, hasSourceExtension);
     }
 }
 
diff --git a/Source/cmGlobalVisualStudioGenerator.cxx b/Source/cmGlobalVisualStudioGenerator.cxx
index 3cee9e2..69c893c 100644
--- a/Source/cmGlobalVisualStudioGenerator.cxx
+++ b/Source/cmGlobalVisualStudioGenerator.cxx
@@ -122,24 +122,58 @@ void
 cmGlobalVisualStudioGenerator
 ::ComputeTargetObjects(cmGeneratorTarget* gt) const
 {
-  std::string dir_max;
-  gt->LocalGenerator->GetDirectoryForObjects(gt->Target, dir_max);
+  cmLocalVisualStudioGenerator* lg =
+    static_cast<cmLocalVisualStudioGenerator*>(gt->LocalGenerator);
+  std::string dir_max = lg->ComputeLongestObjectDirectory(*gt->Target);
 
+  // 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);
-  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);
+  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)
+      {
+      gt->AddExplicitObjectName(sf);
+      objectName = lg->GetObjectFileNameWithoutTarget(*sf, dir_max);
+      }
+    gt->AddObject(sf, objectName);
     }
 
-  std::string dir;
-  gt->LocalGenerator->GetObjectDirectory(gt->Target, dir);
+  std::string dir = gt->Makefile->GetCurrentOutputDirectory();
+  dir += "/";
+  std::string tgtDir = lg->GetTargetDirectory(*gt->Target);
+  if(!tgtDir.empty())
+    {
+    dir += tgtDir;
+    dir += "/";
+    }
+  const char* cd = this->GetCMakeCFGIntDir();
+  if(cd && *cd)
+    {
+    dir += cd;
+    dir += "/";
+    }
   gt->ObjectDirectory = dir;
 }
 
diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx
index 2eef69d..30a2a1e 100644
--- a/Source/cmGlobalXCodeGenerator.cxx
+++ b/Source/cmGlobalXCodeGenerator.cxx
@@ -3952,20 +3952,47 @@ 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);
-  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)
+  for(std::vector<cmSourceFile*>::const_iterator
+      si = objectSources.begin();
+      si != objectSources.end(); ++si)
     {
-    gt->AddObject(*srcIt, *objIt);
+    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::string dir;
-  gt->LocalGenerator->GetObjectDirectory(*gt->Target, dir);
+  const char* configName = this->GetCMakeCFGIntDir();
+  std::string dir = this->GetObjectsNormalDirectory(
+    "$(PROJECT_NAME)", configName, gt->Target);
+  if(this->XcodeVersion >= 21)
+    {
+    dir += "$(CURRENT_ARCH)/";
+    }
+  else
+    {
+#ifdef __ppc__
+    dir += "ppc/";
+#endif
+#ifdef __i386
+    dir += "i386/";
+#endif
+    }
   gt->ObjectDirectory = dir;
 }
diff --git a/Source/cmGlobalXCodeGenerator.h b/Source/cmGlobalXCodeGenerator.h
index 655fb23..93315ba 100644
--- a/Source/cmGlobalXCodeGenerator.h
+++ b/Source/cmGlobalXCodeGenerator.h
@@ -91,14 +91,6 @@ public:
 
   virtual bool SetGeneratorToolset(std::string const& ts);
   void AppendFlag(std::string& flags, std::string const& flag);
-
-  std::string GetObjectsNormalDirectory(
-    const std::string &projName,
-    const std::string &configName,
-    const cmTarget *t) const;
-
-  int GetXcodeVersion() const { return this->XcodeVersion; }
-
 private:
   cmXCodeObject* CreateOrGetPBXGroup(cmTarget& cmtarget,
                                      cmSourceGroup* sg);
@@ -228,6 +220,11 @@ private:
                            const char*) const {}
   void ComputeTargetObjects(cmGeneratorTarget* gt) const;
 
+  std::string GetObjectsNormalDirectory(
+    const std::string &projName,
+    const std::string &configName,
+    const cmTarget *t) const;
+
   void addObject(cmXCodeObject *obj);
   std::string PostBuildMakeTarget(std::string const& tName,
                                   std::string const& configName);
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index edbaf92..de8dd51 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/Source/cmLocalGenerator.cxx
@@ -3080,39 +3080,6 @@ cmLocalGenerator
 }
 
 //----------------------------------------------------------------------------
-void cmLocalGenerator::GetObjectDirectory(cmTarget* tgt, std::string& dir)
-{
-  std::map<cmTarget*, std::string>::const_iterator it
-                                      = this->ObjectDirectoryCache.find(tgt);
-  if (it == this->ObjectDirectoryCache.end())
-    {
-    this->ComputeObjectDirectory(tgt, this->ObjectDirectoryCache[tgt]);
-    }
-  dir = this->ObjectDirectoryCache[tgt];
-}
-
-//----------------------------------------------------------------------------
-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);
-}
-
-//----------------------------------------------------------------------------
 std::string
 cmLocalGenerator
 ::GetObjectFileNameWithoutTarget(const cmSourceFile& source,
diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h
index 38e303a..4d62833 100644
--- a/Source/cmLocalGenerator.h
+++ b/Source/cmLocalGenerator.h
@@ -371,14 +371,6 @@ public:
                       std::string& linkPath,
                       cmGeneratorTarget* target);
 
-  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,
@@ -483,9 +475,6 @@ protected:
   cmIML_INT_uint64_t BackwardsCompatibility;
   bool BackwardsCompatibilityFinal;
 private:
-  std::map<cmTarget*, std::string> ObjectDirectoryCache;
-  virtual void ComputeObjectDirectory(cmTarget* tgt, std::string& dir);
-
   std::string ConvertToOutputForExistingCommon(const std::string& remote,
                                                std::string const& result,
                                                OutputFormat format);
diff --git a/Source/cmLocalNinjaGenerator.cxx b/Source/cmLocalNinjaGenerator.cxx
index 3261900..acaacdd 100644
--- a/Source/cmLocalNinjaGenerator.cxx
+++ b/Source/cmLocalNinjaGenerator.cxx
@@ -267,32 +267,6 @@ void cmLocalNinjaGenerator::SetConfigName()
     }
 }
 
-//----------------------------------------------------------------------------
-void cmLocalNinjaGenerator::ComputeObjectDirectory(cmTarget* tgt,
-                                                   std::string& dir)
-{
-  dir = this->GetMakefile()->GetCurrentOutputDirectory();
-  dir += "/";
-  dir += this->GetTargetDirectory(*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 fe8929a..2d870fb 100644
--- a/Source/cmLocalNinjaGenerator.h
+++ b/Source/cmLocalNinjaGenerator.h
@@ -100,13 +100,6 @@ 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&);
 
 protected:
   virtual std::string ConvertToIncludeReference(std::string const& path,
diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx
index b3c823e..3681e0e 100644
--- a/Source/cmLocalUnixMakefileGenerator3.cxx
+++ b/Source/cmLocalUnixMakefileGenerator3.cxx
@@ -172,83 +172,26 @@ void cmLocalUnixMakefileGenerator3::Generate()
 }
 
 //----------------------------------------------------------------------------
-void cmLocalUnixMakefileGenerator3::ComputeObjectDirectory(cmTarget* tgt,
-                                                           std::string& dir)
+void cmLocalUnixMakefileGenerator3::AddLocalObjectFile(
+  cmTarget* target, cmSourceFile* sf, std::string objNoTargetDir,
+  bool hasSourceExtension)
 {
-  dir = this->GetMakefile()->GetCurrentOutputDirectory();
-  dir += "/";
-  dir += this->GetTargetDirectory(*tgt);
-  dir += "/";
-}
-
-//----------------------------------------------------------------------------
-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)
+  if(cmSystemTools::FileIsFullPath(objNoTargetDir.c_str()))
     {
-    cmSourceFile* sf = *si;
-    objectFiles.push_back(this->GetObjectFileNameWithoutTarget(*sf, dir));
-    }
-}
-
-//----------------------------------------------------------------------------
-void cmLocalUnixMakefileGenerator3::
-GetLocalObjectFiles(std::map<std::string, LocalObjectInfo> &localObjectFiles)
-{
-  std::set<std::string> emitted;
-  cmGeneratorTargetsType targets = this->Makefile->GetGeneratorTargets();
-  for(cmGeneratorTargetsType::iterator ti = targets.begin();
-      ti != targets.end(); ++ti)
-    {
-    cmGeneratorTarget* gt = ti->second;
-    if (gt->GetType() == cmTarget::INTERFACE_LIBRARY)
-      {
-      continue;
-      }
-    std::vector<cmSourceFile*> objectSources;
-    gt->GetObjectSources(objectSources);
-    // Compute full path to object file directory for this target.
-    std::string dir_max;
-    dir_max += gt->Makefile->GetCurrentOutputDirectory();
-    dir_max += "/";
-    dir_max += this->GetTargetDirectory(*gt->Target);
-    dir_max += "/";
-    // Compute the name of each object file.
-    for(std::vector<cmSourceFile*>::iterator
-          si = objectSources.begin();
-        si != objectSources.end(); ++si)
-      {
-      cmSourceFile* sf = *si;
-      bool hasSourceExtension = true;
-      std::string objectName = this->GetObjectFileNameWithoutTarget(*sf,
-                                                                    dir_max,
-                                                        &hasSourceExtension);
-      if(cmSystemTools::FileIsFullPath(objectName.c_str()))
-        {
-        objectName = cmSystemTools::GetFilenameName(objectName);
-        }
-      LocalObjectInfo& info = localObjectFiles[objectName];
-      info.HasSourceExtension = hasSourceExtension;
-      info.push_back(LocalObjectEntry(gt->Target, sf->GetLanguage()));
-      }
+    objNoTargetDir = cmSystemTools::GetFilenameName(objNoTargetDir);
     }
+  LocalObjectInfo& info = this->LocalObjectFiles[objNoTargetDir];
+  info.HasSourceExtension = hasSourceExtension;
+  info.push_back(LocalObjectEntry(target, sf->GetLanguage()));
 }
 
 //----------------------------------------------------------------------------
 void cmLocalUnixMakefileGenerator3::GetIndividualFileTargets
                                             (std::vector<std::string>& targets)
 {
-  std::map<std::string, LocalObjectInfo> localObjectFiles;
-  this->GetLocalObjectFiles(localObjectFiles);
   for (std::map<std::string, LocalObjectInfo>::iterator lo =
-         localObjectFiles.begin();
-       lo != localObjectFiles.end(); ++lo)
+         this->LocalObjectFiles.begin();
+       lo != this->LocalObjectFiles.end(); ++lo)
     {
     targets.push_back(lo->first);
 
@@ -310,14 +253,11 @@ void cmLocalUnixMakefileGenerator3::WriteLocalMakefile()
   bool do_assembly_rules =
     this->GetCreateAssemblySourceRules();
 
-  std::map<std::string, LocalObjectInfo> localObjectFiles;
-  this->GetLocalObjectFiles(localObjectFiles);
-
   // now write out the object rules
   // for each object file name
   for (std::map<std::string, LocalObjectInfo>::iterator lo =
-         localObjectFiles.begin();
-       lo != localObjectFiles.end(); ++lo)
+         this->LocalObjectFiles.begin();
+       lo != this->LocalObjectFiles.end(); ++lo)
     {
     // Add a convenience rule for building the object file.
     this->WriteObjectConvenienceRule(ruleFileStream,
diff --git a/Source/cmLocalUnixMakefileGenerator3.h b/Source/cmLocalUnixMakefileGenerator3.h
index e2f8058..7987c96 100644
--- a/Source/cmLocalUnixMakefileGenerator3.h
+++ b/Source/cmLocalUnixMakefileGenerator3.h
@@ -223,6 +223,10 @@ public:
   // write the target rules for the local Makefile into the stream
   void WriteLocalAllRules(std::ostream& ruleFileStream);
 
+  void AddLocalObjectFile(cmTarget* target, cmSourceFile* sf,
+                          std::string objNoTargetDir,
+                          bool hasSourceExtension);
+
   std::vector<std::string> const& GetLocalHelp() { return this->LocalHelp; }
 
   /** Get whether to create rules to generate preprocessed and
@@ -242,14 +246,6 @@ 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&);
-
 protected:
   void WriteLocalMakefile();
 
@@ -369,9 +365,7 @@ private:
     LocalObjectInfo():HasSourceExtension(false), HasPreprocessRule(false),
                       HasAssembleRule(false) {}
   };
-  void GetLocalObjectFiles(
-                    std::map<std::string, LocalObjectInfo> &localObjectFiles);
-
+  std::map<std::string, LocalObjectInfo> LocalObjectFiles;
   void WriteObjectConvenienceRule(std::ostream& ruleFileStream,
                                   const char* comment, const char* output,
                                   LocalObjectInfo const& info);
diff --git a/Source/cmLocalVisualStudio6Generator.cxx b/Source/cmLocalVisualStudio6Generator.cxx
index ce55068..f1fd994 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(this->HasExplicitObjectName(*sf))
+    if(gt->HasExplicitObjectName(*sf))
       {
       objectNameDir = cmSystemTools::GetFilenamePath(gt->GetObjectName(*sf));
       }
diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx
index 8819361..4491140 100644
--- a/Source/cmLocalVisualStudio7Generator.cxx
+++ b/Source/cmLocalVisualStudio7Generator.cxx
@@ -1482,7 +1482,7 @@ cmLocalVisualStudio7GeneratorFCInfo
   cmGeneratorTarget* gt =
     lg->GetGlobalGenerator()->GetGeneratorTarget(&target);
   std::string objectName;
-  if(lg->HasExplicitObjectName(&sf))
+  if(gt->HasExplicitObjectName(&sf))
     {
     objectName = gt->GetObjectName(&sf);
     }
diff --git a/Source/cmLocalVisualStudioGenerator.cxx b/Source/cmLocalVisualStudioGenerator.cxx
index 88d793e..6e93d22 100644
--- a/Source/cmLocalVisualStudioGenerator.cxx
+++ b/Source/cmLocalVisualStudioGenerator.cxx
@@ -31,65 +31,6 @@ cmLocalVisualStudioGenerator::~cmLocalVisualStudioGenerator()
 }
 
 //----------------------------------------------------------------------------
-void cmLocalVisualStudioGenerator::ComputeObjectDirectory(cmTarget* tgt,
-                                                          std::string& dir)
-{
-  dir = this->GetMakefile()->GetCurrentOutputDirectory();
-  dir += "/";
-  std::string tgtDir = this->GetTargetDirectory(*tgt);
-  if(!tgtDir.empty())
-    {
-    dir += tgtDir;
-    dir += "/";
-    }
-  const char* cd = this->GetGlobalGenerator()->GetCMakeCFGIntDir();
-  if(cd && *cd)
-    {
-    dir += cd;
-    dir += "/";
-    }
-}
-
-//----------------------------------------------------------------------------
-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,
@@ -136,22 +77,6 @@ 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
-::GetDirectoryForObjects(cmTarget* tgt, std::string& dir)
-{
-  dir = this->ComputeLongestObjectDirectory(*tgt);
-}
-
-//----------------------------------------------------------------------------
 std::string
 cmLocalVisualStudioGenerator
 ::ConstructScript(cmCustomCommand const& cc,
diff --git a/Source/cmLocalVisualStudioGenerator.h b/Source/cmLocalVisualStudioGenerator.h
index ba39bf4..94a6293 100644
--- a/Source/cmLocalVisualStudioGenerator.h
+++ b/Source/cmLocalVisualStudioGenerator.h
@@ -61,15 +61,6 @@ public:
 
   virtual void AddCMakeListsRules() = 0;
 
-  void GetDirectoryForObjects(cmTarget* tgt, std::string& dir);
-
-  bool HasExplicitObjectName(cmSourceFile const* file) const;
-
-  virtual void ComputeObjectFilenames(
-                              const std::vector<cmSourceFile*>& objectSources,
-                              std::vector<std::string>& objectFiles,
-                              const std::string& dir);
-
 protected:
   virtual const char* ReportErrorLabel() const;
   virtual bool CustomCommandUseLocal() const { return false; }
@@ -80,10 +71,6 @@ protected:
                        bool isFortran);
 
   VSVersion Version;
-private:
-  virtual void ComputeObjectDirectory(cmTarget* tgt, std::string& dir);
-
-  std::set<cmSourceFile const*> ExplicitObjectName;
 };
 
 #endif
diff --git a/Source/cmLocalXCodeGenerator.cxx b/Source/cmLocalXCodeGenerator.cxx
index 05aed0c..5857aef 100644
--- a/Source/cmLocalXCodeGenerator.cxx
+++ b/Source/cmLocalXCodeGenerator.cxx
@@ -71,62 +71,3 @@ void cmLocalXCodeGenerator::GenerateInstallRules()
     t->HasMacOSXRpathInstallNameDir("");
     }
 }
-
-//----------------------------------------------------------------------------
-void cmLocalXCodeGenerator::GetDirectoryForObjects(cmTarget*,
-                                                   std::string&)
-{
-}
-
-//----------------------------------------------------------------------------
-void cmLocalXCodeGenerator::ComputeObjectDirectory(cmTarget* tgt,
-                                                   std::string& dir)
-{
-  cmGlobalXCodeGenerator* gg =
-    static_cast<cmGlobalXCodeGenerator*>(this->GlobalGenerator);
-  const char* configName = gg->GetCMakeCFGIntDir();
-  dir = gg->GetObjectsNormalDirectory("$(PROJECT_NAME)", configName, tgt);
-  if(gg->GetXcodeVersion() >= 21)
-    {
-    dir += "$(CURRENT_ARCH)/";
-    }
-  else
-    {
-#ifdef __ppc__
-    dir += "ppc/";
-#endif
-#ifdef __i386
-    dir += "i386/";
-#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 5cd8654..3bfe3a3 100644
--- a/Source/cmLocalXCodeGenerator.h
+++ b/Source/cmLocalXCodeGenerator.h
@@ -32,13 +32,7 @@ public:
                                 const std::string& rawFlag);
   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);
 
 };
 
diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx
index 5bb3b36..90155b4 100644
--- a/Source/cmVisualStudio10TargetGenerator.cxx
+++ b/Source/cmVisualStudio10TargetGenerator.cxx
@@ -1094,7 +1094,7 @@ bool cmVisualStudio10TargetGenerator::OutputSourceSpecificFlags(
   cmSourceFile& sf = *source;
 
   std::string objectName;
-  if(this->LocalGenerator->HasExplicitObjectName(&sf))
+  if(this->GeneratorTarget->HasExplicitObjectName(&sf))
     {
     objectName = this->GeneratorTarget->GetObjectName(&sf);
     }

-----------------------------------------------------------------------

Summary of changes:
 Source/cmGeneratorTarget.cxx               |   14 +++++
 Source/cmGeneratorTarget.h                 |    3 +
 Source/cmGlobalNinjaGenerator.cxx          |   26 ++++-----
 Source/cmGlobalUnixMakefileGenerator3.cxx  |   32 ++++++-----
 Source/cmGlobalVisualStudioGenerator.cxx   |   60 +++++++++++++++-----
 Source/cmGlobalXCodeGenerator.cxx          |   47 ++++++++++++----
 Source/cmGlobalXCodeGenerator.h            |   13 ++---
 Source/cmLocalGenerator.cxx                |   33 -----------
 Source/cmLocalGenerator.h                  |   11 ----
 Source/cmLocalNinjaGenerator.cxx           |   26 ---------
 Source/cmLocalNinjaGenerator.h             |    7 ---
 Source/cmLocalUnixMakefileGenerator3.cxx   |   84 ++++------------------------
 Source/cmLocalUnixMakefileGenerator3.h     |   16 ++----
 Source/cmLocalVisualStudio6Generator.cxx   |    2 +-
 Source/cmLocalVisualStudio7Generator.cxx   |    2 +-
 Source/cmLocalVisualStudioGenerator.cxx    |   75 -------------------------
 Source/cmLocalVisualStudioGenerator.h      |   13 -----
 Source/cmLocalXCodeGenerator.cxx           |   59 -------------------
 Source/cmLocalXCodeGenerator.h             |    6 --
 Source/cmVisualStudio10TargetGenerator.cxx |    2 +-
 20 files changed, 158 insertions(+), 373 deletions(-)


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list