Ver código fonte

Merge topic 'vs-cleanup'

a5cb4fe1c6 cmGlobalVisualStudioGenerator: Remove unused code left from VS 7.1

Acked-by: Kitware Robot <[email protected]>
Merge-request: !11149
Brad King 3 meses atrás
pai
commit
d48a9e1111

+ 0 - 37
Source/cmGlobalVisualStudio71Generator.cxx

@@ -109,43 +109,6 @@ void cmGlobalVisualStudio71Generator::WriteProject(
   fout << "\tEndProjectSection\n";
 
   fout << "EndProject\n";
-
-  auto ui = this->UtilityDepends.find(t);
-  if (ui != this->UtilityDepends.end()) {
-    char const* uname = ui->second.c_str();
-    /* clang-format off */
-    fout << R"(Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = ")"
-         << uname << "\", \""
-         << this->ConvertToSolutionPath(dir) << (dir[0]? "\\":"")
-         << uname << ".vcproj" << "\", \"{"
-         << this->GetGUID(uname) << "}\"\n"
-         << "\tProjectSection(ProjectDependencies) = postProject\n"
-            "\t\t{" << guid << "} = {" << guid << "}\n"
-            "\tEndProjectSection\n"
-            "EndProject\n";
-    /* clang-format on */
-  }
-}
-
-// Write a dsp file into the SLN file,
-// Note, that dependencies from executables to
-// the libraries it uses are also done here
-void cmGlobalVisualStudio71Generator::WriteProjectDepends(
-  std::ostream& fout, std::string const&, std::string const&,
-  cmGeneratorTarget const* target) const
-{
-  auto i = this->VSTargetDepends.find(target);
-  assert(i != this->VSTargetDepends.end());
-  VSDependSet const& depends = i->second;
-  for (std::string const& name : depends) {
-    std::string guid = this->GetGUID(name);
-    if (guid.empty()) {
-      std::string m = cmStrCat("Target: ", target->GetName(),
-                               " depends on unknown target: ", name);
-      cmSystemTools::Error(m);
-    }
-    fout << "\t\t{" << guid << "} = {" << guid << "}\n";
-  }
 }
 
 // Write a dsp file into the SLN file, Note, that dependencies from

+ 0 - 3
Source/cmGlobalVisualStudio71Generator.h

@@ -36,9 +36,6 @@ protected:
   void WriteProject(std::ostream& fout, std::string const& name,
                     std::string const& path,
                     cmGeneratorTarget const* t) const override;
-  void WriteProjectDepends(std::ostream& fout, std::string const& name,
-                           std::string const& path,
-                           cmGeneratorTarget const* t) const override;
   void WriteProjectConfigurations(
     std::ostream& fout, std::string const& name,
     cmGeneratorTarget const& target, std::vector<std::string> const& configs,

+ 0 - 63
Source/cmGlobalVisualStudio7Generator.cxx

@@ -620,69 +620,6 @@ void cmGlobalVisualStudio7Generator::WriteSLNFooter(std::ostream& fout) const
   fout << "EndGlobal\n";
 }
 
-std::string cmGlobalVisualStudio7Generator::WriteUtilityDepend(
-  cmGeneratorTarget const* target)
-{
-  std::vector<std::string> configs =
-    target->Target->GetMakefile()->GetGeneratorConfigs(
-      cmMakefile::ExcludeEmptyConfig);
-  std::string pname = cmStrCat(target->GetName(), "_UTILITY");
-  std::string fname =
-    cmStrCat(target->GetLocalGenerator()->GetCurrentBinaryDirectory(), '/',
-             pname, ".vcproj");
-  cmGeneratedFileStream fout(fname);
-  fout.SetCopyIfDifferent(true);
-  std::string guid = this->GetGUID(pname);
-
-  /* clang-format off */
-  fout <<
-    R"(<?xml version="1.0" encoding = ")"
-    << this->Encoding() << "\"?>\n"
-    "<VisualStudioProject\n"
-    "\tProjectType=\"Visual C++\"\n"
-    "\tVersion=\"" << this->GetIDEVersion() << "0\"\n"
-    "\tName=\"" << pname << "\"\n"
-    "\tProjectGUID=\"{" << guid << "}\"\n"
-    "\tKeyword=\"Win32Proj\">\n"
-    "\t<Platforms><Platform Name=\"Win32\"/></Platforms>\n"
-    "\t<Configurations>\n"
-    ;
-  /* clang-format on */
-  std::string intDirPrefix =
-    target->GetLocalGenerator()->MaybeRelativeToCurBinDir(
-      cmStrCat(target->GetSupportDirectory(), '\\'));
-  for (std::string const& i : configs) {
-    std::string intDir = cmStrCat(intDirPrefix, i);
-
-    /* clang-format off */
-    fout <<
-      "\t\t<Configuration\n"
-      "\t\t\tName=\"" << i << "|Win32\"\n"
-      "\t\t\tOutputDirectory=\"" << i << "\"\n"
-      "\t\t\tIntermediateDirectory=\"" << intDir << "\"\n"
-      "\t\t\tConfigurationType=\"10\"\n"
-      "\t\t\tUseOfMFC=\"0\"\n"
-      "\t\t\tATLMinimizesCRunTimeLibraryUsage=\"FALSE\"\n"
-      "\t\t\tCharacterSet=\"2\">\n"
-      "\t\t</Configuration>\n"
-      ;
-    /* clang-format on */
-  }
-  /* clang-format off */
-  fout <<
-    "\t</Configurations>\n"
-    "\t<Files></Files>\n"
-    "\t<Globals></Globals>\n"
-    "</VisualStudioProject>\n"
-    ;
-  /* clang-format on */
-
-  if (fout.Close()) {
-    this->FileReplacedDuringGenerate(fname);
-  }
-  return pname;
-}
-
 std::string cmGlobalVisualStudio7Generator::GetGUID(
   std::string const& name) const
 {

+ 0 - 1
Source/cmGlobalVisualStudio7Generator.h

@@ -160,7 +160,6 @@ protected:
   virtual void WriteSLNGlobalSections(std::ostream& fout,
                                       cmLocalGenerator* root) const;
   virtual void WriteSLNFooter(std::ostream& fout) const;
-  std::string WriteUtilityDepend(cmGeneratorTarget const* target) override;
 
   VSFolders CreateSolutionFolders(
     OrderedTargetDependSet const& orderedProjectTargets);

+ 0 - 8
Source/cmGlobalVisualStudio8Generator.cxx

@@ -450,14 +450,6 @@ bool cmGlobalVisualStudio8Generator::TargetSystemSupportsDeployment() const
   return this->TargetsWindowsCE();
 }
 
-bool cmGlobalVisualStudio8Generator::ComputeTargetDepends()
-{
-  // Skip over the cmGlobalVisualStudioGenerator implementation!
-  // We do not need the support that VS <= 7.1 needs.
-  // NOLINTNEXTLINE(bugprone-parent-virtual-call)
-  return this->cmGlobalGenerator::ComputeTargetDepends();
-}
-
 void cmGlobalVisualStudio8Generator::WriteProjectDepends(
   std::ostream& fout, std::string const&, std::string const&,
   cmGeneratorTarget const* gt) const

+ 0 - 1
Source/cmGlobalVisualStudio8Generator.h

@@ -80,7 +80,6 @@ protected:
     cmGeneratorTarget const& target, std::vector<std::string> const& configs,
     std::set<std::string> const& configsPartOfDefaultBuild,
     std::string const& platformMapping = "") const override;
-  bool ComputeTargetDepends() override;
   void WriteProjectDepends(std::ostream& fout, std::string const& name,
                            std::string const& path,
                            cmGeneratorTarget const* t) const override;

+ 0 - 154
Source/cmGlobalVisualStudioGenerator.cxx

@@ -321,148 +321,6 @@ std::string cmGlobalVisualStudioGenerator::GetUserMacrosRegKeyBase()
   return "";
 }
 
-void cmGlobalVisualStudioGenerator::FillLinkClosure(
-  cmGeneratorTarget const* target, TargetSet& linked)
-{
-  if (linked.insert(target).second) {
-    TargetDependSet const& depends = this->GetTargetDirectDepends(target);
-    for (cmTargetDepend const& di : depends) {
-      if (di.IsLink()) {
-        this->FillLinkClosure(di, linked);
-      }
-    }
-  }
-}
-
-cmGlobalVisualStudioGenerator::TargetSet const&
-cmGlobalVisualStudioGenerator::GetTargetLinkClosure(cmGeneratorTarget* target)
-{
-  auto i = this->TargetLinkClosure.find(target);
-  if (i == this->TargetLinkClosure.end()) {
-    TargetSetMap::value_type entry(target, TargetSet());
-    i = this->TargetLinkClosure.insert(entry).first;
-    this->FillLinkClosure(target, i->second);
-  }
-  return i->second;
-}
-
-void cmGlobalVisualStudioGenerator::FollowLinkDepends(
-  cmGeneratorTarget const* target, std::set<cmGeneratorTarget const*>& linked)
-{
-  if (!target->IsInBuildSystem()) {
-    return;
-  }
-  if (linked.insert(target).second &&
-      target->GetType() == cmStateEnums::STATIC_LIBRARY) {
-    // Static library targets do not list their link dependencies so
-    // we must follow them transitively now.
-    TargetDependSet const& depends = this->GetTargetDirectDepends(target);
-    for (cmTargetDepend const& di : depends) {
-      if (di.IsLink()) {
-        this->FollowLinkDepends(di, linked);
-      }
-    }
-  }
-}
-
-bool cmGlobalVisualStudioGenerator::ComputeTargetDepends()
-{
-  if (!this->cmGlobalGenerator::ComputeTargetDepends()) {
-    return false;
-  }
-  for (auto const& it : this->ProjectMap) {
-    for (cmLocalGenerator const* i : it.second) {
-      for (auto const& ti : i->GetGeneratorTargets()) {
-        this->ComputeVSTargetDepends(ti.get());
-      }
-    }
-  }
-  return true;
-}
-
-static bool VSLinkable(cmGeneratorTarget const* t)
-{
-  return t->IsLinkable() || t->GetType() == cmStateEnums::OBJECT_LIBRARY;
-}
-
-void cmGlobalVisualStudioGenerator::ComputeVSTargetDepends(
-  cmGeneratorTarget* target)
-{
-  if (this->VSTargetDepends.find(target) != this->VSTargetDepends.end()) {
-    return;
-  }
-  VSDependSet& vsTargetDepend = this->VSTargetDepends[target];
-  // VS <= 7.1 has two behaviors that affect solution dependencies.
-  //
-  // (1) Solution-level dependencies between a linkable target and a
-  // library cause that library to be linked.  We use an intermediate
-  // empty utility target to express the dependency.  (VS 8 and above
-  // provide a project file "LinkLibraryDependencies" setting to
-  // choose whether to activate this behavior.  We disable it except
-  // when linking external project files.)
-  //
-  // (2) We cannot let static libraries depend directly on targets to
-  // which they "link" because the librarian tool will copy the
-  // targets into the static library.  While the work-around for
-  // behavior (1) would also avoid this, it would create a large
-  // number of extra utility targets for little gain.  Instead, use
-  // the above work-around only for dependencies explicitly added by
-  // the add_dependencies() command.  Approximate link dependencies by
-  // leaving them out for the static library itself but following them
-  // transitively for other targets.
-
-  bool allowLinkable = (target->GetType() != cmStateEnums::STATIC_LIBRARY &&
-                        target->GetType() != cmStateEnums::SHARED_LIBRARY &&
-                        target->GetType() != cmStateEnums::MODULE_LIBRARY &&
-                        target->GetType() != cmStateEnums::EXECUTABLE);
-
-  TargetDependSet const& depends = this->GetTargetDirectDepends(target);
-
-  // Collect implicit link dependencies (target_link_libraries).
-  // Static libraries cannot depend on their link implementation
-  // due to behavior (2), but they do not really need to.
-  std::set<cmGeneratorTarget const*> linkDepends;
-  if (target->GetType() != cmStateEnums::STATIC_LIBRARY) {
-    for (cmTargetDepend const& di : depends) {
-      if (di.IsLink()) {
-        this->FollowLinkDepends(di, linkDepends);
-      }
-    }
-  }
-
-  // Collect explicit util dependencies (add_dependencies).
-  std::set<cmGeneratorTarget const*> utilDepends;
-  for (cmTargetDepend const& di : depends) {
-    if (di.IsUtil()) {
-      this->FollowLinkDepends(di, utilDepends);
-    }
-  }
-
-  // Collect all targets linked by this target so we can avoid
-  // intermediate targets below.
-  TargetSet linked;
-  if (target->GetType() != cmStateEnums::STATIC_LIBRARY) {
-    linked = this->GetTargetLinkClosure(target);
-  }
-
-  // Emit link dependencies.
-  for (cmGeneratorTarget const* dep : linkDepends) {
-    vsTargetDepend.insert(dep->GetName());
-  }
-
-  // Emit util dependencies.  Possibly use intermediate targets.
-  for (cmGeneratorTarget const* dgt : utilDepends) {
-    if (allowLinkable || !VSLinkable(dgt) || linked.count(dgt)) {
-      // Direct dependency allowed.
-      vsTargetDepend.insert(dgt->GetName());
-    } else {
-      // Direct dependency on linkable target not allowed.
-      // Use an intermediate utility target.
-      vsTargetDepend.insert(this->GetUtilityDepend(dgt));
-    }
-  }
-}
-
 bool cmGlobalVisualStudioGenerator::FindMakeProgram(cmMakefile* mf)
 {
   // Visual Studio generators know how to lookup their build tool
@@ -474,18 +332,6 @@ bool cmGlobalVisualStudioGenerator::FindMakeProgram(cmMakefile* mf)
   return true;
 }
 
-std::string cmGlobalVisualStudioGenerator::GetUtilityDepend(
-  cmGeneratorTarget const* target)
-{
-  auto i = this->UtilityDepends.find(target);
-  if (i == this->UtilityDepends.end()) {
-    std::string name = this->WriteUtilityDepend(target);
-    UtilityDependsMap::value_type entry(target, name);
-    i = this->UtilityDepends.insert(entry).first;
-  }
-  return i->second;
-}
-
 std::string cmGlobalVisualStudioGenerator::GetStartupProjectName(
   cmLocalGenerator const* root) const
 {

+ 0 - 25
Source/cmGlobalVisualStudioGenerator.h

@@ -174,21 +174,6 @@ protected:
 
   void WriteSLNHeader(std::ostream& fout) const;
 
-  bool ComputeTargetDepends() override;
-  class VSDependSet : public std::set<std::string>
-  {
-  };
-  class VSDependMap : public std::map<cmGeneratorTarget const*, VSDependSet>
-  {
-  };
-  VSDependMap VSTargetDepends;
-  void ComputeVSTargetDepends(cmGeneratorTarget*);
-
-  virtual std::string WriteUtilityDepend(cmGeneratorTarget const*) = 0;
-  std::string GetUtilityDepend(cmGeneratorTarget const* target);
-  using UtilityDependsMap = std::map<cmGeneratorTarget const*, std::string>;
-  UtilityDependsMap UtilityDepends;
-
   VSVersion Version;
   bool ExpressEdition;
 
@@ -201,16 +186,6 @@ private:
                            cmValue) const override
   {
   }
-
-  void FollowLinkDepends(cmGeneratorTarget const* target,
-                         std::set<cmGeneratorTarget const*>& linked);
-
-  class TargetSetMap : public std::map<cmGeneratorTarget*, TargetSet>
-  {
-  };
-  TargetSetMap TargetLinkClosure;
-  void FillLinkClosure(cmGeneratorTarget const* target, TargetSet& linked);
-  TargetSet const& GetTargetLinkClosure(cmGeneratorTarget* target);
 };
 
 class cmGlobalVisualStudioGenerator::OrderedTargetDependSet