cmExtraEclipseCDT4Generator.h 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  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 <cmConfigure.h>
  15. #include "cmExternalMakefileProjectGenerator.h"
  16. #include <iosfwd>
  17. #include <set>
  18. #include <string>
  19. #include <vector>
  20. class cmLocalGenerator;
  21. class cmMakefile;
  22. class cmSourceGroup;
  23. class cmXMLWriter;
  24. /** \class cmExtraEclipseCDT4Generator
  25. * \brief Write Eclipse project files for Makefile based projects
  26. */
  27. class cmExtraEclipseCDT4Generator : public cmExternalMakefileProjectGenerator
  28. {
  29. public:
  30. enum LinkType
  31. {
  32. VirtualFolder,
  33. LinkToFolder,
  34. LinkToFile
  35. };
  36. cmExtraEclipseCDT4Generator();
  37. static cmExternalMakefileProjectGeneratorFactory* GetFactory();
  38. void EnableLanguage(std::vector<std::string> const& languages, cmMakefile*,
  39. bool optional) CM_OVERRIDE;
  40. void Generate() CM_OVERRIDE;
  41. private:
  42. // create .project file in the source tree
  43. void CreateSourceProjectFile();
  44. // create .project file
  45. void CreateProjectFile();
  46. // create .cproject file
  47. void CreateCProjectFile() const;
  48. // If built with cygwin cmake, convert posix to windows path.
  49. static std::string GetEclipsePath(const std::string& path);
  50. // Extract basename.
  51. static std::string GetPathBasename(const std::string& path);
  52. // Generate the project name as: <name>-<type>@<path>
  53. static std::string GenerateProjectName(const std::string& name,
  54. const std::string& type,
  55. const std::string& path);
  56. // Helper functions
  57. static void AppendStorageScanners(cmXMLWriter& xml,
  58. const cmMakefile& makefile);
  59. static void AppendTarget(cmXMLWriter& xml, const std::string& target,
  60. const std::string& make,
  61. const std::string& makeArguments,
  62. const std::string& path, const char* prefix = "",
  63. const char* makeTarget = CM_NULLPTR);
  64. static void AppendScannerProfile(
  65. cmXMLWriter& xml, const std::string& profileID, bool openActionEnabled,
  66. const std::string& openActionFilePath, bool pParserEnabled,
  67. const std::string& scannerInfoProviderID,
  68. const std::string& runActionArguments, const std::string& runActionCommand,
  69. bool runActionUseDefault, bool sipParserEnabled);
  70. static void AppendLinkedResource(cmXMLWriter& xml, const std::string& name,
  71. const std::string& path, LinkType linkType);
  72. static void AppendIncludeDirectories(
  73. cmXMLWriter& xml, const std::vector<std::string>& includeDirs,
  74. std::set<std::string>& emittedDirs);
  75. static void AddEnvVar(std::ostream& out, const char* envVar,
  76. cmLocalGenerator* lg);
  77. void WriteGroups(std::vector<cmSourceGroup> const& sourceGroups,
  78. std::string& linkName, cmXMLWriter& xml);
  79. void CreateLinksToSubprojects(cmXMLWriter& xml, const std::string& baseDir);
  80. void CreateLinksForTargets(cmXMLWriter& xml);
  81. std::vector<std::string> SrcLinkedResources;
  82. std::set<std::string> Natures;
  83. std::string HomeDirectory;
  84. std::string HomeOutputDirectory;
  85. bool IsOutOfSourceBuild;
  86. bool GenerateSourceProject;
  87. bool GenerateLinkedResources;
  88. bool SupportsVirtualFolders;
  89. bool SupportsGmakeErrorParser;
  90. bool SupportsMachO64Parser;
  91. bool CEnabled;
  92. bool CXXEnabled;
  93. };
  94. #endif