BUG: Removed output of dual rules for source files that are processed by both the compiler and by a custom command. Also removed generation of duplicate CMakeLists.txt in the project files.
This commit is contained in:
parent
9020fec9a9
commit
2f42d7ffcb
|
@ -239,10 +239,9 @@ void cmDSPMakefile::WriteDSPFile(std::ostream& fout,
|
|||
for(std::vector<cmSourceGroup>::const_iterator sg = sourceGroups.begin();
|
||||
sg != sourceGroups.end(); ++sg)
|
||||
{
|
||||
const std::vector<std::string>& sources = sg->GetSources();
|
||||
const cmSourceGroup::CustomCommands& customCommands = sg->GetCustomCommands();
|
||||
const cmSourceGroup::BuildRules& buildRules = sg->GetBuildRules();
|
||||
// If the group is empty, don't write it at all.
|
||||
if(sources.empty() && customCommands.empty())
|
||||
if(buildRules.empty())
|
||||
{ continue; }
|
||||
|
||||
// If the group has a name, write the header.
|
||||
|
@ -252,24 +251,21 @@ void cmDSPMakefile::WriteDSPFile(std::ostream& fout,
|
|||
this->WriteDSPBeginGroup(fout, name.c_str(), "");
|
||||
}
|
||||
|
||||
// Loop through each source in the source group.
|
||||
for(std::vector<std::string>::const_iterator s = sources.begin();
|
||||
s != sources.end(); ++s)
|
||||
{
|
||||
this->WriteDSPBuildRule(fout, s->c_str());
|
||||
}
|
||||
|
||||
// Loop through each custom command in the source group.
|
||||
for(cmSourceGroup::CustomCommands::const_iterator cc =
|
||||
customCommands.begin(); cc != customCommands.end(); ++ cc)
|
||||
// Loop through each build rule in the source group.
|
||||
for(cmSourceGroup::BuildRules::const_iterator cc =
|
||||
buildRules.begin(); cc != buildRules.end(); ++ cc)
|
||||
{
|
||||
std::string source = cc->first;
|
||||
const cmSourceGroup::Commands& commands = cc->second;
|
||||
|
||||
fout << "# Begin Source File\n\n";
|
||||
fout << "# Begin Source File\n\n";\
|
||||
|
||||
// Tell MS-Dev what the source is. If the compiler knows how to
|
||||
// build it, then it will.
|
||||
fout << "SOURCE=" << source << "\n\n";
|
||||
|
||||
// Loop through every command generating code from the current source.
|
||||
// Loop through every custom command generating code from the
|
||||
// current source.
|
||||
for(cmSourceGroup::Commands::const_iterator c = commands.begin();
|
||||
c != commands.end(); ++c)
|
||||
{
|
||||
|
@ -493,14 +489,3 @@ void cmDSPMakefile::WriteDSPFooter(std::ostream& fout)
|
|||
fout << buffer << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void cmDSPMakefile::WriteDSPBuildRule(std::ostream& fout, const char* path)
|
||||
{
|
||||
fout << "# Begin Source File\n\n";
|
||||
fout << "SOURCE="
|
||||
<< path << "\n";
|
||||
fout << "# End Source File\n";
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -101,7 +101,6 @@ private:
|
|||
void WriteDSPEndGroup(std::ostream& fout);
|
||||
void WriteDSPHeader(std::ostream& fout, const char *libName,
|
||||
const cmTarget &tgt);
|
||||
void WriteDSPBuildRule(std::ostream& fout, const char*);
|
||||
void WriteDSPBuildRule(std::ostream& fout);
|
||||
void WriteDSPFooter(std::ostream& fout);
|
||||
void AddDSPBuildRule(cmSourceGroup&);
|
||||
|
|
|
@ -239,10 +239,9 @@ void cmDSPMakefile::WriteDSPFile(std::ostream& fout,
|
|||
for(std::vector<cmSourceGroup>::const_iterator sg = sourceGroups.begin();
|
||||
sg != sourceGroups.end(); ++sg)
|
||||
{
|
||||
const std::vector<std::string>& sources = sg->GetSources();
|
||||
const cmSourceGroup::CustomCommands& customCommands = sg->GetCustomCommands();
|
||||
const cmSourceGroup::BuildRules& buildRules = sg->GetBuildRules();
|
||||
// If the group is empty, don't write it at all.
|
||||
if(sources.empty() && customCommands.empty())
|
||||
if(buildRules.empty())
|
||||
{ continue; }
|
||||
|
||||
// If the group has a name, write the header.
|
||||
|
@ -252,24 +251,21 @@ void cmDSPMakefile::WriteDSPFile(std::ostream& fout,
|
|||
this->WriteDSPBeginGroup(fout, name.c_str(), "");
|
||||
}
|
||||
|
||||
// Loop through each source in the source group.
|
||||
for(std::vector<std::string>::const_iterator s = sources.begin();
|
||||
s != sources.end(); ++s)
|
||||
{
|
||||
this->WriteDSPBuildRule(fout, s->c_str());
|
||||
}
|
||||
|
||||
// Loop through each custom command in the source group.
|
||||
for(cmSourceGroup::CustomCommands::const_iterator cc =
|
||||
customCommands.begin(); cc != customCommands.end(); ++ cc)
|
||||
// Loop through each build rule in the source group.
|
||||
for(cmSourceGroup::BuildRules::const_iterator cc =
|
||||
buildRules.begin(); cc != buildRules.end(); ++ cc)
|
||||
{
|
||||
std::string source = cc->first;
|
||||
const cmSourceGroup::Commands& commands = cc->second;
|
||||
|
||||
fout << "# Begin Source File\n\n";
|
||||
fout << "# Begin Source File\n\n";\
|
||||
|
||||
// Tell MS-Dev what the source is. If the compiler knows how to
|
||||
// build it, then it will.
|
||||
fout << "SOURCE=" << source << "\n\n";
|
||||
|
||||
// Loop through every command generating code from the current source.
|
||||
// Loop through every custom command generating code from the
|
||||
// current source.
|
||||
for(cmSourceGroup::Commands::const_iterator c = commands.begin();
|
||||
c != commands.end(); ++c)
|
||||
{
|
||||
|
@ -493,14 +489,3 @@ void cmDSPMakefile::WriteDSPFooter(std::ostream& fout)
|
|||
fout << buffer << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void cmDSPMakefile::WriteDSPBuildRule(std::ostream& fout, const char* path)
|
||||
{
|
||||
fout << "# Begin Source File\n\n";
|
||||
fout << "SOURCE="
|
||||
<< path << "\n";
|
||||
fout << "# End Source File\n";
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -101,7 +101,6 @@ private:
|
|||
void WriteDSPEndGroup(std::ostream& fout);
|
||||
void WriteDSPHeader(std::ostream& fout, const char *libName,
|
||||
const cmTarget &tgt);
|
||||
void WriteDSPBuildRule(std::ostream& fout, const char*);
|
||||
void WriteDSPBuildRule(std::ostream& fout);
|
||||
void WriteDSPFooter(std::ostream& fout);
|
||||
void AddDSPBuildRule(cmSourceGroup&);
|
||||
|
|
|
@ -57,8 +57,7 @@ cmSourceGroup::cmSourceGroup(const char* name, const char* regex):
|
|||
cmSourceGroup::cmSourceGroup(const cmSourceGroup& r):
|
||||
m_Name(r.m_Name),
|
||||
m_GroupRegex(r.m_GroupRegex),
|
||||
m_Sources(r.m_Sources),
|
||||
m_CustomCommands(r.m_CustomCommands)
|
||||
m_BuildRules(r.m_BuildRules)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -72,6 +71,21 @@ bool cmSourceGroup::Matches(const char* name)
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* Add a source to the group that the compiler will know how to build.
|
||||
*/
|
||||
void cmSourceGroup::AddSource(const char* name)
|
||||
{
|
||||
BuildRules::iterator s = m_BuildRules.find(name);
|
||||
if(s == m_BuildRules.end())
|
||||
{
|
||||
// The source was not found. Add it with no commands.
|
||||
m_BuildRules[name];
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Add a source and corresponding custom command to the group. If the
|
||||
* source already exists, the command will be added to its set of commands.
|
||||
|
@ -80,13 +94,13 @@ bool cmSourceGroup::Matches(const char* name)
|
|||
*/
|
||||
void cmSourceGroup::AddCustomCommand(const cmCustomCommand &cmd)
|
||||
{
|
||||
CustomCommands::iterator s = m_CustomCommands.find(cmd.GetSourceName());
|
||||
if(s == m_CustomCommands.end())
|
||||
BuildRules::iterator s = m_BuildRules.find(cmd.GetSourceName());
|
||||
if(s == m_BuildRules.end())
|
||||
{
|
||||
// The source was not found. Add it with this command.
|
||||
m_CustomCommands[cmd.GetSourceName()][cmd.GetCommand()].
|
||||
m_BuildRules[cmd.GetSourceName()][cmd.GetCommand()].
|
||||
m_Depends.insert(cmd.GetDepends().begin(),cmd.GetDepends().end());
|
||||
m_CustomCommands[cmd.GetSourceName()][cmd.GetCommand()].
|
||||
m_BuildRules[cmd.GetSourceName()][cmd.GetCommand()].
|
||||
m_Outputs.insert(cmd.GetOutputs().begin(),cmd.GetOutputs().end());
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -77,20 +77,17 @@ public:
|
|||
/**
|
||||
* Map from source to command map.
|
||||
*/
|
||||
typedef std::map<std::string, Commands> CustomCommands;
|
||||
typedef std::map<std::string, Commands> BuildRules;
|
||||
|
||||
bool Matches(const char* name);
|
||||
void SetGroupRegex(const char* regex)
|
||||
{ m_GroupRegex.compile(regex); }
|
||||
void AddSource(const char* name)
|
||||
{ m_Sources.push_back(name); }
|
||||
void AddSource(const char* name);
|
||||
void AddCustomCommand(const cmCustomCommand &cmd);
|
||||
const char* GetName() const
|
||||
{ return m_Name.c_str(); }
|
||||
const std::vector<std::string>& GetSources() const
|
||||
{ return m_Sources; }
|
||||
const CustomCommands& GetCustomCommands() const
|
||||
{ return m_CustomCommands; }
|
||||
const BuildRules& GetBuildRules() const
|
||||
{ return m_BuildRules; }
|
||||
|
||||
private:
|
||||
/**
|
||||
|
@ -104,14 +101,11 @@ private:
|
|||
cmRegularExpression m_GroupRegex;
|
||||
|
||||
/**
|
||||
* The sources in this group that the compiler will know how to build.
|
||||
* 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.
|
||||
*/
|
||||
std::vector<std::string> m_Sources;
|
||||
|
||||
/**
|
||||
* The custom commands in this group and their corresponding sources.
|
||||
*/
|
||||
CustomCommands m_CustomCommands;
|
||||
BuildRules m_BuildRules;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue