cmake/Source/cmLocalVisualStudio7Generator.h

156 lines
5.7 KiB
C
Raw Normal View History

2016-10-30 18:24:19 +01:00
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
#ifndef cmLocalVisualStudio7Generator_h
#define cmLocalVisualStudio7Generator_h
2018-01-26 17:06:56 +01:00
#include "cmConfigure.h" // IWYU pragma: keep
2017-04-14 19:02:05 +02:00
#include <iosfwd>
2020-08-30 11:54:41 +02:00
#include <memory>
2017-04-14 19:02:05 +02:00
#include <string>
#include <vector>
2016-07-09 11:21:54 +02:00
2017-04-14 19:02:05 +02:00
#include "cmLocalVisualStudioGenerator.h"
2009-10-04 10:30:41 +03:00
#include "cmVisualStudioGeneratorOptions.h"
class cmCustomCommand;
2017-04-14 19:02:05 +02:00
class cmGeneratorTarget;
class cmGlobalGenerator;
class cmLocalVisualStudio7GeneratorFCInfo;
class cmLocalVisualStudio7GeneratorInternals;
2017-04-14 19:02:05 +02:00
class cmMakefile;
class cmSourceFile;
class cmSourceGroup;
2018-08-09 18:06:22 +02:00
class cmVS7GeneratorOptions : public cmVisualStudioGeneratorOptions
{
public:
cmVS7GeneratorOptions(cmLocalVisualStudioGenerator* lg, Tool tool,
cmVS7FlagTable const* table = nullptr,
cmVS7FlagTable const* extraTable = nullptr)
: cmVisualStudioGeneratorOptions(lg, tool, table, extraTable)
{
}
2020-08-30 11:54:41 +02:00
void OutputFlag(std::ostream& fout, int indent, const std::string& tag,
2018-08-09 18:06:22 +02:00
const std::string& content) override;
};
/** \class cmLocalVisualStudio7Generator
* \brief Write Visual Studio .NET project files.
*
* cmLocalVisualStudio7Generator produces a Visual Studio .NET project
* file for each target in its directory.
*/
class cmLocalVisualStudio7Generator : public cmLocalVisualStudioGenerator
{
public:
2019-11-11 23:01:05 +01:00
//! Set cache only and recurse to false by default.
2015-11-17 17:22:37 +01:00
cmLocalVisualStudio7Generator(cmGlobalGenerator* gg, cmMakefile* mf);
virtual ~cmLocalVisualStudio7Generator();
2020-08-30 11:54:41 +02:00
cmLocalVisualStudio7Generator(const cmLocalVisualStudio7Generator&) = delete;
const cmLocalVisualStudio7Generator& operator=(
const cmLocalVisualStudio7Generator&) = delete;
2018-04-23 21:13:27 +02:00
void AddHelperCommands() override;
/**
2013-03-16 19:13:01 +02:00
* Generate the makefile for this directory.
*/
2018-04-23 21:13:27 +02:00
void Generate() override;
2016-07-09 11:21:54 +02:00
enum BuildType
{
STATIC_LIBRARY,
DLL,
EXECUTABLE,
WIN32_EXECUTABLE,
UTILITY
};
/**
* Specify the type of the build: static, dll, or executable.
*/
2016-07-09 11:21:54 +02:00
void SetBuildType(BuildType, const std::string& name);
2018-04-23 21:13:27 +02:00
std::string GetTargetDirectory(
cmGeneratorTarget const* target) const override;
2009-10-04 10:30:41 +03:00
cmSourceFile* CreateVCProjBuildRule();
void WriteStampFiles();
2018-04-23 21:13:27 +02:00
std::string ComputeLongestObjectDirectory(
cmGeneratorTarget const*) const override;
2009-10-04 10:30:41 +03:00
2015-04-27 22:25:09 +02:00
virtual void ReadAndStoreExternalGUID(const std::string& name,
2009-10-04 10:30:41 +03:00
const char* path);
2016-07-09 11:21:54 +02:00
2012-02-18 12:40:36 +02:00
protected:
2016-07-09 11:21:54 +02:00
void CreateSingleVCProj(const std::string& lname, cmGeneratorTarget* tgt);
private:
2020-02-01 23:06:01 +01:00
using Options = cmVS7GeneratorOptions;
using FCInfo = cmLocalVisualStudio7GeneratorFCInfo;
std::string GetBuildTypeLinkerFlags(std::string rootLinkerFlags,
2015-04-27 22:25:09 +02:00
const std::string& configName);
void FixGlobalTargets();
void WriteProjectFiles();
2015-04-27 22:25:09 +02:00
void WriteVCProjHeader(std::ostream& fout, const std::string& libName,
2016-03-13 13:35:51 +01:00
cmGeneratorTarget* tgt,
2016-07-09 11:21:54 +02:00
std::vector<cmSourceGroup>& sgs);
2016-03-13 13:35:51 +01:00
void WriteVCProjFooter(std::ostream& fout, cmGeneratorTarget* target);
2015-04-27 22:25:09 +02:00
void WriteVCProjFile(std::ostream& fout, const std::string& libName,
2016-03-13 13:35:51 +01:00
cmGeneratorTarget* tgt);
void WriteConfigurations(std::ostream& fout,
2015-08-17 11:37:30 +02:00
std::vector<std::string> const& configs,
2016-03-13 13:35:51 +01:00
const std::string& libName, cmGeneratorTarget* tgt);
2016-07-09 11:21:54 +02:00
void WriteConfiguration(std::ostream& fout, const std::string& configName,
2016-03-13 13:35:51 +01:00
const std::string& libName, cmGeneratorTarget* tgt);
2015-04-27 22:25:09 +02:00
std::string EscapeForXML(const std::string& s);
2020-08-30 11:54:41 +02:00
std::string ConvertToXMLOutputPath(const std::string& path);
std::string ConvertToXMLOutputPathSingle(const std::string& path);
2015-04-27 22:25:09 +02:00
void OutputTargetRules(std::ostream& fout, const std::string& configName,
2016-03-13 13:35:51 +01:00
cmGeneratorTarget* target,
const std::string& libName);
2015-04-27 22:25:09 +02:00
void OutputBuildTool(std::ostream& fout, const std::string& configName,
2016-03-13 13:35:51 +01:00
cmGeneratorTarget* t, const Options& targetOptions);
2016-07-09 11:21:54 +02:00
void OutputDeploymentDebuggerTool(std::ostream& fout,
std::string const& config,
cmGeneratorTarget* target);
void OutputLibraryDirectories(std::ostream& fout,
std::vector<std::string> const& dirs);
2016-07-09 11:21:54 +02:00
void WriteProjectSCC(std::ostream& fout, cmGeneratorTarget* target);
2015-04-27 22:25:09 +02:00
void WriteProjectStart(std::ostream& fout, const std::string& libName,
2016-03-13 13:35:51 +01:00
cmGeneratorTarget* tgt,
2016-07-09 11:21:54 +02:00
std::vector<cmSourceGroup>& sgs);
2015-04-27 22:25:09 +02:00
void WriteProjectStartFortran(std::ostream& fout, const std::string& libName,
2016-03-13 13:35:51 +01:00
cmGeneratorTarget* tgt);
2016-07-09 11:21:54 +02:00
void WriteVCProjBeginGroup(std::ostream& fout, const char* group,
const char* filter);
void WriteVCProjEndGroup(std::ostream& fout);
2013-03-16 19:13:01 +02:00
void WriteCustomRule(std::ostream& fout,
2015-08-17 11:37:30 +02:00
std::vector<std::string> const& configs,
2016-07-09 11:21:54 +02:00
const char* source, const cmCustomCommand& command,
FCInfo& fcinfo);
2016-07-09 11:21:54 +02:00
void WriteTargetVersionAttribute(std::ostream& fout, cmGeneratorTarget* gt);
2018-04-23 21:13:27 +02:00
class AllConfigSources;
2016-07-09 11:21:54 +02:00
bool WriteGroup(const cmSourceGroup* sg, cmGeneratorTarget* target,
std::ostream& fout, const std::string& libName,
2017-07-20 19:35:53 +02:00
std::vector<std::string> const& configs,
2018-04-23 21:13:27 +02:00
AllConfigSources const& sources);
friend class cmLocalVisualStudio7GeneratorFCInfo;
friend class cmLocalVisualStudio7GeneratorInternals;
2009-10-04 10:30:41 +03:00
class EventWriter;
2017-04-14 19:02:05 +02:00
2009-10-04 10:30:41 +03:00
friend class EventWriter;
bool FortranProject;
2013-03-16 19:13:01 +02:00
bool WindowsCEProject;
2020-08-30 11:54:41 +02:00
std::unique_ptr<cmLocalVisualStudio7GeneratorInternals> Internal;
};
#endif