cmExtraEclipseCDT4Generator.h 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  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. * This generator is in early alpha stage.
  21. */
  22. class cmExtraEclipseCDT4Generator : public cmExternalMakefileProjectGenerator
  23. {
  24. public:
  25. cmExtraEclipseCDT4Generator();
  26. static cmExternalMakefileProjectGenerator* New() {
  27. return new cmExtraEclipseCDT4Generator;
  28. }
  29. virtual const char* GetName() const {
  30. return cmExtraEclipseCDT4Generator::GetActualName();
  31. }
  32. static const char* GetActualName() { return "Eclipse CDT4"; }
  33. virtual void GetDocumentation(cmDocumentationEntry& entry,
  34. const char* fullName) const;
  35. virtual void SetGlobalGenerator(cmGlobalGenerator* generator);
  36. virtual void Generate();
  37. private:
  38. // create .project file in the source tree
  39. void CreateSourceProjectFile() const;
  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& path,
  60. const char* prefix = "");
  61. static void AppendScannerProfile (cmGeneratedFileStream& fout,
  62. const std::string& profileID,
  63. bool openActionEnabled,
  64. const std::string& openActionFilePath,
  65. bool pParserEnabled,
  66. const std::string& scannerInfoProviderID,
  67. const std::string& runActionArguments,
  68. const std::string& runActionCommand,
  69. bool runActionUseDefault,
  70. bool sipParserEnabled);
  71. static void AppendLinkedResource (cmGeneratedFileStream& fout,
  72. const std::string& name,
  73. const std::string& path);
  74. bool AppendOutLinkedResource(cmGeneratedFileStream& fout,
  75. const std::string& defname,
  76. const std::string& altdefname);
  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. cmMakefile* mf);
  82. std::vector<std::string> SrcLinkedResources;
  83. std::vector<std::string> OutLinkedResources;
  84. std::string HomeDirectory;
  85. std::string HomeOutputDirectory;
  86. bool IsOutOfSourceBuild;
  87. bool GenerateSourceProject;
  88. };
  89. #endif