1 /*============================================================================
2 CMake - Cross Platform Makefile Generator
3 Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
5 Distributed under the OSI-approved BSD License (the "License");
6 see accompanying file Copyright.txt for details.
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
15 #include "cmGlobalVisualStudioGenerator.h"
16 #include "cmGlobalGeneratorFactory.h"
19 struct cmIDEFlagTable;
21 /** \class cmGlobalVisualStudio7Generator
22 * \brief Write a Unix makefiles.
24 * cmGlobalVisualStudio7Generator manages UNIX build process for a tree
26 class cmGlobalVisualStudio7Generator : public cmGlobalVisualStudioGenerator
29 cmGlobalVisualStudio7Generator(const char* platformName = NULL);
30 static cmGlobalGeneratorFactory* NewFactory() {
31 return new cmGlobalGeneratorSimpleFactory
32 <cmGlobalVisualStudio7Generator>(); }
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";}
39 ///! Get the name for the platform.
40 const char* GetPlatformName() const { return this->PlatformName.c_str(); }
42 ///! Create a local generator appropriate to this Global Generator
43 virtual cmLocalGenerator *CreateLocalGenerator();
45 virtual void AddPlatformDefinitions(cmMakefile* mf);
47 /** Get the documentation entry for this generator. */
48 static void GetDocumentation(cmDocumentationEntry& entry);
51 * Try to determine system infomation such as shared library
52 * extension, pthreads, byte order etc.
54 virtual void EnableLanguage(std::vector<std::string>const& languages,
55 cmMakefile *, bool optional);
58 * Try running cmake and building a file. This is used for dynamically
59 * loaded commands, not as part of the usual build process.
61 virtual std::string GenerateBuildCommand(const char* makeProgram,
62 const char *projectName,
63 const char *projectDir,
64 const char* additionalOptions,
65 const char *targetName,
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.
75 virtual void Generate();
78 * Generate the DSW workspace file.
80 virtual void OutputSLNFile();
83 * Get the list of configurations
85 std::vector<std::string> *GetConfigurations();
87 ///! Create a GUID or get an existing one.
88 void CreateGUID(const char* name);
89 std::string GetGUID(const char* name);
91 /** Append the subdirectory for the given configuration. */
92 virtual void AppendDirectoryForConfig(const char* prefix,
97 ///! What is the configurations directory variable called?
98 virtual const char* GetCMakeCFGIntDir() const { return "$(OutDir)"; }
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; }
105 virtual const char* GetIDEVersion() { return "7.0"; }
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);
126 virtual void WriteTargetsToSolution(
128 cmLocalGenerator* root,
129 OrderedTargetDependSet const& projectTargets);
130 virtual void WriteTargetDepends(
132 OrderedTargetDependSet const& projectTargets);
133 virtual void WriteTargetConfigurations(
135 cmLocalGenerator* root,
136 OrderedTargetDependSet const& projectTargets);
138 void GenerateConfigurations(cmMakefile* mf);
140 virtual void WriteExternalProject(std::ostream& fout,
143 const char* typeGuid,
144 const std::set<cmStdString>&
147 std::string ConvertToSolutionPath(const char* path);
149 std::set<std::string> IsPartOfDefaultBuild(const char* project,
151 std::vector<std::string> Configurations;
152 std::map<cmStdString, cmStdString> GUIDMap;
154 virtual void WriteFolders(std::ostream& fout);
155 virtual void WriteFoldersContent(std::ostream& fout);
156 std::map<std::string,std::set<std::string> > VisualStudioFolders;
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;
164 #define CMAKE_CHECK_BUILD_SYSTEM_TARGET "ZERO_CHECK"