summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRobert Maynard <robert.maynard@kitware.com>2013-02-06 18:31:44 (GMT)
committerBrad King <brad.king@kitware.com>2013-02-19 19:43:20 (GMT)
commit4760eade425e8e294ac9400785ffce70912d5b43 (patch)
tree42c6a522be0010a7cfc22bbe453bff89dee570b1
parentda0898e0a2f01cfbc5f2a1061ea94662fd3e455e (diff)
downloadCMake-4760eade425e8e294ac9400785ffce70912d5b43.zip
CMake-4760eade425e8e294ac9400785ffce70912d5b43.tar.gz
CMake-4760eade425e8e294ac9400785ffce70912d5b43.tar.bz2
Remove ability to generate sublime clang files.
SublimeClang is a optional plugin to SublimeText and I felt it shouldn't be part of the generator for the following reasons: 1. Reduces the amount of sublime and sublimeClang specific code we have to maintain inside CMake. 2. In testing the SublimeClang commands generated did not work for the VTK project. For people that do want this feature I recommend that they looking into https://gist.github.com/robertmaynard/4724705 for a way to use CMAKE_EXPORT_COMPILE_COMMANDS to generate JSON files that can be used by SublimeClang.
-rw-r--r--Source/cmDocumentVariables.cxx8
-rw-r--r--Source/cmExtraSublimeTextGenerator.cxx102
-rw-r--r--Source/cmExtraSublimeTextGenerator.h4
3 files changed, 5 insertions, 109 deletions
diff --git a/Source/cmDocumentVariables.cxx b/Source/cmDocumentVariables.cxx
index 579f77f..08b3ef1 100644
--- a/Source/cmDocumentVariables.cxx
+++ b/Source/cmDocumentVariables.cxx
@@ -904,14 +904,6 @@ void cmDocumentVariables::DefineVariables(cmake* cm)
"only be used when evaluating the INCLUDE_DIRECTORIES target property. "
"In that case, it outputs a backtrace for each include directory in "
"the build. Default is unset.",false,"Variables That Change Behavior");
- cm->DefineProperty
- ("CMAKE_SUBLIMECLANG_DISABLED", cmProperty::VARIABLE,
- "Used by the Sublime Text 2 generator to disable SublimeClang in "
- "generated project files.",
- "For very large projects SublimeClang might run slowly. Set this variable"
- " to TRUE to instruct the Sublime Text 2 generator to disable "
- " SublimeClang in the generated project files.", false,
- "Variables That Change Behavior");
// Variables defined by CMake that describe the system
diff --git a/Source/cmExtraSublimeTextGenerator.cxx b/Source/cmExtraSublimeTextGenerator.cxx
index d10179e..ef29329 100644
--- a/Source/cmExtraSublimeTextGenerator.cxx
+++ b/Source/cmExtraSublimeTextGenerator.cxx
@@ -87,8 +87,8 @@ void cmExtraSublimeTextGenerator::CreateProjectFile(
std::string outputDir=mf->GetStartOutputDirectory();
std::string projectName=mf->GetProjectName();
- std::string filename=outputDir+"/";
- filename+=projectName+".sublime-project";
+ const std::string filename =
+ outputDir + "/" + projectName + ".sublime-project";
this->CreateNewProjectFile(lgs, filename);
}
@@ -140,108 +140,14 @@ void cmExtraSublimeTextGenerator
// wide
MapSourceFileFlags sourceFileFlags;
AppendAllTargets(lgs, mf, fout, sourceFileFlags);
+
// End of build_systems
fout << "\n\t]";
-
- // Write the settings section with sublimeclang options
- fout << ",\n\t\"settings\":\n\t{\n\t";
- // Check if the CMAKE_SUBLIMECLANG_DISABLED flag has been set. If it has
- // disable sublimeclang for this project.
- const char* sublimeclangDisabledValue =
- mf->GetSafeDefinition("CMAKE_SUBLIMECLANG_DISABLED");
- bool sublimeclangEnabled = cmSystemTools::IsOff(sublimeclangDisabledValue);
- // Per project sublimeclang settings override default and user settings,
- // so we only write the sublimeclang_enabled setting to the project file
- // if it is set to be disabled.
- if (!sublimeclangEnabled)
- {
- fout << "\t\"sublimeclang_enabled\": false,\n\t";
- }
- std::string outputDir = mf->GetStartOutputDirectory();
- std::string projectName = mf->GetProjectName();
- std::string sublimeClangOptionsFilename = outputDir+"/";
- sublimeClangOptionsFilename += projectName + ".sublimeclang-options";
- std::string sublimeClangOptionsScriptFilename = outputDir + "/"
- + projectName + "_sublimeclang_options_script.py";
- fout << "\t\"sublimeclang_options_script\": \"python "
- << sublimeClangOptionsScriptFilename << " "
- << sublimeClangOptionsFilename
- << "\"\n\t";
- // End of the settings section
- fout << "}\n";
-
- // End of file
- fout << "}";
-
- this->WriteSublimeClangOptionsFile(sourceFileFlags,
- sublimeClangOptionsFilename);
- this->WriteSublimeClangOptionsScript(sublimeClangOptionsScriptFilename);
-}
-
-void cmExtraSublimeTextGenerator::
- WriteSublimeClangOptionsScript(const std::string& filename)
-{
- cmGeneratedFileStream fout(filename.c_str());
- if(!fout)
- {
- return;
- }
- fout << "import json\n";
- fout << "import sys\n\n\n";
- fout << "if len(sys.argv) < 2:\n";
- fout << " sys.exit(1)\n";
- fout << "data = None\n";
- fout << "with open(sys.argv[1]) as f:\n";
- fout << " data = json.load(f)\n";
- fout << "if data is not None:\n";
- fout << " for arg in data.get(sys.argv[2], []):\n";
- fout << " print arg\n";
+ fout << "\n\t}";
}
void cmExtraSublimeTextGenerator::
- WriteSublimeClangOptionsFile(const MapSourceFileFlags& sourceFileFlags,
- const std::string& filename)
-{
- cmGeneratedFileStream fout(filename.c_str());
- if(!fout)
- {
- return;
- }
- fout << "{\n";
- MapSourceFileFlags::const_iterator sourceFileFlagsEnd =
- sourceFileFlags.end();
- int totalFiles = sourceFileFlags.size();
- int fileIndex = 0;
- for (MapSourceFileFlags::const_iterator iter = sourceFileFlags.begin();
- iter != sourceFileFlagsEnd; ++iter)
- {
- const std::string& sourceFilePath = iter->first;
- const std::vector<std::string>& flags = iter->second;
- fout << "\t\"" << sourceFilePath << "\":\n\t[\n\t";
- std::vector<std::string>::const_iterator flagsEnd = flags.end();
- for (std::vector<std::string>::const_iterator flagsIter = flags.begin();
- flagsIter != flagsEnd; ++flagsIter)
- {
- fout << "\t\"" << *flagsIter << "\"";
- if (flagsIter + 1 != flagsEnd)
- {
- fout << ",";
- }
- fout << "\n\t";
- }
- fout << "]";
- if (fileIndex < totalFiles - 1)
- {
- fout << ",";
- }
- fout << "\n";
- fileIndex++;
- }
- fout << "}\n";
-}
-
-void cmExtraSublimeTextGenerator::
AppendAllTargets(const std::vector<cmLocalGenerator*>& lgs,
const cmMakefile* mf,
cmGeneratedFileStream& fout,
diff --git a/Source/cmExtraSublimeTextGenerator.h b/Source/cmExtraSublimeTextGenerator.h
index 8c0c1f3..7902593 100644
--- a/Source/cmExtraSublimeTextGenerator.h
+++ b/Source/cmExtraSublimeTextGenerator.h
@@ -48,9 +48,7 @@ private:
void CreateNewProjectFile(const std::vector<cmLocalGenerator*>& lgs,
const std::string& filename);
- void WriteSublimeClangOptionsScript(const std::string& filename);
- void WriteSublimeClangOptionsFile(const MapSourceFileFlags& sourceFileFlags,
- const std::string& filename);
+
/** Appends all targets as build systems to the project file and get all
* include directories and compiler definitions used.
*/