[Cmake-commits] CMake branch, next, updated. v3.7.1-1463-gbec52e5

Brad King brad.king at kitware.com
Thu Dec 1 10:38:42 EST 2016


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  bec52e5115f2a5598b8d997f18dc1232e0a74f07 (commit)
       via  66bd8a3cf2f401f5d37bb8eff6da711824adea91 (commit)
      from  bd7c0fa734c662df43cd287ea37b7b84f5251601 (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 -----------------------------------------------------------------
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=bec52e5115f2a5598b8d997f18dc1232e0a74f07
commit bec52e5115f2a5598b8d997f18dc1232e0a74f07
Merge: bd7c0fa 66bd8a3
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Thu Dec 1 10:38:35 2016 -0500
Commit:     CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Thu Dec 1 10:38:35 2016 -0500

    Merge topic 'target_project_type' into next
    
    66bd8a3c cmVisualStudio10TargetGenerator: Prepare to handle C# projects


https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=66bd8a3cf2f401f5d37bb8eff6da711824adea91
commit 66bd8a3cf2f401f5d37bb8eff6da711824adea91
Author:     Michael Stürmer <michael.stuermer at schaeffler.com>
AuthorDate: Thu Dec 1 12:07:03 2016 +0100
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Thu Dec 1 10:36:43 2016 -0500

    cmVisualStudio10TargetGenerator: Prepare to handle C# projects
    
    Generalize some internal infrastructure to prepare for generating
    either `.vcxproj` or `.csproj` files.
    
    - Add member string for project file extension
    - Add member enum for project type
    - Add member flag for in-source build
    - Add member flag for managed build
    - Rename PathToVcxproj to PathToProjectFile

diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx
index 5b99007..22c3024 100644
--- a/Source/cmVisualStudio10TargetGenerator.cxx
+++ b/Source/cmVisualStudio10TargetGenerator.cxx
@@ -59,6 +59,16 @@ static bool cmVS10IsTargetsFile(std::string const& path)
   return cmSystemTools::Strucmp(ext.c_str(), ".targets") == 0;
 }
 
+static std::string computeProjectFileExtension(cmGeneratorTarget const* t)
+{
+  std::string res;
+  res = ".vcxproj";
+  if (cmGlobalVisualStudioGenerator::TargetIsCSharpOnly(t)) {
+    res = ".csproj";
+  }
+  return res;
+}
+
 cmVisualStudio10TargetGenerator::cmVisualStudio10TargetGenerator(
   cmGeneratorTarget* target, cmGlobalVisualStudio10Generator* gg)
 {
@@ -79,12 +89,16 @@ cmVisualStudio10TargetGenerator::cmVisualStudio10TargetGenerator(
          &this->NsightTegraVersion[0], &this->NsightTegraVersion[1],
          &this->NsightTegraVersion[2], &this->NsightTegraVersion[3]);
   this->MSTools = !this->NsightTegra;
+  this->Managed = false;
   this->TargetCompileAsWinRT = false;
   this->BuildFileStream = 0;
   this->IsMissingFiles = false;
   this->DefaultArtifactDir =
     this->LocalGenerator->GetCurrentBinaryDirectory() + std::string("/") +
     this->LocalGenerator->GetTargetDirectory(this->GeneratorTarget);
+  this->InSourceBuild =
+    (strcmp(this->Makefile->GetCurrentSourceDirectory(),
+            this->Makefile->GetCurrentBinaryDirectory()) == 0);
 }
 
 cmVisualStudio10TargetGenerator::~cmVisualStudio10TargetGenerator()
@@ -101,7 +115,7 @@ cmVisualStudio10TargetGenerator::~cmVisualStudio10TargetGenerator()
     return;
   }
   if (this->BuildFileStream->Close()) {
-    this->GlobalGenerator->FileReplacedDuringGenerate(this->PathToVcxproj);
+    this->GlobalGenerator->FileReplacedDuringGenerate(this->PathToProjectFile);
   }
   delete this->BuildFileStream;
 }
@@ -152,11 +166,20 @@ void cmVisualStudio10TargetGenerator::Generate()
       this->GeneratorTarget->GetProperty("EXTERNAL_MSPROJECT")) {
     return;
   }
+  this->ProjectFileExtension =
+    computeProjectFileExtension(this->GeneratorTarget);
+  if (this->ProjectFileExtension == ".vcxproj") {
+    this->ProjectType = vcxproj;
+    this->Managed = false;
+  } else if (this->ProjectFileExtension == ".csproj") {
+    this->ProjectType = csproj;
+    this->Managed = true;
+  }
   // Tell the global generator the name of the project file
   this->GeneratorTarget->Target->SetProperty("GENERATOR_FILE_NAME",
                                              this->Name.c_str());
-  this->GeneratorTarget->Target->SetProperty("GENERATOR_FILE_NAME_EXT",
-                                             ".vcxproj");
+  this->GeneratorTarget->Target->SetProperty(
+    "GENERATOR_FILE_NAME_EXT", this->ProjectFileExtension.c_str());
   if (this->GeneratorTarget->GetType() <= cmStateEnums::OBJECT_LIBRARY) {
     if (!this->ComputeClOptions()) {
       return;
@@ -177,9 +200,9 @@ void cmVisualStudio10TargetGenerator::Generate()
   std::string path = this->LocalGenerator->GetCurrentBinaryDirectory();
   path += "/";
   path += this->Name;
-  path += ".vcxproj";
+  path += this->ProjectFileExtension;
   this->BuildFileStream = new cmGeneratedFileStream(path.c_str());
-  this->PathToVcxproj = path;
+  this->PathToProjectFile = path;
   this->BuildFileStream->SetCopyIfDifferent(true);
 
   // Write the encoding header into the file
@@ -871,7 +894,8 @@ void cmVisualStudio10TargetGenerator::WriteGroups()
   std::string path = this->LocalGenerator->GetCurrentBinaryDirectory();
   path += "/";
   path += this->Name;
-  path += ".vcxproj.filters";
+  path += computeProjectFileExtension(this->GeneratorTarget);
+  path += ".filters";
   cmGeneratedFileStream fout(path.c_str());
   fout.SetCopyIfDifferent(true);
   char magic[] = { char(0xEF), char(0xBB), char(0xBF) };
@@ -1739,6 +1763,15 @@ bool cmVisualStudio10TargetGenerator::ComputeClOptions(
     }
   }
 
+  if (csproj != this->ProjectType && clOptions.IsManaged()) {
+    this->Managed = true;
+    std::string managedType = clOptions.GetFlag("CompileAsManaged");
+    if (managedType == "Safe") {
+      // force empty calling convention if safe clr is used
+      clOptions.AddFlag("CallingConvention", "");
+    }
+  }
+
   this->ClOptions[configName] = pOptions.release();
   return true;
 }
@@ -2650,8 +2683,9 @@ void cmVisualStudio10TargetGenerator::WriteProjectReferences()
       path = lg->GetCurrentBinaryDirectory();
       path += "/";
       path += dt->GetName();
-      path += ".vcxproj";
+      path += computeProjectFileExtension(dt);
     }
+    this->ConvertToWindowsSlash(path);
     (*this->BuildFileStream) << cmVS10EscapeXML(path) << "\">\n";
     this->WriteString("<Project>", 3);
     (*this->BuildFileStream) << this->GlobalGenerator->GetGUID(name.c_str())
diff --git a/Source/cmVisualStudio10TargetGenerator.h b/Source/cmVisualStudio10TargetGenerator.h
index a4e3adb..e68bf1a 100644
--- a/Source/cmVisualStudio10TargetGenerator.h
+++ b/Source/cmVisualStudio10TargetGenerator.h
@@ -145,7 +145,14 @@ private:
   OptionsMap RcOptions;
   OptionsMap MasmOptions;
   OptionsMap LinkOptions;
-  std::string PathToVcxproj;
+  std::string PathToProjectFile;
+  std::string ProjectFileExtension;
+  enum VsProjectType
+  {
+    vcxproj,
+    csproj
+  } ProjectType;
+  bool InSourceBuild;
   std::vector<std::string> Configurations;
   std::vector<TargetsFileAndConfigs> TargetsFileAndConfigsVec;
   cmGeneratorTarget* GeneratorTarget;
@@ -154,6 +161,7 @@ private:
   std::string GUID;
   std::string Name;
   bool MSTools;
+  bool Managed;
   bool NsightTegra;
   int NsightTegraVersion[4];
   bool TargetCompileAsWinRT;

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

Summary of changes:
 Source/cmVisualStudio10TargetGenerator.cxx |   48 ++++++++++++++++++++++++----
 Source/cmVisualStudio10TargetGenerator.h   |   10 +++++-
 2 files changed, 50 insertions(+), 8 deletions(-)


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list