1 /*=========================================================================
3 Program: CMake - Cross-Platform Makefile Generator
4 Module: $RCSfile: cmLocalVisualStudio7Generator.h,v $
6 Date: $Date: 2009-07-29 15:28:54 $
7 Version: $Revision: 1.59 $
9 Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved.
10 See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details.
12 This software is distributed WITHOUT ANY WARRANTY; without even
13 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
14 PURPOSE. See the above copyright notices for more information.
16 =========================================================================*/
17 #ifndef cmLocalVisualStudio7Generator_h
18 #define cmLocalVisualStudio7Generator_h
20 #include "cmLocalVisualStudioGenerator.h"
21 #include "cmVisualStudioGeneratorOptions.h"
25 class cmCustomCommand
;
29 class cmLocalVisualStudio7GeneratorOptions
;
30 class cmLocalVisualStudio7GeneratorFCInfo
;
31 class cmLocalVisualStudio7GeneratorInternals
;
33 /** \class cmLocalVisualStudio7Generator
34 * \brief Write Visual Studio .NET project files.
36 * cmLocalVisualStudio7Generator produces a Visual Studio .NET project
37 * file for each target in its directory.
39 class cmLocalVisualStudio7Generator
: public cmLocalVisualStudioGenerator
42 ///! Set cache only and recurse to false by default.
43 cmLocalVisualStudio7Generator();
45 virtual ~cmLocalVisualStudio7Generator();
47 virtual void AddHelperCommands();
50 * Generate the makefile for this directory.
52 virtual void Generate();
54 enum BuildType
{STATIC_LIBRARY
, DLL
, EXECUTABLE
, WIN32_EXECUTABLE
, UTILITY
};
57 * Specify the type of the build: static, dll, or executable.
59 void SetBuildType(BuildType
,const char *name
);
61 void SetVersion71() {this->Version
= 71;}
62 void SetVersion8() {this->Version
= 8;}
63 void SetVersion9() {this->Version
= 9;}
64 void SetPlatformName(const char* n
) { this->PlatformName
= n
;}
65 virtual void ConfigureFinalPass();
66 void GetTargetObjectFileDirectories(cmTarget
* target
,
67 std::vector
<std::string
>&
70 void SetExtraFlagTable(cmVS7FlagTable
const* table
)
71 { this->ExtraFlagTable
= table
; }
72 virtual std::string
GetTargetDirectory(cmTarget
const&) const;
73 cmSourceFile
* CreateVCProjBuildRule();
74 void WriteStampFiles();
75 // Compute the maximum length full path to the intermediate
76 // files directory for any configuration. This is used to construct
77 // object file names that do not produce paths that are too long.
78 void ComputeMaxDirectoryLength(std::string
& maxdir
,
81 virtual void ReadAndStoreExternalGUID(const char* name
,
84 typedef cmVisualStudioGeneratorOptions Options
;
85 typedef cmLocalVisualStudio7GeneratorFCInfo FCInfo
;
86 std::string
GetBuildTypeLinkerFlags(std::string rootLinkerFlags
,
87 const char* configName
);
88 void FixGlobalTargets();
89 void WriteProjectFiles();
90 void WriteVCProjHeader(std::ostream
& fout
, const char *libName
,
91 cmTarget
&tgt
, std::vector
<cmSourceGroup
> &sgs
);
92 void WriteVCProjFooter(std::ostream
& fout
);
93 void CreateSingleVCProj(const char *lname
, cmTarget
&tgt
);
94 void WriteVCProjFile(std::ostream
& fout
, const char *libName
,
96 void WriteConfigurations(std::ostream
& fout
,
97 const char *libName
, cmTarget
&tgt
);
98 void WriteConfiguration(std::ostream
& fout
,
99 const char* configName
,
100 const char* libName
, cmTarget
&tgt
);
101 std::string
EscapeForXML(const char* s
);
102 std::string
ConvertToXMLOutputPath(const char* path
);
103 std::string
ConvertToXMLOutputPathSingle(const char* path
);
104 void OutputTargetRules(std::ostream
& fout
, const char* configName
,
105 cmTarget
&target
, const char *libName
);
106 void OutputBuildTool(std::ostream
& fout
, const char* configName
,
107 cmTarget
& t
, bool debug
);
108 void OutputLibraryDirectories(std::ostream
& fout
,
109 std::vector
<std::string
> const& dirs
);
110 void OutputModuleDefinitionFile(std::ostream
& fout
, cmTarget
&target
);
111 void WriteProjectStart(std::ostream
& fout
, const char *libName
,
112 cmTarget
&tgt
, std::vector
<cmSourceGroup
> &sgs
);
113 void WriteProjectStartFortran(std::ostream
& fout
, const char *libName
,
115 void WriteVCProjBeginGroup(std::ostream
& fout
,
118 void WriteVCProjEndGroup(std::ostream
& fout
);
120 void WriteCustomRule(std::ostream
& fout
,
122 const cmCustomCommand
& command
,
124 void WriteTargetVersionAttribute(std::ostream
& fout
, cmTarget
& target
);
126 void WriteGroup(const cmSourceGroup
*sg
,
127 cmTarget
& target
, std::ostream
&fout
,
128 const char *libName
, std::vector
<std::string
> *configs
);
130 friend class cmLocalVisualStudio7GeneratorFCInfo
;
131 friend class cmLocalVisualStudio7GeneratorInternals
;
134 friend class EventWriter
;
136 cmVS7FlagTable
const* ExtraFlagTable
;
137 std::string ModuleDefinitionFile
;
140 std::string PlatformName
; // Win32 or x64
141 cmLocalVisualStudio7GeneratorInternals
* Internal
;