Imported Upstream version 2.8.12.2
[platform/upstream/cmake.git] / Source / cmLocalVisualStudio6Generator.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 cmLocalVisualStudio6Generator_h
13 #define cmLocalVisualStudio6Generator_h
14
15 #include "cmLocalVisualStudioGenerator.h"
16
17 class cmTarget;
18 class cmSourceFile;
19 class cmSourceGroup;
20 class cmCustomCommand;
21
22 /** \class cmLocalVisualStudio6Generator
23  * \brief Write a LocalUnix makefiles.
24  *
25  * cmLocalVisualStudio6Generator produces a LocalUnix makefile from its
26  * member this->Makefile.
27  */
28 class cmLocalVisualStudio6Generator : public cmLocalVisualStudioGenerator
29 {
30 public:
31   ///! Set cache only and recurse to false by default.
32   cmLocalVisualStudio6Generator();
33
34   virtual ~cmLocalVisualStudio6Generator();
35
36   virtual void AddHelperCommands();
37   virtual void AddCMakeListsRules();
38
39   /**
40    * Generate the makefile for this directory.
41    */
42   virtual void Generate();
43
44   void OutputDSPFile();
45
46   enum BuildType {STATIC_LIBRARY, DLL, EXECUTABLE, WIN32_EXECUTABLE, UTILITY};
47
48   /**
49    * Specify the type of the build: static, dll, or executable.
50    */
51   void SetBuildType(BuildType, const char* libName, cmTarget&);
52
53   virtual std::string GetTargetDirectory(cmTarget const& target) const;
54   virtual std::string ComputeLongestObjectDirectory(cmTarget&) const;
55 private:
56   std::string DSPHeaderTemplate;
57   std::string DSPFooterTemplate;
58
59   void CreateSingleDSP(const char *lname, cmTarget &tgt);
60   void WriteDSPFile(std::ostream& fout, const char *libName,
61                     cmTarget &tgt);
62   void WriteDSPBeginGroup(std::ostream& fout,
63                           const char* group,
64                           const char* filter);
65   void WriteDSPEndGroup(std::ostream& fout);
66
67   void WriteDSPHeader(std::ostream& fout, const char *libName,
68                       cmTarget &tgt, std::vector<cmSourceGroup> &sgs);
69
70   void WriteDSPFooter(std::ostream& fout);
71   void AddDSPBuildRule(cmTarget& tgt);
72   void WriteCustomRule(std::ostream& fout,
73                        const char* source,
74                        const cmCustomCommand& command,
75                        const char* flags);
76   void AddUtilityCommandHack(cmTarget& target, int count,
77                              std::vector<std::string>& depends,
78                              const cmCustomCommand& origCommand);
79   void WriteGroup(const cmSourceGroup *sg, cmTarget& target,
80                   std::ostream &fout, const char *libName);
81   class EventWriter;
82   friend class EventWriter;
83   cmsys::auto_ptr<cmCustomCommand>
84   MaybeCreateOutputDir(cmTarget& target, const char* config);
85   std::string CreateTargetRules(cmTarget &target,
86                                 const char* configName,
87                                 const char *libName);
88   void ComputeLinkOptions(cmTarget& target, const char* configName,
89                           const std::string extraOptions,
90                           std::string& options);
91   void OutputObjects(cmTarget& target, const char* tool,
92                      std::string& options);
93   std::string GetTargetIncludeOptions(cmTarget &target, const char *config);
94   std::vector<std::string> Configurations;
95
96   std::string GetConfigName(std::string const& configuration) const;
97
98   // Special definition check for VS6.
99   virtual bool CheckDefinition(std::string const& define) const;
100 };
101
102 #endif
103