1 /*============================================================================
2 CMake - Cross Platform Makefile Generator
3 Copyright 2004-2009 Kitware, Inc.
4 Copyright 2004 Alexander Neundorf (neundorf@kde.org)
6 Distributed under the OSI-approved BSD License (the "License");
7 see accompanying file Copyright.txt for details.
9 This software is distributed WITHOUT ANY WARRANTY; without even the
10 implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
11 See the License for more information.
12 ============================================================================*/
13 #ifndef cmExtraSublimeTextGenerator_h
14 #define cmExtraSublimeTextGenerator_h
16 #include "cmExternalMakefileProjectGenerator.h"
17 #include "cmSourceFile.h"
19 class cmLocalGenerator;
22 class cmGeneratedFileStream;
23 class cmGeneratorTarget;
25 /** \class cmExtraSublimeTextGenerator
26 * \brief Write Sublime Text 2 project files for Makefile based projects
28 class cmExtraSublimeTextGenerator : public cmExternalMakefileProjectGenerator
31 typedef std::map<std::string, std::vector<std::string> > MapSourceFileFlags;
32 cmExtraSublimeTextGenerator();
34 virtual const char* GetName() const
35 { return cmExtraSublimeTextGenerator::GetActualName();}
36 static const char* GetActualName()
37 { return "Sublime Text 2";}
38 static cmExternalMakefileProjectGenerator* New()
39 { return new cmExtraSublimeTextGenerator; }
40 /** Get the documentation entry for this generator. */
41 virtual void GetDocumentation(cmDocumentationEntry& entry,
42 const char* fullName) const;
44 virtual void Generate();
47 void CreateProjectFile(const std::vector<cmLocalGenerator*>& lgs);
49 void CreateNewProjectFile(const std::vector<cmLocalGenerator*>& lgs,
50 const std::string& filename);
52 /** Appends all targets as build systems to the project file and get all
53 * include directories and compiler definitions used.
55 void AppendAllTargets(const std::vector<cmLocalGenerator*>& lgs,
57 cmGeneratedFileStream& fout,
58 MapSourceFileFlags& sourceFileFlags);
59 /** Returns the build command that needs to be executed to build the
62 std::string BuildMakeCommand(const std::string& make, const char* makefile,
64 /** Appends the specified target to the generated project file as a Sublime
67 void AppendTarget(cmGeneratedFileStream& fout,
68 const char* targetName,
72 const cmMakefile* makefile,
74 MapSourceFileFlags& sourceFileFlags, bool firstTarget);
76 * Compute the flags for compilation of object files for a given @a language.
77 * @note Generally it is the value of the variable whose name is computed
78 * by LanguageFlagsVarName().
80 std::string ComputeFlagsForObject(cmSourceFile *source,
83 cmGeneratorTarget* gtgt);
85 std::string ComputeDefines(cmSourceFile *source, cmLocalGenerator* lg,
86 cmTarget *target, cmGeneratorTarget* gtgt);