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.
This commit is contained in:
parent
2c1fb789d7
commit
61d2314989
@ -23,7 +23,7 @@
|
|||||||
* Write the CABLE configuration code to define this InstantiationSet.
|
* Write the CABLE configuration code to define this InstantiationSet.
|
||||||
* This includes the "class" keyword to do class template instantiations.
|
* This includes the "class" keyword to do class template instantiations.
|
||||||
*/
|
*/
|
||||||
void cmCableInstantiateClassCommand::WriteConfiguration() const
|
bool cmCableInstantiateClassCommand::WriteConfiguration()
|
||||||
{
|
{
|
||||||
std::ostream& os = m_CableData->GetOutputStream();
|
std::ostream& os = m_CableData->GetOutputStream();
|
||||||
cmCableData::Indentation indent = m_CableData->GetIndentation();
|
cmCableData::Indentation indent = m_CableData->GetIndentation();
|
||||||
@ -46,4 +46,6 @@ void cmCableInstantiateClassCommand::WriteConfiguration() const
|
|||||||
os << "</Element>" << std::endl;
|
os << "</Element>" << std::endl;
|
||||||
}
|
}
|
||||||
os << indent << "</InstantiationSet>" << std::endl;
|
os << indent << "</InstantiationSet>" << std::endl;
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -63,7 +63,7 @@ public:
|
|||||||
"template classes (not functions, operators, etc).";
|
"template classes (not functions, operators, etc).";
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void WriteConfiguration() const;
|
virtual bool WriteConfiguration();
|
||||||
|
|
||||||
cmTypeMacro(cmCableInstantiateClassCommand, cmCableInstantiateCommand);
|
cmTypeMacro(cmCableInstantiateClassCommand, cmCableInstantiateCommand);
|
||||||
protected:
|
protected:
|
||||||
|
@ -22,7 +22,7 @@
|
|||||||
/**
|
/**
|
||||||
* Write the CABLE configuration code to define this InstantiationSet.
|
* Write the CABLE configuration code to define this InstantiationSet.
|
||||||
*/
|
*/
|
||||||
void cmCableInstantiateCommand::WriteConfiguration() const
|
bool cmCableInstantiateCommand::WriteConfiguration()
|
||||||
{
|
{
|
||||||
std::ostream& os = m_CableData->GetOutputStream();
|
std::ostream& os = m_CableData->GetOutputStream();
|
||||||
cmCableData::Indentation indent = m_CableData->GetIndentation();
|
cmCableData::Indentation indent = m_CableData->GetIndentation();
|
||||||
@ -45,4 +45,6 @@ void cmCableInstantiateCommand::WriteConfiguration() const
|
|||||||
os << "</Element>" << std::endl;
|
os << "</Element>" << std::endl;
|
||||||
}
|
}
|
||||||
os << indent << "</InstantiationSet>" << std::endl;
|
os << indent << "</InstantiationSet>" << std::endl;
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -62,7 +62,7 @@ public:
|
|||||||
"template non-classes (functions, operators, etc).";
|
"template non-classes (functions, operators, etc).";
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void WriteConfiguration() const;
|
virtual bool WriteConfiguration();
|
||||||
|
|
||||||
cmTypeMacro(cmCableInstantiateCommand, cmCablePackageCommand);
|
cmTypeMacro(cmCableInstantiateCommand, cmCablePackageCommand);
|
||||||
protected:
|
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
|
// Add custom rules to the makefile to generate this package's source
|
||||||
// files.
|
// files.
|
||||||
|
{
|
||||||
std::string command = "${CABLE}";
|
std::string command = "${CABLE}";
|
||||||
m_Makefile->ExpandVariablesInString(command);
|
m_Makefile->ExpandVariablesInString(command);
|
||||||
std::vector<std::string> depends;
|
std::vector<std::string> depends;
|
||||||
@ -115,6 +116,27 @@ bool cmCablePackageCommand::Invoke(std::vector<std::string>& args)
|
|||||||
command.c_str(),
|
command.c_str(),
|
||||||
depends,
|
depends,
|
||||||
outputs, m_TargetName.c_str());
|
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
|
// add the source list to the target
|
||||||
m_Makefile->GetTargets()[m_TargetName.c_str()].GetSourceLists().push_back(m_PackageName);
|
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.
|
// Write this command's configuration.
|
||||||
this->WriteConfiguration();
|
return this->WriteConfiguration();
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
@ -42,7 +42,7 @@ public:
|
|||||||
|
|
||||||
cmTypeMacro(cmCablePackageEntryCommand, cmCableCommand);
|
cmTypeMacro(cmCablePackageEntryCommand, cmCableCommand);
|
||||||
|
|
||||||
virtual void WriteConfiguration() const =0;
|
virtual bool WriteConfiguration() =0;
|
||||||
protected:
|
protected:
|
||||||
typedef std::vector<std::string> Entries;
|
typedef std::vector<std::string> Entries;
|
||||||
|
|
||||||
|
@ -45,7 +45,7 @@ void cmCableSourceFilesCommand::FinalPass()
|
|||||||
* Write the CABLE configuration code to indicate header dependencies for
|
* Write the CABLE configuration code to indicate header dependencies for
|
||||||
* a package.
|
* a package.
|
||||||
*/
|
*/
|
||||||
void cmCableSourceFilesCommand::WriteConfiguration() const
|
bool cmCableSourceFilesCommand::WriteConfiguration()
|
||||||
{
|
{
|
||||||
std::ostream& os = m_CableData->GetOutputStream();
|
std::ostream& os = m_CableData->GetOutputStream();
|
||||||
cmCableData::Indentation indent = m_CableData->GetIndentation();
|
cmCableData::Indentation indent = m_CableData->GetIndentation();
|
||||||
@ -77,6 +77,8 @@ void cmCableSourceFilesCommand::WriteConfiguration() const
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
os << indent << "</Headers>" << std::endl;
|
os << indent << "</Headers>" << std::endl;
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -67,7 +67,7 @@ public:
|
|||||||
"Generates a Package's Headers block in the CABLE configuration.";
|
"Generates a Package's Headers block in the CABLE configuration.";
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void WriteConfiguration() const;
|
virtual bool WriteConfiguration();
|
||||||
bool SourceFileExists(const std::string&) const;
|
bool SourceFileExists(const std::string&) const;
|
||||||
|
|
||||||
cmTypeMacro(cmCableSourceFilesCommand, cmCableCommand);
|
cmTypeMacro(cmCableSourceFilesCommand, cmCableCommand);
|
||||||
|
@ -19,16 +19,22 @@
|
|||||||
/**
|
/**
|
||||||
* Write the CABLE configuration code to define this WrapperSet.
|
* 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();
|
std::ostream& os = m_CableData->GetOutputStream();
|
||||||
cmCableData::Indentation indent = m_CableData->GetIndentation();
|
cmCableData::Indentation indent = m_CableData->GetIndentation();
|
||||||
|
|
||||||
cmRegularExpression needCdataBlock("[&<>]");
|
cmRegularExpression needCdataBlock("[&<>]");
|
||||||
|
|
||||||
os << indent << "<WrapperSet>" << std::endl;
|
Entries::const_iterator e = m_Entries.begin();
|
||||||
for(Entries::const_iterator e = m_Entries.begin();
|
os << indent << "<WrapperSet name=\"" << e->c_str() << "\">" << std::endl;
|
||||||
e != m_Entries.end(); ++e)
|
for(++e;e != m_Entries.end(); ++e)
|
||||||
{
|
{
|
||||||
os << indent << " <Element>";
|
os << indent << " <Element>";
|
||||||
if(needCdataBlock.find(e->c_str()))
|
if(needCdataBlock.find(e->c_str()))
|
||||||
@ -42,4 +48,6 @@ void cmCableWrapCommand::WriteConfiguration() const
|
|||||||
os << "</Element>" << std::endl;
|
os << "</Element>" << std::endl;
|
||||||
}
|
}
|
||||||
os << indent << "</WrapperSet>" << std::endl;
|
os << indent << "</WrapperSet>" << std::endl;
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -59,7 +59,7 @@ public:
|
|||||||
"Generates a WrapSet in the CABLE configuration.";
|
"Generates a WrapSet in the CABLE configuration.";
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void WriteConfiguration() const;
|
virtual bool WriteConfiguration();
|
||||||
|
|
||||||
cmTypeMacro(cmCableWrapCommand, cmCablePackageCommand);
|
cmTypeMacro(cmCableWrapCommand, cmCablePackageCommand);
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user