2001-03-20 13:20:59 -05:00
|
|
|
/*=========================================================================
|
|
|
|
|
2002-10-23 18:03:27 -04:00
|
|
|
Program: CMake - Cross-Platform Makefile Generator
|
2001-03-20 13:20:59 -05:00
|
|
|
Module: $RCSfile$
|
|
|
|
Language: C++
|
|
|
|
Date: $Date$
|
|
|
|
Version: $Revision$
|
|
|
|
|
2002-10-23 18:03:27 -04:00
|
|
|
Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved.
|
|
|
|
See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details.
|
2001-03-20 13:20:59 -05:00
|
|
|
|
2002-01-21 15:30:43 -05:00
|
|
|
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.
|
2001-03-20 13:20:59 -05:00
|
|
|
|
|
|
|
=========================================================================*/
|
|
|
|
#ifndef cmSourceGroup_h
|
|
|
|
#define cmSourceGroup_h
|
|
|
|
|
|
|
|
#include "cmStandardIncludes.h"
|
|
|
|
#include "cmRegularExpression.h"
|
2001-04-11 14:59:02 -04:00
|
|
|
#include "cmCustomCommand.h"
|
2002-03-04 14:14:41 -05:00
|
|
|
class cmSourceFile;
|
2001-03-20 13:20:59 -05:00
|
|
|
|
|
|
|
/** \class cmSourceGroup
|
|
|
|
* \brief Hold a group of sources as specified by a SOURCE_GROUP command.
|
|
|
|
*
|
|
|
|
* cmSourceGroup holds all the source files and corresponding commands
|
|
|
|
* for files matching the regular expression specified for the group.
|
|
|
|
*/
|
|
|
|
class cmSourceGroup
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
cmSourceGroup(const char* name, const char* regex);
|
|
|
|
cmSourceGroup(const cmSourceGroup&);
|
|
|
|
~cmSourceGroup() {}
|
|
|
|
|
|
|
|
struct CommandFiles
|
|
|
|
{
|
|
|
|
CommandFiles() {}
|
|
|
|
CommandFiles(const CommandFiles& r):
|
2002-12-10 16:47:37 -05:00
|
|
|
m_Comment(r.m_Comment), m_Outputs(r.m_Outputs), m_Depends(r.m_Depends) {}
|
2001-03-20 13:20:59 -05:00
|
|
|
|
2001-05-04 09:39:05 -04:00
|
|
|
void Merge(const CommandFiles &r);
|
|
|
|
|
2001-09-04 16:07:54 -04:00
|
|
|
std::string m_Command;
|
|
|
|
std::string m_Arguments;
|
2002-12-10 16:47:37 -05:00
|
|
|
std::string m_Comment;
|
2001-03-20 13:20:59 -05:00
|
|
|
std::set<std::string> m_Outputs;
|
|
|
|
std::set<std::string> m_Depends;
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Map from command to its output/depends sets.
|
|
|
|
*/
|
2001-08-22 11:58:17 -04:00
|
|
|
typedef std::map<cmStdString, CommandFiles> Commands;
|
2001-03-20 13:20:59 -05:00
|
|
|
|
2002-03-04 14:14:41 -05:00
|
|
|
struct SourceAndCommands
|
|
|
|
{
|
|
|
|
SourceAndCommands(): m_SourceFile(0) {}
|
|
|
|
const cmSourceFile* m_SourceFile;
|
|
|
|
Commands m_Commands;
|
|
|
|
};
|
2001-03-20 13:20:59 -05:00
|
|
|
/**
|
|
|
|
* Map from source to command map.
|
|
|
|
*/
|
2002-03-04 14:14:41 -05:00
|
|
|
typedef std::map<cmStdString, SourceAndCommands> BuildRules;
|
2001-03-20 13:20:59 -05:00
|
|
|
|
|
|
|
bool Matches(const char* name);
|
|
|
|
void SetGroupRegex(const char* regex)
|
|
|
|
{ m_GroupRegex.compile(regex); }
|
2002-03-04 14:14:41 -05:00
|
|
|
void AddSource(const char* name, const cmSourceFile*);
|
2001-04-11 14:59:02 -04:00
|
|
|
void AddCustomCommand(const cmCustomCommand &cmd);
|
2001-03-20 13:20:59 -05:00
|
|
|
const char* GetName() const
|
|
|
|
{ return m_Name.c_str(); }
|
2001-04-27 14:51:43 -04:00
|
|
|
const BuildRules& GetBuildRules() const
|
|
|
|
{ return m_BuildRules; }
|
2001-05-04 11:30:46 -04:00
|
|
|
void Print() const;
|
2001-03-20 13:20:59 -05:00
|
|
|
private:
|
|
|
|
/**
|
|
|
|
* The name of the source group.
|
|
|
|
*/
|
|
|
|
std::string m_Name;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The regular expression matching the files in the group.
|
|
|
|
*/
|
|
|
|
cmRegularExpression m_GroupRegex;
|
|
|
|
|
|
|
|
/**
|
2001-04-27 14:51:43 -04:00
|
|
|
* Map from source name to the commands to build from the source.
|
|
|
|
* Some commands may build from files that the compiler also knows how to
|
|
|
|
* build.
|
2001-03-20 13:20:59 -05:00
|
|
|
*/
|
2001-04-27 14:51:43 -04:00
|
|
|
BuildRules m_BuildRules;
|
2001-03-20 13:20:59 -05:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|