cmExtraEclipseCDT4Generator.h 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  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 cmXMLWriter;
  17. class cmSourceGroup;
  18. /** \class cmExtraEclipseCDT4Generator
  19. * \brief Write Eclipse project files for Makefile based projects
  20. */
  21. class cmExtraEclipseCDT4Generator : public cmExternalMakefileProjectGenerator
  22. {
  23. public:
  24. enum LinkType {VirtualFolder, LinkToFolder, LinkToFile };
  25. cmExtraEclipseCDT4Generator();
  26. static cmExternalMakefileProjectGenerator* New() {
  27. return new cmExtraEclipseCDT4Generator;
  28. }
  29. virtual std::string GetName() const {
  30. return cmExtraEclipseCDT4Generator::GetActualName();
  31. }
  32. static std::string GetActualName() { return "Eclipse CDT4"; }
  33. virtual void GetDocumentation(cmDocumentationEntry& entry,
  34. const std::string& fullName) const;
  35. virtual void EnableLanguage(std::vector<std::string> const& languages,
  36. cmMakefile *, bool optional);
  37. virtual void Generate();
  38. private:
  39. // create .project file in the source tree
  40. void CreateSourceProjectFile();
  41. // create .project file
  42. void CreateProjectFile();
  43. // create .cproject file
  44. void CreateCProjectFile() const;
  45. // If built with cygwin cmake, convert posix to windows path.
  46. static std::string GetEclipsePath(const std::string& path);
  47. // Extract basename.
  48. static std::string GetPathBasename(const std::string& path);
  49. // Generate the project name as: <name>-<type>@<path>
  50. static std::string GenerateProjectName(const std::string& name,
  51. const std::string& type,
  52. const std::string& path);
  53. // Helper functions
  54. static void AppendStorageScanners(cmXMLWriter& xml,
  55. const cmMakefile& makefile);
  56. static void AppendTarget (cmXMLWriter& xml,
  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 (cmXMLWriter& xml,
  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 (cmXMLWriter& xml,
  74. const std::string& name,
  75. const std::string& path,
  76. LinkType linkType);
  77. static void AppendIncludeDirectories(cmXMLWriter& xml,
  78. const std::vector<std::string>& includeDirs,
  79. std::set<std::string>& emittedDirs);
  80. static void AddEnvVar(std::ostream& out, const char* envVar,
  81. cmLocalGenerator* lg);
  82. void WriteGroups(std::vector<cmSourceGroup> const& sourceGroups,
  83. std::string& linkName, cmXMLWriter& xml);
  84. void CreateLinksToSubprojects(cmXMLWriter& xml, const std::string& baseDir);
  85. void CreateLinksForTargets(cmXMLWriter& xml);
  86. std::vector<std::string> SrcLinkedResources;
  87. std::set<std::string> Natures;
  88. std::string HomeDirectory;
  89. std::string HomeOutputDirectory;
  90. bool IsOutOfSourceBuild;
  91. bool GenerateSourceProject;
  92. bool GenerateLinkedResources;
  93. bool SupportsVirtualFolders;
  94. bool SupportsGmakeErrorParser;
  95. bool SupportsMachO64Parser;
  96. bool CEnabled;
  97. bool CXXEnabled;
  98. };
  99. #endif