cmExtraSublimeTextGenerator.h 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  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. #include "cmSourceFile.h"
  15. class cmLocalGenerator;
  16. class cmMakefile;
  17. class cmGeneratedFileStream;
  18. class cmGeneratorTarget;
  19. /** \class cmExtraSublimeTextGenerator
  20. * \brief Write Sublime Text 2 project files for Makefile based projects
  21. */
  22. class cmExtraSublimeTextGenerator : public cmExternalMakefileProjectGenerator
  23. {
  24. public:
  25. static cmExternalMakefileProjectGeneratorFactory* GetFactory();
  26. typedef std::map<std::string, std::vector<std::string> > MapSourceFileFlags;
  27. cmExtraSublimeTextGenerator();
  28. void Generate() CM_OVERRIDE;
  29. private:
  30. void CreateProjectFile(const std::vector<cmLocalGenerator*>& lgs);
  31. void CreateNewProjectFile(const std::vector<cmLocalGenerator*>& lgs,
  32. const std::string& filename);
  33. /** Appends all targets as build systems to the project file and get all
  34. * include directories and compiler definitions used.
  35. */
  36. void AppendAllTargets(const std::vector<cmLocalGenerator*>& lgs,
  37. const cmMakefile* mf, cmGeneratedFileStream& fout,
  38. MapSourceFileFlags& sourceFileFlags);
  39. /** Returns the build command that needs to be executed to build the
  40. * specified target.
  41. */
  42. std::string BuildMakeCommand(const std::string& make, const char* makefile,
  43. const std::string& target);
  44. /** Appends the specified target to the generated project file as a Sublime
  45. * Text build system.
  46. */
  47. void AppendTarget(cmGeneratedFileStream& fout, const std::string& targetName,
  48. cmLocalGenerator* lg, cmGeneratorTarget* target,
  49. const char* make, const cmMakefile* makefile,
  50. const char* compiler, MapSourceFileFlags& sourceFileFlags,
  51. bool firstTarget);
  52. /**
  53. * Compute the flags for compilation of object files for a given @a language.
  54. * @note Generally it is the value of the variable whose name is computed
  55. * by LanguageFlagsVarName().
  56. */
  57. std::string ComputeFlagsForObject(cmSourceFile* source, cmLocalGenerator* lg,
  58. cmGeneratorTarget* gtgt);
  59. std::string ComputeDefines(cmSourceFile* source, cmLocalGenerator* lg,
  60. cmGeneratorTarget* gtgt);
  61. };
  62. #endif