cmExtraEclipseCDT4Generator.h 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  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. enum LinkType {VirtualFolder, LinkToFolder, LinkToFile };
  24. cmExtraEclipseCDT4Generator();
  25. static cmExternalMakefileProjectGenerator* New() {
  26. return new cmExtraEclipseCDT4Generator;
  27. }
  28. virtual std::string GetName() const {
  29. return cmExtraEclipseCDT4Generator::GetActualName();
  30. }
  31. static std::string GetActualName() { return "Eclipse CDT4"; }
  32. virtual void GetDocumentation(cmDocumentationEntry& entry,
  33. const std::string& fullName) const;
  34. virtual void EnableLanguage(std::vector<std::string> const& languages,
  35. cmMakefile *, bool optional);
  36. virtual void Generate();
  37. private:
  38. // create .project file in the source tree
  39. void CreateSourceProjectFile();
  40. // create .project file
  41. void CreateProjectFile();
  42. // create .cproject file
  43. void CreateCProjectFile() const;
  44. // If built with cygwin cmake, convert posix to windows path.
  45. static std::string GetEclipsePath(const std::string& path);
  46. // Extract basename.
  47. static std::string GetPathBasename(const std::string& path);
  48. // Generate the project name as: <name>-<type>@<path>
  49. static std::string GenerateProjectName(const std::string& name,
  50. const std::string& type,
  51. const std::string& path);
  52. static std::string EscapeForXML(const std::string& value);
  53. // Helper functions
  54. static void AppendStorageScanners(cmGeneratedFileStream& fout,
  55. const cmMakefile& makefile);
  56. static void AppendTarget (cmGeneratedFileStream& fout,
  57. const std::string& target,
  58. const std::string& make,
  59. const std::string& makeArguments,
  60. const std::string& path,
  61. const char* prefix = "",
  62. const char* makeTarget = NULL);
  63. static void AppendScannerProfile (cmGeneratedFileStream& fout,
  64. const std::string& profileID,
  65. bool openActionEnabled,
  66. const std::string& openActionFilePath,
  67. bool pParserEnabled,
  68. const std::string& scannerInfoProviderID,
  69. const std::string& runActionArguments,
  70. const std::string& runActionCommand,
  71. bool runActionUseDefault,
  72. bool sipParserEnabled);
  73. static void AppendLinkedResource (cmGeneratedFileStream& fout,
  74. const std::string& name,
  75. const std::string& path,
  76. LinkType linkType);
  77. static void AppendIncludeDirectories(cmGeneratedFileStream& fout,
  78. const std::vector<std::string>& includeDirs,
  79. std::set<std::string>& emittedDirs);
  80. static void AddEnvVar(cmGeneratedFileStream& fout, const char* envVar,
  81. cmLocalGenerator* lg);
  82. void CreateLinksToSubprojects(cmGeneratedFileStream& fout,
  83. const std::string& baseDir);
  84. void CreateLinksForTargets(cmGeneratedFileStream& fout);
  85. std::vector<std::string> SrcLinkedResources;
  86. std::set<std::string> Natures;
  87. std::string HomeDirectory;
  88. std::string HomeOutputDirectory;
  89. bool IsOutOfSourceBuild;
  90. bool GenerateSourceProject;
  91. bool GenerateLinkedResources;
  92. bool SupportsVirtualFolders;
  93. bool SupportsGmakeErrorParser;
  94. bool SupportsMachO64Parser;
  95. };
  96. #endif