cmExtraEclipseCDT4Generator.h 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. /*=========================================================================
  2. Program: CMake - Cross-Platform Makefile Generator
  3. Module: $RCSfile$
  4. Language: C++
  5. Date: $Date$
  6. Version: $Revision$
  7. Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved.
  8. Copyright (c) 2004 Alexander Neundorf, [email protected]. All rights reserved.
  9. Copyright (c) 2007 Miguel A. Figueroa-Villanueva. All rights reserved.
  10. See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details.
  11. This software is distributed WITHOUT ANY WARRANTY; without even
  12. the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
  13. PURPOSE. See the above copyright notices for more information.
  14. =========================================================================*/
  15. #ifndef cmExtraEclipseCDT4Generator_h
  16. #define cmExtraEclipseCDT4Generator_h
  17. #include "cmExternalMakefileProjectGenerator.h"
  18. class cmMakefile;
  19. class cmGeneratedFileStream;
  20. /** \class cmExtraEclipseCDT4Generator
  21. * \brief Write Eclipse project files for Makefile based projects
  22. *
  23. * This generator is in early alpha stage.
  24. */
  25. class cmExtraEclipseCDT4Generator : public cmExternalMakefileProjectGenerator
  26. {
  27. public:
  28. cmExtraEclipseCDT4Generator();
  29. static cmExternalMakefileProjectGenerator* New() {
  30. return new cmExtraEclipseCDT4Generator;
  31. }
  32. virtual const char* GetName() const {
  33. return cmExtraEclipseCDT4Generator::GetActualName();
  34. }
  35. static const char* GetActualName() { return "Eclipse CDT4"; }
  36. virtual void GetDocumentation(cmDocumentationEntry& entry,
  37. const char* fullName) const;
  38. virtual void SetGlobalGenerator(cmGlobalGenerator* generator);
  39. virtual void Generate();
  40. private:
  41. // create .project file in the source tree
  42. void CreateSourceProjectFile() const;
  43. // create .project file
  44. void CreateProjectFile();
  45. // create .cproject file
  46. void CreateCProjectFile() const;
  47. // Eclipse supported toolchain types
  48. enum EclipseToolchainType
  49. {
  50. EclipseToolchainOther,
  51. EclipseToolchainLinux,
  52. EclipseToolchainCygwin,
  53. EclipseToolchainMinGW,
  54. EclipseToolchainSolaris,
  55. EclipseToolchainMacOSX
  56. };
  57. static EclipseToolchainType GetToolChainType(const cmMakefile& makefile);
  58. // If built with cygwin cmake, convert posix to windows path.
  59. static std::string GetEclipsePath(const std::string& path);
  60. // Extract basename.
  61. static std::string GetPathBasename(const std::string& path);
  62. // Generate the project name as: <name>-<type>@<path>
  63. static std::string GenerateProjectName(const std::string& name,
  64. const std::string& type,
  65. const std::string& path);
  66. static std::string EscapeForXML(const std::string& value);
  67. // Helper functions
  68. static void AppendStorageScanners(cmGeneratedFileStream& fout,
  69. const cmMakefile& makefile);
  70. static void AppendTarget (cmGeneratedFileStream& fout,
  71. const std::string& target,
  72. const std::string& make);
  73. static void AppendScannerProfile (cmGeneratedFileStream& fout,
  74. const std::string& profileID,
  75. bool openActionEnabled,
  76. const std::string& openActionFilePath,
  77. bool pParserEnabled,
  78. const std::string& scannerInfoProviderID,
  79. const std::string& runActionArguments,
  80. const std::string& runActionCommand,
  81. bool runActionUseDefault,
  82. bool sipParserEnabled);
  83. static void AppendLinkedResource (cmGeneratedFileStream& fout,
  84. const std::string& name,
  85. const std::string& path);
  86. std::vector<std::string> SrcLinkedResources;
  87. std::vector<std::string> OutLinkedResources;
  88. std::string HomeDirectory;
  89. std::string HomeOutputDirectory;
  90. bool IsOutOfSourceBuild;
  91. bool GenerateSourceProject;
  92. };
  93. #endif