Fixed support for the Ninja build system.

This commit is contained in:
Morné Chamberlain 2012-10-13 11:20:09 +02:00
parent 4d585b109d
commit ef8aa081a1
1 changed files with 31 additions and 10 deletions

View File

@ -29,7 +29,12 @@
# define PATH_SEP "/" # define PATH_SEP "/"
#endif #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: Homepage:
http://www.sublimetext.com/ http://www.sublimetext.com/
@ -257,7 +262,6 @@ void cmExtraSublimeTextGenerator::
std::stringstream& fileIncludePatternsStream, std::stringstream& fileIncludePatternsStream,
std::set<std::string>& folderIncludePatternsSet) std::set<std::string>& folderIncludePatternsSet)
{ {
// Convert
const char* cmakeRoot = mf->GetDefinition("CMAKE_ROOT"); const char* cmakeRoot = mf->GetDefinition("CMAKE_ROOT");
for (std::vector<std::string>::const_iterator jt = allFiles.begin(); for (std::vector<std::string>::const_iterator jt = allFiles.begin();
jt != allFiles.end(); jt != allFiles.end();
@ -481,8 +485,17 @@ void cmExtraSublimeTextGenerator::AppendTarget(cmGeneratedFileStream& fout,
} }
// Write out the build_system data for this target // Write out the build_system data for this target
std::string makefileName = makefile->GetStartOutputDirectory(); 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"; makefileName += "/Makefile";
}
if (!firstTarget) if (!firstTarget)
{ {
fout << ",\n\t"; fout << ",\n\t";
@ -513,20 +526,28 @@ std::string cmExtraSublimeTextGenerator::BuildMakeCommand(
command += target; command += target;
command += "\""; 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 std::string makefileName = cmSystemTools::ConvertToOutputPath(makefile);
// http://public.kitware.com/Bug/view.php?id=10014
std::string makefileName = makefile;
command += ", \"-f\", \""; command += ", \"-f\", \"";
command += makefileName + "\""; command += makefileName + "\"";
command += ", \"VERBOSE=1\", \""; command += ", \"-v\", \"";
command += target; command += target;
command += "\""; command += "\"";
} }
else 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 += ", \"-f\", \"";
command += makefileName + "\""; command += makefileName + "\"";
command += ", \"VERBOSE=1\", \""; command += ", \"VERBOSE=1\", \"";