Imported Upstream version 2.8.12.2
[platform/upstream/cmake.git] / Source / cmLocalVisualStudio7Generator.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 cmLocalVisualStudio7Generator_h
13 #define cmLocalVisualStudio7Generator_h
14
15 #include "cmLocalVisualStudioGenerator.h"
16 #include "cmVisualStudioGeneratorOptions.h"
17
18 class cmTarget;
19 class cmSourceFile;
20 class cmCustomCommand;
21 class cmSourceGroup;
22
23
24 class cmLocalVisualStudio7GeneratorOptions;
25 class cmLocalVisualStudio7GeneratorFCInfo;
26 class cmLocalVisualStudio7GeneratorInternals;
27
28 /** \class cmLocalVisualStudio7Generator
29  * \brief Write Visual Studio .NET project files.
30  *
31  * cmLocalVisualStudio7Generator produces a Visual Studio .NET project
32  * file for each target in its directory.
33  */
34 class cmLocalVisualStudio7Generator : public cmLocalVisualStudioGenerator
35 {
36 public:
37   ///! Set cache only and recurse to false by default.
38   cmLocalVisualStudio7Generator(VSVersion v);
39
40   virtual ~cmLocalVisualStudio7Generator();
41
42   virtual void AddHelperCommands();
43
44   /**
45    * Generate the makefile for this directory.
46    */
47   virtual void Generate();
48
49   enum BuildType {STATIC_LIBRARY, DLL, EXECUTABLE, WIN32_EXECUTABLE, UTILITY};
50
51   /**
52    * Specify the type of the build: static, dll, or executable.
53    */
54   void SetBuildType(BuildType,const char *name);
55
56   void SetPlatformName(const char* n) { this->PlatformName = n;}
57
58   void SetExtraFlagTable(cmVS7FlagTable const* table)
59     { this->ExtraFlagTable = table; }
60   virtual std::string GetTargetDirectory(cmTarget const&) const;
61   cmSourceFile* CreateVCProjBuildRule();
62   void WriteStampFiles();
63   virtual std::string ComputeLongestObjectDirectory(cmTarget&) const;
64
65   virtual void ReadAndStoreExternalGUID(const char* name,
66                                         const char* path);
67   virtual void AddCMakeListsRules();
68 protected:
69   void CreateSingleVCProj(const char *lname, cmTarget &tgt);
70 private:
71   typedef cmVisualStudioGeneratorOptions Options;
72   typedef cmLocalVisualStudio7GeneratorFCInfo FCInfo;
73   std::string GetBuildTypeLinkerFlags(std::string rootLinkerFlags,
74                                       const char* configName);
75   void FixGlobalTargets();
76   void WriteProjectFiles();
77   void WriteVCProjHeader(std::ostream& fout, const char *libName,
78                          cmTarget &tgt, std::vector<cmSourceGroup> &sgs);
79   void WriteVCProjFooter(std::ostream& fout, cmTarget &target);
80   void WriteVCProjFile(std::ostream& fout, const char *libName,
81                        cmTarget &tgt);
82   void WriteConfigurations(std::ostream& fout,
83                            const char *libName, cmTarget &tgt);
84   void WriteConfiguration(std::ostream& fout,
85                           const char* configName,
86                           const char* libName, cmTarget &tgt);
87   std::string EscapeForXML(const char* s);
88   std::string ConvertToXMLOutputPath(const char* path);
89   std::string ConvertToXMLOutputPathSingle(const char* path);
90   void OutputTargetRules(std::ostream& fout, const char* configName,
91                          cmTarget &target, const char *libName);
92   void OutputBuildTool(std::ostream& fout, const char* configName,
93                        cmTarget& t, const Options& targetOptions);
94   void OutputLibraryDirectories(std::ostream& fout,
95                                 std::vector<std::string> const& dirs);
96   void WriteProjectSCC(std::ostream& fout, cmTarget& target);
97   void WriteProjectStart(std::ostream& fout, const char *libName,
98                          cmTarget &tgt, std::vector<cmSourceGroup> &sgs);
99   void WriteProjectStartFortran(std::ostream& fout, const char *libName,
100                                 cmTarget &tgt);
101   void WriteVCProjBeginGroup(std::ostream& fout,
102                           const char* group,
103                           const char* filter);
104   void WriteVCProjEndGroup(std::ostream& fout);
105
106   void WriteCustomRule(std::ostream& fout,
107                        const char* source,
108                        const cmCustomCommand& command,
109                        FCInfo& fcinfo);
110   void WriteTargetVersionAttribute(std::ostream& fout, cmTarget& target);
111
112   bool WriteGroup(const cmSourceGroup *sg,
113                   cmTarget& target, std::ostream &fout,
114                   const char *libName, std::vector<std::string> *configs);
115
116   friend class cmLocalVisualStudio7GeneratorFCInfo;
117   friend class cmLocalVisualStudio7GeneratorInternals;
118
119   class EventWriter;
120   friend class EventWriter;
121
122   cmVS7FlagTable const* ExtraFlagTable;
123   std::string ModuleDefinitionFile;
124   bool FortranProject;
125   bool WindowsCEProject;
126   std::string PlatformName; // Win32 or x64
127   cmLocalVisualStudio7GeneratorInternals* Internal;
128 };
129
130
131 #endif
132