Commit 61d23149 authored by Brad King's avatar Brad King
Browse files

ENH: Changed WriteConfiguration to non-const so it can do error checking. ...

ENH: Changed WriteConfiguration to non-const so it can do error checking.  Added parsing and output of a name for each WrapperSet generated from a CABLE_WRAP command.
parent 2c1fb789
......@@ -23,7 +23,7 @@
* Write the CABLE configuration code to define this InstantiationSet.
* This includes the "class" keyword to do class template instantiations.
*/
void cmCableInstantiateClassCommand::WriteConfiguration() const
bool cmCableInstantiateClassCommand::WriteConfiguration()
{
std::ostream& os = m_CableData->GetOutputStream();
cmCableData::Indentation indent = m_CableData->GetIndentation();
......@@ -46,4 +46,6 @@ void cmCableInstantiateClassCommand::WriteConfiguration() const
os << "</Element>" << std::endl;
}
os << indent << "</InstantiationSet>" << std::endl;
return true;
}
......@@ -63,7 +63,7 @@ public:
"template classes (not functions, operators, etc).";
}
virtual void WriteConfiguration() const;
virtual bool WriteConfiguration();
cmTypeMacro(cmCableInstantiateClassCommand, cmCableInstantiateCommand);
protected:
......
......@@ -22,7 +22,7 @@
/**
* Write the CABLE configuration code to define this InstantiationSet.
*/
void cmCableInstantiateCommand::WriteConfiguration() const
bool cmCableInstantiateCommand::WriteConfiguration()
{
std::ostream& os = m_CableData->GetOutputStream();
cmCableData::Indentation indent = m_CableData->GetIndentation();
......@@ -45,4 +45,6 @@ void cmCableInstantiateCommand::WriteConfiguration() const
os << "</Element>" << std::endl;
}
os << indent << "</InstantiationSet>" << std::endl;
return true;
}
......@@ -62,7 +62,7 @@ public:
"template non-classes (functions, operators, etc).";
}
virtual void WriteConfiguration() const;
virtual bool WriteConfiguration();
cmTypeMacro(cmCableInstantiateCommand, cmCablePackageCommand);
protected:
......
......@@ -100,6 +100,7 @@ bool cmCablePackageCommand::Invoke(std::vector<std::string>& args)
// Add custom rules to the makefile to generate this package's source
// files.
{
std::string command = "${CABLE}";
m_Makefile->ExpandVariablesInString(command);
std::vector<std::string> depends;
......@@ -115,6 +116,27 @@ bool cmCablePackageCommand::Invoke(std::vector<std::string>& args)
command.c_str(),
depends,
outputs, m_TargetName.c_str());
}
// Add custom rules to the makefile to generate this package's xml files.
{
std::string command = "${GCCXML}";
m_Makefile->ExpandVariablesInString(command);
std::vector<std::string> depends;
depends.push_back(command);
std::string input = "Cxx/"+m_PackageName+"_cxx.cxx";
std::string output = "Cxx/"+m_PackageName+"_cxx.xml";
command = "\""+command+"\" ${CXX_FLAGS} -fsyntax-only -fxml=" + output + " -c " + input;
std::vector<std::string> outputs;
outputs.push_back("Cxx/"+m_PackageName+"_cxx.xml");
// A rule for the package's source files.
m_Makefile->AddCustomCommand(input.c_str(),
command.c_str(),
depends,
outputs, m_TargetName.c_str());
}
// add the source list to the target
m_Makefile->GetTargets()[m_TargetName.c_str()].GetSourceLists().push_back(m_PackageName);
......
......@@ -36,7 +36,5 @@ bool cmCablePackageEntryCommand::Invoke(std::vector<std::string>& args)
}
// Write this command's configuration.
this->WriteConfiguration();
return true;
return this->WriteConfiguration();
}
......@@ -42,7 +42,7 @@ public:
cmTypeMacro(cmCablePackageEntryCommand, cmCableCommand);
virtual void WriteConfiguration() const =0;
virtual bool WriteConfiguration() =0;
protected:
typedef std::vector<std::string> Entries;
......
......@@ -45,7 +45,7 @@ void cmCableSourceFilesCommand::FinalPass()
* Write the CABLE configuration code to indicate header dependencies for
* a package.
*/
void cmCableSourceFilesCommand::WriteConfiguration() const
bool cmCableSourceFilesCommand::WriteConfiguration()
{
std::ostream& os = m_CableData->GetOutputStream();
cmCableData::Indentation indent = m_CableData->GetIndentation();
......@@ -77,6 +77,8 @@ void cmCableSourceFilesCommand::WriteConfiguration() const
}
}
os << indent << "</Headers>" << std::endl;
return true;
}
......
......@@ -67,7 +67,7 @@ public:
"Generates a Package's Headers block in the CABLE configuration.";
}
virtual void WriteConfiguration() const;
virtual bool WriteConfiguration();
bool SourceFileExists(const std::string&) const;
cmTypeMacro(cmCableSourceFilesCommand, cmCableCommand);
......
......@@ -19,16 +19,22 @@
/**
* Write the CABLE configuration code to define this WrapperSet.
*/
void cmCableWrapCommand::WriteConfiguration() const
bool cmCableWrapCommand::WriteConfiguration()
{
if(m_Entries.size() < 2)
{
this->SetError("called with incorrect number of arguments");
return false;
}
std::ostream& os = m_CableData->GetOutputStream();
cmCableData::Indentation indent = m_CableData->GetIndentation();
cmRegularExpression needCdataBlock("[&<>]");
os << indent << "<WrapperSet>" << std::endl;
for(Entries::const_iterator e = m_Entries.begin();
e != m_Entries.end(); ++e)
Entries::const_iterator e = m_Entries.begin();
os << indent << "<WrapperSet name=\"" << e->c_str() << "\">" << std::endl;
for(++e;e != m_Entries.end(); ++e)
{
os << indent << " <Element>";
if(needCdataBlock.find(e->c_str()))
......@@ -42,4 +48,6 @@ void cmCableWrapCommand::WriteConfiguration() const
os << "</Element>" << std::endl;
}
os << indent << "</WrapperSet>" << std::endl;
return true;
}
......@@ -59,7 +59,7 @@ public:
"Generates a WrapSet in the CABLE configuration.";
}
virtual void WriteConfiguration() const;
virtual bool WriteConfiguration();
cmTypeMacro(cmCableWrapCommand, cmCablePackageCommand);
};
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment