packaging: Initial packaging
[platform/upstream/cmake.git] / Source / cmExtraEclipseCDT4Generator.h
1 /*============================================================================
2   CMake - Cross Platform Makefile Generator
3   Copyright 2004-2009 Kitware, Inc.
4   Copyright 2004 Alexander Neundorf (neundorf@kde.org)
5   Copyright 2007 Miguel A. Figueroa-Villanueva
6
7   Distributed under the OSI-approved BSD License (the "License");
8   see accompanying file Copyright.txt for details.
9
10   This software is distributed WITHOUT ANY WARRANTY; without even the
11   implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12   See the License for more information.
13 ============================================================================*/
14 #ifndef cmExtraEclipseCDT4Generator_h
15 #define cmExtraEclipseCDT4Generator_h
16
17 #include "cmExternalMakefileProjectGenerator.h"
18
19 class cmMakefile;
20 class cmGeneratedFileStream;
21
22 /** \class cmExtraEclipseCDT4Generator
23  * \brief Write Eclipse project files for Makefile based projects
24  */
25 class cmExtraEclipseCDT4Generator : public cmExternalMakefileProjectGenerator
26 {
27 public:
28   enum LinkType {VirtualFolder, LinkToFolder, LinkToFile };
29
30   cmExtraEclipseCDT4Generator();
31
32   static cmExternalMakefileProjectGenerator* New() {
33     return new cmExtraEclipseCDT4Generator;
34   }
35
36   virtual const char* GetName() const {
37     return cmExtraEclipseCDT4Generator::GetActualName();
38   }
39
40   static const char* GetActualName() { return "Eclipse CDT4"; }
41
42   virtual void GetDocumentation(cmDocumentationEntry& entry,
43                                 const char*           fullName) const;
44
45   virtual void Generate();
46
47 private:
48   // create .project file in the source tree
49   void CreateSourceProjectFile();
50
51   // create .project file
52   void CreateProjectFile();
53
54   // create .cproject file
55   void CreateCProjectFile() const;
56
57   // If built with cygwin cmake, convert posix to windows path.
58   static std::string GetEclipsePath(const std::string& path);
59
60   // Extract basename.
61   static std::string GetPathBasename(const std::string& path);
62
63   // Generate the project name as: <name>-<type>@<path>
64   static std::string GenerateProjectName(const std::string& name,
65                                          const std::string& type,
66                                          const std::string& path);
67
68   static std::string EscapeForXML(const std::string& value);
69
70   // Helper functions
71   static void AppendStorageScanners(cmGeneratedFileStream& fout,
72                                     const cmMakefile& makefile);
73   static void AppendTarget         (cmGeneratedFileStream& fout,
74                                     const std::string&     target,
75                                     const std::string&     make,
76                                     const std::string&     makeArguments,
77                                     const std::string&     path,
78                                     const char* prefix = "",
79                                     const char* makeTarget = NULL);
80   static void AppendScannerProfile (cmGeneratedFileStream& fout,
81                                     const std::string&   profileID,
82                                     bool                 openActionEnabled,
83                                     const std::string&   openActionFilePath,
84                                     bool                 pParserEnabled,
85                                     const std::string&   scannerInfoProviderID,
86                                     const std::string&   runActionArguments,
87                                     const std::string&   runActionCommand,
88                                     bool                 runActionUseDefault,
89                                     bool                 sipParserEnabled);
90
91   static void AppendLinkedResource (cmGeneratedFileStream& fout,
92                                     const std::string&     name,
93                                     const std::string&     path,
94                                     LinkType linkType);
95
96   static void AppendIncludeDirectories(cmGeneratedFileStream& fout,
97                                    const std::vector<std::string>& includeDirs,
98                                    std::set<std::string>& emittedDirs);
99
100   static void AddEnvVar(cmGeneratedFileStream& fout, const char* envVar,
101                         cmMakefile* mf);
102
103   void CreateLinksToSubprojects(cmGeneratedFileStream& fout,
104                                 const std::string& baseDir);
105   void CreateLinksForTargets(cmGeneratedFileStream& fout);
106
107   std::vector<std::string> SrcLinkedResources;
108   std::string HomeDirectory;
109   std::string HomeOutputDirectory;
110   bool IsOutOfSourceBuild;
111   bool GenerateSourceProject;
112   bool GenerateLinkedResources;
113   bool SupportsVirtualFolders;
114   bool SupportsGmakeErrorParser;
115
116 };
117
118 #endif