[Cmake-commits] CMake branch, next, updated. v3.2.3-1391-g898ccde

Brad King brad.king at kitware.com
Tue Jun 2 11:49:55 EDT 2015


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  898ccde4de1e9ef285d2a06b63d5455bd975d2f5 (commit)
       via  0fb452574f25304b78281011f6efb64c34f7b537 (commit)
      from  219c12f2eefbd17b84747d2ed8a0ad2f66000501 (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=898ccde4de1e9ef285d2a06b63d5455bd975d2f5
commit 898ccde4de1e9ef285d2a06b63d5455bd975d2f5
Merge: 219c12f 0fb4525
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Tue Jun 2 11:49:54 2015 -0400
Commit:     CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Tue Jun 2 11:49:54 2015 -0400

    Merge topic 'vs-deterministic-guid' into next
    
    0fb45257 VS: Compute project GUIDs deterministically


http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=0fb452574f25304b78281011f6efb64c34f7b537
commit 0fb452574f25304b78281011f6efb64c34f7b537
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Tue Jun 2 11:49:07 2015 -0400
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Tue Jun 2 11:49:07 2015 -0400

    VS: Compute project GUIDs deterministically
    
    Compute deterministic GUIDs that are unique to the build tree by
    hashing the path to the build tree with the GUID logical name.
    Avoid storing them in the cache, but honor any found there.
    This will allow project GUIDs to be reproduced in a fresh build
    tree so long as its path is the same as the original, which may
    be useful for incremental builds.

diff --git a/Source/cmGlobalGenerator.h b/Source/cmGlobalGenerator.h
index 979e971..598f6ad 100644
--- a/Source/cmGlobalGenerator.h
+++ b/Source/cmGlobalGenerator.h
@@ -310,8 +310,6 @@ public:
     {
     return this->BinaryDirectories.insert(dir).second;
     }
-  /** Supported systems creates a GUID for the given name */
-  virtual void CreateGUID(const std::string&) {}
 
   /** Return true if the generated build tree may contain multiple builds.
       i.e. "Can I build Debug and Release in the same tree?" */
diff --git a/Source/cmGlobalVisualStudio7Generator.cxx b/Source/cmGlobalVisualStudio7Generator.cxx
index 4dd54d0..a242046 100644
--- a/Source/cmGlobalVisualStudio7Generator.cxx
+++ b/Source/cmGlobalVisualStudio7Generator.cxx
@@ -513,8 +513,6 @@ void cmGlobalVisualStudio7Generator::WriteTargetsToSolution(
 
             cumulativePath = cumulativePath + "/" + *iter;
             }
-
-          this->CreateGUID(cumulativePath.c_str());
           }
 
         if (!cumulativePath.empty())
@@ -899,7 +897,6 @@ cmGlobalVisualStudio7Generator::WriteUtilityDepend(cmTarget const* target)
   fname += ".vcproj";
   cmGeneratedFileStream fout(fname.c_str());
   fout.SetCopyIfDifferent(true);
-  this->CreateGUID(pname.c_str());
   std::string guid = this->GetGUID(pname.c_str());
 
   fout <<
@@ -943,41 +940,28 @@ cmGlobalVisualStudio7Generator::WriteUtilityDepend(cmTarget const* target)
   return pname;
 }
 
-std::string cmGlobalVisualStudio7Generator::GetGUID(const std::string& name)
+//----------------------------------------------------------------------------
+std::string cmGlobalVisualStudio7Generator::GetGUID(std::string const& name)
 {
-  std::string guidStoreName = name;
-  guidStoreName += "_GUID_CMAKE";
-  const char* storedGUID =
-    this->CMakeInstance->GetCacheDefinition(guidStoreName.c_str());
-  if(storedGUID)
+  std::string const& guidStoreName = name + "_GUID_CMAKE";
+  if (const char* storedGUID =
+      this->CMakeInstance->GetCacheDefinition(guidStoreName.c_str()))
     {
     return std::string(storedGUID);
     }
-  cmSystemTools::Error("Unknown Target referenced : ",
-                       name.c_str());
-  return "";
-}
-
-
-void cmGlobalVisualStudio7Generator::CreateGUID(const std::string& name)
-{
-  std::string guidStoreName = name;
-  guidStoreName += "_GUID_CMAKE";
-  if(this->CMakeInstance->GetCacheDefinition(guidStoreName.c_str()))
-    {
-    return;
-    }
-  std::string ret;
-  UUID uid;
-  unsigned short *uidstr;
-  UuidCreate(&uid);
-  UuidToStringW(&uid,&uidstr);
-  ret = cmsys::Encoding::ToNarrow(reinterpret_cast<wchar_t*>(uidstr));
-  RpcStringFreeW(&uidstr);
-  ret = cmSystemTools::UpperCase(ret);
-  this->CMakeInstance->AddCacheEntry(guidStoreName.c_str(),
-                                     ret.c_str(), "Stored GUID",
-                                     cmState::INTERNAL);
+  // Compute a GUID that is deterministic but unique to the build tree.
+  std::string input = this->CMakeInstance->GetState()->GetBinaryDirectory();
+  input += "|";
+  input += name;
+  std::string md5 = cmSystemTools::ComputeStringMD5(input);
+  assert(md5.length() == 32);
+  std::string const& guid =
+    (md5.substr( 0,8)+"-"+
+     md5.substr( 8,4)+"-"+
+     md5.substr(12,4)+"-"+
+     md5.substr(16,4)+"-"+
+     md5.substr(20,12));
+  return cmSystemTools::UpperCase(guid);
 }
 
 //----------------------------------------------------------------------------
diff --git a/Source/cmGlobalVisualStudio7Generator.h b/Source/cmGlobalVisualStudio7Generator.h
index c98d269..931ac9c 100644
--- a/Source/cmGlobalVisualStudio7Generator.h
+++ b/Source/cmGlobalVisualStudio7Generator.h
@@ -80,9 +80,8 @@ public:
    */
   virtual void OutputSLNFile();
 
-  ///! Create a GUID or get an existing one.
-  void CreateGUID(const std::string& name);
-  std::string GetGUID(const std::string& name);
+  ///! Lookup a stored GUID or compute one deterministically.
+  std::string GetGUID(std::string const& name);
 
   /** Append the subdirectory for the given configuration.  */
   virtual void AppendDirectoryForConfig(const std::string& prefix,
diff --git a/Source/cmGlobalVisualStudio8Generator.cxx b/Source/cmGlobalVisualStudio8Generator.cxx
index a3ebc61..d24066f 100644
--- a/Source/cmGlobalVisualStudio8Generator.cxx
+++ b/Source/cmGlobalVisualStudio8Generator.cxx
@@ -185,7 +185,6 @@ void cmGlobalVisualStudio8Generator
 void cmGlobalVisualStudio8Generator::Configure()
 {
   this->cmGlobalVisualStudio7Generator::Configure();
-  this->CreateGUID(CMAKE_CHECK_BUILD_SYSTEM_TARGET);
 }
 
 //----------------------------------------------------------------------------
diff --git a/Source/cmLocalVisualStudio10Generator.cxx b/Source/cmLocalVisualStudio10Generator.cxx
index ad6a020..9ded83a 100644
--- a/Source/cmLocalVisualStudio10Generator.cxx
+++ b/Source/cmLocalVisualStudio10Generator.cxx
@@ -107,10 +107,9 @@ void cmLocalVisualStudio10Generator
   cmVS10XMLParser parser;
   parser.ParseFile(path);
 
-  // if we can not find a GUID then create one
+  // if we can not find a GUID then we will generate one later
   if(parser.GUID.empty())
     {
-    this->GlobalGenerator->CreateGUID(name);
     return;
     }
 
diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx
index 9c031cf..627f07a 100644
--- a/Source/cmLocalVisualStudio7Generator.cxx
+++ b/Source/cmLocalVisualStudio7Generator.cxx
@@ -96,10 +96,6 @@ void cmLocalVisualStudio7Generator::AddHelperCommands()
       this->ReadAndStoreExternalGUID(
         l->second.GetName().c_str(), path);
       }
-    else
-      {
-      gg->CreateGUID(l->first.c_str());
-      }
     }
 
 
@@ -2312,12 +2308,9 @@ void cmLocalVisualStudio7Generator::ReadAndStoreExternalGUID(
 {
   cmVS7XMLParser parser;
   parser.ParseFile(path);
-  // if we can not find a GUID then create one
+  // if we can not find a GUID then we will generate one later
   if(parser.GUID.size() == 0)
     {
-    cmGlobalVisualStudio7Generator* gg =
-      static_cast<cmGlobalVisualStudio7Generator *>(this->GlobalGenerator);
-    gg->CreateGUID(name);
     return;
     }
   std::string guidStoreName = name;
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index 7c74a0f..f953751 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -2116,25 +2116,11 @@ void cmMakefile::AddSourceGroup(const std::vector<std::string>& name,
     return;
     }
   // build the whole source group path
-  const char* fullname = sg->GetFullName();
   cmGlobalGenerator* gg = this->GetGlobalGenerator();
-  if(strlen(fullname))
-    {
-    std::string guidName = "SG_Filter_";
-    guidName += fullname;
-    gg->CreateGUID(guidName);
-    }
   for(++i; i<=lastElement; ++i)
     {
     sg->AddChild(cmSourceGroup(name[i].c_str(), 0, sg->GetFullName()));
     sg = sg->LookupChild(name[i].c_str());
-    fullname = sg->GetFullName();
-    if(strlen(fullname))
-      {
-      std::string guidName = "SG_Filter_";
-      guidName += fullname;
-      gg->CreateGUID(guidName);
-      }
     }
 
   sg->SetGroupRegex(regex);
diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx
index 5dfdb14..0be1335 100644
--- a/Source/cmVisualStudio10TargetGenerator.cxx
+++ b/Source/cmVisualStudio10TargetGenerator.cxx
@@ -178,7 +178,6 @@ cmVisualStudio10TargetGenerator(cmTarget* target,
     (cmLocalVisualStudio7Generator*)
     this->Makefile->GetLocalGenerator();
   this->Name = this->Target->GetName();
-  this->GlobalGenerator->CreateGUID(this->Name.c_str());
   this->GUID = this->GlobalGenerator->GetGUID(this->Name.c_str());
   this->Platform = gg->GetPlatformName();
   this->NsightTegra = gg->IsNsightTegra();
@@ -1084,7 +1083,6 @@ void cmVisualStudio10TargetGenerator::WriteGroups()
       (*this->BuildFileStream) << name << "\">\n";
       std::string guidName = "SG_Filter_";
       guidName += name;
-      this->GlobalGenerator->CreateGUID(guidName.c_str());
       this->WriteString("<UniqueIdentifier>", 3);
       std::string guid
         = this->GlobalGenerator->GetGUID(guidName.c_str());
@@ -1099,7 +1097,6 @@ void cmVisualStudio10TargetGenerator::WriteGroups()
     {
     this->WriteString("<Filter Include=\"Object Libraries\">\n", 2);
     std::string guidName = "SG_Filter_Object Libraries";
-    this->GlobalGenerator->CreateGUID(guidName.c_str());
     this->WriteString("<UniqueIdentifier>", 3);
     std::string guid =
       this->GlobalGenerator->GetGUID(guidName.c_str());
@@ -1112,7 +1109,6 @@ void cmVisualStudio10TargetGenerator::WriteGroups()
     {
     this->WriteString("<Filter Include=\"Resource Files\">\n", 2);
     std::string guidName = "SG_Filter_Resource Files";
-    this->GlobalGenerator->CreateGUID(guidName.c_str());
     this->WriteString("<UniqueIdentifier>", 3);
     std::string guid =
       this->GlobalGenerator->GetGUID(guidName.c_str());

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

Summary of changes:
 Source/cmGlobalGenerator.h                 |    2 --
 Source/cmGlobalVisualStudio7Generator.cxx  |   52 ++++++++++------------------
 Source/cmGlobalVisualStudio7Generator.h    |    5 ++-
 Source/cmGlobalVisualStudio8Generator.cxx  |    1 -
 Source/cmLocalVisualStudio10Generator.cxx  |    3 +-
 Source/cmLocalVisualStudio7Generator.cxx   |    9 +----
 Source/cmMakefile.cxx                      |   14 --------
 Source/cmVisualStudio10TargetGenerator.cxx |    4 ---
 8 files changed, 22 insertions(+), 68 deletions(-)


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list