fixed commands that were setting definitions in final pass to set definitions in initial pass

This commit is contained in:
Ken Martin 2002-06-29 20:04:28 -04:00
parent 3cfca938da
commit 0b88e57e54
4 changed files with 83 additions and 85 deletions

View File

@ -49,6 +49,15 @@ bool cmQTWrapCPPCommand::InitialPass(std::vector<std::string> const& argsIn)
m_LibraryName = args[0];
m_SourceList = args[1];
std::string sourceListValue;
// was the list already populated
const char *def = m_Makefile->GetDefinition(m_SourceList.c_str());
if (def)
{
sourceListValue = def;
}
// get the list of classes for this library
for(std::vector<std::string>::iterator j = (args.begin() + 2);
j != args.end(); ++j)
@ -72,9 +81,15 @@ bool cmQTWrapCPPCommand::InitialPass(std::vector<std::string> const& argsIn)
// add starting depends
file.GetDepends().push_back(hname);
m_WrapClasses.push_back(file);
if (sourceListValue.size() > 0)
{
sourceListValue += ";";
}
sourceListValue += newName + ".cxx";
}
}
m_Makefile->AddDefinition(m_SourceList.c_str(), sourceListValue.c_str());
return true;
}
@ -85,14 +100,6 @@ void cmQTWrapCPPCommand::FinalPass()
size_t lastClass = m_WrapClasses.size();
std::vector<std::string> depends;
std::string moc_exe = "${QT_MOC_EXE}";
std::string sourceListValue;
// was the list already populated
const char *def = m_Makefile->GetDefinition(m_SourceList.c_str());
if (def)
{
sourceListValue = def;
}
// wrap all the .h files
depends.push_back(moc_exe);
@ -109,11 +116,6 @@ void cmQTWrapCPPCommand::FinalPass()
{
// Add output to build list
m_Makefile->AddSource(m_WrapClasses[classNum]);
if (sourceListValue.size() > 0)
{
sourceListValue += ";";
}
sourceListValue += m_WrapClasses[classNum].GetSourceName() + ".cxx";
// set up moc command
std::string res = m_Makefile->GetCurrentOutputDirectory();
@ -134,7 +136,6 @@ void cmQTWrapCPPCommand::FinalPass()
}
m_Makefile->AddDefinition("GENERATED_QT_FILES",moc_list.c_str());
m_Makefile->AddDefinition(m_SourceList.c_str(), sourceListValue.c_str());
}

View File

@ -40,6 +40,13 @@ bool cmVTKWrapJavaCommand::InitialPass(std::vector<std::string> const& argsIn)
// keep the library name
m_LibraryName = args[0];
m_SourceList = args[1];
std::string sourceListValue;
// was the list already populated
const char *def = m_Makefile->GetDefinition(m_SourceList.c_str());
if (def)
{
sourceListValue = def;
}
// get the list of classes for this library
for(std::vector<std::string>::const_iterator j = (args.begin() + 2);
@ -65,9 +72,15 @@ bool cmVTKWrapJavaCommand::InitialPass(std::vector<std::string> const& argsIn)
file.GetDepends().push_back(hname);
m_WrapClasses.push_back(file);
m_OriginalNames.push_back(srcName);
if (sourceListValue.size() > 0)
{
sourceListValue += ";";
}
sourceListValue += newName + ".cxx";
}
}
m_Makefile->AddDefinition(m_SourceList.c_str(), sourceListValue.c_str());
return true;
}
@ -83,17 +96,9 @@ void cmVTKWrapJavaCommand::FinalPass()
std::string pjava = "${VTK_PARSE_JAVA_EXE}";
std::string hints = "${VTK_WRAP_HINTS}";
std::string resultDirectory = "${VTK_JAVA_HOME}";
std::string sourceListValue;
m_Makefile->ExpandVariablesInString(hints);
// was the list already populated
const char *def = m_Makefile->GetDefinition(m_SourceList.c_str());
if (def)
{
sourceListValue = def;
}
// wrap all the .h files
depends.push_back(wjava);
depends2.push_back(pjava);
@ -105,11 +110,6 @@ void cmVTKWrapJavaCommand::FinalPass()
for(size_t classNum = 0; classNum < lastClass; classNum++)
{
m_Makefile->AddSource(m_WrapClasses[classNum]);
if (sourceListValue.size() > 0)
{
sourceListValue += ";";
}
sourceListValue += m_WrapClasses[classNum].GetSourceName() + ".cxx";
// wrap java
std::string res = m_Makefile->GetCurrentOutputDirectory();
@ -153,7 +153,6 @@ void cmVTKWrapJavaCommand::FinalPass()
alldepends,
empty);
m_Makefile->AddDefinition(m_SourceList.c_str(), sourceListValue.c_str());
}

View File

@ -41,6 +41,29 @@ bool cmVTKWrapPythonCommand::InitialPass(std::vector<std::string> const& argsIn)
// keep the library name
m_LibraryName = args[0];
m_SourceList = args[1];
std::string sourceListValue;
// was the list already populated
const char *def = m_Makefile->GetDefinition(m_SourceList.c_str());
if (def)
{
sourceListValue = def;
sourceListValue += ";";
}
// Create the init file
std::string res = m_LibraryName;
res += "Init.cxx";
this->CreateInitFile(res);
// add the init file
cmSourceFile cfile;
cfile.SetIsAnAbstractClass(false);
std::string newName = m_LibraryName;
newName += "Init";
cfile.SetName(newName.c_str(), m_Makefile->GetCurrentOutputDirectory(),
"cxx",false);
m_Makefile->AddSource(cfile);
sourceListValue += newName + ".cxx";
// get the list of classes for this library
for(std::vector<std::string>::iterator j = (args.begin() + 2);
@ -65,9 +88,12 @@ bool cmVTKWrapPythonCommand::InitialPass(std::vector<std::string> const& argsIn)
// add starting depends
file.GetDepends().push_back(hname);
m_WrapClasses.push_back(file);
sourceListValue += ";";
sourceListValue += newName + ".cxx";
}
}
m_Makefile->AddDefinition(m_SourceList.c_str(), sourceListValue.c_str());
return true;
}
@ -78,33 +104,9 @@ void cmVTKWrapPythonCommand::FinalPass()
std::vector<std::string> depends;
std::string wpython = "${VTK_WRAP_PYTHON_EXE}";
std::string hints = "${VTK_WRAP_HINTS}";
std::string sourceListValue;
m_Makefile->ExpandVariablesInString(hints);
// was the list already populated
const char *def = m_Makefile->GetDefinition(m_SourceList.c_str());
if (def)
{
sourceListValue = def;
sourceListValue += ";";
}
// Create the init file
std::string res = m_LibraryName;
res += "Init.cxx";
this->CreateInitFile(res);
// add the init file
cmSourceFile cfile;
cfile.SetIsAnAbstractClass(false);
std::string newName = m_LibraryName;
newName += "Init";
cfile.SetName(newName.c_str(), m_Makefile->GetCurrentOutputDirectory(),
"cxx",false);
m_Makefile->AddSource(cfile);
sourceListValue += newName + ".cxx";
// wrap all the .h files
depends.push_back(wpython);
if (strcmp("${VTK_WRAP_HINTS}",hints.c_str()))
@ -125,14 +127,11 @@ void cmVTKWrapPythonCommand::FinalPass()
}
args.push_back((m_WrapClasses[classNum].IsAnAbstractClass() ? "0" : "1"));
args.push_back(res);
sourceListValue += ";";
sourceListValue += m_WrapClasses[classNum].GetSourceName() + ".cxx";
m_Makefile->AddCustomCommand(m_WrapHeaders[classNum].c_str(),
wpython.c_str(), args, depends,
res.c_str(), m_LibraryName.c_str());
}
m_Makefile->AddDefinition(m_SourceList.c_str(), sourceListValue.c_str());
}
bool cmVTKWrapPythonCommand::CreateInitFile(std::string& res)

View File

@ -81,45 +81,6 @@ bool cmVTKWrapTclCommand::InitialPass(std::vector<std::string> const& argsIn)
// get the resulting source list name
m_SourceList = sources[0];
for(std::vector<std::string>::iterator j = (sources.begin() + 1);
j != sources.end(); ++j)
{
cmSourceFile *curr = m_Makefile->GetSource(j->c_str());
// if we should wrap the class
if (!curr || !curr->GetWrapExclude())
{
cmSourceFile file;
if (curr)
{
file.SetIsAnAbstractClass(curr->IsAnAbstractClass());
}
std::string srcName = cmSystemTools::GetFilenameWithoutExtension(*j);
std::string newName = srcName + "Tcl";
std::string hname = cdir + "/" + srcName + ".h";
file.SetName(newName.c_str(), m_Makefile->GetCurrentOutputDirectory(),
"cxx",false);
m_WrapHeaders.push_back(hname);
// add starting depends
file.GetDepends().push_back(hname);
m_WrapClasses.push_back(file);
}
}
}
return true;
}
void cmVTKWrapTclCommand::FinalPass()
{
// first we add the rules for all the .h to Tcl.cxx files
size_t lastClass = m_WrapClasses.size();
std::vector<std::string> depends;
std::string wtcl = "${VTK_WRAP_TCL_EXE}";
std::string hints = "${VTK_WRAP_HINTS}";
m_Makefile->ExpandVariablesInString(hints);
std::string sourceListValue;
// was the list already populated
@ -145,6 +106,48 @@ void cmVTKWrapTclCommand::FinalPass()
m_Makefile->AddSource(cfile);
sourceListValue += newName + ".cxx";
for(std::vector<std::string>::iterator j = (sources.begin() + 1);
j != sources.end(); ++j)
{
cmSourceFile *curr = m_Makefile->GetSource(j->c_str());
// if we should wrap the class
if (!curr || !curr->GetWrapExclude())
{
cmSourceFile file;
if (curr)
{
file.SetIsAnAbstractClass(curr->IsAnAbstractClass());
}
std::string srcName = cmSystemTools::GetFilenameWithoutExtension(*j);
std::string newName = srcName + "Tcl";
std::string hname = cdir + "/" + srcName + ".h";
file.SetName(newName.c_str(), m_Makefile->GetCurrentOutputDirectory(),
"cxx",false);
m_WrapHeaders.push_back(hname);
// add starting depends
file.GetDepends().push_back(hname);
m_WrapClasses.push_back(file);
sourceListValue += ";";
sourceListValue += newName + ".cxx";
}
}
m_Makefile->AddDefinition(m_SourceList.c_str(), sourceListValue.c_str());
}
return true;
}
void cmVTKWrapTclCommand::FinalPass()
{
// first we add the rules for all the .h to Tcl.cxx files
size_t lastClass = m_WrapClasses.size();
std::vector<std::string> depends;
std::string wtcl = "${VTK_WRAP_TCL_EXE}";
std::string hints = "${VTK_WRAP_HINTS}";
m_Makefile->ExpandVariablesInString(hints);
// wrap all the .h files
depends.push_back(wtcl);
if (strcmp("${VTK_WRAP_HINTS}",hints.c_str()))
@ -165,15 +168,11 @@ void cmVTKWrapTclCommand::FinalPass()
res += "/";
res += m_WrapClasses[classNum].GetSourceName() + ".cxx";
args.push_back(res);
sourceListValue += ";";
sourceListValue += m_WrapClasses[classNum].GetSourceName() + ".cxx";
m_Makefile->AddCustomCommand(m_WrapHeaders[classNum].c_str(),
wtcl.c_str(), args, depends,
res.c_str(), m_LibraryName.c_str());
}
m_Makefile->AddDefinition(m_SourceList.c_str(), sourceListValue.c_str());
}
bool cmVTKWrapTclCommand::CreateInitFile(std::string& res)