cmExtraSublimeTextGenerator.h 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. /*============================================================================
  2. CMake - Cross Platform Makefile Generator
  3. Copyright 2004-2009 Kitware, Inc.
  4. Copyright 2004 Alexander Neundorf ([email protected])
  5. Distributed under the OSI-approved BSD License (the "License");
  6. see accompanying file Copyright.txt for details.
  7. This software is distributed WITHOUT ANY WARRANTY; without even the
  8. implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  9. See the License for more information.
  10. ============================================================================*/
  11. #ifndef cmExtraSublimeTextGenerator_h
  12. #define cmExtraSublimeTextGenerator_h
  13. #include "cmExternalMakefileProjectGenerator.h"
  14. class cmLocalGenerator;
  15. class cmMakefile;
  16. class cmTarget;
  17. class cmGeneratedFileStream;
  18. /** \class cmExtraSublimeTextGenerator
  19. * \brief Write Sublime Text 2 project files for Makefile based projects
  20. */
  21. class cmExtraSublimeTextGenerator : public cmExternalMakefileProjectGenerator
  22. {
  23. public:
  24. cmExtraSublimeTextGenerator();
  25. virtual const char* GetName() const
  26. { return cmExtraSublimeTextGenerator::GetActualName();}
  27. static const char* GetActualName()
  28. { return "SublimeText2";}
  29. static cmExternalMakefileProjectGenerator* New()
  30. { return new cmExtraSublimeTextGenerator; }
  31. /** Get the documentation entry for this generator. */
  32. virtual void GetDocumentation(cmDocumentationEntry& entry,
  33. const char* fullName) const;
  34. virtual void Generate();
  35. private:
  36. void CreateProjectFile(const std::vector<cmLocalGenerator*>& lgs);
  37. void CreateNewProjectFile(const std::vector<cmLocalGenerator*>& lgs,
  38. const std::string& filename);
  39. /** Populates allFiles with the full paths to all of the source files
  40. * from the local generators in lgs.
  41. */
  42. void GetFileList(const std::vector<cmLocalGenerator*>& lgs,
  43. std::vector<std::string>& allFiles);
  44. /** Sends comma seperated source files paths to fileIncludePatternsStream
  45. * and builds a set of all directories and subdirectories containing
  46. * source files.
  47. */
  48. void GetFileStringAndFolderSet(const std::vector<cmLocalGenerator*>& lgs,
  49. const cmMakefile* mf,
  50. const std::vector<std::string>& allFiles,
  51. std::stringstream& fileIncludePatternsStream,
  52. std::set<std::string>&
  53. folderIncludePatternsSet);
  54. /** Appends all targets as build systems to the project file and get all
  55. * include directories and compiler definitions used.
  56. */
  57. void AppendAllTargets(const std::vector<cmLocalGenerator*>& lgs,
  58. const cmMakefile* mf,
  59. cmGeneratedFileStream& fout,
  60. std::set<std::string>& includeDirs,
  61. std::set<std::string>& defines);
  62. /** Returns the build command that needs to be executed to build the
  63. * specified target.
  64. */
  65. std::string BuildMakeCommand(const std::string& make, const char* makefile,
  66. const char* target);
  67. /** Appends the specified target to the generated project file as a Sublime
  68. * Text build system.
  69. */
  70. void AppendTarget(cmGeneratedFileStream& fout,
  71. const char* targetName,
  72. cmTarget* target,
  73. const char* make,
  74. const cmMakefile* makefile,
  75. const char* compiler,
  76. std::set<std::string>& includeDirs,
  77. std::set<std::string>& defines, bool firstTarget);
  78. };
  79. #endif