cmExtraEclipseCDT4Generator.h 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. /*============================================================================
  2. CMake - Cross Platform Makefile Generator
  3. Copyright 2004-2009 Kitware, Inc.
  4. Copyright 2004 Alexander Neundorf ([email protected])
  5. Copyright 2007 Miguel A. Figueroa-Villanueva
  6. Distributed under the OSI-approved BSD License (the "License");
  7. see accompanying file Copyright.txt for details.
  8. This software is distributed WITHOUT ANY WARRANTY; without even the
  9. implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  10. See the License for more information.
  11. ============================================================================*/
  12. #ifndef cmExtraEclipseCDT4Generator_h
  13. #define cmExtraEclipseCDT4Generator_h
  14. #include "cmExternalMakefileProjectGenerator.h"
  15. class cmMakefile;
  16. class cmGeneratedFileStream;
  17. /** \class cmExtraEclipseCDT4Generator
  18. * \brief Write Eclipse project files for Makefile based projects
  19. */
  20. class cmExtraEclipseCDT4Generator : public cmExternalMakefileProjectGenerator
  21. {
  22. public:
  23. cmExtraEclipseCDT4Generator();
  24. static cmExternalMakefileProjectGenerator* New() {
  25. return new cmExtraEclipseCDT4Generator;
  26. }
  27. virtual const char* GetName() const {
  28. return cmExtraEclipseCDT4Generator::GetActualName();
  29. }
  30. static const char* GetActualName() { return "Eclipse CDT4"; }
  31. virtual void GetDocumentation(cmDocumentationEntry& entry,
  32. const char* fullName) const;
  33. virtual void Generate();
  34. private:
  35. // create .project file in the source tree
  36. void CreateSourceProjectFile() const;
  37. // create .project file
  38. void CreateProjectFile();
  39. // create .cproject file
  40. void CreateCProjectFile() const;
  41. // If built with cygwin cmake, convert posix to windows path.
  42. static std::string GetEclipsePath(const std::string& path);
  43. // Extract basename.
  44. static std::string GetPathBasename(const std::string& path);
  45. // Generate the project name as: <name>-<type>@<path>
  46. static std::string GenerateProjectName(const std::string& name,
  47. const std::string& type,
  48. const std::string& path);
  49. static std::string EscapeForXML(const std::string& value);
  50. // Helper functions
  51. static void AppendStorageScanners(cmGeneratedFileStream& fout,
  52. const cmMakefile& makefile);
  53. static void AppendTarget (cmGeneratedFileStream& fout,
  54. const std::string& target,
  55. const std::string& make,
  56. const std::string& makeArguments,
  57. const std::string& path,
  58. const char* prefix = "");
  59. static void AppendScannerProfile (cmGeneratedFileStream& fout,
  60. const std::string& profileID,
  61. bool openActionEnabled,
  62. const std::string& openActionFilePath,
  63. bool pParserEnabled,
  64. const std::string& scannerInfoProviderID,
  65. const std::string& runActionArguments,
  66. const std::string& runActionCommand,
  67. bool runActionUseDefault,
  68. bool sipParserEnabled);
  69. static void AppendLinkedResource (cmGeneratedFileStream& fout,
  70. const std::string& name,
  71. const std::string& path);
  72. bool AppendOutLinkedResource(cmGeneratedFileStream& fout,
  73. const std::string& defname,
  74. const std::string& altdefname);
  75. static void AppendIncludeDirectories(cmGeneratedFileStream& fout,
  76. const std::vector<std::string>& includeDirs,
  77. std::set<std::string>& emittedDirs);
  78. static void AddEnvVar(cmGeneratedFileStream& fout, const char* envVar,
  79. cmMakefile* mf);
  80. std::vector<std::string> SrcLinkedResources;
  81. std::vector<std::string> OutLinkedResources;
  82. std::string HomeDirectory;
  83. std::string HomeOutputDirectory;
  84. bool IsOutOfSourceBuild;
  85. bool GenerateSourceProject;
  86. };
  87. #endif