summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Source/cmDSPMakefile.cxx37
-rw-r--r--Source/cmDSPMakefile.h1
-rw-r--r--Source/cmDSPWriter.cxx37
-rw-r--r--Source/cmDSPWriter.h1
-rw-r--r--Source/cmSourceGroup.cxx26
-rw-r--r--Source/cmSourceGroup.h22
6 files changed, 50 insertions, 74 deletions
diff --git a/Source/cmDSPMakefile.cxx b/Source/cmDSPMakefile.cxx
index c107bb4..5b4073c 100644
--- a/Source/cmDSPMakefile.cxx
+++ b/Source/cmDSPMakefile.cxx
@@ -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";
-}
-
-
diff --git a/Source/cmDSPMakefile.h b/Source/cmDSPMakefile.h
index fe67aa2..6082f1e 100644
--- a/Source/cmDSPMakefile.h
+++ b/Source/cmDSPMakefile.h
@@ -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&);
diff --git a/Source/cmDSPWriter.cxx b/Source/cmDSPWriter.cxx
index c107bb4..5b4073c 100644
--- a/Source/cmDSPWriter.cxx
+++ b/Source/cmDSPWriter.cxx
@@ -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";
-}
-
-
diff --git a/Source/cmDSPWriter.h b/Source/cmDSPWriter.h
index fe67aa2..6082f1e 100644
--- a/Source/cmDSPWriter.h
+++ b/Source/cmDSPWriter.h
@@ -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&);
diff --git a/Source/cmSourceGroup.cxx b/Source/cmSourceGroup.cxx
index 24d56ab..49b2bd7 100644
--- a/Source/cmSourceGroup.cxx
+++ b/Source/cmSourceGroup.cxx
@@ -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)
{
}
@@ -73,6 +72,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.
* If the command also already exists, the given dependencies and outputs
@@ -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;
}
diff --git a/Source/cmSourceGroup.h b/Source/cmSourceGroup.h
index db79ecc..9162f2b 100644
--- a/Source/cmSourceGroup.h
+++ b/Source/cmSourceGroup.h
@@ -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