cmExtraSublimeTextGenerator.h 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  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. /** Appends all targets as build systems to the project file and get all
  40. * include directories and compiler definitions used.
  41. */
  42. void AppendAllTargets(const std::vector<cmLocalGenerator*>& lgs,
  43. const cmMakefile* mf,
  44. cmGeneratedFileStream& fout,
  45. std::set<std::string>& includeDirs,
  46. std::set<std::string>& defines);
  47. /** Returns the build command that needs to be executed to build the
  48. * specified target.
  49. */
  50. std::string BuildMakeCommand(const std::string& make, const char* makefile,
  51. const char* target);
  52. /** Appends the specified target to the generated project file as a Sublime
  53. * Text build system.
  54. */
  55. void AppendTarget(cmGeneratedFileStream& fout,
  56. const char* targetName,
  57. cmTarget* target,
  58. const char* make,
  59. const cmMakefile* makefile,
  60. const char* compiler,
  61. std::set<std::string>& includeDirs,
  62. std::set<std::string>& defines, bool firstTarget);
  63. };
  64. #endif