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