瀏覽代碼

Fixed support for the Ninja build system.

Morné Chamberlain 13 年之前
父節點
當前提交
ef8aa081a1
共有 1 個文件被更改,包括 31 次插入10 次删除
  1. 31 10
      Source/cmExtraSublimeTextGenerator.cxx

+ 31 - 10
Source/cmExtraSublimeTextGenerator.cxx

@@ -29,7 +29,12 @@
 #  define PATH_SEP "/"
 #endif
 
-/* Some useful URLs:
+/*
+Sublime Text 2 Generator
+Author: Morné Chamberlain
+This generator was initially based off of the CodeBlocks generator.
+
+Some useful URLs:
 Homepage:
 http://www.sublimetext.com/
 
@@ -257,7 +262,6 @@ void cmExtraSublimeTextGenerator::
                             std::stringstream& fileIncludePatternsStream,
                             std::set<std::string>& folderIncludePatternsSet)
 {
-  // Convert
   const char* cmakeRoot = mf->GetDefinition("CMAKE_ROOT");
   for (std::vector<std::string>::const_iterator jt = allFiles.begin();
        jt != allFiles.end();
@@ -481,8 +485,17 @@ void cmExtraSublimeTextGenerator::AppendTarget(cmGeneratedFileStream& fout,
     }
 
   // Write out the build_system data for this target
-  std::string makefileName = makefile->GetStartOutputDirectory();
-  makefileName += "/Makefile";
+  std::string makefileName = makefile->GetHomeOutputDirectory();
+  // Ninja uses ninja.build files (look for a way to get the output file name
+  // from cmMakefile)
+  if (strcmp(this->GlobalGenerator->GetName(), "Ninja")==0)
+    {
+      makefileName += "/build.ninja";
+    }
+    else
+    {
+      makefileName += "/Makefile";
+    }
   if (!firstTarget)
     {
     fout << ",\n\t";
@@ -513,20 +526,28 @@ std::string cmExtraSublimeTextGenerator::BuildMakeCommand(
     command += target;
     command += "\"";
     }
-  else if (strcmp(this->GlobalGenerator->GetName(), "MinGW Makefiles")==0)
+  else if (strcmp(this->GlobalGenerator->GetName(), "Ninja")==0)
     {
-    // no escaping of spaces in this case, see
-    // http://public.kitware.com/Bug/view.php?id=10014
-    std::string makefileName = makefile;
+    std::string makefileName = cmSystemTools::ConvertToOutputPath(makefile);
     command += ", \"-f\", \"";
     command += makefileName + "\"";
-    command += ", \"VERBOSE=1\", \"";
+    command += ", \"-v\", \"";
     command += target;
     command += "\"";
     }
   else
     {
-    std::string makefileName = cmSystemTools::ConvertToOutputPath(makefile);
+    std::string makefileName;
+    if (strcmp(this->GlobalGenerator->GetName(), "MinGW Makefiles")==0)
+      {
+        // no escaping of spaces in this case, see
+        // http://public.kitware.com/Bug/view.php?id=10014
+        makefileName = makefile;
+      }
+      else
+      {
+        makefileName = cmSystemTools::ConvertToOutputPath(makefile);
+      }
     command += ", \"-f\", \"";
     command += makefileName + "\"";
     command += ", \"VERBOSE=1\", \"";