2006-02-19 23:25:27 +03:00
|
|
|
/*=========================================================================
|
|
|
|
|
|
|
|
Program: CMake - Cross-Platform Makefile Generator
|
|
|
|
Module: $RCSfile$
|
|
|
|
Language: C++
|
|
|
|
Date: $Date$
|
|
|
|
Version: $Revision$
|
|
|
|
|
|
|
|
Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved.
|
|
|
|
See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details.
|
|
|
|
|
|
|
|
This software is distributed WITHOUT ANY WARRANTY; without even
|
|
|
|
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
|
|
|
PURPOSE. See the above copyright notices for more information.
|
|
|
|
|
|
|
|
=========================================================================*/
|
|
|
|
#ifndef cmInstallGenerator_h
|
|
|
|
#define cmInstallGenerator_h
|
|
|
|
|
|
|
|
#include "cmStandardIncludes.h"
|
|
|
|
|
|
|
|
class cmLocalGenerator;
|
|
|
|
|
2007-07-02 19:02:52 +04:00
|
|
|
class cmInstallGeneratorIndent
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
cmInstallGeneratorIndent(): Level(0) {}
|
|
|
|
cmInstallGeneratorIndent(int level): Level(level) {}
|
|
|
|
void Write(std::ostream& os) const
|
|
|
|
{
|
|
|
|
for(int i=0; i < this->Level; ++i)
|
|
|
|
{
|
|
|
|
os << " ";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
cmInstallGeneratorIndent Next(int step = 2) const
|
|
|
|
{
|
|
|
|
return cmInstallGeneratorIndent(this->Level + step);
|
|
|
|
}
|
|
|
|
private:
|
|
|
|
int Level;
|
|
|
|
};
|
|
|
|
inline std::ostream& operator<<(std::ostream& os,
|
|
|
|
cmInstallGeneratorIndent const& indent)
|
|
|
|
{
|
|
|
|
indent.Write(os);
|
|
|
|
return os;
|
|
|
|
}
|
|
|
|
|
2006-02-19 23:25:27 +03:00
|
|
|
/** \class cmInstallGenerator
|
|
|
|
* \brief Support class for generating install scripts.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
class cmInstallGenerator
|
|
|
|
{
|
|
|
|
public:
|
2007-07-02 22:56:57 +04:00
|
|
|
cmInstallGenerator(const char* destination,
|
|
|
|
std::vector<std::string> const& configurations,
|
|
|
|
const char* component);
|
2006-02-19 23:25:27 +03:00
|
|
|
virtual ~cmInstallGenerator();
|
|
|
|
|
|
|
|
void Generate(std::ostream& os, const char* config,
|
|
|
|
std::vector<std::string> const& configurationTypes);
|
|
|
|
|
2006-05-05 22:57:19 +04:00
|
|
|
static void AddInstallRule(
|
|
|
|
std::ostream& os, const char* dest, int type,
|
2007-06-29 00:11:18 +04:00
|
|
|
std::vector<std::string> const& files,
|
|
|
|
bool optional = false,
|
2006-05-05 22:57:19 +04:00
|
|
|
const char* properties = 0,
|
2006-08-17 22:48:54 +04:00
|
|
|
const char* permissions_file = 0,
|
|
|
|
const char* permissions_dir = 0,
|
2006-08-22 00:55:03 +04:00
|
|
|
const char* rename = 0,
|
2007-07-02 19:02:52 +04:00
|
|
|
const char* literal_args = 0,
|
|
|
|
cmInstallGeneratorIndent const& indent = cmInstallGeneratorIndent()
|
2006-05-05 22:57:19 +04:00
|
|
|
);
|
2006-02-19 23:25:27 +03:00
|
|
|
|
2007-07-02 22:56:57 +04:00
|
|
|
const char* GetDestination() const
|
|
|
|
{ return this->Destination.c_str(); }
|
|
|
|
const std::vector<std::string>& GetConfigurations() const
|
|
|
|
{ return this->Configurations; }
|
2006-02-19 23:25:27 +03:00
|
|
|
protected:
|
2007-07-02 22:56:57 +04:00
|
|
|
typedef cmInstallGeneratorIndent Indent;
|
|
|
|
virtual void GenerateScript(std::ostream& os);
|
|
|
|
virtual void GenerateScriptConfigs(std::ostream& os, Indent const& indent);
|
|
|
|
virtual void GenerateScriptActions(std::ostream& os, Indent const& indent);
|
2006-02-19 23:25:27 +03:00
|
|
|
|
2007-07-02 22:56:57 +04:00
|
|
|
std::string CreateConfigTest(const char* config);
|
|
|
|
std::string CreateConfigTest(std::vector<std::string> const& configs);
|
|
|
|
std::string CreateComponentTest(const char* component);
|
|
|
|
|
|
|
|
// Information shared by most generator types.
|
|
|
|
std::string Destination;
|
|
|
|
std::vector<std::string> const Configurations;
|
|
|
|
std::string Component;
|
|
|
|
|
|
|
|
// Information used during generation.
|
2006-02-19 23:25:27 +03:00
|
|
|
const char* ConfigurationName;
|
|
|
|
std::vector<std::string> const* ConfigurationTypes;
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|