cmExtraSublimeTextGenerator.h 3.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  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 "Sublime Text 2";}
  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. * Extracts compile flags from a variable.
  65. * flag would typically be "-D" or "-I"
  66. */
  67. void ExtractFlags(const char* value, const std::string& flag,
  68. std::set<std::string> &defines);
  69. };
  70. #endif