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