Imported Upstream version 2.8.12.2
[platform/upstream/cmake.git] / Source / cmGlobalVisualStudio7Generator.h
1 /*============================================================================
2   CMake - Cross Platform Makefile Generator
3   Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
4
5   Distributed under the OSI-approved BSD License (the "License");
6   see accompanying file Copyright.txt for details.
7
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 cmGlobalVisualStudio7Generator_h
13 #define cmGlobalVisualStudio7Generator_h
14
15 #include "cmGlobalVisualStudioGenerator.h"
16 #include "cmGlobalGeneratorFactory.h"
17
18 class cmTarget;
19 struct cmIDEFlagTable;
20
21 /** \class cmGlobalVisualStudio7Generator
22  * \brief Write a Unix makefiles.
23  *
24  * cmGlobalVisualStudio7Generator manages UNIX build process for a tree
25  */
26 class cmGlobalVisualStudio7Generator : public cmGlobalVisualStudioGenerator
27 {
28 public:
29   cmGlobalVisualStudio7Generator(const char* platformName = NULL);
30   static cmGlobalGeneratorFactory* NewFactory() {
31     return new cmGlobalGeneratorSimpleFactory
32       <cmGlobalVisualStudio7Generator>(); }
33
34   ///! Get the name for the generator.
35   virtual const char* GetName() const {
36     return cmGlobalVisualStudio7Generator::GetActualName();}
37   static const char* GetActualName() {return "Visual Studio 7";}
38
39   ///! Get the name for the platform.
40   const char* GetPlatformName() const { return this->PlatformName.c_str(); }
41
42   ///! Create a local generator appropriate to this Global Generator
43   virtual cmLocalGenerator *CreateLocalGenerator();
44
45   virtual void AddPlatformDefinitions(cmMakefile* mf);
46
47   /** Get the documentation entry for this generator.  */
48   static void GetDocumentation(cmDocumentationEntry& entry);
49
50   /**
51    * Try to determine system infomation such as shared library
52    * extension, pthreads, byte order etc.
53    */
54   virtual void EnableLanguage(std::vector<std::string>const& languages,
55                               cmMakefile *, bool optional);
56
57   /**
58    * Try running cmake and building a file. This is used for dynamically
59    * loaded commands, not as part of the usual build process.
60    */
61   virtual std::string GenerateBuildCommand(const char* makeProgram,
62                                            const char *projectName,
63                                            const char *projectDir,
64                                            const char* additionalOptions,
65                                            const char *targetName,
66                                            const char* config,
67                                            bool ignoreErrors,
68                                            bool fast);
69
70   /**
71    * Generate the all required files for building this project/tree. This
72    * basically creates a series of LocalGenerators for each directory and
73    * requests that they Generate.
74    */
75   virtual void Generate();
76
77   /**
78    * Generate the DSW workspace file.
79    */
80   virtual void OutputSLNFile();
81
82   /**
83    * Get the list of configurations
84    */
85   std::vector<std::string> *GetConfigurations();
86
87   ///! Create a GUID or get an existing one.
88   void CreateGUID(const char* name);
89   std::string GetGUID(const char* name);
90
91   /** Append the subdirectory for the given configuration.  */
92   virtual void AppendDirectoryForConfig(const char* prefix,
93                                         const char* config,
94                                         const char* suffix,
95                                         std::string& dir);
96
97   ///! What is the configurations directory variable called?
98   virtual const char* GetCMakeCFGIntDir() const { return "$(OutDir)"; }
99
100   /** Return true if the target project file should have the option
101       LinkLibraryDependencies and link to .sln dependencies. */
102   virtual bool NeedLinkLibraryDependencies(cmTarget&) { return false; }
103
104 protected:
105   virtual const char* GetIDEVersion() { return "7.0"; }
106
107   static cmIDEFlagTable const* GetExtraFlagTableVS7();
108   virtual void OutputSLNFile(cmLocalGenerator* root,
109                              std::vector<cmLocalGenerator*>& generators);
110   virtual void WriteSLNFile(std::ostream& fout, cmLocalGenerator* root,
111                             std::vector<cmLocalGenerator*>& generators);
112   virtual void WriteProject(std::ostream& fout,
113                             const char* name, const char* path, cmTarget &t);
114   virtual void WriteProjectDepends(std::ostream& fout,
115                            const char* name, const char* path, cmTarget &t);
116   virtual void WriteProjectConfigurations(
117     std::ostream& fout, const char* name, cmTarget::TargetType type,
118     const std::set<std::string>& configsPartOfDefaultBuild,
119     const char* platformMapping = NULL);
120   virtual void WriteSLNGlobalSections(std::ostream& fout,
121                                       cmLocalGenerator* root);
122   virtual void WriteSLNFooter(std::ostream& fout);
123   virtual void WriteSLNHeader(std::ostream& fout);
124   virtual std::string WriteUtilityDepend(cmTarget* target);
125
126   virtual void WriteTargetsToSolution(
127     std::ostream& fout,
128     cmLocalGenerator* root,
129     OrderedTargetDependSet const& projectTargets);
130   virtual void WriteTargetDepends(
131     std::ostream& fout,
132     OrderedTargetDependSet const& projectTargets);
133   virtual void WriteTargetConfigurations(
134     std::ostream& fout,
135     cmLocalGenerator* root,
136     OrderedTargetDependSet const& projectTargets);
137
138   void GenerateConfigurations(cmMakefile* mf);
139
140   virtual void WriteExternalProject(std::ostream& fout,
141                                     const char* name,
142                                     const char* path,
143                                     const char* typeGuid,
144                                     const std::set<cmStdString>&
145                                     dependencies);
146
147   std::string ConvertToSolutionPath(const char* path);
148
149   std::set<std::string> IsPartOfDefaultBuild(const char* project,
150                                              cmTarget* target);
151   std::vector<std::string> Configurations;
152   std::map<cmStdString, cmStdString> GUIDMap;
153
154   virtual void WriteFolders(std::ostream& fout);
155   virtual void WriteFoldersContent(std::ostream& fout);
156   std::map<std::string,std::set<std::string> > VisualStudioFolders;
157
158   // Set during OutputSLNFile with the name of the current project.
159   // There is one SLN file per project.
160   std::string CurrentProject;
161   std::string PlatformName;
162 };
163
164 #define CMAKE_CHECK_BUILD_SYSTEM_TARGET "ZERO_CHECK"
165
166 #endif