2009-09-28 19:43:28 +04:00
|
|
|
/*============================================================================
|
|
|
|
CMake - Cross Platform Makefile Generator
|
|
|
|
Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
|
2007-04-04 19:22:14 +04:00
|
|
|
|
2009-09-28 19:43:28 +04:00
|
|
|
Distributed under the OSI-approved BSD License (the "License");
|
|
|
|
see accompanying file Copyright.txt for details.
|
2007-04-04 19:22:14 +04:00
|
|
|
|
2009-09-28 19:43:28 +04:00
|
|
|
This software is distributed WITHOUT ANY WARRANTY; without even the
|
|
|
|
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
|
|
See the License for more information.
|
|
|
|
============================================================================*/
|
2007-04-04 19:22:14 +04:00
|
|
|
#ifndef cmGlobalVisualStudioGenerator_h
|
|
|
|
#define cmGlobalVisualStudioGenerator_h
|
|
|
|
|
|
|
|
#include "cmGlobalGenerator.h"
|
|
|
|
|
|
|
|
/** \class cmGlobalVisualStudioGenerator
|
|
|
|
* \brief Base class for global Visual Studio generators.
|
|
|
|
*
|
|
|
|
* cmGlobalVisualStudioGenerator provides functionality common to all
|
|
|
|
* global Visual Studio generators.
|
|
|
|
*/
|
|
|
|
class cmGlobalVisualStudioGenerator : public cmGlobalGenerator
|
|
|
|
{
|
|
|
|
public:
|
2015-05-17 12:33:09 +03:00
|
|
|
/** Known versions of Visual Studio. */
|
|
|
|
enum VSVersion
|
|
|
|
{
|
|
|
|
VS6 = 60,
|
|
|
|
VS7 = 70,
|
|
|
|
VS71 = 71,
|
|
|
|
VS8 = 80,
|
|
|
|
VS9 = 90,
|
|
|
|
VS10 = 100,
|
|
|
|
VS11 = 110,
|
|
|
|
VS12 = 120,
|
|
|
|
/* VS13 = 130 was skipped */
|
|
|
|
VS14 = 140
|
|
|
|
};
|
|
|
|
|
2007-04-04 19:22:14 +04:00
|
|
|
cmGlobalVisualStudioGenerator();
|
|
|
|
virtual ~cmGlobalVisualStudioGenerator();
|
2007-04-04 22:50:35 +04:00
|
|
|
|
2015-05-17 12:33:09 +03:00
|
|
|
VSVersion GetVersion() const;
|
|
|
|
void SetVersion(VSVersion v);
|
|
|
|
|
2007-11-16 15:01:58 +03:00
|
|
|
/**
|
|
|
|
* Configure CMake's Visual Studio macros file into the user's Visual
|
|
|
|
* Studio macros directory.
|
|
|
|
*/
|
|
|
|
virtual void ConfigureCMakeVisualStudioMacros();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Where does this version of Visual Studio look for macros for the
|
|
|
|
* current user? Returns the empty string if this version of Visual
|
|
|
|
* Studio does not implement support for VB macros.
|
|
|
|
*/
|
|
|
|
virtual std::string GetUserMacrosDirectory();
|
|
|
|
|
2008-02-15 19:49:58 +03:00
|
|
|
/**
|
|
|
|
* What is the reg key path to "vsmacros" for this version of Visual
|
|
|
|
* Studio?
|
|
|
|
*/
|
|
|
|
virtual std::string GetUserMacrosRegKeyBase();
|
|
|
|
|
2007-11-19 21:44:51 +03:00
|
|
|
enum MacroName {MacroReload, MacroStop};
|
|
|
|
|
2007-11-16 15:01:58 +03:00
|
|
|
/**
|
|
|
|
* Call the ReloadProjects macro if necessary based on
|
|
|
|
* GetFilesReplacedDuringGenerate results.
|
|
|
|
*/
|
2015-04-15 16:30:14 +03:00
|
|
|
void CallVisualStudioMacro(MacroName m,
|
|
|
|
const char* vsSolutionFile = 0);
|
2012-08-13 21:42:58 +04:00
|
|
|
|
2008-04-30 21:26:04 +04:00
|
|
|
// return true if target is fortran only
|
2013-12-10 18:16:23 +04:00
|
|
|
bool TargetIsFortranOnly(cmTarget const& t);
|
2007-11-16 15:01:58 +03:00
|
|
|
|
2009-09-16 19:44:08 +04:00
|
|
|
/** Get the top-level registry key for this VS version. */
|
|
|
|
std::string GetRegistryBase();
|
2009-12-04 20:09:01 +03:00
|
|
|
|
2012-11-20 15:18:43 +04:00
|
|
|
/** Get the top-level registry key for the given VS version. */
|
|
|
|
static std::string GetRegistryBase(const char* version);
|
|
|
|
|
2009-12-04 20:09:01 +03:00
|
|
|
/** Return true if the generated build tree may contain multiple builds.
|
|
|
|
i.e. "Can I build Debug and Release in the same tree?" */
|
|
|
|
virtual bool IsMultiConfig() { return true; }
|
|
|
|
|
2012-11-20 15:38:06 +04:00
|
|
|
/** Return true if building for Windows CE */
|
|
|
|
virtual bool TargetsWindowsCE() const { return false; }
|
|
|
|
|
2013-12-10 18:16:23 +04:00
|
|
|
class TargetSet: public std::set<cmTarget const*> {};
|
2009-10-01 00:02:58 +04:00
|
|
|
struct TargetCompare
|
|
|
|
{
|
|
|
|
bool operator()(cmTarget const* l, cmTarget const* r) const;
|
|
|
|
};
|
2010-08-25 18:26:25 +04:00
|
|
|
class OrderedTargetDependSet;
|
2009-10-01 00:02:58 +04:00
|
|
|
|
2013-11-15 19:41:45 +04:00
|
|
|
virtual void FindMakeProgram(cmMakefile*);
|
|
|
|
|
2014-02-02 08:18:04 +04:00
|
|
|
|
|
|
|
virtual std::string ExpandCFGIntDir(const std::string& str,
|
|
|
|
const std::string& config) const;
|
|
|
|
|
2014-03-13 00:09:20 +04:00
|
|
|
void ComputeTargetObjectDirectory(cmGeneratorTarget* gt) const;
|
2010-10-07 17:54:24 +04:00
|
|
|
protected:
|
2014-07-22 23:01:05 +04:00
|
|
|
virtual void Generate();
|
|
|
|
|
2010-10-07 17:54:24 +04:00
|
|
|
// Does this VS version link targets to each other if there are
|
|
|
|
// dependencies in the SLN file? This was done for VS versions
|
|
|
|
// below 8.
|
|
|
|
virtual bool VSLinksDependencies() const { return true; }
|
|
|
|
|
|
|
|
virtual const char* GetIDEVersion() = 0;
|
|
|
|
|
2010-08-25 02:39:36 +04:00
|
|
|
virtual bool ComputeTargetDepends();
|
2014-02-10 09:21:34 +04:00
|
|
|
class VSDependSet: public std::set<std::string> {};
|
2013-12-10 18:16:23 +04:00
|
|
|
class VSDependMap: public std::map<cmTarget const*, VSDependSet> {};
|
2010-08-25 02:39:36 +04:00
|
|
|
VSDependMap VSTargetDepends;
|
|
|
|
void ComputeVSTargetDepends(cmTarget&);
|
2009-10-21 00:38:37 +04:00
|
|
|
|
2014-02-07 02:31:47 +04:00
|
|
|
bool CheckTargetLinks(cmTarget& target, const std::string& name);
|
|
|
|
std::string GetUtilityForTarget(cmTarget& target, const std::string&);
|
2013-12-10 18:16:23 +04:00
|
|
|
virtual std::string WriteUtilityDepend(cmTarget const*) = 0;
|
|
|
|
std::string GetUtilityDepend(cmTarget const* target);
|
2014-02-10 09:21:34 +04:00
|
|
|
typedef std::map<cmTarget const*, std::string> UtilityDependsMap;
|
2010-08-25 02:47:56 +04:00
|
|
|
UtilityDependsMap UtilityDepends;
|
2012-07-21 17:37:46 +04:00
|
|
|
|
2015-05-17 12:33:09 +03:00
|
|
|
protected:
|
|
|
|
VSVersion Version;
|
|
|
|
|
2010-08-25 18:26:25 +04:00
|
|
|
private:
|
2013-11-15 19:41:45 +04:00
|
|
|
virtual std::string GetVSMakeProgram() = 0;
|
2014-02-04 06:20:56 +04:00
|
|
|
void PrintCompilerAdvice(std::ostream&, std::string const&,
|
|
|
|
const char*) const {}
|
2012-03-07 23:04:33 +04:00
|
|
|
|
2013-12-10 18:16:23 +04:00
|
|
|
void FollowLinkDepends(cmTarget const* target,
|
|
|
|
std::set<cmTarget const*>& linked);
|
2010-08-25 18:26:25 +04:00
|
|
|
|
|
|
|
class TargetSetMap: public std::map<cmTarget*, TargetSet> {};
|
|
|
|
TargetSetMap TargetLinkClosure;
|
2013-12-10 18:16:23 +04:00
|
|
|
void FillLinkClosure(cmTarget const* target, TargetSet& linked);
|
2010-08-25 18:26:25 +04:00
|
|
|
TargetSet const& GetTargetLinkClosure(cmTarget* target);
|
|
|
|
};
|
|
|
|
|
|
|
|
class cmGlobalVisualStudioGenerator::OrderedTargetDependSet:
|
|
|
|
public std::multiset<cmTargetDepend,
|
|
|
|
cmGlobalVisualStudioGenerator::TargetCompare>
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
typedef cmGlobalGenerator::TargetDependSet TargetDependSet;
|
|
|
|
typedef cmGlobalVisualStudioGenerator::TargetSet TargetSet;
|
|
|
|
OrderedTargetDependSet(TargetDependSet const&);
|
|
|
|
OrderedTargetDependSet(TargetSet const&);
|
2007-04-04 19:22:14 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|